@zelloptt/react-native-zello-sdk 0.4.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -4
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +72 -7
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +53 -8
- package/ios/Extensions/ZelloConsoleSettings+Extension.swift +6 -1
- package/ios/Extensions/ZelloContact+Extension.swift +49 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +44 -7
- package/ios/ZelloIOSSdkModule.swift +45 -4
- package/ios/ZelloIOSSdkModuleBridge.m +11 -0
- package/lib/commonjs/docs/assets/navigation.js +1 -1
- package/lib/commonjs/docs/assets/navigation.js.map +1 -1
- package/lib/commonjs/docs/assets/search.js +1 -1
- package/lib/commonjs/docs/assets/search.js.map +1 -1
- package/lib/commonjs/docs/classes/sdk.Zello.html +67 -43
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +5 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +4 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +9 -9
- package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +24 -0
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/commonjs/docs/classes/types.ZelloUser.html +10 -8
- package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +99 -74
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +4 -2
- package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +2 -2
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/commonjs/docs/index.html +7 -4
- package/lib/commonjs/docs/modules/events.html +1 -1
- package/lib/commonjs/docs/modules/index.html +4 -2
- package/lib/commonjs/docs/modules/sdk.html +1 -1
- package/lib/commonjs/docs/modules/types.html +4 -2
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +4 -4
- package/lib/commonjs/docs/types/types.ZelloConfig.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +8 -0
- package/lib/commonjs/docs/types/types.ZelloContact.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +1 -1
- package/lib/commonjs/docs/types/types.ZelloMessage.html +1 -1
- package/lib/commonjs/events/index.js +6 -0
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/sdk/index.js +173 -14
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/types/index.js +56 -12
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +41 -10
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/docs/assets/navigation.js +1 -1
- package/lib/module/docs/assets/navigation.js.map +1 -1
- package/lib/module/docs/assets/search.js +1 -1
- package/lib/module/docs/assets/search.js.map +1 -1
- package/lib/module/docs/classes/sdk.Zello.html +67 -43
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloChannel.html +8 -8
- package/lib/module/docs/classes/types.ZelloChannelUser.html +5 -4
- package/lib/module/docs/classes/types.ZelloDispatchCall.html +4 -4
- package/lib/module/docs/classes/types.ZelloDispatchChannel.html +9 -9
- package/lib/module/docs/classes/types.ZelloGroupConversation.html +24 -0
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +11 -11
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloImageMessage.html +8 -8
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +7 -7
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +6 -6
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +10 -10
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +5 -5
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +7 -7
- package/lib/module/docs/classes/types.ZelloTextMessage.html +7 -7
- package/lib/module/docs/classes/types.ZelloUser.html +10 -8
- package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +5 -0
- package/lib/module/docs/enums/events.ZelloEvent.html +99 -74
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +3 -3
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +2 -2
- package/lib/module/docs/enums/types.ZelloConnectionError.html +2 -2
- package/lib/module/docs/enums/types.ZelloConnectionState.html +2 -2
- package/lib/module/docs/enums/types.ZelloContactType.html +4 -2
- package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +2 -2
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +2 -2
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +2 -2
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +2 -2
- package/lib/module/docs/enums/types.ZelloUserStatus.html +5 -5
- package/lib/module/docs/index.html +7 -4
- package/lib/module/docs/modules/events.html +1 -1
- package/lib/module/docs/modules/index.html +4 -2
- package/lib/module/docs/modules/sdk.html +1 -1
- package/lib/module/docs/modules/types.html +4 -2
- package/lib/module/docs/types/types.ZelloChannelOptions.html +4 -4
- package/lib/module/docs/types/types.ZelloConfig.html +1 -1
- package/lib/module/docs/types/types.ZelloConsoleSettings.html +8 -0
- package/lib/module/docs/types/types.ZelloContact.html +1 -1
- package/lib/module/docs/types/types.ZelloCredentials.html +1 -1
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +1 -1
- package/lib/module/docs/types/types.ZelloMessage.html +1 -1
- package/lib/module/events/index.js +6 -0
- package/lib/module/events/index.js.map +1 -1
- package/lib/module/sdk/index.js +175 -16
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/types/index.js +57 -11
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/utils/index.js +41 -11
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/events/index.d.ts +38 -1
- package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdk/index.d.ts +38 -4
- package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/types/index.d.ts +66 -10
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/src/events/index.d.ts +38 -1
- package/lib/typescript/module/src/events/index.d.ts.map +1 -1
- package/lib/typescript/module/src/sdk/index.d.ts +38 -4
- package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/module/src/types/index.d.ts +66 -10
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/index.d.ts +2 -1
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-zello-sdk.podspec +1 -1
- package/src/events/index.ts +37 -0
- package/src/sdk/index.ts +215 -17
- package/src/types/index.ts +90 -12
- package/src/utils/index.ts +65 -20
- package/lib/commonjs/docs/classes/types.ZelloConsoleSettings.html +0 -5
- package/lib/module/docs/classes/types.ZelloConsoleSettings.html +0 -5
package/src/sdk/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
import {
|
|
9
9
|
bridgeCallToSdkCall,
|
|
10
|
+
bridgeChannelUserToSdkChannelUser,
|
|
10
11
|
bridgeConsoleSettingsToSdkConsoleSettings,
|
|
11
12
|
isAndroid,
|
|
12
13
|
} from '../utils';
|
|
@@ -15,7 +16,6 @@ import {
|
|
|
15
16
|
ZelloAlertMessage,
|
|
16
17
|
ZelloChannel,
|
|
17
18
|
ZelloChannelAlertLevel,
|
|
18
|
-
ZelloChannelUser,
|
|
19
19
|
ZelloConfig,
|
|
20
20
|
ZelloConnectionError,
|
|
21
21
|
ZelloConnectionState,
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
ZelloContactType,
|
|
25
25
|
ZelloCredentials,
|
|
26
26
|
ZelloDispatchChannel,
|
|
27
|
+
ZelloGroupConversation,
|
|
27
28
|
ZelloHistoryImageMessage,
|
|
28
29
|
ZelloHistoryMessage,
|
|
29
30
|
ZelloHistoryVoiceMessage,
|
|
@@ -82,6 +83,10 @@ export class Zello extends EventEmitter {
|
|
|
82
83
|
* The list of {@link ZelloChannel} in the contact list. Sorted by name, ascending.
|
|
83
84
|
*/
|
|
84
85
|
public channels: ZelloChannel[] = [];
|
|
86
|
+
/**
|
|
87
|
+
* The list of {@link ZelloGroupConversation} in the contact list. Sorted by name, ascending.
|
|
88
|
+
*/
|
|
89
|
+
public groupConversations: ZelloGroupConversation[] = [];
|
|
85
90
|
|
|
86
91
|
/**
|
|
87
92
|
* The current account status. undefined when {@link state} is not {@link ZelloConnectionState.Connected}.
|
|
@@ -145,9 +150,6 @@ export class Zello extends EventEmitter {
|
|
|
145
150
|
|
|
146
151
|
/**
|
|
147
152
|
* Sets configuration variables for the SDK.
|
|
148
|
-
*
|
|
149
|
-
* At the moment, this is only functional on Android.
|
|
150
|
-
*
|
|
151
153
|
* @param config The configuration to set.
|
|
152
154
|
*/
|
|
153
155
|
public configure(config: ZelloConfig) {
|
|
@@ -222,6 +224,17 @@ export class Zello extends EventEmitter {
|
|
|
222
224
|
return sortedArrayFind(this.channels, name, compareNameAscending);
|
|
223
225
|
}
|
|
224
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Returns the group conversation with the given name. Case-insensitive.
|
|
229
|
+
* @param name The name of the group conversation to search for.
|
|
230
|
+
* @return The group conversation with the given name, or null if no group conversation with that name exists.
|
|
231
|
+
*/
|
|
232
|
+
public getGroupConversation(
|
|
233
|
+
name: string
|
|
234
|
+
): ZelloGroupConversation | undefined {
|
|
235
|
+
return sortedArrayFind(this.groupConversations, name, compareNameAscending);
|
|
236
|
+
}
|
|
237
|
+
|
|
225
238
|
/**
|
|
226
239
|
* Sets the selected contact.
|
|
227
240
|
* While optional, this is typically used for tracking the contact that the user is currently interacting with.
|
|
@@ -260,7 +273,11 @@ export class Zello extends EventEmitter {
|
|
|
260
273
|
if (isAndroid) {
|
|
261
274
|
ZelloAndroidSdkModule.connectChannel(channel.name);
|
|
262
275
|
} else {
|
|
263
|
-
|
|
276
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
277
|
+
ZelloIOSSdkModule.connectGroupConversation(channel.name);
|
|
278
|
+
} else {
|
|
279
|
+
ZelloIOSSdkModule.connectChannel(channel.name);
|
|
280
|
+
}
|
|
264
281
|
}
|
|
265
282
|
}
|
|
266
283
|
|
|
@@ -274,7 +291,11 @@ export class Zello extends EventEmitter {
|
|
|
274
291
|
if (isAndroid) {
|
|
275
292
|
ZelloAndroidSdkModule.disconnectChannel(channel.name);
|
|
276
293
|
} else {
|
|
277
|
-
|
|
294
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
295
|
+
ZelloIOSSdkModule.disconnectGroupConversation(channel.name);
|
|
296
|
+
} else {
|
|
297
|
+
ZelloIOSSdkModule.disconnectChannel(channel.name);
|
|
298
|
+
}
|
|
278
299
|
}
|
|
279
300
|
}
|
|
280
301
|
|
|
@@ -553,6 +574,94 @@ export class Zello extends EventEmitter {
|
|
|
553
574
|
}
|
|
554
575
|
}
|
|
555
576
|
|
|
577
|
+
/**
|
|
578
|
+
* Creates a new group conversation with the given users.
|
|
579
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
580
|
+
* @param users The users to create the group conversation with.
|
|
581
|
+
* @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
|
|
582
|
+
*/
|
|
583
|
+
public createGroupConversation(users: ZelloUser[], displayName?: string) {
|
|
584
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
if (isAndroid) {
|
|
588
|
+
ZelloAndroidSdkModule.createGroupConversation(
|
|
589
|
+
users.map((user) => user.name),
|
|
590
|
+
displayName
|
|
591
|
+
);
|
|
592
|
+
} else {
|
|
593
|
+
ZelloIOSSdkModule.createGroupConversation(
|
|
594
|
+
users.map((user) => user.name),
|
|
595
|
+
displayName
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Adds users to the given group conversation.
|
|
602
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
603
|
+
* @param groupConversation The group conversation to add users to.
|
|
604
|
+
* @param users The users to add to the group conversation.
|
|
605
|
+
*/
|
|
606
|
+
public addUsersToGroupConversation(
|
|
607
|
+
groupConversation: ZelloGroupConversation,
|
|
608
|
+
users: ZelloUser[]
|
|
609
|
+
) {
|
|
610
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
if (isAndroid) {
|
|
614
|
+
ZelloAndroidSdkModule.addUsersToGroupConversation(
|
|
615
|
+
groupConversation.name,
|
|
616
|
+
users.map((user) => user.name)
|
|
617
|
+
);
|
|
618
|
+
} else {
|
|
619
|
+
ZelloIOSSdkModule.addUsersToGroupConversation(
|
|
620
|
+
groupConversation.name,
|
|
621
|
+
users.map((user) => user.name)
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* Removes the user from the group conversation.
|
|
628
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
629
|
+
* @param groupConversation The group conversation to leave.
|
|
630
|
+
*/
|
|
631
|
+
public leaveGroupConversation(groupConversation: ZelloGroupConversation) {
|
|
632
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
if (isAndroid) {
|
|
636
|
+
ZelloAndroidSdkModule.leaveGroupConversation(groupConversation.name);
|
|
637
|
+
} else {
|
|
638
|
+
ZelloIOSSdkModule.leaveGroupConversation(groupConversation.name);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Renames the group conversation.
|
|
644
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
645
|
+
* @param groupConversation The group conversation to rename.
|
|
646
|
+
* @param name The new name for the group conversation.
|
|
647
|
+
*/
|
|
648
|
+
public renameGroupConversation(
|
|
649
|
+
groupConversation: ZelloGroupConversation,
|
|
650
|
+
name: string
|
|
651
|
+
) {
|
|
652
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
653
|
+
return;
|
|
654
|
+
}
|
|
655
|
+
if (isAndroid) {
|
|
656
|
+
ZelloAndroidSdkModule.renameGroupConversation(
|
|
657
|
+
groupConversation.name,
|
|
658
|
+
name
|
|
659
|
+
);
|
|
660
|
+
} else {
|
|
661
|
+
ZelloIOSSdkModule.renameGroupConversation(groupConversation.name, name);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
556
665
|
private setupEventListener(eventEmitter: NativeEventEmitter) {
|
|
557
666
|
this.eventListener = eventEmitter.addListener('zellosdk', (event) => {
|
|
558
667
|
const eventName = event.eventName;
|
|
@@ -598,13 +707,24 @@ export class Zello extends EventEmitter {
|
|
|
598
707
|
);
|
|
599
708
|
this.channels.sort(compareNameAscending);
|
|
600
709
|
|
|
710
|
+
this.groupConversations = event.groupConversations.map(
|
|
711
|
+
(groupConversation: any) =>
|
|
712
|
+
bridgeContactToSdkContact(groupConversation)
|
|
713
|
+
);
|
|
714
|
+
this.groupConversations.sort(compareNameAscending);
|
|
715
|
+
|
|
601
716
|
if (event.emergencyChannel) {
|
|
602
717
|
this.emergencyChannel = bridgeContactToSdkContact(
|
|
603
718
|
event.emergencyChannel
|
|
604
719
|
) as ZelloChannel;
|
|
605
720
|
}
|
|
606
721
|
|
|
607
|
-
this.emit(
|
|
722
|
+
this.emit(
|
|
723
|
+
ZelloEvent.CONTACT_LIST_UPDATED,
|
|
724
|
+
this.users,
|
|
725
|
+
this.channels,
|
|
726
|
+
this.groupConversations
|
|
727
|
+
);
|
|
608
728
|
break;
|
|
609
729
|
}
|
|
610
730
|
case 'onSelectedContactChanged': {
|
|
@@ -632,7 +752,7 @@ export class Zello extends EventEmitter {
|
|
|
632
752
|
}
|
|
633
753
|
this.incomingVoiceMessage = new ZelloIncomingVoiceMessage(
|
|
634
754
|
contact,
|
|
635
|
-
|
|
755
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
636
756
|
parseInt(event.timestamp, 10)
|
|
637
757
|
);
|
|
638
758
|
this.emit(
|
|
@@ -651,7 +771,7 @@ export class Zello extends EventEmitter {
|
|
|
651
771
|
ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED,
|
|
652
772
|
new ZelloIncomingVoiceMessage(
|
|
653
773
|
contact,
|
|
654
|
-
|
|
774
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
655
775
|
parseInt(event.timestamp, 10)
|
|
656
776
|
)
|
|
657
777
|
);
|
|
@@ -724,7 +844,7 @@ export class Zello extends EventEmitter {
|
|
|
724
844
|
ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED,
|
|
725
845
|
new ZelloImageMessage(
|
|
726
846
|
contact,
|
|
727
|
-
|
|
847
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
728
848
|
true,
|
|
729
849
|
parseInt(event.timestamp, 10),
|
|
730
850
|
event.thumbnail,
|
|
@@ -778,7 +898,7 @@ export class Zello extends EventEmitter {
|
|
|
778
898
|
ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED,
|
|
779
899
|
new ZelloAlertMessage(
|
|
780
900
|
contact,
|
|
781
|
-
|
|
901
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
782
902
|
true,
|
|
783
903
|
parseInt(event.timestamp, 10),
|
|
784
904
|
event.text
|
|
@@ -829,7 +949,7 @@ export class Zello extends EventEmitter {
|
|
|
829
949
|
ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED,
|
|
830
950
|
new ZelloTextMessage(
|
|
831
951
|
contact,
|
|
832
|
-
|
|
952
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
833
953
|
true,
|
|
834
954
|
parseInt(event.timestamp, 10),
|
|
835
955
|
event.text
|
|
@@ -880,7 +1000,7 @@ export class Zello extends EventEmitter {
|
|
|
880
1000
|
ZelloEvent.INCOMING_LOCATION_MESSAGE_RECEIVED,
|
|
881
1001
|
new ZelloLocationMessage(
|
|
882
1002
|
contact,
|
|
883
|
-
|
|
1003
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
884
1004
|
true,
|
|
885
1005
|
parseInt(event.timestamp, 10),
|
|
886
1006
|
event.latitude,
|
|
@@ -1009,12 +1129,9 @@ export class Zello extends EventEmitter {
|
|
|
1009
1129
|
if (!contact) {
|
|
1010
1130
|
return undefined;
|
|
1011
1131
|
}
|
|
1012
|
-
const channelUser = recent.channelUser
|
|
1013
|
-
? new ZelloChannelUser(recent.channelUser)
|
|
1014
|
-
: undefined;
|
|
1015
1132
|
return new ZelloRecentEntry(
|
|
1016
1133
|
contact,
|
|
1017
|
-
channelUser,
|
|
1134
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
1018
1135
|
parseInt(recent.timestamp, 10),
|
|
1019
1136
|
recent.type.toLowerCase(),
|
|
1020
1137
|
recent.incoming
|
|
@@ -1061,6 +1178,86 @@ export class Zello extends EventEmitter {
|
|
|
1061
1178
|
this.processDispatchCallEvent(event);
|
|
1062
1179
|
break;
|
|
1063
1180
|
}
|
|
1181
|
+
case 'onGroupConversationLeft': {
|
|
1182
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1183
|
+
event.conversation
|
|
1184
|
+
) as ZelloGroupConversation;
|
|
1185
|
+
if (!groupConversation) {
|
|
1186
|
+
break;
|
|
1187
|
+
}
|
|
1188
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
|
|
1189
|
+
break;
|
|
1190
|
+
}
|
|
1191
|
+
case 'onGroupConversationInvite': {
|
|
1192
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1193
|
+
event.conversation
|
|
1194
|
+
) as ZelloGroupConversation;
|
|
1195
|
+
if (!groupConversation) {
|
|
1196
|
+
break;
|
|
1197
|
+
}
|
|
1198
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
|
|
1199
|
+
break;
|
|
1200
|
+
}
|
|
1201
|
+
case 'onGroupConversationCreated': {
|
|
1202
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1203
|
+
event.conversation
|
|
1204
|
+
) as ZelloGroupConversation;
|
|
1205
|
+
if (!groupConversation) {
|
|
1206
|
+
break;
|
|
1207
|
+
}
|
|
1208
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
|
|
1209
|
+
break;
|
|
1210
|
+
}
|
|
1211
|
+
case 'onGroupConversationRenamed': {
|
|
1212
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1213
|
+
event.conversation
|
|
1214
|
+
) as ZelloGroupConversation;
|
|
1215
|
+
if (!groupConversation) {
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
|
|
1219
|
+
break;
|
|
1220
|
+
}
|
|
1221
|
+
case 'onGroupConversationUsersAdded': {
|
|
1222
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1223
|
+
event.conversation
|
|
1224
|
+
) as ZelloGroupConversation;
|
|
1225
|
+
if (!groupConversation) {
|
|
1226
|
+
break;
|
|
1227
|
+
}
|
|
1228
|
+
const users = event.users.map((user: any) =>
|
|
1229
|
+
bridgeChannelUserToSdkChannelUser(user)
|
|
1230
|
+
);
|
|
1231
|
+
if (!users || users.length === 0) {
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
this.emit(
|
|
1235
|
+
ZelloEvent.GROUP_CONVERSATION_USERS_ADDED,
|
|
1236
|
+
groupConversation,
|
|
1237
|
+
users
|
|
1238
|
+
);
|
|
1239
|
+
break;
|
|
1240
|
+
}
|
|
1241
|
+
case 'onGroupConversationUsersLeft': {
|
|
1242
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1243
|
+
event.conversation
|
|
1244
|
+
) as ZelloGroupConversation;
|
|
1245
|
+
if (!groupConversation) {
|
|
1246
|
+
break;
|
|
1247
|
+
}
|
|
1248
|
+
const users = event.users.map((user: any) =>
|
|
1249
|
+
bridgeChannelUserToSdkChannelUser(user)
|
|
1250
|
+
);
|
|
1251
|
+
if (!users || users.length === 0) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
this.emit(
|
|
1255
|
+
ZelloEvent.GROUP_CONVERSATION_USERS_LEFT,
|
|
1256
|
+
groupConversation,
|
|
1257
|
+
users
|
|
1258
|
+
);
|
|
1259
|
+
break;
|
|
1260
|
+
}
|
|
1064
1261
|
default:
|
|
1065
1262
|
break;
|
|
1066
1263
|
}
|
|
@@ -1096,6 +1293,7 @@ export class Zello extends EventEmitter {
|
|
|
1096
1293
|
private clearContactList() {
|
|
1097
1294
|
this.users = [];
|
|
1098
1295
|
this.channels = [];
|
|
1296
|
+
this.groupConversations = [];
|
|
1099
1297
|
}
|
|
1100
1298
|
|
|
1101
1299
|
private static getSdk() {
|
package/src/types/index.ts
CHANGED
|
@@ -26,6 +26,8 @@ export type ZelloContact = {
|
|
|
26
26
|
export enum ZelloContactType {
|
|
27
27
|
User = 'user',
|
|
28
28
|
Channel = 'channel',
|
|
29
|
+
DispatchChannel = 'dispatchChannel',
|
|
30
|
+
GroupConversation = 'groupConversation',
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
/**
|
|
@@ -73,6 +75,10 @@ export class ZelloUser implements ZelloContact {
|
|
|
73
75
|
* This can be used for displaying a smaller version of the profile picture (such as in a list).
|
|
74
76
|
*/
|
|
75
77
|
public profilePictureThumbnailUrl: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The supported features of the user.
|
|
80
|
+
*/
|
|
81
|
+
public supportedFeatures: ZelloUserSupportedFeatures;
|
|
76
82
|
|
|
77
83
|
constructor(
|
|
78
84
|
name: string,
|
|
@@ -80,7 +86,8 @@ export class ZelloUser implements ZelloContact {
|
|
|
80
86
|
isMuted: boolean,
|
|
81
87
|
status: ZelloUserStatus,
|
|
82
88
|
profilePictureUrl: string | undefined,
|
|
83
|
-
profilePictureThumbnailUrl: string | undefined
|
|
89
|
+
profilePictureThumbnailUrl: string | undefined,
|
|
90
|
+
supportedFeatures: ZelloUserSupportedFeatures
|
|
84
91
|
) {
|
|
85
92
|
this.name = name;
|
|
86
93
|
this.type = ZelloContactType.User;
|
|
@@ -89,6 +96,21 @@ export class ZelloUser implements ZelloContact {
|
|
|
89
96
|
this.status = status;
|
|
90
97
|
this.profilePictureUrl = profilePictureUrl;
|
|
91
98
|
this.profilePictureThumbnailUrl = profilePictureThumbnailUrl;
|
|
99
|
+
this.supportedFeatures = supportedFeatures;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The supported features of a {@link ZelloUser}.
|
|
105
|
+
*/
|
|
106
|
+
export class ZelloUserSupportedFeatures {
|
|
107
|
+
/**
|
|
108
|
+
* Whether the user supports group conversations.
|
|
109
|
+
*/
|
|
110
|
+
public readonly groupConversations: boolean;
|
|
111
|
+
|
|
112
|
+
constructor(groupConversations: boolean) {
|
|
113
|
+
this.groupConversations = groupConversations;
|
|
92
114
|
}
|
|
93
115
|
}
|
|
94
116
|
|
|
@@ -146,6 +168,7 @@ export class ZelloDispatchChannel extends ZelloChannel {
|
|
|
146
168
|
currentCall: ZelloDispatchCall | undefined
|
|
147
169
|
) {
|
|
148
170
|
super(name, isMuted, connectionStatus, usersOnline, options);
|
|
171
|
+
this.type = ZelloContactType.DispatchChannel;
|
|
149
172
|
this.currentCall = currentCall;
|
|
150
173
|
}
|
|
151
174
|
}
|
|
@@ -179,6 +202,43 @@ export enum ZelloDispatchCallStatus {
|
|
|
179
202
|
Disconnected = 'disconnected',
|
|
180
203
|
}
|
|
181
204
|
|
|
205
|
+
/**
|
|
206
|
+
* A ad-hoc group conversation in Zello. A {@link ZelloGroupConversation} is a type of {@link ZelloChannel}, but the provisioning is done by the end user instead of through the Zello Work Administrative Console.
|
|
207
|
+
*
|
|
208
|
+
* {@link ZelloGroupConversation}s are only possible when {@link ZelloConsoleSettings.allowGroupConversations} is true.
|
|
209
|
+
*/
|
|
210
|
+
export class ZelloGroupConversation extends ZelloChannel {
|
|
211
|
+
/**
|
|
212
|
+
* The display name of the group conversation. This should be used in the UI instead of {@link ZelloChannel#name}, as the {@link ZelloChannel#name} will be a uniquely hashed value starting with c##.
|
|
213
|
+
*/
|
|
214
|
+
public readonly displayName: string;
|
|
215
|
+
/**
|
|
216
|
+
* The users in the group conversation.
|
|
217
|
+
*/
|
|
218
|
+
public readonly users: ZelloChannelUser[];
|
|
219
|
+
/**
|
|
220
|
+
* The users in the group conversation that are currently online.
|
|
221
|
+
*/
|
|
222
|
+
public readonly onlineUsers: ZelloChannelUser[];
|
|
223
|
+
|
|
224
|
+
constructor(
|
|
225
|
+
name: string,
|
|
226
|
+
isMuted: boolean,
|
|
227
|
+
connectionStatus: ZelloChannelConnectionStatus,
|
|
228
|
+
usersOnline: number,
|
|
229
|
+
options: ZelloChannelOptions,
|
|
230
|
+
displayName: string,
|
|
231
|
+
users: ZelloChannelUser[],
|
|
232
|
+
onlineUsers: ZelloChannelUser[]
|
|
233
|
+
) {
|
|
234
|
+
super(name, isMuted, connectionStatus, usersOnline, options);
|
|
235
|
+
this.type = ZelloContactType.GroupConversation;
|
|
236
|
+
this.displayName = displayName;
|
|
237
|
+
this.users = users;
|
|
238
|
+
this.onlineUsers = onlineUsers;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
182
242
|
/**
|
|
183
243
|
* The connection status of a {@link ZelloChannel}.
|
|
184
244
|
*/
|
|
@@ -211,7 +271,7 @@ export type ZelloChannelOptions = {
|
|
|
211
271
|
* Whether the user is allowed to send alert messages to the channel.
|
|
212
272
|
* When this is true, you should not show any UI to allow the user to send alert messages to the channel.
|
|
213
273
|
*/
|
|
214
|
-
|
|
274
|
+
allowAlertMessages: boolean;
|
|
215
275
|
/**
|
|
216
276
|
* Whether the user is allowed to send text messages to the channel.
|
|
217
277
|
* When this is true, you should not show any UI to allow the user to send text messages to the channel.
|
|
@@ -221,17 +281,19 @@ export type ZelloChannelOptions = {
|
|
|
221
281
|
* Whether the user is allowed to send location messages to the channel.
|
|
222
282
|
* When this is true, you should not show any UI to allow the user to send location messages to the channel.
|
|
223
283
|
*/
|
|
224
|
-
|
|
284
|
+
allowLocationMessages: boolean;
|
|
225
285
|
};
|
|
226
286
|
|
|
227
287
|
/**
|
|
228
|
-
* A user in a {@link ZelloChannel}. A {@link ZelloChannelUser} may or may not
|
|
288
|
+
* A user in a {@link ZelloChannel}. A {@link ZelloChannelUser} may or may not be part of your contact list.
|
|
229
289
|
*/
|
|
230
290
|
export class ZelloChannelUser {
|
|
231
291
|
public name: string;
|
|
292
|
+
public displayName: string;
|
|
232
293
|
|
|
233
|
-
constructor(name: string) {
|
|
294
|
+
constructor(name: string, displayName: string) {
|
|
234
295
|
this.name = name;
|
|
296
|
+
this.displayName = displayName;
|
|
235
297
|
}
|
|
236
298
|
}
|
|
237
299
|
|
|
@@ -875,13 +937,29 @@ export type ZelloConfig = {
|
|
|
875
937
|
/**
|
|
876
938
|
* Settings for the network. These are configured via the Zello Work Administrative Console.
|
|
877
939
|
*/
|
|
878
|
-
export
|
|
940
|
+
export type ZelloConsoleSettings = {
|
|
879
941
|
/**
|
|
880
942
|
* Allow non-dispatchers to end calls. When this is false, you should not show any UI to allow non-dispatchers to end calls.
|
|
881
943
|
*/
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
944
|
+
allowNonDispatchersToEndCalls: boolean;
|
|
945
|
+
/**
|
|
946
|
+
* Allow image messages. When this is false, you should not show any UI to allow users to send image messages.
|
|
947
|
+
*/
|
|
948
|
+
allowImageMessages: boolean;
|
|
949
|
+
/**
|
|
950
|
+
* Allow alert messages. When this is false, you should not show any UI to allow users to send alert messages.
|
|
951
|
+
*/
|
|
952
|
+
allowAlertMessages: boolean;
|
|
953
|
+
/**
|
|
954
|
+
* Allow location messages. When this is false, you should not show any UI to allow users to send location messages.
|
|
955
|
+
*/
|
|
956
|
+
allowLocationMessages: boolean;
|
|
957
|
+
/**
|
|
958
|
+
* Allow text messages. When this is false, you should not show any UI to allow users to send text messages.
|
|
959
|
+
*/
|
|
960
|
+
allowTextMessages: boolean;
|
|
961
|
+
/**
|
|
962
|
+
* Allow group conversations. When this is false, you should not show any UI to allow users to create group conversations.
|
|
963
|
+
*/
|
|
964
|
+
allowGroupConversations: boolean;
|
|
965
|
+
};
|