@zelloptt/react-native-zello-sdk 2.0.1 → 4.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.
Files changed (201) hide show
  1. package/README.md +100 -15
  2. package/android/build.gradle +29 -10
  3. package/android/gradle.properties +4 -4
  4. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +93 -68
  5. package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +25 -0
  6. package/app.plugin.js +97 -0
  7. package/ios/Extensions/ZelloContact+Extension.swift +26 -3
  8. package/ios/Extensions/ZelloHistoryVoiceMessage+Extension.swift +3 -0
  9. package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +8 -2
  10. package/ios/Extensions/ZelloIncomingEmergency+Extension.swift +1 -0
  11. package/ios/Extensions/ZelloTranscription+Extension.swift +18 -0
  12. package/ios/ZelloIOSSdkModule.swift +24 -7
  13. package/ios/ZelloIOSSdkModuleBridge.m +1 -0
  14. package/ios/ZelloSdkModule.h +8 -0
  15. package/ios/ZelloSdkModule.mm +189 -0
  16. package/ios/ZelloSdkModuleImpl.swift +280 -0
  17. package/lib/commonjs/docs/assets/highlight.css +17 -10
  18. package/lib/commonjs/docs/assets/icons.js +1 -1
  19. package/lib/commonjs/docs/assets/icons.js.map +1 -1
  20. package/lib/commonjs/docs/assets/icons.svg +1 -1
  21. package/lib/commonjs/docs/assets/main.js +220 -288
  22. package/lib/commonjs/docs/assets/main.js.map +1 -1
  23. package/lib/commonjs/docs/assets/navigation.js +1 -1
  24. package/lib/commonjs/docs/assets/navigation.js.map +1 -1
  25. package/lib/commonjs/docs/assets/search.js +1 -1
  26. package/lib/commonjs/docs/assets/search.js.map +1 -1
  27. package/lib/commonjs/docs/assets/style.css +21 -6
  28. package/lib/commonjs/docs/classes/sdk.Zello.html +793 -97
  29. package/lib/commonjs/docs/classes/types.ZelloAlertMessage.html +122 -9
  30. package/lib/commonjs/docs/classes/types.ZelloChannel.html +155 -10
  31. package/lib/commonjs/docs/classes/types.ZelloChannelUser.html +86 -4
  32. package/lib/commonjs/docs/classes/types.ZelloDispatchCall.html +90 -6
  33. package/lib/commonjs/docs/classes/types.ZelloDispatchChannel.html +163 -11
  34. package/lib/commonjs/docs/classes/types.ZelloGroupConversation.html +178 -13
  35. package/lib/commonjs/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
  36. package/lib/commonjs/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
  37. package/lib/commonjs/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
  38. package/lib/commonjs/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
  39. package/lib/commonjs/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
  40. package/lib/commonjs/docs/classes/types.ZelloImageMessage.html +130 -10
  41. package/lib/commonjs/docs/classes/types.ZelloIncomingEmergency.html +114 -9
  42. package/lib/commonjs/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
  43. package/lib/commonjs/docs/classes/types.ZelloLocationMessage.html +146 -12
  44. package/lib/commonjs/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
  45. package/lib/commonjs/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
  46. package/lib/commonjs/docs/classes/types.ZelloRecentEntry.html +114 -9
  47. package/lib/commonjs/docs/classes/types.ZelloTextMessage.html +122 -9
  48. package/lib/commonjs/docs/classes/types.ZelloTranscription.html +122 -0
  49. package/lib/commonjs/docs/classes/types.ZelloTranslation.html +91 -0
  50. package/lib/commonjs/docs/classes/types.ZelloUser.html +142 -11
  51. package/lib/commonjs/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
  52. package/lib/commonjs/docs/enums/events.ZelloEvent.html +563 -95
  53. package/lib/commonjs/docs/enums/types.ZelloAccountStatus.html +67 -5
  54. package/lib/commonjs/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
  55. package/lib/commonjs/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
  56. package/lib/commonjs/docs/enums/types.ZelloChannelType.html +84 -0
  57. package/lib/commonjs/docs/enums/types.ZelloConnectionError.html +68 -3
  58. package/lib/commonjs/docs/enums/types.ZelloConnectionState.html +73 -3
  59. package/lib/commonjs/docs/enums/types.ZelloContactType.html +73 -3
  60. package/lib/commonjs/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
  61. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
  62. package/lib/commonjs/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
  63. package/lib/commonjs/docs/enums/types.ZelloRecentEntryType.html +78 -3
  64. package/lib/commonjs/docs/enums/types.ZelloUserStatus.html +81 -7
  65. package/lib/commonjs/docs/hierarchy.html +29 -1
  66. package/lib/commonjs/docs/index.html +155 -26
  67. package/lib/commonjs/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
  68. package/lib/commonjs/docs/modules/events.html +37 -1
  69. package/lib/commonjs/docs/modules/index.html +37 -1
  70. package/lib/commonjs/docs/modules/sdk.html +37 -1
  71. package/lib/commonjs/docs/modules/specs_NativeZelloSdk.html +41 -0
  72. package/lib/commonjs/docs/modules/types.html +45 -1
  73. package/lib/commonjs/docs/modules.html +36 -1
  74. package/lib/commonjs/docs/types/types.ZelloChannelOptions.html +114 -9
  75. package/lib/commonjs/docs/types/types.ZelloConfig.html +86 -7
  76. package/lib/commonjs/docs/types/types.ZelloConsoleSettings.html +96 -9
  77. package/lib/commonjs/docs/types/types.ZelloContact.html +80 -6
  78. package/lib/commonjs/docs/types/types.ZelloCredentials.html +75 -6
  79. package/lib/commonjs/docs/types/types.ZelloHistoryMessage.html +97 -8
  80. package/lib/commonjs/docs/types/types.ZelloMessage.html +91 -7
  81. package/lib/commonjs/docs/variables/specs_NativeZelloSdk.default.html +34 -0
  82. package/lib/commonjs/events/index.js +217 -0
  83. package/lib/commonjs/events/index.js.map +1 -1
  84. package/lib/commonjs/sdk/index.js +731 -911
  85. package/lib/commonjs/sdk/index.js.map +1 -1
  86. package/lib/commonjs/specs/NativeZelloSdk.js +27 -0
  87. package/lib/commonjs/specs/NativeZelloSdk.js.map +1 -0
  88. package/lib/commonjs/types/index.js +423 -302
  89. package/lib/commonjs/types/index.js.map +1 -1
  90. package/lib/commonjs/utils/index.js +27 -4
  91. package/lib/commonjs/utils/index.js.map +1 -1
  92. package/lib/module/docs/assets/highlight.css +17 -10
  93. package/lib/module/docs/assets/icons.js +1 -1
  94. package/lib/module/docs/assets/icons.js.map +1 -1
  95. package/lib/module/docs/assets/icons.svg +1 -1
  96. package/lib/module/docs/assets/main.js +220 -288
  97. package/lib/module/docs/assets/main.js.map +1 -1
  98. package/lib/module/docs/assets/navigation.js +1 -1
  99. package/lib/module/docs/assets/navigation.js.map +1 -1
  100. package/lib/module/docs/assets/search.js +1 -1
  101. package/lib/module/docs/assets/search.js.map +1 -1
  102. package/lib/module/docs/assets/style.css +21 -6
  103. package/lib/module/docs/classes/sdk.Zello.html +793 -97
  104. package/lib/module/docs/classes/types.ZelloAlertMessage.html +122 -9
  105. package/lib/module/docs/classes/types.ZelloChannel.html +155 -10
  106. package/lib/module/docs/classes/types.ZelloChannelUser.html +86 -4
  107. package/lib/module/docs/classes/types.ZelloDispatchCall.html +90 -6
  108. package/lib/module/docs/classes/types.ZelloDispatchChannel.html +163 -11
  109. package/lib/module/docs/classes/types.ZelloGroupConversation.html +178 -13
  110. package/lib/module/docs/classes/types.ZelloHistoryAlertMessage.html +131 -10
  111. package/lib/module/docs/classes/types.ZelloHistoryImageMessage.html +123 -9
  112. package/lib/module/docs/classes/types.ZelloHistoryLocationMessage.html +155 -13
  113. package/lib/module/docs/classes/types.ZelloHistoryTextMessage.html +131 -10
  114. package/lib/module/docs/classes/types.ZelloHistoryVoiceMessage.html +145 -10
  115. package/lib/module/docs/classes/types.ZelloImageMessage.html +130 -10
  116. package/lib/module/docs/classes/types.ZelloIncomingEmergency.html +114 -9
  117. package/lib/module/docs/classes/types.ZelloIncomingVoiceMessage.html +124 -8
  118. package/lib/module/docs/classes/types.ZelloLocationMessage.html +146 -12
  119. package/lib/module/docs/classes/types.ZelloOutgoingEmergency.html +98 -7
  120. package/lib/module/docs/classes/types.ZelloOutgoingVoiceMessage.html +120 -9
  121. package/lib/module/docs/classes/types.ZelloRecentEntry.html +114 -9
  122. package/lib/module/docs/classes/types.ZelloTextMessage.html +122 -9
  123. package/lib/module/docs/classes/types.ZelloTranscription.html +122 -0
  124. package/lib/module/docs/classes/types.ZelloTranslation.html +91 -0
  125. package/lib/module/docs/classes/types.ZelloUser.html +142 -11
  126. package/lib/module/docs/classes/types.ZelloUserSupportedFeatures.html +82 -5
  127. package/lib/module/docs/enums/events.ZelloEvent.html +563 -95
  128. package/lib/module/docs/enums/types.ZelloAccountStatus.html +67 -5
  129. package/lib/module/docs/enums/types.ZelloChannelAlertLevel.html +67 -5
  130. package/lib/module/docs/enums/types.ZelloChannelConnectionStatus.html +68 -3
  131. package/lib/module/docs/enums/types.ZelloChannelType.html +84 -0
  132. package/lib/module/docs/enums/types.ZelloConnectionError.html +68 -3
  133. package/lib/module/docs/enums/types.ZelloConnectionState.html +73 -3
  134. package/lib/module/docs/enums/types.ZelloContactType.html +73 -3
  135. package/lib/module/docs/enums/types.ZelloDispatchCallStatus.html +73 -3
  136. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageError.html +63 -3
  137. package/lib/module/docs/enums/types.ZelloOutgoingVoiceMessageState.html +78 -3
  138. package/lib/module/docs/enums/types.ZelloRecentEntryType.html +78 -3
  139. package/lib/module/docs/enums/types.ZelloUserStatus.html +81 -7
  140. package/lib/module/docs/hierarchy.html +29 -1
  141. package/lib/module/docs/index.html +155 -26
  142. package/lib/module/docs/interfaces/specs_NativeZelloSdk.Spec.html +504 -0
  143. package/lib/module/docs/modules/events.html +37 -1
  144. package/lib/module/docs/modules/index.html +37 -1
  145. package/lib/module/docs/modules/sdk.html +37 -1
  146. package/lib/module/docs/modules/specs_NativeZelloSdk.html +41 -0
  147. package/lib/module/docs/modules/types.html +45 -1
  148. package/lib/module/docs/modules.html +36 -1
  149. package/lib/module/docs/types/types.ZelloChannelOptions.html +114 -9
  150. package/lib/module/docs/types/types.ZelloConfig.html +86 -7
  151. package/lib/module/docs/types/types.ZelloConsoleSettings.html +96 -9
  152. package/lib/module/docs/types/types.ZelloContact.html +80 -6
  153. package/lib/module/docs/types/types.ZelloCredentials.html +75 -6
  154. package/lib/module/docs/types/types.ZelloHistoryMessage.html +97 -8
  155. package/lib/module/docs/types/types.ZelloMessage.html +91 -7
  156. package/lib/module/docs/variables/specs_NativeZelloSdk.default.html +34 -0
  157. package/lib/module/events/index.js +217 -0
  158. package/lib/module/events/index.js.map +1 -1
  159. package/lib/module/sdk/index.js +730 -912
  160. package/lib/module/sdk/index.js.map +1 -1
  161. package/lib/module/specs/NativeZelloSdk.js +25 -0
  162. package/lib/module/specs/NativeZelloSdk.js.map +1 -0
  163. package/lib/module/types/index.js +378 -301
  164. package/lib/module/types/index.js.map +1 -1
  165. package/lib/module/utils/index.js +27 -5
  166. package/lib/module/utils/index.js.map +1 -1
  167. package/lib/typescript/commonjs/src/events/index.d.ts +9 -0
  168. package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/src/sdk/index.d.ts +10 -0
  170. package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -1
  171. package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts +55 -0
  172. package/lib/typescript/commonjs/src/specs/NativeZelloSdk.d.ts.map +1 -0
  173. package/lib/typescript/commonjs/src/types/index.d.ts +106 -4
  174. package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/src/utils/index.d.ts +2 -1
  176. package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -1
  177. package/lib/typescript/module/src/events/index.d.ts +9 -0
  178. package/lib/typescript/module/src/events/index.d.ts.map +1 -1
  179. package/lib/typescript/module/src/index.d.ts +4 -4
  180. package/lib/typescript/module/src/index.d.ts.map +1 -1
  181. package/lib/typescript/module/src/sdk/index.d.ts +11 -1
  182. package/lib/typescript/module/src/sdk/index.d.ts.map +1 -1
  183. package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts +55 -0
  184. package/lib/typescript/module/src/specs/NativeZelloSdk.d.ts.map +1 -0
  185. package/lib/typescript/module/src/types/index.d.ts +106 -4
  186. package/lib/typescript/module/src/types/index.d.ts.map +1 -1
  187. package/lib/typescript/module/src/utils/algorithms/index.d.ts +1 -1
  188. package/lib/typescript/module/src/utils/algorithms/index.d.ts.map +1 -1
  189. package/lib/typescript/module/src/utils/index.d.ts +2 -1
  190. package/lib/typescript/module/src/utils/index.d.ts.map +1 -1
  191. package/package.json +53 -16
  192. package/react-native-zello-sdk.podspec +23 -24
  193. package/scripts/podfile-transform.js +416 -0
  194. package/scripts/setup-ios.js +248 -0
  195. package/scripts/zello_pods.rb +128 -0
  196. package/scripts/zello_sdk_requirement.rb +12 -0
  197. package/src/events/index.ts +9 -0
  198. package/src/sdk/index.ts +105 -225
  199. package/src/specs/NativeZelloSdk.ts +89 -0
  200. package/src/types/index.ts +153 -6
  201. package/src/utils/index.ts +50 -3
