@zelloptt/react-native-zello-sdk 0.4.0 → 1.0.1
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 +103 -29
- 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 +51 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +49 -9
- package/ios/ZelloIOSSdkModule.swift +88 -27
- package/ios/ZelloIOSSdkModuleBridge.m +22 -11
- 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 +69 -45
- 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 +107 -82
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +4 -4
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +4 -4
- 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 +6 -6
- 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 +195 -47
- 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 +69 -45
- 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 +107 -82
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +4 -4
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +4 -4
- 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 +6 -6
- 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 +197 -49
- 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 +2 -1
- package/react-native-zello-sdk.podspec +1 -1
- package/src/events/index.ts +37 -0
- package/src/sdk/index.ts +237 -50
- 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.
|
|
@@ -229,11 +242,10 @@ export class Zello extends EventEmitter {
|
|
|
229
242
|
* @param contact The contact to set as selected.
|
|
230
243
|
*/
|
|
231
244
|
public setSelectedContact(contact: ZelloContact) {
|
|
232
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
233
245
|
if (isAndroid) {
|
|
234
|
-
ZelloAndroidSdkModule.setSelectedContact(contact.name,
|
|
246
|
+
ZelloAndroidSdkModule.setSelectedContact(contact.name, contact.type);
|
|
235
247
|
} else {
|
|
236
|
-
ZelloIOSSdkModule.selectContact(contact.name,
|
|
248
|
+
ZelloIOSSdkModule.selectContact(contact.name, contact.type);
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
251
|
|
|
@@ -260,7 +272,11 @@ export class Zello extends EventEmitter {
|
|
|
260
272
|
if (isAndroid) {
|
|
261
273
|
ZelloAndroidSdkModule.connectChannel(channel.name);
|
|
262
274
|
} else {
|
|
263
|
-
|
|
275
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
276
|
+
ZelloIOSSdkModule.connectGroupConversation(channel.name);
|
|
277
|
+
} else {
|
|
278
|
+
ZelloIOSSdkModule.connectChannel(channel.name);
|
|
279
|
+
}
|
|
264
280
|
}
|
|
265
281
|
}
|
|
266
282
|
|
|
@@ -274,7 +290,11 @@ export class Zello extends EventEmitter {
|
|
|
274
290
|
if (isAndroid) {
|
|
275
291
|
ZelloAndroidSdkModule.disconnectChannel(channel.name);
|
|
276
292
|
} else {
|
|
277
|
-
|
|
293
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
294
|
+
ZelloIOSSdkModule.disconnectGroupConversation(channel.name);
|
|
295
|
+
} else {
|
|
296
|
+
ZelloIOSSdkModule.disconnectChannel(channel.name);
|
|
297
|
+
}
|
|
278
298
|
}
|
|
279
299
|
}
|
|
280
300
|
|
|
@@ -285,11 +305,10 @@ export class Zello extends EventEmitter {
|
|
|
285
305
|
* @param contact The contact to start the voice message with.
|
|
286
306
|
*/
|
|
287
307
|
public startVoiceMessage(contact: ZelloContact) {
|
|
288
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
289
308
|
if (isAndroid) {
|
|
290
|
-
ZelloAndroidSdkModule.startVoiceMessage(contact.name,
|
|
309
|
+
ZelloAndroidSdkModule.startVoiceMessage(contact.name, contact.type);
|
|
291
310
|
} else {
|
|
292
|
-
ZelloIOSSdkModule.startVoiceMessage(contact.name,
|
|
311
|
+
ZelloIOSSdkModule.startVoiceMessage(contact.name, contact.type);
|
|
293
312
|
}
|
|
294
313
|
}
|
|
295
314
|
|
|
@@ -312,11 +331,10 @@ export class Zello extends EventEmitter {
|
|
|
312
331
|
* @param data The image data to send.
|
|
313
332
|
*/
|
|
314
333
|
public sendImage(contact: ZelloContact, data: number[]) {
|
|
315
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
316
334
|
if (isAndroid) {
|
|
317
|
-
ZelloAndroidSdkModule.sendImage(contact.name,
|
|
335
|
+
ZelloAndroidSdkModule.sendImage(contact.name, contact.type, data);
|
|
318
336
|
} else {
|
|
319
|
-
ZelloIOSSdkModule.sendImage(contact.name,
|
|
337
|
+
ZelloIOSSdkModule.sendImage(contact.name, contact.type, data);
|
|
320
338
|
}
|
|
321
339
|
}
|
|
322
340
|
|
|
@@ -326,11 +344,10 @@ export class Zello extends EventEmitter {
|
|
|
326
344
|
* @param contact The contact to send the alert to.
|
|
327
345
|
*/
|
|
328
346
|
public sendLocation(contact: ZelloContact) {
|
|
329
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
330
347
|
if (isAndroid) {
|
|
331
|
-
ZelloAndroidSdkModule.sendLocation(contact.name,
|
|
348
|
+
ZelloAndroidSdkModule.sendLocation(contact.name, contact.type);
|
|
332
349
|
} else {
|
|
333
|
-
ZelloIOSSdkModule.sendLocation(contact.name,
|
|
350
|
+
ZelloIOSSdkModule.sendLocation(contact.name, contact.type);
|
|
334
351
|
}
|
|
335
352
|
}
|
|
336
353
|
|
|
@@ -341,11 +358,10 @@ export class Zello extends EventEmitter {
|
|
|
341
358
|
* @param text The text to send.
|
|
342
359
|
*/
|
|
343
360
|
public sendText(contact: ZelloContact, text: string) {
|
|
344
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
345
361
|
if (isAndroid) {
|
|
346
|
-
ZelloAndroidSdkModule.sendText(contact.name,
|
|
362
|
+
ZelloAndroidSdkModule.sendText(contact.name, contact.type, text);
|
|
347
363
|
} else {
|
|
348
|
-
ZelloIOSSdkModule.sendText(contact.name,
|
|
364
|
+
ZelloIOSSdkModule.sendText(contact.name, contact.type, text);
|
|
349
365
|
}
|
|
350
366
|
}
|
|
351
367
|
|
|
@@ -361,11 +377,10 @@ export class Zello extends EventEmitter {
|
|
|
361
377
|
text: string,
|
|
362
378
|
level?: ZelloChannelAlertLevel
|
|
363
379
|
) {
|
|
364
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
365
380
|
if (isAndroid) {
|
|
366
|
-
ZelloAndroidSdkModule.sendAlert(contact.name,
|
|
381
|
+
ZelloAndroidSdkModule.sendAlert(contact.name, contact.type, text, level);
|
|
367
382
|
} else {
|
|
368
|
-
ZelloIOSSdkModule.sendAlert(contact.name,
|
|
383
|
+
ZelloIOSSdkModule.sendAlert(contact.name, contact.type, text, level);
|
|
369
384
|
}
|
|
370
385
|
}
|
|
371
386
|
|
|
@@ -387,11 +402,10 @@ export class Zello extends EventEmitter {
|
|
|
387
402
|
* @param contact The contact to mute.
|
|
388
403
|
*/
|
|
389
404
|
public muteContact(contact: ZelloContact) {
|
|
390
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
391
405
|
if (isAndroid) {
|
|
392
|
-
ZelloAndroidSdkModule.muteContact(contact.name,
|
|
406
|
+
ZelloAndroidSdkModule.muteContact(contact.name, contact.type);
|
|
393
407
|
} else {
|
|
394
|
-
ZelloIOSSdkModule.muteContact(contact.name,
|
|
408
|
+
ZelloIOSSdkModule.muteContact(contact.name, contact.type);
|
|
395
409
|
}
|
|
396
410
|
}
|
|
397
411
|
|
|
@@ -401,11 +415,10 @@ export class Zello extends EventEmitter {
|
|
|
401
415
|
* @param contact The contact to unmute.
|
|
402
416
|
*/
|
|
403
417
|
public unmuteContact(contact: ZelloContact) {
|
|
404
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
405
418
|
if (isAndroid) {
|
|
406
|
-
ZelloAndroidSdkModule.unmuteContact(contact.name,
|
|
419
|
+
ZelloAndroidSdkModule.unmuteContact(contact.name, contact.type);
|
|
407
420
|
} else {
|
|
408
|
-
ZelloIOSSdkModule.unmuteContact(contact.name,
|
|
421
|
+
ZelloIOSSdkModule.unmuteContact(contact.name, contact.type);
|
|
409
422
|
}
|
|
410
423
|
}
|
|
411
424
|
|
|
@@ -446,7 +459,6 @@ export class Zello extends EventEmitter {
|
|
|
446
459
|
): Promise<ZelloHistoryMessage[]> {
|
|
447
460
|
const defaultHistorySize = 50;
|
|
448
461
|
return new Promise((resolve) => {
|
|
449
|
-
const isChannel = contact.type === ZelloContactType.Channel;
|
|
450
462
|
const callback = (history: any[] | undefined) => {
|
|
451
463
|
if (!history) {
|
|
452
464
|
resolve([]);
|
|
@@ -460,14 +472,14 @@ export class Zello extends EventEmitter {
|
|
|
460
472
|
if (isAndroid) {
|
|
461
473
|
ZelloAndroidSdkModule.getHistory(
|
|
462
474
|
contact.name,
|
|
463
|
-
|
|
475
|
+
contact.type,
|
|
464
476
|
size ?? defaultHistorySize,
|
|
465
477
|
callback
|
|
466
478
|
);
|
|
467
479
|
} else {
|
|
468
480
|
ZelloIOSSdkModule.getHistory(
|
|
469
481
|
contact.name,
|
|
470
|
-
|
|
482
|
+
contact.type,
|
|
471
483
|
size ?? defaultHistorySize,
|
|
472
484
|
callback
|
|
473
485
|
);
|
|
@@ -481,18 +493,17 @@ export class Zello extends EventEmitter {
|
|
|
481
493
|
* @param message The history message to play.
|
|
482
494
|
*/
|
|
483
495
|
public playHistoryMessage(message: ZelloHistoryVoiceMessage) {
|
|
484
|
-
const isChannel = message.contact.type === ZelloContactType.Channel;
|
|
485
496
|
if (isAndroid) {
|
|
486
497
|
ZelloAndroidSdkModule.playHistoryMessage(
|
|
487
498
|
message.historyId,
|
|
488
499
|
message.contact.name,
|
|
489
|
-
|
|
500
|
+
message.contact.type
|
|
490
501
|
);
|
|
491
502
|
} else {
|
|
492
503
|
ZelloIOSSdkModule.playHistoryMessage(
|
|
493
504
|
message.historyId,
|
|
494
505
|
message.contact.name,
|
|
495
|
-
|
|
506
|
+
message.contact.type
|
|
496
507
|
);
|
|
497
508
|
}
|
|
498
509
|
}
|
|
@@ -518,19 +529,18 @@ export class Zello extends EventEmitter {
|
|
|
518
529
|
message: ZelloHistoryImageMessage
|
|
519
530
|
): Promise<string | undefined> {
|
|
520
531
|
return new Promise((resolve) => {
|
|
521
|
-
const isChannel = message.contact.type === ZelloContactType.Channel;
|
|
522
532
|
if (isAndroid) {
|
|
523
533
|
ZelloAndroidSdkModule.getImageDataForHistoryImageMessage(
|
|
524
534
|
message.historyId,
|
|
525
535
|
message.contact.name,
|
|
526
|
-
|
|
536
|
+
message.contact.type,
|
|
527
537
|
(data: string | undefined) => resolve(data)
|
|
528
538
|
);
|
|
529
539
|
} else {
|
|
530
540
|
ZelloIOSSdkModule.getHistoryImageData(
|
|
531
541
|
message.historyId,
|
|
532
542
|
message.contact.name,
|
|
533
|
-
|
|
543
|
+
message.contact.type,
|
|
534
544
|
(data: string | undefined) => resolve(data)
|
|
535
545
|
);
|
|
536
546
|
}
|
|
@@ -553,6 +563,94 @@ export class Zello extends EventEmitter {
|
|
|
553
563
|
}
|
|
554
564
|
}
|
|
555
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Creates a new group conversation with the given users.
|
|
568
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
569
|
+
* @param users The users to create the group conversation with.
|
|
570
|
+
* @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
|
|
571
|
+
*/
|
|
572
|
+
public createGroupConversation(users: ZelloUser[], displayName?: string) {
|
|
573
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
if (isAndroid) {
|
|
577
|
+
ZelloAndroidSdkModule.createGroupConversation(
|
|
578
|
+
users.map((user) => user.name),
|
|
579
|
+
displayName
|
|
580
|
+
);
|
|
581
|
+
} else {
|
|
582
|
+
ZelloIOSSdkModule.createGroupConversation(
|
|
583
|
+
users.map((user) => user.name),
|
|
584
|
+
displayName
|
|
585
|
+
);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Adds users to the given group conversation.
|
|
591
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
592
|
+
* @param groupConversation The group conversation to add users to.
|
|
593
|
+
* @param users The users to add to the group conversation.
|
|
594
|
+
*/
|
|
595
|
+
public addUsersToGroupConversation(
|
|
596
|
+
groupConversation: ZelloGroupConversation,
|
|
597
|
+
users: ZelloUser[]
|
|
598
|
+
) {
|
|
599
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
if (isAndroid) {
|
|
603
|
+
ZelloAndroidSdkModule.addUsersToGroupConversation(
|
|
604
|
+
groupConversation.name,
|
|
605
|
+
users.map((user) => user.name)
|
|
606
|
+
);
|
|
607
|
+
} else {
|
|
608
|
+
ZelloIOSSdkModule.addUsersToGroupConversation(
|
|
609
|
+
groupConversation.name,
|
|
610
|
+
users.map((user) => user.name)
|
|
611
|
+
);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Removes the user from the group conversation.
|
|
617
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
618
|
+
* @param groupConversation The group conversation to leave.
|
|
619
|
+
*/
|
|
620
|
+
public leaveGroupConversation(groupConversation: ZelloGroupConversation) {
|
|
621
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (isAndroid) {
|
|
625
|
+
ZelloAndroidSdkModule.leaveGroupConversation(groupConversation.name);
|
|
626
|
+
} else {
|
|
627
|
+
ZelloIOSSdkModule.leaveGroupConversation(groupConversation.name);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Renames the group conversation.
|
|
633
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
634
|
+
* @param groupConversation The group conversation to rename.
|
|
635
|
+
* @param name The new name for the group conversation.
|
|
636
|
+
*/
|
|
637
|
+
public renameGroupConversation(
|
|
638
|
+
groupConversation: ZelloGroupConversation,
|
|
639
|
+
name: string
|
|
640
|
+
) {
|
|
641
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
if (isAndroid) {
|
|
645
|
+
ZelloAndroidSdkModule.renameGroupConversation(
|
|
646
|
+
groupConversation.name,
|
|
647
|
+
name
|
|
648
|
+
);
|
|
649
|
+
} else {
|
|
650
|
+
ZelloIOSSdkModule.renameGroupConversation(groupConversation.name, name);
|
|
651
|
+
}
|
|
652
|
+
}
|
|
653
|
+
|
|
556
654
|
private setupEventListener(eventEmitter: NativeEventEmitter) {
|
|
557
655
|
this.eventListener = eventEmitter.addListener('zellosdk', (event) => {
|
|
558
656
|
const eventName = event.eventName;
|
|
@@ -598,13 +696,24 @@ export class Zello extends EventEmitter {
|
|
|
598
696
|
);
|
|
599
697
|
this.channels.sort(compareNameAscending);
|
|
600
698
|
|
|
699
|
+
this.groupConversations = event.groupConversations.map(
|
|
700
|
+
(groupConversation: any) =>
|
|
701
|
+
bridgeContactToSdkContact(groupConversation)
|
|
702
|
+
);
|
|
703
|
+
this.groupConversations.sort(compareNameAscending);
|
|
704
|
+
|
|
601
705
|
if (event.emergencyChannel) {
|
|
602
706
|
this.emergencyChannel = bridgeContactToSdkContact(
|
|
603
707
|
event.emergencyChannel
|
|
604
708
|
) as ZelloChannel;
|
|
605
709
|
}
|
|
606
710
|
|
|
607
|
-
this.emit(
|
|
711
|
+
this.emit(
|
|
712
|
+
ZelloEvent.CONTACT_LIST_UPDATED,
|
|
713
|
+
this.users,
|
|
714
|
+
this.channels,
|
|
715
|
+
this.groupConversations
|
|
716
|
+
);
|
|
608
717
|
break;
|
|
609
718
|
}
|
|
610
719
|
case 'onSelectedContactChanged': {
|
|
@@ -632,7 +741,7 @@ export class Zello extends EventEmitter {
|
|
|
632
741
|
}
|
|
633
742
|
this.incomingVoiceMessage = new ZelloIncomingVoiceMessage(
|
|
634
743
|
contact,
|
|
635
|
-
|
|
744
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
636
745
|
parseInt(event.timestamp, 10)
|
|
637
746
|
);
|
|
638
747
|
this.emit(
|
|
@@ -651,7 +760,7 @@ export class Zello extends EventEmitter {
|
|
|
651
760
|
ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED,
|
|
652
761
|
new ZelloIncomingVoiceMessage(
|
|
653
762
|
contact,
|
|
654
|
-
|
|
763
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
655
764
|
parseInt(event.timestamp, 10)
|
|
656
765
|
)
|
|
657
766
|
);
|
|
@@ -724,7 +833,7 @@ export class Zello extends EventEmitter {
|
|
|
724
833
|
ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED,
|
|
725
834
|
new ZelloImageMessage(
|
|
726
835
|
contact,
|
|
727
|
-
|
|
836
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
728
837
|
true,
|
|
729
838
|
parseInt(event.timestamp, 10),
|
|
730
839
|
event.thumbnail,
|
|
@@ -778,7 +887,7 @@ export class Zello extends EventEmitter {
|
|
|
778
887
|
ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED,
|
|
779
888
|
new ZelloAlertMessage(
|
|
780
889
|
contact,
|
|
781
|
-
|
|
890
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
782
891
|
true,
|
|
783
892
|
parseInt(event.timestamp, 10),
|
|
784
893
|
event.text
|
|
@@ -829,7 +938,7 @@ export class Zello extends EventEmitter {
|
|
|
829
938
|
ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED,
|
|
830
939
|
new ZelloTextMessage(
|
|
831
940
|
contact,
|
|
832
|
-
|
|
941
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
833
942
|
true,
|
|
834
943
|
parseInt(event.timestamp, 10),
|
|
835
944
|
event.text
|
|
@@ -880,7 +989,7 @@ export class Zello extends EventEmitter {
|
|
|
880
989
|
ZelloEvent.INCOMING_LOCATION_MESSAGE_RECEIVED,
|
|
881
990
|
new ZelloLocationMessage(
|
|
882
991
|
contact,
|
|
883
|
-
|
|
992
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
884
993
|
true,
|
|
885
994
|
parseInt(event.timestamp, 10),
|
|
886
995
|
event.latitude,
|
|
@@ -1009,12 +1118,9 @@ export class Zello extends EventEmitter {
|
|
|
1009
1118
|
if (!contact) {
|
|
1010
1119
|
return undefined;
|
|
1011
1120
|
}
|
|
1012
|
-
const channelUser = recent.channelUser
|
|
1013
|
-
? new ZelloChannelUser(recent.channelUser)
|
|
1014
|
-
: undefined;
|
|
1015
1121
|
return new ZelloRecentEntry(
|
|
1016
1122
|
contact,
|
|
1017
|
-
channelUser,
|
|
1123
|
+
bridgeChannelUserToSdkChannelUser(event.channelUser),
|
|
1018
1124
|
parseInt(recent.timestamp, 10),
|
|
1019
1125
|
recent.type.toLowerCase(),
|
|
1020
1126
|
recent.incoming
|
|
@@ -1061,6 +1167,86 @@ export class Zello extends EventEmitter {
|
|
|
1061
1167
|
this.processDispatchCallEvent(event);
|
|
1062
1168
|
break;
|
|
1063
1169
|
}
|
|
1170
|
+
case 'onGroupConversationLeft': {
|
|
1171
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1172
|
+
event.conversation
|
|
1173
|
+
) as ZelloGroupConversation;
|
|
1174
|
+
if (!groupConversation) {
|
|
1175
|
+
break;
|
|
1176
|
+
}
|
|
1177
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
|
|
1178
|
+
break;
|
|
1179
|
+
}
|
|
1180
|
+
case 'onGroupConversationInvite': {
|
|
1181
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1182
|
+
event.conversation
|
|
1183
|
+
) as ZelloGroupConversation;
|
|
1184
|
+
if (!groupConversation) {
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
case 'onGroupConversationCreated': {
|
|
1191
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1192
|
+
event.conversation
|
|
1193
|
+
) as ZelloGroupConversation;
|
|
1194
|
+
if (!groupConversation) {
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
|
|
1198
|
+
break;
|
|
1199
|
+
}
|
|
1200
|
+
case 'onGroupConversationRenamed': {
|
|
1201
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1202
|
+
event.conversation
|
|
1203
|
+
) as ZelloGroupConversation;
|
|
1204
|
+
if (!groupConversation) {
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
|
|
1208
|
+
break;
|
|
1209
|
+
}
|
|
1210
|
+
case 'onGroupConversationUsersAdded': {
|
|
1211
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1212
|
+
event.conversation
|
|
1213
|
+
) as ZelloGroupConversation;
|
|
1214
|
+
if (!groupConversation) {
|
|
1215
|
+
break;
|
|
1216
|
+
}
|
|
1217
|
+
const users = event.users.map((user: any) =>
|
|
1218
|
+
bridgeChannelUserToSdkChannelUser(user)
|
|
1219
|
+
);
|
|
1220
|
+
if (!users || users.length === 0) {
|
|
1221
|
+
return;
|
|
1222
|
+
}
|
|
1223
|
+
this.emit(
|
|
1224
|
+
ZelloEvent.GROUP_CONVERSATION_USERS_ADDED,
|
|
1225
|
+
groupConversation,
|
|
1226
|
+
users
|
|
1227
|
+
);
|
|
1228
|
+
break;
|
|
1229
|
+
}
|
|
1230
|
+
case 'onGroupConversationUsersLeft': {
|
|
1231
|
+
const groupConversation = bridgeContactToSdkContact(
|
|
1232
|
+
event.conversation
|
|
1233
|
+
) as ZelloGroupConversation;
|
|
1234
|
+
if (!groupConversation) {
|
|
1235
|
+
break;
|
|
1236
|
+
}
|
|
1237
|
+
const users = event.users.map((user: any) =>
|
|
1238
|
+
bridgeChannelUserToSdkChannelUser(user)
|
|
1239
|
+
);
|
|
1240
|
+
if (!users || users.length === 0) {
|
|
1241
|
+
return;
|
|
1242
|
+
}
|
|
1243
|
+
this.emit(
|
|
1244
|
+
ZelloEvent.GROUP_CONVERSATION_USERS_LEFT,
|
|
1245
|
+
groupConversation,
|
|
1246
|
+
users
|
|
1247
|
+
);
|
|
1248
|
+
break;
|
|
1249
|
+
}
|
|
1064
1250
|
default:
|
|
1065
1251
|
break;
|
|
1066
1252
|
}
|
|
@@ -1096,6 +1282,7 @@ export class Zello extends EventEmitter {
|
|
|
1096
1282
|
private clearContactList() {
|
|
1097
1283
|
this.users = [];
|
|
1098
1284
|
this.channels = [];
|
|
1285
|
+
this.groupConversations = [];
|
|
1099
1286
|
}
|
|
1100
1287
|
|
|
1101
1288
|
private static getSdk() {
|