@zelloptt/react-native-zello-sdk 2.0.1 → 3.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 +58 -15
- package/android/build.gradle +29 -10
- package/android/gradle.properties +4 -4
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +93 -68
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +25 -0
- package/ios/Extensions/ZelloContact+Extension.swift +26 -3
- package/ios/Extensions/ZelloHistoryVoiceMessage+Extension.swift +3 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +8 -2
- package/ios/Extensions/ZelloIncomingEmergency+Extension.swift +1 -0
- package/ios/Extensions/ZelloTranscription+Extension.swift +18 -0
- package/ios/ZelloIOSSdkModule.swift +24 -7
- package/ios/ZelloIOSSdkModuleBridge.m +1 -0
- package/ios/ZelloSdkModule.h +8 -0
- package/ios/ZelloSdkModule.mm +189 -0
- package/ios/ZelloSdkModuleImpl.swift +280 -0
- package/lib/commonjs/docs/assets/highlight.css +1 -1
- package/lib/commonjs/docs/assets/icons.js +1 -1
- package/lib/commonjs/docs/assets/icons.js.map +1 -1
- package/lib/commonjs/docs/assets/icons.svg +1 -1
- package/lib/commonjs/docs/assets/main.js +220 -288
- package/lib/commonjs/docs/assets/main.js.map +1 -1
- 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/assets/style.css +21 -6
- package/lib/commonjs/docs/classes/sdk.Zello.html +793 -97
- package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +122 -9
- package/lib/commonjs/docs/classes/types.ZelloChannel.html +155 -10
- package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +86 -4
- package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +90 -6
- package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +163 -11
- package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +178 -13
- package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
- package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
- package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
- package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
- package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
- package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +130 -10
- package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +114 -9
- package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
- package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +146 -12
- package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
- package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
- package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +114 -9
- package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +122 -9
- package/lib/commonjs/docs/classes/types.ZelloTranscription.html +122 -0
- package/lib/commonjs/docs/classes/types.ZelloTranslation.html +91 -0
- package/lib/commonjs/docs/classes/types.ZelloUser.html +142 -11
- package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
- package/lib/commonjs/docs/enums/events.ZelloEvent.html +563 -95
- package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +67 -5
- package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
- package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
- package/lib/commonjs/docs/enums/types.ZelloChannelType.html +84 -0
- package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +68 -3
- package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloContactType.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
- package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
- package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +78 -3
- package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +81 -7
- package/lib/commonjs/docs/hierarchy.html +29 -1
- package/lib/commonjs/docs/index.html +122 -24
- package/lib/commonjs/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
- package/lib/commonjs/docs/modules/events.html +37 -1
- package/lib/commonjs/docs/modules/index.html +37 -1
- package/lib/commonjs/docs/modules/sdk.html +37 -1
- package/lib/commonjs/docs/modules/specs_NativeZelloSdk.html +41 -0
- package/lib/commonjs/docs/modules/types.html +45 -1
- package/lib/commonjs/docs/modules.html +36 -1
- package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +114 -9
- package/lib/commonjs/docs/types/types.ZelloConfig.html +86 -7
- package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +96 -9
- package/lib/commonjs/docs/types/types.ZelloContact.html +80 -6
- package/lib/commonjs/docs/types/types.ZelloCredentials.html +75 -6
- package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +97 -8
- package/lib/commonjs/docs/types/types.ZelloMessage.html +91 -7
- package/lib/commonjs/docs/variables/specs_NativeZelloSdk.default.html +34 -0
- package/lib/commonjs/events/index.js +217 -0
- package/lib/commonjs/events/index.js.map +1 -1
- package/lib/commonjs/sdk/index.js +731 -911
- package/lib/commonjs/sdk/index.js.map +1 -1
- package/lib/commonjs/specs/NativeZelloSdk.js +27 -0
- package/lib/commonjs/specs/NativeZelloSdk.js.map +1 -0
- package/lib/commonjs/types/index.js +423 -302
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/commonjs/utils/index.js +27 -4
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/module/docs/assets/highlight.css +1 -1
- package/lib/module/docs/assets/icons.js +1 -1
- package/lib/module/docs/assets/icons.js.map +1 -1
- package/lib/module/docs/assets/icons.svg +1 -1
- package/lib/module/docs/assets/main.js +220 -288
- package/lib/module/docs/assets/main.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/assets/style.css +21 -6
- package/lib/module/docs/classes/sdk.Zello.html +793 -97
- package/lib/module/docs/classes/types.ZelloAlertMessage.html +122 -9
- package/lib/module/docs/classes/types.ZelloChannel.html +155 -10
- package/lib/module/docs/classes/types.ZelloChannelUser.html +86 -4
- package/lib/module/docs/classes/types.ZelloDispatchCall.html +90 -6
- package/lib/module/docs/classes/types.ZelloDispatchChannel.html +163 -11
- package/lib/module/docs/classes/types.ZelloGroupConversation.html +178 -13
- package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
- package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
- package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
- package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
- package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
- package/lib/module/docs/classes/types.ZelloImageMessage.html +130 -10
- package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +114 -9
- package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
- package/lib/module/docs/classes/types.ZelloLocationMessage.html +146 -12
- package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
- package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
- package/lib/module/docs/classes/types.ZelloRecentEntry.html +114 -9
- package/lib/module/docs/classes/types.ZelloTextMessage.html +122 -9
- package/lib/module/docs/classes/types.ZelloTranscription.html +122 -0
- package/lib/module/docs/classes/types.ZelloTranslation.html +91 -0
- package/lib/module/docs/classes/types.ZelloUser.html +142 -11
- package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
- package/lib/module/docs/enums/events.ZelloEvent.html +563 -95
- package/lib/module/docs/enums/types.ZelloAccountStatus.html +67 -5
- package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
- package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
- package/lib/module/docs/enums/types.ZelloChannelType.html +84 -0
- package/lib/module/docs/enums/types.ZelloConnectionError.html +68 -3
- package/lib/module/docs/enums/types.ZelloConnectionState.html +73 -3
- package/lib/module/docs/enums/types.ZelloContactType.html +73 -3
- package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
- package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
- package/lib/module/docs/enums/types.ZelloRecentEntryType.html +78 -3
- package/lib/module/docs/enums/types.ZelloUserStatus.html +81 -7
- package/lib/module/docs/hierarchy.html +29 -1
- package/lib/module/docs/index.html +122 -24
- package/lib/module/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
- package/lib/module/docs/modules/events.html +37 -1
- package/lib/module/docs/modules/index.html +37 -1
- package/lib/module/docs/modules/sdk.html +37 -1
- package/lib/module/docs/modules/specs_NativeZelloSdk.html +41 -0
- package/lib/module/docs/modules/types.html +45 -1
- package/lib/module/docs/modules.html +36 -1
- package/lib/module/docs/types/types.ZelloChannelOptions.html +114 -9
- package/lib/module/docs/types/types.ZelloConfig.html +86 -7
- package/lib/module/docs/types/types.ZelloConsoleSettings.html +96 -9
- package/lib/module/docs/types/types.ZelloContact.html +80 -6
- package/lib/module/docs/types/types.ZelloCredentials.html +75 -6
- package/lib/module/docs/types/types.ZelloHistoryMessage.html +97 -8
- package/lib/module/docs/types/types.ZelloMessage.html +91 -7
- package/lib/module/docs/variables/specs_NativeZelloSdk.default.html +34 -0
- package/lib/module/events/index.js +217 -0
- package/lib/module/events/index.js.map +1 -1
- package/lib/module/sdk/index.js +730 -912
- package/lib/module/sdk/index.js.map +1 -1
- package/lib/module/specs/NativeZelloSdk.js +25 -0
- package/lib/module/specs/NativeZelloSdk.js.map +1 -0
- package/lib/module/types/index.js +378 -301
- package/lib/module/types/index.js.map +1 -1
- package/lib/module/utils/index.js +27 -5
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/commonjs/src/events/index.d.ts +9 -0
- package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/sdk/index.d.ts +10 -0
- package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts +55 -0
- package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/index.d.ts +106 -4
- 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 +9 -0
- package/lib/typescript/module/src/events/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +4 -4
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/sdk/index.d.ts +11 -1
- package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
- package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts +55 -0
- package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts.map +1 -0
- package/lib/typescript/module/src/types/index.d.ts +106 -4
- package/lib/typescript/module/src/types/index.d.ts.map +1 -1
- package/lib/typescript/module/src/utils/algorithms/index.d.ts +1 -1
- package/lib/typescript/module/src/utils/algorithms/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 +31 -15
- package/react-native-zello-sdk.podspec +26 -1
- package/src/events/index.ts +9 -0
- package/src/sdk/index.ts +105 -225
- package/src/specs/NativeZelloSdk.ts +89 -0
- package/src/types/index.ts +153 -6
- package/src/utils/index.ts +50 -3
package/lib/module/sdk/index.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _Zello;
|
|
4
|
-
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
-
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
-
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
-
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
9
|
-
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
10
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
11
|
-
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
12
|
-
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
|
-
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
16
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
3
|
// noinspection JSUnusedGlobalSymbols
|
|
18
4
|
|
|
19
|
-
import {
|
|
5
|
+
import { DeviceEventEmitter, NativeModules } from 'react-native';
|
|
20
6
|
import { bridgeCallToSdkCall, bridgeChannelUserToSdkChannelUser, bridgeConsoleSettingsToSdkConsoleSettings, isAndroid } from "../utils/index.js";
|
|
21
|
-
import { ZelloAccountStatus, ZelloAlertMessage, ZelloConnectionError, ZelloConnectionState, ZelloContactType, ZelloImageMessage, ZelloIncomingVoiceMessage, ZelloLocationMessage, ZelloOutgoingEmergency, ZelloOutgoingVoiceMessage, ZelloOutgoingVoiceMessageError, ZelloOutgoingVoiceMessageState, ZelloRecentEntry, ZelloTextMessage } from "../types/index.js";
|
|
7
|
+
import { ZelloAccountStatus, ZelloAlertMessage, ZelloConnectionError, ZelloConnectionState, ZelloContactType, ZelloHistoryVoiceMessage, ZelloImageMessage, ZelloIncomingVoiceMessage, ZelloLocationMessage, ZelloOutgoingEmergency, ZelloOutgoingVoiceMessage, ZelloOutgoingVoiceMessageError, ZelloOutgoingVoiceMessageState, ZelloRecentEntry, ZelloTextMessage } from "../types/index.js";
|
|
22
8
|
import EventEmitter from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
23
9
|
import { compareNameAscending, sortedArrayFind } from "../utils/algorithms/index.js";
|
|
24
10
|
import { bridgeContactToSdkContact, bridgeHistoryMessageToSdkHistoryMessage, bridgeIncomingEmergencyToSdkIncomingEmergency } from "../utils/index.js";
|
|
25
11
|
import { ZelloEvent } from "../events/index.js";
|
|
12
|
+
import NativeZelloSdk from "../specs/NativeZelloSdk.js";
|
|
13
|
+
|
|
14
|
+
// `ZelloIOSSdkModule` is the iOS RCTEventEmitter that owns the Zello delegate
|
|
15
|
+
// (see `getSdk`). All method calls go through the unified `NativeZelloSdk`
|
|
16
|
+
// TurboModule, which on Android also owns the delegate.
|
|
26
17
|
const {
|
|
27
|
-
ZelloAndroidSdkModule,
|
|
28
18
|
ZelloIOSSdkModule
|
|
29
19
|
} = NativeModules;
|
|
30
20
|
|
|
@@ -32,1010 +22,838 @@ const {
|
|
|
32
22
|
* Zello SDK.
|
|
33
23
|
* This class is a singleton, and can be accessed via {@link Zello.getInstance}.
|
|
34
24
|
*/
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
25
|
+
export class Zello extends EventEmitter {
|
|
26
|
+
static getInstance() {
|
|
27
|
+
if (!Zello.instance) {
|
|
28
|
+
Zello.instance = new Zello();
|
|
29
|
+
}
|
|
30
|
+
return Zello.instance;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The current connection state of the SDK.
|
|
35
|
+
*/
|
|
36
|
+
state = ZelloConnectionState.Disconnected;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The currently selected contact.
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* The list of {@link ZelloUser} in the contact list. Sorted by name, ascending.
|
|
44
|
+
*/
|
|
45
|
+
users = [];
|
|
46
|
+
/**
|
|
47
|
+
* The list of {@link ZelloChannel} in the contact list. Sorted by name, ascending.
|
|
48
|
+
*/
|
|
49
|
+
channels = [];
|
|
50
|
+
/**
|
|
51
|
+
* The list of {@link ZelloGroupConversation} in the contact list. Sorted by name, ascending.
|
|
52
|
+
*/
|
|
53
|
+
groupConversations = [];
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* The current account status. undefined when {@link state} is not {@link ZelloConnectionState.Connected}.
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The current incoming voice message.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The current outgoing voice message.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The configured emergency channel.
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The list of incoming emergencies. There can be multiple emergencies on the emergency channel at once.
|
|
73
|
+
* Sorted by start timestamp, ascending.
|
|
74
|
+
*/
|
|
75
|
+
incomingEmergencies = [];
|
|
76
|
+
/**
|
|
77
|
+
* The current outgoing emergency.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The list of recent entries. Sorted by timestamp, descending.
|
|
82
|
+
*/
|
|
83
|
+
recents = [];
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The currently playing history voice message.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The console settings for the network.
|
|
91
|
+
* This is only expected to be valid when {@link state} is {@link ZelloConnectionState.Connected}.
|
|
92
|
+
*/
|
|
93
|
+
|
|
94
|
+
constructor() {
|
|
95
|
+
super();
|
|
96
|
+
// Accessing the native module instantiates it, which registers the SDK
|
|
97
|
+
// delegate that drives events. The events themselves arrive on the global
|
|
98
|
+
// DeviceEventEmitter 'zellosdk' channel (bridgeless-safe on both platforms).
|
|
99
99
|
const sdk = Zello.getSdk();
|
|
100
100
|
if (sdk) {
|
|
101
|
-
|
|
102
|
-
if (isAndroid) {
|
|
103
|
-
eventEmitter = new NativeEventEmitter();
|
|
104
|
-
} else {
|
|
105
|
-
eventEmitter = new NativeEventEmitter(sdk);
|
|
106
|
-
}
|
|
107
|
-
_this.setupEventListener(eventEmitter);
|
|
101
|
+
this.setupEventListener();
|
|
108
102
|
}
|
|
109
|
-
return _this;
|
|
110
103
|
}
|
|
111
104
|
|
|
112
105
|
/**
|
|
113
106
|
* Sets configuration variables for the SDK.
|
|
114
107
|
* @param config The configuration to set.
|
|
115
108
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
value: function configure(config) {
|
|
120
|
-
if (isAndroid) {
|
|
121
|
-
ZelloAndroidSdkModule.configure(config.android.enableOfflineMessagePushNotifications, config.android.enableForegroundService);
|
|
122
|
-
} else {
|
|
123
|
-
ZelloIOSSdkModule.configure(config.ios.isDebugBuild, config.ios.appGroup);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
109
|
+
configure(config) {
|
|
110
|
+
NativeZelloSdk.configure(config);
|
|
111
|
+
}
|
|
126
112
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.eventListener?.remove();
|
|
136
|
-
}
|
|
113
|
+
/**
|
|
114
|
+
* Destroys the SDK instance and cleans up resources.
|
|
115
|
+
* Call this when you are done using the SDK instance for good (application quit).
|
|
116
|
+
*/
|
|
117
|
+
destroy() {
|
|
118
|
+
this.removeAllListeners();
|
|
119
|
+
this.eventListener?.remove();
|
|
120
|
+
}
|
|
137
121
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
if (isAndroid) {
|
|
148
|
-
ZelloAndroidSdkModule.connect(credentials.network, credentials.username, credentials.password);
|
|
149
|
-
} else {
|
|
150
|
-
ZelloIOSSdkModule.connect(credentials.network, credentials.username, credentials.password);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
122
|
+
/**
|
|
123
|
+
* Signs into to the Zello Work network using the provided credentials.
|
|
124
|
+
* This will typically trigger the {@link ZelloEvent.CONNECT_STARTED} event, followed by either {@link ZelloEvent.CONNECT_SUCCEEDED} or {@link ZelloEvent.CONNECT_FAILED}.
|
|
125
|
+
* However, if the state is incorrect, {@link ZelloEvent.CONNECT_FAILED} will be triggered immediately.
|
|
126
|
+
* @param credentials The credentials to use for signing in.
|
|
127
|
+
*/
|
|
128
|
+
connect(credentials) {
|
|
129
|
+
NativeZelloSdk.connect(credentials.network, credentials.username, credentials.password);
|
|
130
|
+
}
|
|
153
131
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
if (isAndroid) {
|
|
162
|
-
ZelloAndroidSdkModule.disconnect();
|
|
163
|
-
} else {
|
|
164
|
-
ZelloIOSSdkModule.disconnect();
|
|
165
|
-
}
|
|
166
|
-
}
|
|
132
|
+
/**
|
|
133
|
+
* Signs out of the Zello Work network.
|
|
134
|
+
* This will trigger the {@link ZelloEvent.DISCONNECTED} event.
|
|
135
|
+
*/
|
|
136
|
+
disconnect() {
|
|
137
|
+
NativeZelloSdk.disconnect();
|
|
138
|
+
}
|
|
167
139
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return sortedArrayFind(this.users, name, compareNameAscending);
|
|
177
|
-
}
|
|
140
|
+
/**
|
|
141
|
+
* Returns the user with the given name. Case-insensitive.
|
|
142
|
+
* @param name The name of the user to search for.
|
|
143
|
+
* @return The user with the given name, or null if no user with that name exists.
|
|
144
|
+
*/
|
|
145
|
+
getUser(name) {
|
|
146
|
+
return sortedArrayFind(this.users, name, compareNameAscending);
|
|
147
|
+
}
|
|
178
148
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
return sortedArrayFind(this.channels, name, compareNameAscending);
|
|
188
|
-
}
|
|
149
|
+
/**
|
|
150
|
+
* Returns the channel with the given name. Case-insensitive.
|
|
151
|
+
* @param name The name of the channel to search for.
|
|
152
|
+
* @return The channel with the given name, or null if no channel with that name exists.
|
|
153
|
+
*/
|
|
154
|
+
getChannel(name) {
|
|
155
|
+
return sortedArrayFind(this.channels, name, compareNameAscending);
|
|
156
|
+
}
|
|
189
157
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
return sortedArrayFind(this.groupConversations, name, compareNameAscending);
|
|
199
|
-
}
|
|
158
|
+
/**
|
|
159
|
+
* Returns the group conversation with the given name. Case-insensitive.
|
|
160
|
+
* @param name The name of the group conversation to search for.
|
|
161
|
+
* @return The group conversation with the given name, or null if no group conversation with that name exists.
|
|
162
|
+
*/
|
|
163
|
+
getGroupConversation(name) {
|
|
164
|
+
return sortedArrayFind(this.groupConversations, name, compareNameAscending);
|
|
165
|
+
}
|
|
200
166
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (isAndroid) {
|
|
211
|
-
ZelloAndroidSdkModule.setSelectedContact(contact.name, contact.type);
|
|
212
|
-
} else {
|
|
213
|
-
ZelloIOSSdkModule.selectContact(contact.name, contact.type);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
167
|
+
/**
|
|
168
|
+
* Sets the selected contact.
|
|
169
|
+
* While optional, this is typically used for tracking the contact that the user is currently interacting with.
|
|
170
|
+
* This will trigger the {@link ZelloEvent.SELECTED_CONTACT_CHANGED} event.
|
|
171
|
+
* @param contact The contact to set as selected.
|
|
172
|
+
*/
|
|
173
|
+
setSelectedContact(contact) {
|
|
174
|
+
NativeZelloSdk.selectContact(contact.name, contact.type);
|
|
175
|
+
}
|
|
216
176
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (isAndroid) {
|
|
226
|
-
ZelloAndroidSdkModule.setAccountStatus(status);
|
|
227
|
-
} else {
|
|
228
|
-
ZelloIOSSdkModule.setAccountStatus(status);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
177
|
+
/**
|
|
178
|
+
* Sets the user's online account status.
|
|
179
|
+
* This will trigger the {@link ZelloEvent.ACCOUNT_STATUS_CHANGED} event.
|
|
180
|
+
* @param status The account status to set.
|
|
181
|
+
*/
|
|
182
|
+
setAccountStatus(status) {
|
|
183
|
+
NativeZelloSdk.setAccountStatus(status);
|
|
184
|
+
}
|
|
231
185
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
} else {
|
|
244
|
-
if (channel.type === ZelloContactType.GroupConversation) {
|
|
245
|
-
ZelloIOSSdkModule.connectGroupConversation(channel.name);
|
|
246
|
-
} else {
|
|
247
|
-
ZelloIOSSdkModule.connectChannel(channel.name);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
186
|
+
/**
|
|
187
|
+
* Connects to the given channel.
|
|
188
|
+
* Once connected, the user will be able to send and receive messages from the channel.
|
|
189
|
+
* This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
|
|
190
|
+
* @param channel The channel to connect to.
|
|
191
|
+
*/
|
|
192
|
+
connectChannel(channel) {
|
|
193
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
194
|
+
NativeZelloSdk.connectGroupConversation(channel.name);
|
|
195
|
+
} else {
|
|
196
|
+
NativeZelloSdk.connectChannel(channel.name);
|
|
250
197
|
}
|
|
198
|
+
}
|
|
251
199
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
} else {
|
|
264
|
-
if (channel.type === ZelloContactType.GroupConversation) {
|
|
265
|
-
ZelloIOSSdkModule.disconnectGroupConversation(channel.name);
|
|
266
|
-
} else {
|
|
267
|
-
ZelloIOSSdkModule.disconnectChannel(channel.name);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
200
|
+
/**
|
|
201
|
+
* Disconnects from the given channel.
|
|
202
|
+
* Once disconnected, the user will no longer be able to send or receive messages from the channel.
|
|
203
|
+
* This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
|
|
204
|
+
* @param channel The channel to disconnect from.
|
|
205
|
+
*/
|
|
206
|
+
disconnectChannel(channel) {
|
|
207
|
+
if (channel.type === ZelloContactType.GroupConversation) {
|
|
208
|
+
NativeZelloSdk.disconnectGroupConversation(channel.name);
|
|
209
|
+
} else {
|
|
210
|
+
NativeZelloSdk.disconnectChannel(channel.name);
|
|
270
211
|
}
|
|
212
|
+
}
|
|
271
213
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
if (isAndroid) {
|
|
282
|
-
ZelloAndroidSdkModule.startVoiceMessage(contact.name, contact.type);
|
|
283
|
-
} else {
|
|
284
|
-
ZelloIOSSdkModule.startVoiceMessage(contact.name, contact.type);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
214
|
+
/**
|
|
215
|
+
* Starts a voice message with the given contact.
|
|
216
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING} event, followed by the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED} event.
|
|
217
|
+
* If there is an error, the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event will be triggered.
|
|
218
|
+
* @param contact The contact to start the voice message with.
|
|
219
|
+
*/
|
|
220
|
+
startVoiceMessage(contact) {
|
|
221
|
+
NativeZelloSdk.startVoiceMessage(contact.name, contact.type);
|
|
222
|
+
}
|
|
287
223
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (isAndroid) {
|
|
296
|
-
ZelloAndroidSdkModule.stopVoiceMessage();
|
|
297
|
-
} else {
|
|
298
|
-
ZelloIOSSdkModule.stopVoiceMessage();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
224
|
+
/**
|
|
225
|
+
* Stops the current outgoing voice message.
|
|
226
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event.
|
|
227
|
+
*/
|
|
228
|
+
stopVoiceMessage() {
|
|
229
|
+
NativeZelloSdk.stopVoiceMessage();
|
|
230
|
+
}
|
|
301
231
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (isAndroid) {
|
|
312
|
-
ZelloAndroidSdkModule.sendImage(contact.name, contact.type, data);
|
|
313
|
-
} else {
|
|
314
|
-
ZelloIOSSdkModule.sendImage(contact.name, contact.type, data);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
232
|
+
/**
|
|
233
|
+
* Sends the image message data to the given contact.
|
|
234
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED} event.
|
|
235
|
+
* @param contact The contact to send the image to.
|
|
236
|
+
* @param data The image data to send.
|
|
237
|
+
*/
|
|
238
|
+
sendImage(contact, data) {
|
|
239
|
+
NativeZelloSdk.sendImage(contact.name, contact.type, data);
|
|
240
|
+
}
|
|
317
241
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if (isAndroid) {
|
|
327
|
-
ZelloAndroidSdkModule.sendLocation(contact.name, contact.type);
|
|
328
|
-
} else {
|
|
329
|
-
ZelloIOSSdkModule.sendLocation(contact.name, contact.type);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
242
|
+
/**
|
|
243
|
+
* Sends the alert message to the given contact.
|
|
244
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
|
|
245
|
+
* @param contact The contact to send the alert to.
|
|
246
|
+
*/
|
|
247
|
+
sendLocation(contact) {
|
|
248
|
+
NativeZelloSdk.sendLocation(contact.name, contact.type);
|
|
249
|
+
}
|
|
332
250
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
if (isAndroid) {
|
|
343
|
-
ZelloAndroidSdkModule.sendText(contact.name, contact.type, text);
|
|
344
|
-
} else {
|
|
345
|
-
ZelloIOSSdkModule.sendText(contact.name, contact.type, text);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
251
|
+
/**
|
|
252
|
+
* Sends the text message to the given contact.
|
|
253
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED} event.
|
|
254
|
+
* @param contact The contact to send the text to.
|
|
255
|
+
* @param text The text to send.
|
|
256
|
+
*/
|
|
257
|
+
sendText(contact, text) {
|
|
258
|
+
NativeZelloSdk.sendText(contact.name, contact.type, text);
|
|
259
|
+
}
|
|
348
260
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
if (isAndroid) {
|
|
360
|
-
ZelloAndroidSdkModule.sendAlert(contact.name, contact.type, text, level);
|
|
361
|
-
} else {
|
|
362
|
-
ZelloIOSSdkModule.sendAlert(contact.name, contact.type, text, level);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
261
|
+
/**
|
|
262
|
+
* Sends the alert message to the given contact.
|
|
263
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
|
|
264
|
+
* @param contact The contact to send the alert to.
|
|
265
|
+
* @param text The text to send.
|
|
266
|
+
* @param level Optional; The alert level to send. Only applicable for channels.
|
|
267
|
+
*/
|
|
268
|
+
sendAlert(contact, text, level) {
|
|
269
|
+
NativeZelloSdk.sendAlert(contact.name, contact.type, text, level ?? '');
|
|
270
|
+
}
|
|
365
271
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
if (isAndroid) {
|
|
374
|
-
ZelloAndroidSdkModule.submitProblemReport();
|
|
375
|
-
} else {
|
|
376
|
-
ZelloIOSSdkModule.submitProblemReport();
|
|
377
|
-
}
|
|
378
|
-
}
|
|
272
|
+
/**
|
|
273
|
+
* Submits a problem report to Zello.
|
|
274
|
+
* Additionally, please contact us to provide more information on what happened.
|
|
275
|
+
*/
|
|
276
|
+
submitProblemReport() {
|
|
277
|
+
NativeZelloSdk.submitProblemReport();
|
|
278
|
+
}
|
|
379
279
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
if (isAndroid) {
|
|
389
|
-
ZelloAndroidSdkModule.muteContact(contact.name, contact.type);
|
|
390
|
-
} else {
|
|
391
|
-
ZelloIOSSdkModule.muteContact(contact.name, contact.type);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
280
|
+
/**
|
|
281
|
+
* Mutes the given contact. When muted, incoming messages from this contact will not play live, but will still appear in the history.
|
|
282
|
+
* This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
|
|
283
|
+
* @param contact The contact to mute.
|
|
284
|
+
*/
|
|
285
|
+
muteContact(contact) {
|
|
286
|
+
NativeZelloSdk.muteContact(contact.name, contact.type);
|
|
287
|
+
}
|
|
394
288
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
if (isAndroid) {
|
|
404
|
-
ZelloAndroidSdkModule.unmuteContact(contact.name, contact.type);
|
|
405
|
-
} else {
|
|
406
|
-
ZelloIOSSdkModule.unmuteContact(contact.name, contact.type);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
289
|
+
/**
|
|
290
|
+
* Unmutes a previously muted contact. When unmuted, incoming messages from this contact will play live.
|
|
291
|
+
* This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
|
|
292
|
+
* @param contact The contact to unmute.
|
|
293
|
+
*/
|
|
294
|
+
unmuteContact(contact) {
|
|
295
|
+
NativeZelloSdk.unmuteContact(contact.name, contact.type);
|
|
296
|
+
}
|
|
409
297
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (isAndroid) {
|
|
419
|
-
ZelloAndroidSdkModule.startEmergency();
|
|
420
|
-
} else {
|
|
421
|
-
ZelloIOSSdkModule.startEmergency();
|
|
422
|
-
}
|
|
423
|
-
}
|
|
298
|
+
/**
|
|
299
|
+
* Starts an outgoing emergency to the emergency channel.
|
|
300
|
+
* Upon starting, the user's location will be sent, an alert message will be sent, and a 10-second-long voice message will start recording.
|
|
301
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STARTED} event.
|
|
302
|
+
*/
|
|
303
|
+
startEmergency() {
|
|
304
|
+
NativeZelloSdk.startEmergency();
|
|
305
|
+
}
|
|
424
306
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
if (isAndroid) {
|
|
433
|
-
ZelloAndroidSdkModule.stopEmergency();
|
|
434
|
-
} else {
|
|
435
|
-
ZelloIOSSdkModule.stopEmergency();
|
|
436
|
-
}
|
|
437
|
-
}
|
|
307
|
+
/**
|
|
308
|
+
* Stops the outgoing emergency.
|
|
309
|
+
* This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STOPPED} event.
|
|
310
|
+
*/
|
|
311
|
+
stopEmergency() {
|
|
312
|
+
NativeZelloSdk.stopEmergency();
|
|
313
|
+
}
|
|
438
314
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
if (!history) {
|
|
452
|
-
resolve([]);
|
|
453
|
-
return;
|
|
454
|
-
}
|
|
455
|
-
const messages = history.map(message => bridgeHistoryMessageToSdkHistoryMessage(message)).filter(item => item !== undefined);
|
|
456
|
-
resolve(messages);
|
|
457
|
-
};
|
|
458
|
-
if (isAndroid) {
|
|
459
|
-
ZelloAndroidSdkModule.getHistory(contact.name, contact.type, size ?? defaultHistorySize, callback);
|
|
460
|
-
} else {
|
|
461
|
-
ZelloIOSSdkModule.getHistory(contact.name, contact.type, size ?? defaultHistorySize, callback);
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
}
|
|
315
|
+
/**
|
|
316
|
+
* Stops an incoming emergency started by another user on the emergency channel.
|
|
317
|
+
*
|
|
318
|
+
* This requires the emergency channel's {@link ZelloChannelOptions.allowEmergencyEndOthers | allowEmergencyEndOthers} option
|
|
319
|
+
* to be true; otherwise this method has no effect.
|
|
320
|
+
*
|
|
321
|
+
* On success, this will trigger the {@link ZelloEvent.INCOMING_EMERGENCY_STOPPED} event for the emergency.
|
|
322
|
+
* @param incomingEmergency The incoming emergency to stop. Must be one of the entries currently in {@link incomingEmergencies}.
|
|
323
|
+
*/
|
|
324
|
+
stopIncomingEmergency(incomingEmergency) {
|
|
325
|
+
NativeZelloSdk.stopIncomingEmergency(incomingEmergency.emergencyId);
|
|
326
|
+
}
|
|
465
327
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
ZelloIOSSdkModule.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
|
|
478
|
-
}
|
|
328
|
+
/**
|
|
329
|
+
* Returns the history messages for the given contact.
|
|
330
|
+
* @param contact The contact to get the history for.
|
|
331
|
+
* @param size Optional; The number of history items to retrieve. Defaults to 50.
|
|
332
|
+
* @return The history items for the given contact.
|
|
333
|
+
*/
|
|
334
|
+
async getHistory(contact, size) {
|
|
335
|
+
const defaultHistorySize = 50;
|
|
336
|
+
const history = await NativeZelloSdk.getHistory(contact.name, contact.type, size ?? defaultHistorySize);
|
|
337
|
+
if (!history) {
|
|
338
|
+
return [];
|
|
479
339
|
}
|
|
340
|
+
return history.map(message => bridgeHistoryMessageToSdkHistoryMessage(message)).filter(item => item !== undefined);
|
|
341
|
+
}
|
|
480
342
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
ZelloAndroidSdkModule.stopHistoryMessagePlayback();
|
|
490
|
-
} else {
|
|
491
|
-
ZelloIOSSdkModule.stopHistoryMessagePlayback();
|
|
492
|
-
}
|
|
493
|
-
}
|
|
343
|
+
/**
|
|
344
|
+
* Plays the given history message.
|
|
345
|
+
* This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STARTED} event.
|
|
346
|
+
* @param message The history message to play.
|
|
347
|
+
*/
|
|
348
|
+
playHistoryMessage(message) {
|
|
349
|
+
NativeZelloSdk.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
|
|
350
|
+
}
|
|
494
351
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
value: function getImageDataForHistoryImageMessage(message) {
|
|
503
|
-
return new Promise(resolve => {
|
|
504
|
-
if (isAndroid) {
|
|
505
|
-
ZelloAndroidSdkModule.getImageDataForHistoryImageMessage(message.historyId, message.contact.name, message.contact.type, data => resolve(data));
|
|
506
|
-
} else {
|
|
507
|
-
ZelloIOSSdkModule.getHistoryImageData(message.historyId, message.contact.name, message.contact.type, data => resolve(data));
|
|
508
|
-
}
|
|
509
|
-
});
|
|
510
|
-
}
|
|
352
|
+
/**
|
|
353
|
+
* Stops the current history message playback.
|
|
354
|
+
* This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STOPPED} event.
|
|
355
|
+
*/
|
|
356
|
+
stopHistoryMessagePlayback() {
|
|
357
|
+
NativeZelloSdk.stopHistoryMessagePlayback();
|
|
358
|
+
}
|
|
511
359
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
}, {
|
|
521
|
-
key: "endDispatchCall",
|
|
522
|
-
value: function endDispatchCall(channel) {
|
|
523
|
-
if (isAndroid) {
|
|
524
|
-
ZelloAndroidSdkModule.endDispatchCall(channel.name);
|
|
525
|
-
} else {
|
|
526
|
-
ZelloIOSSdkModule.endDispatchCall(channel.name);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
360
|
+
/**
|
|
361
|
+
* Returns the image data for the given history image message.
|
|
362
|
+
* @param message The history image message to get the image data for.
|
|
363
|
+
* @return The image data for the given history image message.
|
|
364
|
+
*/
|
|
365
|
+
getImageDataForHistoryImageMessage(message) {
|
|
366
|
+
return NativeZelloSdk.getHistoryImageData(message.historyId, message.contact.name, message.contact.type);
|
|
367
|
+
}
|
|
529
368
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
369
|
+
/**
|
|
370
|
+
* Ends the dispatch call for the given dispatch channel.
|
|
371
|
+
* This will trigger the {@link ZelloEvent.DISPATCH_CALL_ENDED} event.
|
|
372
|
+
*
|
|
373
|
+
* If {@link consoleSettings | ZelloConsoleSettings.allowNonDispatchersToEndCalls} is false, this method will do nothing.
|
|
374
|
+
*
|
|
375
|
+
* @param channel The dispatch channel to end the call for.
|
|
376
|
+
*/
|
|
377
|
+
endDispatchCall(channel) {
|
|
378
|
+
NativeZelloSdk.endDispatchCall(channel.name);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Creates a new group conversation with the given users.
|
|
383
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
384
|
+
* @param users The users to create the group conversation with.
|
|
385
|
+
* @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
|
|
386
|
+
*/
|
|
387
|
+
createGroupConversation(users, displayName) {
|
|
388
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
389
|
+
return;
|
|
547
390
|
}
|
|
391
|
+
NativeZelloSdk.createGroupConversation(users.map(user => user.name), displayName ?? '');
|
|
392
|
+
}
|
|
548
393
|
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
if (!this.consoleSettings?.allowGroupConversations) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
if (isAndroid) {
|
|
562
|
-
ZelloAndroidSdkModule.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
|
|
563
|
-
} else {
|
|
564
|
-
ZelloIOSSdkModule.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
|
|
565
|
-
}
|
|
394
|
+
/**
|
|
395
|
+
* Adds users to the given group conversation.
|
|
396
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
397
|
+
* @param groupConversation The group conversation to add users to.
|
|
398
|
+
* @param users The users to add to the group conversation.
|
|
399
|
+
*/
|
|
400
|
+
addUsersToGroupConversation(groupConversation, users) {
|
|
401
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
402
|
+
return;
|
|
566
403
|
}
|
|
404
|
+
NativeZelloSdk.addUsersToGroupConversation(groupConversation.name, users.map(user => user.name));
|
|
405
|
+
}
|
|
567
406
|
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
if (!this.consoleSettings?.allowGroupConversations) {
|
|
577
|
-
return;
|
|
578
|
-
}
|
|
579
|
-
if (isAndroid) {
|
|
580
|
-
ZelloAndroidSdkModule.leaveGroupConversation(groupConversation.name);
|
|
581
|
-
} else {
|
|
582
|
-
ZelloIOSSdkModule.leaveGroupConversation(groupConversation.name);
|
|
583
|
-
}
|
|
407
|
+
/**
|
|
408
|
+
* Removes the user from the group conversation.
|
|
409
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
410
|
+
* @param groupConversation The group conversation to leave.
|
|
411
|
+
*/
|
|
412
|
+
leaveGroupConversation(groupConversation) {
|
|
413
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
414
|
+
return;
|
|
584
415
|
}
|
|
416
|
+
NativeZelloSdk.leaveGroupConversation(groupConversation.name);
|
|
417
|
+
}
|
|
585
418
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
if (!this.consoleSettings?.allowGroupConversations) {
|
|
596
|
-
return;
|
|
597
|
-
}
|
|
598
|
-
if (isAndroid) {
|
|
599
|
-
ZelloAndroidSdkModule.renameGroupConversation(groupConversation.name, name);
|
|
600
|
-
} else {
|
|
601
|
-
ZelloIOSSdkModule.renameGroupConversation(groupConversation.name, name);
|
|
602
|
-
}
|
|
419
|
+
/**
|
|
420
|
+
* Renames the group conversation.
|
|
421
|
+
* This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
|
|
422
|
+
* @param groupConversation The group conversation to rename.
|
|
423
|
+
* @param name The new name for the group conversation.
|
|
424
|
+
*/
|
|
425
|
+
renameGroupConversation(groupConversation, name) {
|
|
426
|
+
if (!this.consoleSettings?.allowGroupConversations) {
|
|
427
|
+
return;
|
|
603
428
|
}
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
429
|
+
NativeZelloSdk.renameGroupConversation(groupConversation.name, name);
|
|
430
|
+
}
|
|
431
|
+
setupEventListener() {
|
|
432
|
+
this.eventListener = DeviceEventEmitter.addListener('zellosdk', event => {
|
|
433
|
+
const eventName = event.eventName;
|
|
434
|
+
switch (eventName) {
|
|
435
|
+
case 'onConnectFailed':
|
|
436
|
+
{
|
|
437
|
+
this.state = ZelloConnectionState.Disconnected;
|
|
438
|
+
const error = event.error?.toLowerCase() ?? ZelloConnectionError.Unknown;
|
|
439
|
+
this.emit(ZelloEvent.CONNECT_FAILED, this.state, error);
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case 'onConnectStarted':
|
|
443
|
+
{
|
|
444
|
+
this.state = ZelloConnectionState.Connecting;
|
|
445
|
+
this.emit(ZelloEvent.CONNECT_STARTED, this.state);
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
case 'onConnectSucceeded':
|
|
449
|
+
{
|
|
450
|
+
this.state = ZelloConnectionState.Connected;
|
|
451
|
+
this.emit(ZelloEvent.CONNECT_SUCCEEDED, this.state);
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
case 'onDisconnected':
|
|
455
|
+
{
|
|
456
|
+
this.state = ZelloConnectionState.Disconnected;
|
|
457
|
+
this.emit(ZelloEvent.DISCONNECTED, this.state);
|
|
458
|
+
break;
|
|
459
|
+
}
|
|
460
|
+
case 'onWillReconnect':
|
|
461
|
+
{
|
|
462
|
+
this.state = ZelloConnectionState.Reconnecting;
|
|
463
|
+
this.emit(ZelloEvent.RECONNECTING, this.state);
|
|
464
|
+
break;
|
|
465
|
+
}
|
|
466
|
+
case 'onContactListUpdated':
|
|
467
|
+
{
|
|
468
|
+
this.clearContactList();
|
|
469
|
+
this.users = event.users.map(user => bridgeContactToSdkContact(user));
|
|
470
|
+
this.users.sort(compareNameAscending);
|
|
471
|
+
this.channels = event.channels.map(channel => bridgeContactToSdkContact(channel));
|
|
472
|
+
this.channels.sort(compareNameAscending);
|
|
473
|
+
this.groupConversations = event.groupConversations.map(groupConversation => bridgeContactToSdkContact(groupConversation));
|
|
474
|
+
this.groupConversations.sort(compareNameAscending);
|
|
475
|
+
if (event.emergencyChannel) {
|
|
476
|
+
this.emergencyChannel = bridgeContactToSdkContact(event.emergencyChannel);
|
|
477
|
+
}
|
|
478
|
+
this.emit(ZelloEvent.CONTACT_LIST_UPDATED, this.users, this.channels, this.groupConversations);
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
481
|
+
case 'onSelectedContactChanged':
|
|
482
|
+
{
|
|
483
|
+
this.selectedContact = event.contact ? bridgeContactToSdkContact(event.contact) : undefined;
|
|
484
|
+
this.emit(ZelloEvent.SELECTED_CONTACT_CHANGED, this.selectedContact);
|
|
485
|
+
break;
|
|
486
|
+
}
|
|
487
|
+
case 'onAccountStatusChanged':
|
|
488
|
+
{
|
|
489
|
+
const statusValue = event.status?.toLowerCase();
|
|
490
|
+
if (!statusValue || Object.values(ZelloAccountStatus).includes(statusValue)) {
|
|
491
|
+
this.accountStatus = statusValue;
|
|
492
|
+
this.emit(ZelloEvent.ACCOUNT_STATUS_CHANGED, this.accountStatus);
|
|
628
493
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
case 'onIncomingVoiceMessageStarted':
|
|
497
|
+
{
|
|
498
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
499
|
+
if (!contact) {
|
|
633
500
|
break;
|
|
634
501
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
502
|
+
this.incomingVoiceMessage = new ZelloIncomingVoiceMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(event.timestamp, 10), event.isTranslation === true);
|
|
503
|
+
this.emit(ZelloEvent.INCOMING_VOICE_MESSAGE_STARTED, this.incomingVoiceMessage);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
case 'onIncomingVoiceMessageStopped':
|
|
507
|
+
{
|
|
508
|
+
this.incomingVoiceMessage = undefined;
|
|
509
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
510
|
+
if (!contact) {
|
|
639
511
|
break;
|
|
640
512
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
this.groupConversations = event.groupConversations.map(groupConversation => bridgeContactToSdkContact(groupConversation));
|
|
649
|
-
this.groupConversations.sort(compareNameAscending);
|
|
650
|
-
if (event.emergencyChannel) {
|
|
651
|
-
this.emergencyChannel = bridgeContactToSdkContact(event.emergencyChannel);
|
|
652
|
-
}
|
|
653
|
-
this.emit(ZelloEvent.CONTACT_LIST_UPDATED, this.users, this.channels, this.groupConversations);
|
|
513
|
+
this.emit(ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED, new ZelloIncomingVoiceMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(event.timestamp, 10), event.isTranslation === true));
|
|
514
|
+
break;
|
|
515
|
+
}
|
|
516
|
+
case 'onOutgoingVoiceMessageConnecting':
|
|
517
|
+
{
|
|
518
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
519
|
+
if (!contact) {
|
|
654
520
|
break;
|
|
655
521
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
522
|
+
this.outgoingVoiceMessage = new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), ZelloOutgoingVoiceMessageState.Connecting);
|
|
523
|
+
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING, this.outgoingVoiceMessage);
|
|
524
|
+
break;
|
|
525
|
+
}
|
|
526
|
+
case 'onOutgoingVoiceMessageStarted':
|
|
527
|
+
{
|
|
528
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
529
|
+
if (!contact) {
|
|
660
530
|
break;
|
|
661
531
|
}
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
532
|
+
this.outgoingVoiceMessage = new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), ZelloOutgoingVoiceMessageState.Sending);
|
|
533
|
+
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED, this.outgoingVoiceMessage);
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
case 'onOutgoingVoiceMessageStopped':
|
|
537
|
+
{
|
|
538
|
+
this.outgoingVoiceMessage = undefined;
|
|
539
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
540
|
+
if (!contact) {
|
|
669
541
|
break;
|
|
670
542
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
break;
|
|
676
|
-
}
|
|
677
|
-
this.incomingVoiceMessage = new ZelloIncomingVoiceMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(event.timestamp, 10));
|
|
678
|
-
this.emit(ZelloEvent.INCOMING_VOICE_MESSAGE_STARTED, this.incomingVoiceMessage);
|
|
679
|
-
break;
|
|
543
|
+
const isError = event.error != null; // This checks for both null and undefined
|
|
544
|
+
let error;
|
|
545
|
+
if (isError) {
|
|
546
|
+
error = event.error?.toLowerCase() ?? ZelloOutgoingVoiceMessageError.Unknown;
|
|
680
547
|
}
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
this.emit(ZelloEvent.INCOMING_VOICE_MESSAGE_STOPPED, new ZelloIncomingVoiceMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(event.timestamp, 10)));
|
|
548
|
+
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED, new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), isError ? ZelloOutgoingVoiceMessageState.Failed : ZelloOutgoingVoiceMessageState.Sent), error);
|
|
549
|
+
break;
|
|
550
|
+
}
|
|
551
|
+
case 'onIncomingImageMessage':
|
|
552
|
+
{
|
|
553
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
554
|
+
if (!contact) {
|
|
689
555
|
break;
|
|
690
556
|
}
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING, this.outgoingVoiceMessage);
|
|
557
|
+
this.emit(ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED, new ZelloImageMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.thumbnail, event.image));
|
|
558
|
+
break;
|
|
559
|
+
}
|
|
560
|
+
case 'onOutgoingImageMessageSent':
|
|
561
|
+
{
|
|
562
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
563
|
+
if (!contact) {
|
|
699
564
|
break;
|
|
700
565
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED, this.outgoingVoiceMessage);
|
|
566
|
+
this.emit(ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT, new ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
|
|
567
|
+
break;
|
|
568
|
+
}
|
|
569
|
+
case 'onOutgoingImageMessageSendFailed':
|
|
570
|
+
{
|
|
571
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
572
|
+
if (!contact) {
|
|
709
573
|
break;
|
|
710
574
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
const isError = event.error != null; // This checks for both null and undefined
|
|
719
|
-
let error;
|
|
720
|
-
if (isError) {
|
|
721
|
-
error = event.error?.toLowerCase() ?? ZelloOutgoingVoiceMessageError.Unknown;
|
|
722
|
-
}
|
|
723
|
-
this.emit(ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED, new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), isError ? ZelloOutgoingVoiceMessageState.Failed : ZelloOutgoingVoiceMessageState.Sent), error);
|
|
575
|
+
this.emit(ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED, new ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
578
|
+
case 'onIncomingAlertMessage':
|
|
579
|
+
{
|
|
580
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
581
|
+
if (!contact) {
|
|
724
582
|
break;
|
|
725
583
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
584
|
+
this.emit(ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED, new ZelloAlertMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
case 'onOutgoingAlertMessageSent':
|
|
588
|
+
{
|
|
589
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
590
|
+
if (!contact) {
|
|
733
591
|
break;
|
|
734
592
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
593
|
+
this.emit(ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT, new ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
case 'onOutgoingAlertMessageSendFailed':
|
|
597
|
+
{
|
|
598
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
599
|
+
if (!contact) {
|
|
742
600
|
break;
|
|
743
601
|
}
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
602
|
+
this.emit(ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED, new ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
|
|
603
|
+
break;
|
|
604
|
+
}
|
|
605
|
+
case 'onIncomingTextMessage':
|
|
606
|
+
{
|
|
607
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
608
|
+
if (!contact) {
|
|
751
609
|
break;
|
|
752
610
|
}
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
611
|
+
this.emit(ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED, new ZelloTextMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
case 'onOutgoingTextMessageSent':
|
|
615
|
+
{
|
|
616
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
617
|
+
if (!contact) {
|
|
760
618
|
break;
|
|
761
619
|
}
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
620
|
+
this.emit(ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT, new ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
case 'onOutgoingTextMessageSendFailed':
|
|
624
|
+
{
|
|
625
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
626
|
+
if (!contact) {
|
|
769
627
|
break;
|
|
770
628
|
}
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
629
|
+
this.emit(ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED, new ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
|
|
630
|
+
break;
|
|
631
|
+
}
|
|
632
|
+
case 'onIncomingLocationMessage':
|
|
633
|
+
{
|
|
634
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
635
|
+
if (!contact) {
|
|
778
636
|
break;
|
|
779
637
|
}
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
638
|
+
this.emit(ZelloEvent.INCOMING_LOCATION_MESSAGE_RECEIVED, new ZelloLocationMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
641
|
+
case 'onOutgoingLocationMessageSent':
|
|
642
|
+
{
|
|
643
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
644
|
+
if (!contact) {
|
|
787
645
|
break;
|
|
788
646
|
}
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
647
|
+
this.emit(ZelloEvent.OUTGOING_LOCATION_MESSAGE_SENT, new ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
|
|
648
|
+
break;
|
|
649
|
+
}
|
|
650
|
+
case 'onOutgoingLocationMessageSendFailed':
|
|
651
|
+
{
|
|
652
|
+
const contact = bridgeContactToSdkContact(event.contact);
|
|
653
|
+
if (!contact) {
|
|
796
654
|
break;
|
|
797
655
|
}
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
656
|
+
this.emit(ZelloEvent.OUTGOING_LOCATION_MESSAGE_SEND_FAILED, new ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
|
|
657
|
+
break;
|
|
658
|
+
}
|
|
659
|
+
case 'onIncomingEmergencyStarted':
|
|
660
|
+
{
|
|
661
|
+
this.incomingEmergencies = [];
|
|
662
|
+
event.emergencies.forEach(emergency => {
|
|
663
|
+
const incomingEmergency = bridgeIncomingEmergencyToSdkIncomingEmergency(emergency);
|
|
664
|
+
if (incomingEmergency) {
|
|
665
|
+
this.incomingEmergencies.push(incomingEmergency);
|
|
803
666
|
}
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
667
|
+
});
|
|
668
|
+
this.incomingEmergencies.sort((a, b) => a.startTimestamp - b.startTimestamp);
|
|
669
|
+
this.emit(ZelloEvent.INCOMING_EMERGENCY_STARTED, bridgeIncomingEmergencyToSdkIncomingEmergency(event.emergency), this.incomingEmergencies);
|
|
670
|
+
break;
|
|
671
|
+
}
|
|
672
|
+
case 'onIncomingEmergencyStopped':
|
|
673
|
+
{
|
|
674
|
+
this.incomingEmergencies = [];
|
|
675
|
+
event.emergencies.forEach(emergency => {
|
|
676
|
+
const incomingEmergency = bridgeIncomingEmergencyToSdkIncomingEmergency(emergency);
|
|
677
|
+
if (incomingEmergency) {
|
|
678
|
+
this.incomingEmergencies.push(incomingEmergency);
|
|
812
679
|
}
|
|
813
|
-
|
|
680
|
+
});
|
|
681
|
+
this.emit(ZelloEvent.INCOMING_EMERGENCY_STOPPED, bridgeIncomingEmergencyToSdkIncomingEmergency(event.emergency));
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
case 'onOutgoingEmergencyStarted':
|
|
685
|
+
{
|
|
686
|
+
const channel = bridgeContactToSdkContact(event.channel);
|
|
687
|
+
if (!channel) {
|
|
814
688
|
break;
|
|
815
689
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
690
|
+
this.outgoingEmergency = new ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), undefined);
|
|
691
|
+
this.emit(ZelloEvent.OUTGOING_EMERGENCY_STARTED, this.outgoingEmergency);
|
|
692
|
+
break;
|
|
693
|
+
}
|
|
694
|
+
case 'onOutgoingEmergencyStopped':
|
|
695
|
+
{
|
|
696
|
+
const channel = bridgeContactToSdkContact(event.channel);
|
|
697
|
+
if (!channel) {
|
|
823
698
|
break;
|
|
824
699
|
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
700
|
+
this.outgoingEmergency = undefined;
|
|
701
|
+
this.emit(ZelloEvent.OUTGOING_EMERGENCY_STOPPED, new ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), event.endTimestamp));
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
case 'onRecentsUpdated':
|
|
705
|
+
{
|
|
706
|
+
this.recents = event.recents.map(recent => {
|
|
707
|
+
const contact = bridgeContactToSdkContact(recent.contact);
|
|
828
708
|
if (!contact) {
|
|
829
|
-
|
|
830
|
-
}
|
|
831
|
-
this.emit(ZelloEvent.OUTGOING_LOCATION_MESSAGE_SEND_FAILED, new ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
|
|
832
|
-
break;
|
|
833
|
-
}
|
|
834
|
-
case 'onIncomingEmergencyStarted':
|
|
835
|
-
{
|
|
836
|
-
this.incomingEmergencies = [];
|
|
837
|
-
event.emergencies.forEach(emergency => {
|
|
838
|
-
const incomingEmergency = bridgeIncomingEmergencyToSdkIncomingEmergency(emergency);
|
|
839
|
-
if (incomingEmergency) {
|
|
840
|
-
this.incomingEmergencies.push(incomingEmergency);
|
|
841
|
-
}
|
|
842
|
-
});
|
|
843
|
-
this.incomingEmergencies.sort((a, b) => a.startTimestamp - b.startTimestamp);
|
|
844
|
-
this.emit(ZelloEvent.INCOMING_EMERGENCY_STARTED, bridgeIncomingEmergencyToSdkIncomingEmergency(event.emergency), this.incomingEmergencies);
|
|
845
|
-
break;
|
|
846
|
-
}
|
|
847
|
-
case 'onIncomingEmergencyStopped':
|
|
848
|
-
{
|
|
849
|
-
this.incomingEmergencies = [];
|
|
850
|
-
event.emergencies.forEach(emergency => {
|
|
851
|
-
const incomingEmergency = bridgeIncomingEmergencyToSdkIncomingEmergency(emergency);
|
|
852
|
-
if (incomingEmergency) {
|
|
853
|
-
this.incomingEmergencies.push(incomingEmergency);
|
|
854
|
-
}
|
|
855
|
-
});
|
|
856
|
-
this.emit(ZelloEvent.INCOMING_EMERGENCY_STOPPED, bridgeIncomingEmergencyToSdkIncomingEmergency(event.emergency));
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
case 'onOutgoingEmergencyStarted':
|
|
860
|
-
{
|
|
861
|
-
const channel = bridgeContactToSdkContact(event.channel);
|
|
862
|
-
if (!channel) {
|
|
863
|
-
break;
|
|
709
|
+
return undefined;
|
|
864
710
|
}
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
case 'onHistoryUpdated':
|
|
892
|
-
{
|
|
893
|
-
this.emit(ZelloEvent.HISTORY_UPDATED);
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
896
|
-
case 'onHistoryPlaybackStarted':
|
|
897
|
-
{
|
|
898
|
-
this.historyVoiceMessage = bridgeHistoryMessageToSdkHistoryMessage(event);
|
|
899
|
-
this.emit(ZelloEvent.HISTORY_PLAYBACK_STARTED, this.historyVoiceMessage);
|
|
900
|
-
break;
|
|
901
|
-
}
|
|
902
|
-
case 'onHistoryPlaybackStopped':
|
|
903
|
-
{
|
|
904
|
-
this.historyVoiceMessage = undefined;
|
|
905
|
-
this.emit(ZelloEvent.HISTORY_PLAYBACK_STOPPED, this.historyVoiceMessage);
|
|
711
|
+
return new ZelloRecentEntry(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(recent.timestamp, 10), recent.type.toLowerCase(), recent.incoming);
|
|
712
|
+
}).filter(recent => recent !== undefined);
|
|
713
|
+
this.emit(ZelloEvent.RECENTS_UPDATED, this.recents);
|
|
714
|
+
break;
|
|
715
|
+
}
|
|
716
|
+
case 'onHistoryUpdated':
|
|
717
|
+
{
|
|
718
|
+
this.emit(ZelloEvent.HISTORY_UPDATED);
|
|
719
|
+
break;
|
|
720
|
+
}
|
|
721
|
+
case 'onHistoryPlaybackStarted':
|
|
722
|
+
{
|
|
723
|
+
this.historyVoiceMessage = bridgeHistoryMessageToSdkHistoryMessage(event);
|
|
724
|
+
this.emit(ZelloEvent.HISTORY_PLAYBACK_STARTED, this.historyVoiceMessage);
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
case 'onHistoryPlaybackStopped':
|
|
728
|
+
{
|
|
729
|
+
this.historyVoiceMessage = undefined;
|
|
730
|
+
this.emit(ZelloEvent.HISTORY_PLAYBACK_STOPPED, this.historyVoiceMessage);
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
case 'onHistoryVoiceMessageTranscriptionAvailable':
|
|
734
|
+
{
|
|
735
|
+
const message = bridgeHistoryMessageToSdkHistoryMessage(event);
|
|
736
|
+
if (!(message instanceof ZelloHistoryVoiceMessage)) {
|
|
906
737
|
break;
|
|
907
738
|
}
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
739
|
+
this.emit(ZelloEvent.HISTORY_VOICE_MESSAGE_TRANSCRIPTION_AVAILABLE, message);
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
case 'onConsoleSettingsChanged':
|
|
743
|
+
{
|
|
744
|
+
this.consoleSettings = bridgeConsoleSettingsToSdkConsoleSettings(event);
|
|
745
|
+
this.emit(ZelloEvent.CONSOLE_SETTINGS_CHANGED, this.consoleSettings);
|
|
746
|
+
break;
|
|
747
|
+
}
|
|
748
|
+
case 'onDispatchCallTransferred':
|
|
749
|
+
case 'onDispatchCallEnded':
|
|
750
|
+
case 'onDispatchCallActive':
|
|
751
|
+
case 'onDispatchCallPending':
|
|
752
|
+
{
|
|
753
|
+
this.processDispatchCallEvent(event);
|
|
754
|
+
break;
|
|
755
|
+
}
|
|
756
|
+
case 'onGroupConversationLeft':
|
|
757
|
+
{
|
|
758
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
759
|
+
if (!groupConversation) {
|
|
912
760
|
break;
|
|
913
761
|
}
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
762
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
|
|
763
|
+
break;
|
|
764
|
+
}
|
|
765
|
+
case 'onGroupConversationInvite':
|
|
766
|
+
{
|
|
767
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
768
|
+
if (!groupConversation) {
|
|
920
769
|
break;
|
|
921
770
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
771
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
case 'onGroupConversationCreated':
|
|
775
|
+
{
|
|
776
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
777
|
+
if (!groupConversation) {
|
|
929
778
|
break;
|
|
930
779
|
}
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
780
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
case 'onGroupConversationRenamed':
|
|
784
|
+
{
|
|
785
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
786
|
+
if (!groupConversation) {
|
|
938
787
|
break;
|
|
939
788
|
}
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
789
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
case 'onGroupConversationUsersAdded':
|
|
793
|
+
{
|
|
794
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
795
|
+
if (!groupConversation) {
|
|
947
796
|
break;
|
|
948
797
|
}
|
|
949
|
-
|
|
950
|
-
{
|
|
951
|
-
|
|
952
|
-
if (!groupConversation) {
|
|
953
|
-
break;
|
|
954
|
-
}
|
|
955
|
-
this.emit(ZelloEvent.GROUP_CONVERSATION_RENAMED, groupConversation);
|
|
956
|
-
break;
|
|
798
|
+
const users = event.users.map(user => bridgeChannelUserToSdkChannelUser(user));
|
|
799
|
+
if (!users || users.length === 0) {
|
|
800
|
+
return;
|
|
957
801
|
}
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
if (!users || users.length === 0) {
|
|
966
|
-
return;
|
|
967
|
-
}
|
|
968
|
-
this.emit(ZelloEvent.GROUP_CONVERSATION_USERS_ADDED, groupConversation, users);
|
|
802
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_USERS_ADDED, groupConversation, users);
|
|
803
|
+
break;
|
|
804
|
+
}
|
|
805
|
+
case 'onGroupConversationUsersLeft':
|
|
806
|
+
{
|
|
807
|
+
const groupConversation = bridgeContactToSdkContact(event.conversation);
|
|
808
|
+
if (!groupConversation) {
|
|
969
809
|
break;
|
|
970
810
|
}
|
|
971
|
-
|
|
972
|
-
{
|
|
973
|
-
|
|
974
|
-
if (!groupConversation) {
|
|
975
|
-
break;
|
|
976
|
-
}
|
|
977
|
-
const users = event.users.map(user => bridgeChannelUserToSdkChannelUser(user));
|
|
978
|
-
if (!users || users.length === 0) {
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
|
-
this.emit(ZelloEvent.GROUP_CONVERSATION_USERS_LEFT, groupConversation, users);
|
|
982
|
-
break;
|
|
811
|
+
const users = event.users.map(user => bridgeChannelUserToSdkChannelUser(user));
|
|
812
|
+
if (!users || users.length === 0) {
|
|
813
|
+
return;
|
|
983
814
|
}
|
|
984
|
-
|
|
815
|
+
this.emit(ZelloEvent.GROUP_CONVERSATION_USERS_LEFT, groupConversation, users);
|
|
985
816
|
break;
|
|
986
|
-
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
}, {
|
|
990
|
-
key: "processDispatchCallEvent",
|
|
991
|
-
value: function processDispatchCallEvent(event) {
|
|
992
|
-
const channel = bridgeContactToSdkContact(event.channel);
|
|
993
|
-
const call = bridgeCallToSdkCall(event.call);
|
|
994
|
-
if (!channel || !call) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
switch (event.name) {
|
|
998
|
-
case 'onDispatchCallTransferred':
|
|
999
|
-
this.emit(ZelloEvent.DISPATCH_CALL_TRANSFERRED, channel, call);
|
|
1000
|
-
break;
|
|
1001
|
-
case 'onDispatchCallEnded':
|
|
1002
|
-
this.emit(ZelloEvent.DISPATCH_CALL_ENDED, channel, call);
|
|
1003
|
-
break;
|
|
1004
|
-
case 'onDispatchCallActive':
|
|
1005
|
-
this.emit(ZelloEvent.DISPATCH_CALL_ACTIVE, channel, call);
|
|
1006
|
-
break;
|
|
1007
|
-
case 'onDispatchCallPending':
|
|
1008
|
-
this.emit(ZelloEvent.DISPATCH_CALL_PENDING, channel, call);
|
|
1009
|
-
break;
|
|
817
|
+
}
|
|
1010
818
|
default:
|
|
1011
819
|
break;
|
|
1012
820
|
}
|
|
821
|
+
});
|
|
822
|
+
}
|
|
823
|
+
processDispatchCallEvent(event) {
|
|
824
|
+
const channel = bridgeContactToSdkContact(event.channel);
|
|
825
|
+
const call = bridgeCallToSdkCall(event.call);
|
|
826
|
+
if (!channel || !call) {
|
|
827
|
+
return;
|
|
828
|
+
}
|
|
829
|
+
switch (event.name) {
|
|
830
|
+
case 'onDispatchCallTransferred':
|
|
831
|
+
this.emit(ZelloEvent.DISPATCH_CALL_TRANSFERRED, channel, call);
|
|
832
|
+
break;
|
|
833
|
+
case 'onDispatchCallEnded':
|
|
834
|
+
this.emit(ZelloEvent.DISPATCH_CALL_ENDED, channel, call);
|
|
835
|
+
break;
|
|
836
|
+
case 'onDispatchCallActive':
|
|
837
|
+
this.emit(ZelloEvent.DISPATCH_CALL_ACTIVE, channel, call);
|
|
838
|
+
break;
|
|
839
|
+
case 'onDispatchCallPending':
|
|
840
|
+
this.emit(ZelloEvent.DISPATCH_CALL_PENDING, channel, call);
|
|
841
|
+
break;
|
|
842
|
+
default:
|
|
843
|
+
break;
|
|
1013
844
|
}
|
|
1014
|
-
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
}
|
|
1029
|
-
}, {
|
|
1030
|
-
key: "getSdk",
|
|
1031
|
-
value: function getSdk() {
|
|
1032
|
-
if (isAndroid) {
|
|
1033
|
-
return ZelloAndroidSdkModule;
|
|
1034
|
-
}
|
|
1035
|
-
return ZelloIOSSdkModule;
|
|
1036
|
-
}
|
|
1037
|
-
}]);
|
|
1038
|
-
}(EventEmitter);
|
|
1039
|
-
_Zello = Zello;
|
|
1040
|
-
_defineProperty(Zello, "instance", void 0);
|
|
845
|
+
}
|
|
846
|
+
clearContactList() {
|
|
847
|
+
this.users = [];
|
|
848
|
+
this.channels = [];
|
|
849
|
+
this.groupConversations = [];
|
|
850
|
+
}
|
|
851
|
+
static getSdk() {
|
|
852
|
+
// On Android the TurboModule owns the Zello delegate and is already created
|
|
853
|
+
// by importing the spec; on iOS the ZelloIOSSdkModule RCTEventEmitter owns
|
|
854
|
+
// it and is instantiated on access. Either way this only needs to be truthy
|
|
855
|
+
// so the DeviceEventEmitter listener gets registered.
|
|
856
|
+
return isAndroid ? NativeZelloSdk : ZelloIOSSdkModule;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
1041
859
|
//# sourceMappingURL=index.js.map
|