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