@@ -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 { NativeEventEmitter, NativeModules } from 'react-native';
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 let Zello = /*#__PURE__*/function (_EventEmitter) {
36
- function Zello() {
37
- var _this;
38
- _classCallCheck(this, Zello);
39
- _this = _callSuper(this, Zello);
40
- /**
41
- * The current connection state of the SDK.
42
- */
43
- _defineProperty(_this, "state", ZelloConnectionState.Disconnected);
44
- /**
45
- * The currently selected contact.
46
- */
47
- _defineProperty(_this, "selectedContact", void 0);
48
- /**
49
- * The list of {@link ZelloUser} in the contact list. Sorted by name, ascending.
50
- */
51
- _defineProperty(_this, "users", []);
52
- /**
53
- * The list of {@link ZelloChannel} in the contact list. Sorted by name, ascending.
54
- */
55
- _defineProperty(_this, "channels", []);
56
- /**
57
- * The list of {@link ZelloGroupConversation} in the contact list. Sorted by name, ascending.
58
- */
59
- _defineProperty(_this, "groupConversations", []);
60
- /**
61
- * The current account status. undefined when {@link state} is not {@link ZelloConnectionState.Connected}.
62
- */
63
- _defineProperty(_this, "accountStatus", void 0);
64
- /**
65
- * The current incoming voice message.
66
- */
67
- _defineProperty(_this, "incomingVoiceMessage", void 0);
68
- /**
69
- * The current outgoing voice message.
70
- */
71
- _defineProperty(_this, "outgoingVoiceMessage", void 0);
72
- /**
73
- * The configured emergency channel.
74
- */
75
- _defineProperty(_this, "emergencyChannel", void 0);
76
- /**
77
- * The list of incoming emergencies. There can be multiple emergencies on the emergency channel at once.
78
- * Sorted by start timestamp, ascending.
79
- */
80
- _defineProperty(_this, "incomingEmergencies", []);
81
- /**
82
- * The current outgoing emergency.
83
- */
84
- _defineProperty(_this, "outgoingEmergency", void 0);
85
- /**
86
- * The list of recent entries. Sorted by timestamp, descending.
87
- */
88
- _defineProperty(_this, "recents", []);
89
- /**
90
- * The currently playing history voice message.
91
- */
92
- _defineProperty(_this, "historyVoiceMessage", void 0);
93
- /**
94
- * The console settings for the network.
95
- * This is only expected to be valid when {@link state} is {@link ZelloConnectionState.Connected}.
96
- */
97
- _defineProperty(_this, "consoleSettings", void 0);
98
- _defineProperty(_this, "eventListener", void 0);
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
- let eventEmitter;
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
- _inherits(Zello, _EventEmitter);
117
- return _createClass(Zello, [{
118
- key: "configure",
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
- * Destroys the SDK instance and cleans up resources.
129
- * Call this when you are done using the SDK instance for good (application quit).
130
- */
131
- }, {
132
- key: "destroy",
133
- value: function destroy() {
134
- this.removeAllListeners();
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
- * Signs into to the Zello Work network using the provided credentials.
140
- * This will typically trigger the {@link ZelloEvent.CONNECT_STARTED} event, followed by either {@link ZelloEvent.CONNECT_SUCCEEDED} or {@link ZelloEvent.CONNECT_FAILED}.
141
- * However, if the state is incorrect, {@link ZelloEvent.CONNECT_FAILED} will be triggered immediately.
142
- * @param credentials The credentials to use for signing in.
143
- */
144
- }, {
145
- key: "connect",
146
- value: function connect(credentials) {
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
- * Signs out of the Zello Work network.
156
- * This will trigger the {@link ZelloEvent.DISCONNECTED} event.
157
- */
158
- }, {
159
- key: "disconnect",
160
- value: function disconnect() {
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
- * Returns the user with the given name. Case-insensitive.
170
- * @param name The name of the user to search for.
171
- * @return The user with the given name, or null if no user with that name exists.
172
- */
173
- }, {
174
- key: "getUser",
175
- value: function getUser(name) {
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
- * Returns the channel with the given name. Case-insensitive.
181
- * @param name The name of the channel to search for.
182
- * @return The channel with the given name, or null if no channel with that name exists.
183
- */
184
- }, {
185
- key: "getChannel",
186
- value: function getChannel(name) {
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
- * Returns the group conversation with the given name. Case-insensitive.
192
- * @param name The name of the group conversation to search for.
193
- * @return The group conversation with the given name, or null if no group conversation with that name exists.
194
- */
195
- }, {
196
- key: "getGroupConversation",
197
- value: function getGroupConversation(name) {
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
- * Sets the selected contact.
203
- * While optional, this is typically used for tracking the contact that the user is currently interacting with.
204
- * This will trigger the {@link ZelloEvent.SELECTED_CONTACT_CHANGED} event.
205
- * @param contact The contact to set as selected.
206
- */
207
- }, {
208
- key: "setSelectedContact",
209
- value: function setSelectedContact(contact) {
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
- * Sets the user's online account status.
219
- * This will trigger the {@link ZelloEvent.ACCOUNT_STATUS_CHANGED} event.
220
- * @param status The account status to set.
221
- */
222
- }, {
223
- key: "setAccountStatus",
224
- value: function setAccountStatus(status) {
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
- * Connects to the given channel.
234
- * Once connected, the user will be able to send and receive messages from the channel.
235
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
236
- * @param channel The channel to connect to.
237
- */
238
- }, {
239
- key: "connectChannel",
240
- value: function connectChannel(channel) {
241
- if (isAndroid) {
242
- ZelloAndroidSdkModule.connectChannel(channel.name);
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
- * Disconnects from the given channel.
254
- * Once disconnected, the user will no longer be able to send or receive messages from the channel.
255
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
256
- * @param channel The channel to disconnect from.
257
- */
258
- }, {
259
- key: "disconnectChannel",
260
- value: function disconnectChannel(channel) {
261
- if (isAndroid) {
262
- ZelloAndroidSdkModule.disconnectChannel(channel.name);
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
- * Starts a voice message with the given contact.
274
- * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_CONNECTING} event, followed by the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STARTED} event.
275
- * If there is an error, the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event will be triggered.
276
- * @param contact The contact to start the voice message with.
277
- */
278
- }, {
279
- key: "startVoiceMessage",
280
- value: function startVoiceMessage(contact) {
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
- * Stops the current outgoing voice message.
290
- * This will trigger the {@link ZelloEvent.OUTGOING_VOICE_MESSAGE_STOPPED} event.
291
- */
292
- }, {
293
- key: "stopVoiceMessage",
294
- value: function stopVoiceMessage() {
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
- * Sends the image message data to the given contact.
304
- * This will trigger the {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED} event.
305
- * @param contact The contact to send the image to.
306
- * @param data The image data to send.
307
- */
308
- }, {
309
- key: "sendImage",
310
- value: function sendImage(contact, data) {
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
- * Sends the alert message to the given contact.
320
- * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
321
- * @param contact The contact to send the alert to.
322
- */
323
- }, {
324
- key: "sendLocation",
325
- value: function sendLocation(contact) {
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
- * Sends the text message to the given contact.
335
- * This will trigger the {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED} event.
336
- * @param contact The contact to send the text to.
337
- * @param text The text to send.
338
- */
339
- }, {
340
- key: "sendText",
341
- value: function sendText(contact, text) {
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
- * Sends the alert message to the given contact.
351
- * This will trigger the {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT} or {@link ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED} event.
352
- * @param contact The contact to send the alert to.
353
- * @param text The text to send.
354
- * @param level Optional; The alert level to send. Only applicable for channels.
355
- */
356
- }, {
357
- key: "sendAlert",
358
- value: function sendAlert(contact, text, level) {
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
- * Submits a problem report to Zello.
368
- * Additionally, please contact us to provide more information on what happened.
369
- */
370
- }, {
371
- key: "submitProblemReport",
372
- value: function submitProblemReport() {
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
- * Mutes the given contact. When muted, incoming messages from this contact will not play live, but will still appear in the history.
382
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
383
- * @param contact The contact to mute.
384
- */
385
- }, {
386
- key: "muteContact",
387
- value: function muteContact(contact) {
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
- * Unmutes a previously muted contact. When unmuted, incoming messages from this contact will play live.
397
- * This will trigger the {@link ZelloEvent.CONTACT_LIST_UPDATED} event.
398
- * @param contact The contact to unmute.
399
- */
400
- }, {
401
- key: "unmuteContact",
402
- value: function unmuteContact(contact) {
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
- * Starts an outgoing emergency to the emergency channel.
412
- * 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.
413
- * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STARTED} event.
414
- */
415
- }, {
416
- key: "startEmergency",
417
- value: function startEmergency() {
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
- * Stops the outgoing emergency.
427
- * This will trigger the {@link ZelloEvent.OUTGOING_EMERGENCY_STOPPED} event.
428
- */
429
- }, {
430
- key: "stopEmergency",
431
- value: function stopEmergency() {
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
- * Returns the history messages for the given contact.
441
- * @param contact The contact to get the history for.
442
- * @param size Optional; The number of history items to retrieve. Defaults to 50.
443
- * @return The history items for the given contact.
444
- */
445
- }, {
446
- key: "getHistory",
447
- value: function getHistory(contact, size) {
448
- const defaultHistorySize = 50;
449
- return new Promise(resolve => {
450
- const callback = history => {
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
- * Plays the given history message.
468
- * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STARTED} event.
469
- * @param message The history message to play.
470
- */
471
- }, {
472
- key: "playHistoryMessage",
473
- value: function playHistoryMessage(message) {
474
- if (isAndroid) {
475
- ZelloAndroidSdkModule.playHistoryMessage(message.historyId, message.contact.name, message.contact.type);
476
- } else {
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
- * Stops the current history message playback.
483
- * This will trigger the {@link ZelloEvent.HISTORY_PLAYBACK_STOPPED} event.
484
- */
485
- }, {
486
- key: "stopHistoryMessagePlayback",
487
- value: function stopHistoryMessagePlayback() {
488
- if (isAndroid) {
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
- * Returns the image data for the given history image message.
497
- * @param message The history image message to get the image data for.
498
- * @return The image data for the given history image message.
499
- */
500
- }, {
501
- key: "getImageDataForHistoryImageMessage",
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
- * Ends the dispatch call for the given dispatch channel.
514
- * This will trigger the {@link ZelloEvent.DISPATCH_CALL_ENDED} event.
515
- *
516
- * If {@link consoleSettings | ZelloConsoleSettings.allowNonDispatchersToEndCalls} is false, this method will do nothing.
517
- *
518
- * @param channel The dispatch channel to end the call for.
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
- * Creates a new group conversation with the given users.
532
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_CREATED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
533
- * @param users The users to create the group conversation with.
534
- * @param displayName Optional; The display name of the group conversation. The conversation can be renamed later by using {@link renameGroupConversation}.
535
- */
536
- }, {
537
- key: "createGroupConversation",
538
- value: function createGroupConversation(users, displayName) {
539
- if (!this.consoleSettings?.allowGroupConversations) {
540
- return;
541
- }
542
- if (isAndroid) {
543
- ZelloAndroidSdkModule.createGroupConversation(users.map(user => user.name), displayName);
544
- } else {
545
- ZelloIOSSdkModule.createGroupConversation(users.map(user => user.name), displayName);
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
- * Adds users to the given group conversation.
551
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_USERS_ADDED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
552
- * @param groupConversation The group conversation to add users to.
553
- * @param users The users to add to the group conversation.
554
- */
555
- }, {
556
- key: "addUsersToGroupConversation",
557
- value: function addUsersToGroupConversation(groupConversation, users) {
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
- * Removes the user from the group conversation.
570
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_LEFT} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
571
- * @param groupConversation The group conversation to leave.
572
- */
573
- }, {
574
- key: "leaveGroupConversation",
575
- value: function leaveGroupConversation(groupConversation) {
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
- * Renames the group conversation.
588
- * This will trigger the {@link ZelloEvent.GROUP_CONVERSATION_RENAMED} and {@link ZelloEvent.CONTACT_LIST_UPDATED} events.
589
- * @param groupConversation The group conversation to rename.
590
- * @param name The new name for the group conversation.
591
- */
592
- }, {
593
- key: "renameGroupConversation",
594
- value: function renameGroupConversation(groupConversation, name) {
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
- key: "setupEventListener",
606
- value: function setupEventListener(eventEmitter) {
607
- this.eventListener = eventEmitter.addListener('zellosdk', event => {
608
- const eventName = event.eventName;
609
- switch (eventName) {
610
- case 'onConnectFailed':
611
- {
612
- this.state = ZelloConnectionState.Disconnected;
613
- const error = event.error?.toLowerCase() ?? ZelloConnectionError.Unknown;
614
- this.emit(ZelloEvent.CONNECT_FAILED, this.state, error);
615
- break;
616
- }
617
- case 'onConnectStarted':
618
- {
619
- this.state = ZelloConnectionState.Connecting;
620
- this.emit(ZelloEvent.CONNECT_STARTED, this.state);
621
- break;
622
- }
623
- case 'onConnectSucceeded':
624
- {
625
- this.state = ZelloConnectionState.Connected;
626
- this.emit(ZelloEvent.CONNECT_SUCCEEDED, this.state);
627
- break;
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
- case 'onDisconnected':
630
- {
631
- this.state = ZelloConnectionState.Disconnected;
632
- this.emit(ZelloEvent.DISCONNECTED, this.state);
494
+ break;
495
+ }
496
+ case 'onIncomingVoiceMessageStarted':
497
+ {
498
+ const contact = bridgeContactToSdkContact(event.contact);
499
+ if (!contact) {
633
500
  break;
634
501
  }
635
- case 'onWillReconnect':
636
- {
637
- this.state = ZelloConnectionState.Reconnecting;
638
- this.emit(ZelloEvent.RECONNECTING, this.state);
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
- case 'onContactListUpdated':
642
- {
643
- this.clearContactList();
644
- this.users = event.users.map(user => bridgeContactToSdkContact(user));
645
- this.users.sort(compareNameAscending);
646
- this.channels = event.channels.map(channel => bridgeContactToSdkContact(channel));
647
- this.channels.sort(compareNameAscending);
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
- case 'onSelectedContactChanged':
657
- {
658
- this.selectedContact = event.contact ? bridgeContactToSdkContact(event.contact) : undefined;
659
- this.emit(ZelloEvent.SELECTED_CONTACT_CHANGED, this.selectedContact);
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
- case 'onAccountStatusChanged':
663
- {
664
- const statusValue = event.status?.toLowerCase();
665
- if (!statusValue || Object.values(ZelloAccountStatus).includes(statusValue)) {
666
- this.accountStatus = statusValue;
667
- this.emit(ZelloEvent.ACCOUNT_STATUS_CHANGED, this.accountStatus);
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
- case 'onIncomingVoiceMessageStarted':
672
- {
673
- const contact = bridgeContactToSdkContact(event.contact);
674
- if (!contact) {
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
- case 'onIncomingVoiceMessageStopped':
682
- {
683
- this.incomingVoiceMessage = undefined;
684
- const contact = bridgeContactToSdkContact(event.contact);
685
- if (!contact) {
686
- break;
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
- case 'onOutgoingVoiceMessageConnecting':
692
- {
693
- const contact = bridgeContactToSdkContact(event.contact);
694
- if (!contact) {
695
- break;
696
- }
697
- this.outgoingVoiceMessage = new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), ZelloOutgoingVoiceMessageState.Connecting);
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
- case 'onOutgoingVoiceMessageStarted':
702
- {
703
- const contact = bridgeContactToSdkContact(event.contact);
704
- if (!contact) {
705
- break;
706
- }
707
- this.outgoingVoiceMessage = new ZelloOutgoingVoiceMessage(contact, parseInt(event.timestamp, 10), ZelloOutgoingVoiceMessageState.Sending);
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
- case 'onOutgoingVoiceMessageStopped':
712
- {
713
- this.outgoingVoiceMessage = undefined;
714
- const contact = bridgeContactToSdkContact(event.contact);
715
- if (!contact) {
716
- break;
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
- case 'onIncomingImageMessage':
727
- {
728
- const contact = bridgeContactToSdkContact(event.contact);
729
- if (!contact) {
730
- break;
731
- }
732
- this.emit(ZelloEvent.INCOMING_IMAGE_MESSAGE_RECEIVED, new ZelloImageMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.thumbnail, event.image));
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
- case 'onOutgoingImageMessageSent':
736
- {
737
- const contact = bridgeContactToSdkContact(event.contact);
738
- if (!contact) {
739
- break;
740
- }
741
- this.emit(ZelloEvent.OUTGOING_IMAGE_MESSAGE_SENT, new ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
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
- case 'onOutgoingImageMessageSendFailed':
745
- {
746
- const contact = bridgeContactToSdkContact(event.contact);
747
- if (!contact) {
748
- break;
749
- }
750
- this.emit(ZelloEvent.OUTGOING_IMAGE_MESSAGE_SEND_FAILED, new ZelloImageMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.thumbnail, event.image));
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
- case 'onIncomingAlertMessage':
754
- {
755
- const contact = bridgeContactToSdkContact(event.contact);
756
- if (!contact) {
757
- break;
758
- }
759
- this.emit(ZelloEvent.INCOMING_ALERT_MESSAGE_RECEIVED, new ZelloAlertMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
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
- case 'onOutgoingAlertMessageSent':
763
- {
764
- const contact = bridgeContactToSdkContact(event.contact);
765
- if (!contact) {
766
- break;
767
- }
768
- this.emit(ZelloEvent.OUTGOING_ALERT_MESSAGE_SENT, new ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
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
- case 'onOutgoingAlertMessageSendFailed':
772
- {
773
- const contact = bridgeContactToSdkContact(event.contact);
774
- if (!contact) {
775
- break;
776
- }
777
- this.emit(ZelloEvent.OUTGOING_ALERT_MESSAGE_SEND_FAILED, new ZelloAlertMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
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
- case 'onIncomingTextMessage':
781
- {
782
- const contact = bridgeContactToSdkContact(event.contact);
783
- if (!contact) {
784
- break;
785
- }
786
- this.emit(ZelloEvent.INCOMING_TEXT_MESSAGE_RECEIVED, new ZelloTextMessage(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), true, parseInt(event.timestamp, 10), event.text));
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
- case 'onOutgoingTextMessageSent':
790
- {
791
- const contact = bridgeContactToSdkContact(event.contact);
792
- if (!contact) {
793
- break;
794
- }
795
- this.emit(ZelloEvent.OUTGOING_TEXT_MESSAGE_SENT, new ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
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
- case 'onOutgoingTextMessageSendFailed':
799
- {
800
- const contact = bridgeContactToSdkContact(event.contact);
801
- if (!contact) {
802
- break;
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
- this.emit(ZelloEvent.OUTGOING_TEXT_MESSAGE_SEND_FAILED, new ZelloTextMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.text));
805
- break;
806
- }
807
- case 'onIncomingLocationMessage':
808
- {
809
- const contact = bridgeContactToSdkContact(event.contact);
810
- if (!contact) {
811
- break;
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
- 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));
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
- case 'onOutgoingLocationMessageSent':
817
- {
818
- const contact = bridgeContactToSdkContact(event.contact);
819
- if (!contact) {
820
- break;
821
- }
822
- this.emit(ZelloEvent.OUTGOING_LOCATION_MESSAGE_SENT, new ZelloLocationMessage(contact, undefined, false, parseInt(event.timestamp, 10), event.latitude, event.longitude, event.accuracy, event.address));
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
- case 'onOutgoingLocationMessageSendFailed':
826
- {
827
- const contact = bridgeContactToSdkContact(event.contact);
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
- break;
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
- this.outgoingEmergency = new ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), undefined);
866
- this.emit(ZelloEvent.OUTGOING_EMERGENCY_STARTED, this.outgoingEmergency);
867
- break;
868
- }
869
- case 'onOutgoingEmergencyStopped':
870
- {
871
- const channel = bridgeContactToSdkContact(event.channel);
872
- if (!channel) {
873
- break;
874
- }
875
- this.outgoingEmergency = undefined;
876
- this.emit(ZelloEvent.OUTGOING_EMERGENCY_STOPPED, new ZelloOutgoingEmergency(channel, parseInt(event.startTimestamp, 10), event.endTimestamp));
877
- break;
878
- }
879
- case 'onRecentsUpdated':
880
- {
881
- this.recents = event.recents.map(recent => {
882
- const contact = bridgeContactToSdkContact(recent.contact);
883
- if (!contact) {
884
- return undefined;
885
- }
886
- return new ZelloRecentEntry(contact, bridgeChannelUserToSdkChannelUser(event.channelUser), parseInt(recent.timestamp, 10), recent.type.toLowerCase(), recent.incoming);
887
- }).filter(recent => recent !== undefined);
888
- this.emit(ZelloEvent.RECENTS_UPDATED, this.recents);
889
- break;
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
- case 'onConsoleSettingsChanged':
909
- {
910
- this.consoleSettings = bridgeConsoleSettingsToSdkConsoleSettings(event);
911
- this.emit(ZelloEvent.CONSOLE_SETTINGS_CHANGED, this.consoleSettings);
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
- case 'onDispatchCallTransferred':
915
- case 'onDispatchCallEnded':
916
- case 'onDispatchCallActive':
917
- case 'onDispatchCallPending':
918
- {
919
- this.processDispatchCallEvent(event);
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
- case 'onGroupConversationLeft':
923
- {
924
- const groupConversation = bridgeContactToSdkContact(event.conversation);
925
- if (!groupConversation) {
926
- break;
927
- }
928
- this.emit(ZelloEvent.GROUP_CONVERSATION_LEFT, groupConversation);
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
- case 'onGroupConversationInvite':
932
- {
933
- const groupConversation = bridgeContactToSdkContact(event.conversation);
934
- if (!groupConversation) {
935
- break;
936
- }
937
- this.emit(ZelloEvent.GROUP_CONVERSATION_INVITE, groupConversation);
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
- case 'onGroupConversationCreated':
941
- {
942
- const groupConversation = bridgeContactToSdkContact(event.conversation);
943
- if (!groupConversation) {
944
- break;
945
- }
946
- this.emit(ZelloEvent.GROUP_CONVERSATION_CREATED, groupConversation);
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
- case 'onGroupConversationRenamed':
950
- {
951
- const groupConversation = bridgeContactToSdkContact(event.conversation);
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
- case 'onGroupConversationUsersAdded':
959
- {
960
- const groupConversation = bridgeContactToSdkContact(event.conversation);
961
- if (!groupConversation) {
962
- break;
963
- }
964
- const users = event.users.map(user => bridgeChannelUserToSdkChannelUser(user));
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
- case 'onGroupConversationUsersLeft':
972
- {
973
- const groupConversation = bridgeContactToSdkContact(event.conversation);
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
- default:
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
- key: "clearContactList",
1016
- value: function clearContactList() {
1017
- this.users = [];
1018
- this.channels = [];
1019
- this.groupConversations = [];
1020
- }
1021
- }], [{
1022
- key: "getInstance",
1023
- value: function getInstance() {
1024
- if (!Zello.instance) {
1025
- Zello.instance = new Zello();
1026
- }
1027
- return Zello.instance;
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