@zelloptt/react-native-zello-sdk 0.1.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/LICENSE +20 -0
- package/README.md +21 -0
- package/android/build.gradle +122 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/zellosdk/DummyPackage.kt +18 -0
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModule.kt +437 -0
- package/android/src/main/java/com/zellosdk/ZelloAndroidSdkModuleHelper.kt +198 -0
- package/ios/Extensions/Date+Extension.swift +5 -0
- package/ios/Extensions/UIImage+Extension.swift +9 -0
- package/ios/Extensions/ZelloContact+Extension.swift +52 -0
- package/ios/Extensions/ZelloHistoryAlertMessage+Extension.swift +18 -0
- package/ios/Extensions/ZelloHistoryImageMessage+Extension.swift +17 -0
- package/ios/Extensions/ZelloHistoryLocationMessage+Extension.swift +23 -0
- package/ios/Extensions/ZelloHistoryTextMessage+Extension.swift +18 -0
- package/ios/Extensions/ZelloHistoryVoiceMessage+Extension.swift +18 -0
- package/ios/Extensions/ZelloIOSSdkModule+Extension.swift +285 -0
- package/ios/Extensions/ZelloIncomingEmergency+Extension.swift +16 -0
- package/ios/Extensions/ZelloOutgoingEmergency+Extension.swift +14 -0
- package/ios/Extensions/ZelloRecentEntry+Extension.swift +16 -0
- package/ios/ZelloIOSSdkModule.swift +209 -0
- package/ios/ZelloIOSSdkModuleBridge.h +5 -0
- package/ios/ZelloIOSSdkModuleBridge.m +44 -0
- package/lib/commonjs/events/index.js +43 -0
- package/lib/commonjs/events/index.js.map +1 -0
- package/lib/commonjs/index.js +47 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/sdk/index.js +833 -0
- package/lib/commonjs/sdk/index.js.map +1 -0
- package/lib/commonjs/types/index.js +518 -0
- package/lib/commonjs/types/index.js.map +1 -0
- package/lib/commonjs/utils/algorithms/index.js +79 -0
- package/lib/commonjs/utils/algorithms/index.js.map +1 -0
- package/lib/commonjs/utils/index.js +60 -0
- package/lib/commonjs/utils/index.js.map +1 -0
- package/lib/module/events/index.js +39 -0
- package/lib/module/events/index.js.map +1 -0
- package/lib/module/index.js +10 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/sdk/index.js +829 -0
- package/lib/module/sdk/index.js.map +1 -0
- package/lib/module/types/index.js +547 -0
- package/lib/module/types/index.js.map +1 -0
- package/lib/module/utils/algorithms/index.js +72 -0
- package/lib/module/utils/algorithms/index.js.map +1 -0
- package/lib/module/utils/index.js +52 -0
- package/lib/module/utils/index.js.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/events/index.d.ts +192 -0
- package/lib/typescript/commonjs/src/events/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sdk/index.d.ts +221 -0
- package/lib/typescript/commonjs/src/sdk/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/index.d.ts +560 -0
- package/lib/typescript/commonjs/src/types/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/algorithms/index.d.ts +21 -0
- package/lib/typescript/commonjs/src/utils/algorithms/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts +8 -0
- package/lib/typescript/commonjs/src/utils/index.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/events/index.d.ts +192 -0
- package/lib/typescript/module/src/events/index.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +6 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/sdk/index.d.ts +221 -0
- package/lib/typescript/module/src/sdk/index.d.ts.map +1 -0
- package/lib/typescript/module/src/types/index.d.ts +560 -0
- package/lib/typescript/module/src/types/index.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/algorithms/index.d.ts +21 -0
- package/lib/typescript/module/src/utils/algorithms/index.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/index.d.ts +8 -0
- package/lib/typescript/module/src/utils/index.d.ts.map +1 -0
- package/package.json +195 -0
- package/react-native-zello-sdk.podspec +43 -0
- package/src/events/index.ts +191 -0
- package/src/index.ts +8 -0
- package/src/sdk/index.ts +1038 -0
- package/src/types/index.ts +818 -0
- package/src/utils/algorithms/index.ts +88 -0
- package/src/utils/index.ts +145 -0
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
// noinspection JSUnusedGlobalSymbols
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The parent type for all Zello contact types, including users and channels.
|
|
5
|
+
*/
|
|
6
|
+
export type ZelloContact = {
|
|
7
|
+
/**
|
|
8
|
+
* The name of the contact. Names are unique within their type.
|
|
9
|
+
* When comparing names, it is recommended to do so in a case-insensitive manner.
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* The type of contact.
|
|
14
|
+
*/
|
|
15
|
+
type: ZelloContactType;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the contact is muted.
|
|
18
|
+
* When a contact is muted, messages from the contact will not play live, but they will still be in the history.
|
|
19
|
+
*/
|
|
20
|
+
isMuted: boolean;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The type of {@link ZelloContact}.
|
|
25
|
+
*/
|
|
26
|
+
export enum ZelloContactType {
|
|
27
|
+
User = 'user',
|
|
28
|
+
Channel = 'channel',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The status of a {@link ZelloUser}.
|
|
33
|
+
*/
|
|
34
|
+
export enum ZelloUserStatus {
|
|
35
|
+
/**
|
|
36
|
+
* The user is connected. Messages will play live.
|
|
37
|
+
*/
|
|
38
|
+
Available = 'available',
|
|
39
|
+
/**
|
|
40
|
+
* The user is connected. Messages will not play live.
|
|
41
|
+
*/
|
|
42
|
+
Busy = 'busy',
|
|
43
|
+
/**
|
|
44
|
+
* The user is disconnected. Messages will not play live.
|
|
45
|
+
* The user will download messages sent to them when they reconnect.
|
|
46
|
+
*/
|
|
47
|
+
Standby = 'standby',
|
|
48
|
+
/**
|
|
49
|
+
* The user is disconnected and cannot receive messages.
|
|
50
|
+
*/
|
|
51
|
+
Offline = 'offline',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A Zello user.
|
|
56
|
+
*/
|
|
57
|
+
export class ZelloUser implements ZelloContact {
|
|
58
|
+
public name: string;
|
|
59
|
+
/**
|
|
60
|
+
* The display name of the user. This should be used for UI purposes.
|
|
61
|
+
* Display names are not unique.
|
|
62
|
+
*/
|
|
63
|
+
public displayName: string;
|
|
64
|
+
public type: ZelloContactType;
|
|
65
|
+
public isMuted: boolean;
|
|
66
|
+
public status: ZelloUserStatus;
|
|
67
|
+
/**
|
|
68
|
+
* The URL of the user's profile picture.
|
|
69
|
+
*/
|
|
70
|
+
public profilePictureUrl: string | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* The URL of the user's profile picture thumbnail.
|
|
73
|
+
* This can be used for displaying a smaller version of the profile picture (such as in a list).
|
|
74
|
+
*/
|
|
75
|
+
public profilePictureThumbnailUrl: string | undefined;
|
|
76
|
+
|
|
77
|
+
constructor(
|
|
78
|
+
name: string,
|
|
79
|
+
displayName: string,
|
|
80
|
+
isMuted: boolean,
|
|
81
|
+
status: ZelloUserStatus,
|
|
82
|
+
profilePictureUrl: string | undefined,
|
|
83
|
+
profilePictureThumbnailUrl: string | undefined
|
|
84
|
+
) {
|
|
85
|
+
this.name = name;
|
|
86
|
+
this.type = ZelloContactType.User;
|
|
87
|
+
this.displayName = displayName;
|
|
88
|
+
this.isMuted = isMuted;
|
|
89
|
+
this.status = status;
|
|
90
|
+
this.profilePictureUrl = profilePictureUrl;
|
|
91
|
+
this.profilePictureThumbnailUrl = profilePictureThumbnailUrl;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A Zello channel. A channel contains multiple users.
|
|
97
|
+
*/
|
|
98
|
+
export class ZelloChannel implements ZelloContact {
|
|
99
|
+
public name: string;
|
|
100
|
+
public type: ZelloContactType;
|
|
101
|
+
public isMuted: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The connection status of the channel. Connecting to a channel is asynchronous.
|
|
104
|
+
*/
|
|
105
|
+
public connectionStatus: ZelloChannelConnectionStatus;
|
|
106
|
+
/**
|
|
107
|
+
* The number of users connected to the channel.
|
|
108
|
+
*/
|
|
109
|
+
public usersOnline: number;
|
|
110
|
+
/**
|
|
111
|
+
* The options of the channel.
|
|
112
|
+
*/
|
|
113
|
+
public options: ZelloChannelOptions;
|
|
114
|
+
|
|
115
|
+
constructor(
|
|
116
|
+
name: string,
|
|
117
|
+
isMuted: boolean,
|
|
118
|
+
connectionStatus: ZelloChannelConnectionStatus,
|
|
119
|
+
usersOnline: number,
|
|
120
|
+
options: ZelloChannelOptions
|
|
121
|
+
) {
|
|
122
|
+
this.name = name;
|
|
123
|
+
this.type = ZelloContactType.Channel;
|
|
124
|
+
this.isMuted = isMuted;
|
|
125
|
+
this.connectionStatus = connectionStatus;
|
|
126
|
+
this.usersOnline = usersOnline;
|
|
127
|
+
this.options = options;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The connection status of a {@link ZelloChannel}.
|
|
133
|
+
*/
|
|
134
|
+
export enum ZelloChannelConnectionStatus {
|
|
135
|
+
Disconnected = 'disconnected',
|
|
136
|
+
Connecting = 'connecting',
|
|
137
|
+
Connected = 'connected',
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The options of a {@link ZelloChannel}.
|
|
142
|
+
*/
|
|
143
|
+
export type ZelloChannelOptions = {
|
|
144
|
+
/**
|
|
145
|
+
* Whether the user is allowed to disconnect from the channel.
|
|
146
|
+
* When this is true, you should not show any UI to allow the user to disconnect from the channel.
|
|
147
|
+
*/
|
|
148
|
+
noDisconnect: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Whether the user is allowed to change the channel's connection state.
|
|
151
|
+
* When this is true, you should not show any UI to allow the user to connect or disconnect the channel.
|
|
152
|
+
*/
|
|
153
|
+
hidePowerButton: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Whether the user is allowed to talk on the channel.
|
|
156
|
+
* When this is true, you should not show any UI to allow the user to talk on the channel.
|
|
157
|
+
*/
|
|
158
|
+
listenOnly: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Whether the user is allowed to send alert messages to the channel.
|
|
161
|
+
* When this is true, you should not show any UI to allow the user to send alert messages to the channel.
|
|
162
|
+
*/
|
|
163
|
+
allowAlerts: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether the user is allowed to send text messages to the channel.
|
|
166
|
+
* When this is true, you should not show any UI to allow the user to send text messages to the channel.
|
|
167
|
+
*/
|
|
168
|
+
allowTextMessages: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Whether the user is allowed to send location messages to the channel.
|
|
171
|
+
* When this is true, you should not show any UI to allow the user to send location messages to the channel.
|
|
172
|
+
*/
|
|
173
|
+
allowLocations: boolean;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* A user in a {@link ZelloChannel}. A {@link ZelloChannelUser} may or may not not be part of your contact list.
|
|
178
|
+
*/
|
|
179
|
+
export class ZelloChannelUser {
|
|
180
|
+
public name: string;
|
|
181
|
+
|
|
182
|
+
constructor(name: string) {
|
|
183
|
+
this.name = name;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* The credentials required to connect to Zello.
|
|
189
|
+
*/
|
|
190
|
+
export type ZelloCredentials = {
|
|
191
|
+
/**
|
|
192
|
+
* The network to connect to.
|
|
193
|
+
* This is the "x" in your {x.zellowork.com} Zello Work console login.
|
|
194
|
+
*/
|
|
195
|
+
network: string;
|
|
196
|
+
/**
|
|
197
|
+
* The username to connect.
|
|
198
|
+
*/
|
|
199
|
+
username: string;
|
|
200
|
+
/**
|
|
201
|
+
* The password for the user.
|
|
202
|
+
*/
|
|
203
|
+
password: string;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The connection state of the Zello SDK.
|
|
208
|
+
*/
|
|
209
|
+
export enum ZelloConnectionState {
|
|
210
|
+
Disconnected = 'disconnected',
|
|
211
|
+
Connecting = 'connecting',
|
|
212
|
+
Connected = 'connected',
|
|
213
|
+
Reconnecting = 'reconnecting',
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The error that occurred when connecting to Zello.
|
|
218
|
+
*/
|
|
219
|
+
export enum ZelloConnectionError {
|
|
220
|
+
Unknown = 'unknown',
|
|
221
|
+
InvalidCredentials = 'invalidcredentials',
|
|
222
|
+
InvalidState = 'invalidstate',
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* The error that occurred when sending a voice message.
|
|
227
|
+
*/
|
|
228
|
+
export enum ZelloOutgoingVoiceMessageError {
|
|
229
|
+
Unknown = 'unknown',
|
|
230
|
+
NoMicPermission = 'nomicpermission',
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* The status of the current account.
|
|
235
|
+
*/
|
|
236
|
+
export enum ZelloAccountStatus {
|
|
237
|
+
/**
|
|
238
|
+
* The user is connected. Messages will play live.
|
|
239
|
+
*/
|
|
240
|
+
Available = 'available',
|
|
241
|
+
/**
|
|
242
|
+
* The user is connected. Messages will not play live.
|
|
243
|
+
* The received messages will be available in the history.
|
|
244
|
+
*/
|
|
245
|
+
Busy = 'busy',
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* The parent type for all Zello messages.
|
|
250
|
+
*/
|
|
251
|
+
export type ZelloMessage = {
|
|
252
|
+
/**
|
|
253
|
+
* The contact that sent or received the message. If this is a channel message, the contact will be the channel.
|
|
254
|
+
*/
|
|
255
|
+
contact: ZelloContact;
|
|
256
|
+
/**
|
|
257
|
+
* If incoming, the author that sent the message, if the message was sent in a channel.
|
|
258
|
+
* If outgoing, undefined.
|
|
259
|
+
*/
|
|
260
|
+
channelUser: ZelloChannelUser | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* The timestamp of the message.
|
|
263
|
+
*/
|
|
264
|
+
timestamp: number;
|
|
265
|
+
/**
|
|
266
|
+
* Whether the message was received or sent.
|
|
267
|
+
*/
|
|
268
|
+
incoming: boolean;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* An incoming Zello voice message.
|
|
273
|
+
*/
|
|
274
|
+
export class ZelloIncomingVoiceMessage implements ZelloMessage {
|
|
275
|
+
public contact: ZelloContact;
|
|
276
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
277
|
+
public timestamp: number;
|
|
278
|
+
public incoming = true;
|
|
279
|
+
|
|
280
|
+
constructor(
|
|
281
|
+
contact: ZelloContact,
|
|
282
|
+
channelUser: ZelloChannelUser | undefined,
|
|
283
|
+
timestamp: number
|
|
284
|
+
) {
|
|
285
|
+
this.contact = contact;
|
|
286
|
+
this.channelUser = channelUser;
|
|
287
|
+
this.timestamp = timestamp;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* An outgoing Zello voice message.
|
|
293
|
+
*/
|
|
294
|
+
export class ZelloOutgoingVoiceMessage implements ZelloMessage {
|
|
295
|
+
public contact: ZelloContact;
|
|
296
|
+
public timestamp: number;
|
|
297
|
+
public channelUser = undefined;
|
|
298
|
+
public incoming = false;
|
|
299
|
+
/**
|
|
300
|
+
* The state of the message.
|
|
301
|
+
*/
|
|
302
|
+
public state: ZelloOutgoingVoiceMessageState;
|
|
303
|
+
|
|
304
|
+
constructor(
|
|
305
|
+
contact: ZelloContact,
|
|
306
|
+
timestamp: number,
|
|
307
|
+
state: ZelloOutgoingVoiceMessageState
|
|
308
|
+
) {
|
|
309
|
+
this.contact = contact;
|
|
310
|
+
this.timestamp = timestamp;
|
|
311
|
+
this.state = state;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* The state of an outgoing Zello voice message.
|
|
317
|
+
*/
|
|
318
|
+
export enum ZelloOutgoingVoiceMessageState {
|
|
319
|
+
None = 'none',
|
|
320
|
+
Connecting = 'connecting',
|
|
321
|
+
Sending = 'sending',
|
|
322
|
+
Sent = 'sent',
|
|
323
|
+
Failed = 'failed',
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* A Zello image message.
|
|
328
|
+
*/
|
|
329
|
+
export class ZelloImageMessage implements ZelloMessage {
|
|
330
|
+
public contact: ZelloContact;
|
|
331
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
332
|
+
public incoming: boolean;
|
|
333
|
+
public timestamp: number;
|
|
334
|
+
/**
|
|
335
|
+
* Base64 encoded thumbnail image
|
|
336
|
+
*/
|
|
337
|
+
public thumbnail: string | undefined;
|
|
338
|
+
/**
|
|
339
|
+
* Base64 encoded full image
|
|
340
|
+
*/
|
|
341
|
+
public image: string;
|
|
342
|
+
|
|
343
|
+
constructor(
|
|
344
|
+
contact: ZelloContact,
|
|
345
|
+
channelUser: ZelloChannelUser | undefined,
|
|
346
|
+
incoming: boolean,
|
|
347
|
+
timestamp: number,
|
|
348
|
+
thumbnail: string | undefined,
|
|
349
|
+
image: string
|
|
350
|
+
) {
|
|
351
|
+
this.contact = contact;
|
|
352
|
+
this.channelUser = channelUser;
|
|
353
|
+
this.incoming = incoming;
|
|
354
|
+
this.timestamp = timestamp;
|
|
355
|
+
this.thumbnail = thumbnail;
|
|
356
|
+
this.image = image;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
/**
|
|
361
|
+
* A Zello alert message. Alert messages contain text and are typically used for important messages.
|
|
362
|
+
* They will play a recurring sound until the user acknowledges them by bringing the app to the foreground.
|
|
363
|
+
*/
|
|
364
|
+
export class ZelloAlertMessage implements ZelloMessage {
|
|
365
|
+
public contact: ZelloContact;
|
|
366
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
367
|
+
public incoming: boolean;
|
|
368
|
+
public timestamp: number;
|
|
369
|
+
/**
|
|
370
|
+
* The text body of the message.
|
|
371
|
+
*/
|
|
372
|
+
public text: string;
|
|
373
|
+
|
|
374
|
+
constructor(
|
|
375
|
+
contact: ZelloContact,
|
|
376
|
+
channelUser: ZelloChannelUser | undefined,
|
|
377
|
+
incoming: boolean,
|
|
378
|
+
timestamp: number,
|
|
379
|
+
text: string
|
|
380
|
+
) {
|
|
381
|
+
this.contact = contact;
|
|
382
|
+
this.channelUser = channelUser;
|
|
383
|
+
this.incoming = incoming;
|
|
384
|
+
this.timestamp = timestamp;
|
|
385
|
+
this.text = text;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The level of user a channel alert message should be sent to.
|
|
391
|
+
*/
|
|
392
|
+
export enum ZelloChannelAlertLevel {
|
|
393
|
+
/**
|
|
394
|
+
* Users currently connected to the channel.
|
|
395
|
+
*/
|
|
396
|
+
Connected = 'connected',
|
|
397
|
+
/**
|
|
398
|
+
* All users part of the channel, whether they are connected or not.
|
|
399
|
+
* This will send as a push notification if the user is not connected to Zello.
|
|
400
|
+
*/
|
|
401
|
+
All = 'all',
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/**
|
|
405
|
+
* A Zello text message.
|
|
406
|
+
*/
|
|
407
|
+
export class ZelloTextMessage implements ZelloMessage {
|
|
408
|
+
public contact: ZelloContact;
|
|
409
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
410
|
+
public incoming: boolean;
|
|
411
|
+
public timestamp: number;
|
|
412
|
+
/**
|
|
413
|
+
* The text body of the message.
|
|
414
|
+
*/
|
|
415
|
+
public text: string;
|
|
416
|
+
|
|
417
|
+
constructor(
|
|
418
|
+
contact: ZelloContact,
|
|
419
|
+
channelUser: ZelloChannelUser | undefined,
|
|
420
|
+
incoming: boolean,
|
|
421
|
+
timestamp: number,
|
|
422
|
+
text: string
|
|
423
|
+
) {
|
|
424
|
+
this.contact = contact;
|
|
425
|
+
this.channelUser = channelUser;
|
|
426
|
+
this.incoming = incoming;
|
|
427
|
+
this.timestamp = timestamp;
|
|
428
|
+
this.text = text;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* A Zello location message.
|
|
434
|
+
*/
|
|
435
|
+
export class ZelloLocationMessage implements ZelloMessage {
|
|
436
|
+
public contact: ZelloContact;
|
|
437
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
438
|
+
public incoming: boolean;
|
|
439
|
+
public timestamp: number;
|
|
440
|
+
/**
|
|
441
|
+
* The latitude of the location.
|
|
442
|
+
*/
|
|
443
|
+
public latitude: number;
|
|
444
|
+
/**
|
|
445
|
+
* The longitude of the location.
|
|
446
|
+
*/
|
|
447
|
+
public longitude: number;
|
|
448
|
+
/**
|
|
449
|
+
* The horizontal accuracy of the location in meters.
|
|
450
|
+
*/
|
|
451
|
+
public accuracy: number;
|
|
452
|
+
/**
|
|
453
|
+
* The reverse-geolocation address, if available.
|
|
454
|
+
*/
|
|
455
|
+
public address: string | undefined;
|
|
456
|
+
|
|
457
|
+
constructor(
|
|
458
|
+
contact: ZelloContact,
|
|
459
|
+
channelUser: ZelloChannelUser | undefined,
|
|
460
|
+
incoming: boolean,
|
|
461
|
+
timestamp: number,
|
|
462
|
+
latitude: number,
|
|
463
|
+
longitude: number,
|
|
464
|
+
accuracy: number,
|
|
465
|
+
address: string | undefined
|
|
466
|
+
) {
|
|
467
|
+
this.contact = contact;
|
|
468
|
+
this.channelUser = channelUser;
|
|
469
|
+
this.incoming = incoming;
|
|
470
|
+
this.timestamp = timestamp;
|
|
471
|
+
this.latitude = latitude;
|
|
472
|
+
this.longitude = longitude;
|
|
473
|
+
this.accuracy = accuracy;
|
|
474
|
+
this.address = address;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
/**
|
|
479
|
+
* An incoming Zello emergency.
|
|
480
|
+
*/
|
|
481
|
+
export class ZelloIncomingEmergency {
|
|
482
|
+
/**
|
|
483
|
+
* The emergency channel.
|
|
484
|
+
*/
|
|
485
|
+
public channel: ZelloChannel;
|
|
486
|
+
/**
|
|
487
|
+
* The user that started the emergency.
|
|
488
|
+
*/
|
|
489
|
+
public channelUser: ZelloChannelUser;
|
|
490
|
+
/**
|
|
491
|
+
* The unique identifier of the emergency.
|
|
492
|
+
*/
|
|
493
|
+
public emergencyId: string;
|
|
494
|
+
/**
|
|
495
|
+
* The timestamp when the emergency started.
|
|
496
|
+
*/
|
|
497
|
+
public startTimestamp: number;
|
|
498
|
+
/**
|
|
499
|
+
* The timestamp when the emergency ended, or undefined if it's ongoing.
|
|
500
|
+
*/
|
|
501
|
+
public endTimestamp: number | undefined;
|
|
502
|
+
|
|
503
|
+
constructor(
|
|
504
|
+
channel: ZelloChannel,
|
|
505
|
+
channelUser: ZelloChannelUser,
|
|
506
|
+
emergencyId: string,
|
|
507
|
+
startTimestamp: number,
|
|
508
|
+
endTimestamp: number | undefined
|
|
509
|
+
) {
|
|
510
|
+
this.channel = channel;
|
|
511
|
+
this.channelUser = channelUser;
|
|
512
|
+
this.emergencyId = emergencyId;
|
|
513
|
+
this.startTimestamp = startTimestamp;
|
|
514
|
+
this.endTimestamp = endTimestamp;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* An outgoing Zello emergency.
|
|
520
|
+
*/
|
|
521
|
+
export class ZelloOutgoingEmergency {
|
|
522
|
+
/**
|
|
523
|
+
* The emergency channel.
|
|
524
|
+
*/
|
|
525
|
+
public channel: ZelloChannel;
|
|
526
|
+
/**
|
|
527
|
+
* The timestamp when the emergency started.
|
|
528
|
+
*/
|
|
529
|
+
public startTimestamp: number;
|
|
530
|
+
/**
|
|
531
|
+
* The timestamp when the emergency ended, or undefined if it's ongoing.
|
|
532
|
+
*/
|
|
533
|
+
public endTimestamp: number | undefined;
|
|
534
|
+
|
|
535
|
+
constructor(
|
|
536
|
+
channel: ZelloChannel,
|
|
537
|
+
startTimestamp: number,
|
|
538
|
+
endTimestamp: number | undefined
|
|
539
|
+
) {
|
|
540
|
+
this.channel = channel;
|
|
541
|
+
this.startTimestamp = startTimestamp;
|
|
542
|
+
this.endTimestamp = endTimestamp;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* A Zello recent entry.
|
|
548
|
+
*/
|
|
549
|
+
export class ZelloRecentEntry {
|
|
550
|
+
/**
|
|
551
|
+
* The contact that the recent entry is for.
|
|
552
|
+
*/
|
|
553
|
+
public contact: ZelloContact;
|
|
554
|
+
/**
|
|
555
|
+
* If incoming, the author that sent the most recent message, if the message was sent in a channel.
|
|
556
|
+
* If outgoing, undefined.
|
|
557
|
+
*/
|
|
558
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
559
|
+
/**
|
|
560
|
+
* The timestamp of the most recent message.
|
|
561
|
+
*/
|
|
562
|
+
public timestamp: number;
|
|
563
|
+
/**
|
|
564
|
+
* The type of the most recent message.
|
|
565
|
+
*/
|
|
566
|
+
public type: ZelloRecentEntryType;
|
|
567
|
+
/**
|
|
568
|
+
* Whether the most recent message was incoming.
|
|
569
|
+
*/
|
|
570
|
+
public incoming: boolean;
|
|
571
|
+
|
|
572
|
+
constructor(
|
|
573
|
+
contact: ZelloContact,
|
|
574
|
+
channelUser: ZelloChannelUser | undefined,
|
|
575
|
+
timestamp: number,
|
|
576
|
+
type: ZelloRecentEntryType,
|
|
577
|
+
incoming: boolean
|
|
578
|
+
) {
|
|
579
|
+
this.contact = contact;
|
|
580
|
+
this.channelUser = channelUser;
|
|
581
|
+
this.timestamp = timestamp;
|
|
582
|
+
this.type = type;
|
|
583
|
+
this.incoming = incoming;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* The type of {@link ZelloRecentEntry}.
|
|
589
|
+
*/
|
|
590
|
+
export enum ZelloRecentEntryType {
|
|
591
|
+
Voice = 'voice',
|
|
592
|
+
Image = 'image',
|
|
593
|
+
Alert = 'alert',
|
|
594
|
+
Text = 'text',
|
|
595
|
+
Location = 'location',
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* The parent type for all Zello history messages.
|
|
600
|
+
*/
|
|
601
|
+
export type ZelloHistoryMessage = {
|
|
602
|
+
/**
|
|
603
|
+
* The contact that sent or received the message.
|
|
604
|
+
*/
|
|
605
|
+
contact: ZelloContact;
|
|
606
|
+
/**
|
|
607
|
+
* If incoming, the author that sent the message, if the message was sent in a channel.
|
|
608
|
+
* If outgoing, undefined.
|
|
609
|
+
*/
|
|
610
|
+
channelUser: ZelloChannelUser | undefined;
|
|
611
|
+
/**
|
|
612
|
+
* The timestamp of the message.
|
|
613
|
+
*/
|
|
614
|
+
timestamp: number;
|
|
615
|
+
/**
|
|
616
|
+
* The unique identifier of the message. This can be used to lookup messages in the history.
|
|
617
|
+
* This identifier persists across sessions.
|
|
618
|
+
*/
|
|
619
|
+
historyId: string;
|
|
620
|
+
/**
|
|
621
|
+
* Whether the message was received or sent.
|
|
622
|
+
*/
|
|
623
|
+
incoming: boolean;
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* A Zello history voice message.
|
|
628
|
+
* To play the message, use the {@link sdk.Zello#playHistoryMessage | Zello#playHistoryMessage} function.
|
|
629
|
+
*/
|
|
630
|
+
export class ZelloHistoryVoiceMessage implements ZelloHistoryMessage {
|
|
631
|
+
public contact: ZelloContact;
|
|
632
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
633
|
+
public timestamp: number;
|
|
634
|
+
public historyId: string;
|
|
635
|
+
public incoming: boolean;
|
|
636
|
+
/**
|
|
637
|
+
* The duration of the voice message in milliseconds.
|
|
638
|
+
*/
|
|
639
|
+
public durationMs: number;
|
|
640
|
+
|
|
641
|
+
constructor(
|
|
642
|
+
contact: ZelloContact,
|
|
643
|
+
channelUser: ZelloChannelUser | undefined,
|
|
644
|
+
timestamp: number,
|
|
645
|
+
historyId: string,
|
|
646
|
+
incoming: boolean,
|
|
647
|
+
durationMs: number
|
|
648
|
+
) {
|
|
649
|
+
this.contact = contact;
|
|
650
|
+
this.channelUser = channelUser;
|
|
651
|
+
this.timestamp = timestamp;
|
|
652
|
+
this.historyId = historyId;
|
|
653
|
+
this.incoming = incoming;
|
|
654
|
+
this.durationMs = durationMs;
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* A Zello history image message.
|
|
660
|
+
* To retrieve the image data for the message, use the {@link sdk.Zello#getImageDataForHistoryImageMessage | Zello#getImageDataForHistoryImageMessage} method.
|
|
661
|
+
*/
|
|
662
|
+
export class ZelloHistoryImageMessage implements ZelloHistoryMessage {
|
|
663
|
+
public contact: ZelloContact;
|
|
664
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
665
|
+
public timestamp: number;
|
|
666
|
+
public historyId: string;
|
|
667
|
+
public incoming: boolean;
|
|
668
|
+
|
|
669
|
+
constructor(
|
|
670
|
+
contact: ZelloContact,
|
|
671
|
+
channelUser: ZelloChannelUser | undefined,
|
|
672
|
+
timestamp: number,
|
|
673
|
+
historyId: string,
|
|
674
|
+
incoming: boolean
|
|
675
|
+
) {
|
|
676
|
+
this.contact = contact;
|
|
677
|
+
this.channelUser = channelUser;
|
|
678
|
+
this.timestamp = timestamp;
|
|
679
|
+
this.historyId = historyId;
|
|
680
|
+
this.incoming = incoming;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* A Zello history alert message.
|
|
686
|
+
*/
|
|
687
|
+
export class ZelloHistoryAlertMessage implements ZelloHistoryMessage {
|
|
688
|
+
public contact: ZelloContact;
|
|
689
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
690
|
+
public timestamp: number;
|
|
691
|
+
public historyId: string;
|
|
692
|
+
public incoming: boolean;
|
|
693
|
+
/**
|
|
694
|
+
* The text body of the message.
|
|
695
|
+
*/
|
|
696
|
+
public text: string;
|
|
697
|
+
|
|
698
|
+
constructor(
|
|
699
|
+
contact: ZelloContact,
|
|
700
|
+
channelUser: ZelloChannelUser | undefined,
|
|
701
|
+
timestamp: number,
|
|
702
|
+
historyId: string,
|
|
703
|
+
incoming: boolean,
|
|
704
|
+
text: string
|
|
705
|
+
) {
|
|
706
|
+
this.contact = contact;
|
|
707
|
+
this.channelUser = channelUser;
|
|
708
|
+
this.timestamp = timestamp;
|
|
709
|
+
this.historyId = historyId;
|
|
710
|
+
this.incoming = incoming;
|
|
711
|
+
this.text = text;
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* A Zello history text message.
|
|
717
|
+
*/
|
|
718
|
+
export class ZelloHistoryTextMessage implements ZelloHistoryMessage {
|
|
719
|
+
public contact: ZelloContact;
|
|
720
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
721
|
+
public timestamp: number;
|
|
722
|
+
public historyId: string;
|
|
723
|
+
public incoming: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* The text body of the message.
|
|
726
|
+
*/
|
|
727
|
+
public text: string;
|
|
728
|
+
|
|
729
|
+
constructor(
|
|
730
|
+
contact: ZelloContact,
|
|
731
|
+
channelUser: ZelloChannelUser | undefined,
|
|
732
|
+
timestamp: number,
|
|
733
|
+
historyId: string,
|
|
734
|
+
incoming: boolean,
|
|
735
|
+
text: string
|
|
736
|
+
) {
|
|
737
|
+
this.contact = contact;
|
|
738
|
+
this.channelUser = channelUser;
|
|
739
|
+
this.timestamp = timestamp;
|
|
740
|
+
this.historyId = historyId;
|
|
741
|
+
this.incoming = incoming;
|
|
742
|
+
this.text = text;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* A Zello history location message.
|
|
748
|
+
*/
|
|
749
|
+
export class ZelloHistoryLocationMessage implements ZelloHistoryMessage {
|
|
750
|
+
public contact: ZelloContact;
|
|
751
|
+
public channelUser: ZelloChannelUser | undefined;
|
|
752
|
+
public timestamp: number;
|
|
753
|
+
public historyId: string;
|
|
754
|
+
public incoming: boolean;
|
|
755
|
+
/**
|
|
756
|
+
* The latitude of the location.
|
|
757
|
+
*/
|
|
758
|
+
public latitude: number;
|
|
759
|
+
/**
|
|
760
|
+
* The longitude of the location.
|
|
761
|
+
*/
|
|
762
|
+
public longitude: number;
|
|
763
|
+
/**
|
|
764
|
+
* The horizontal accuracy of the location in meters.
|
|
765
|
+
*/
|
|
766
|
+
public accuracy: number;
|
|
767
|
+
/**
|
|
768
|
+
* The reverse-geolocation address, if available.
|
|
769
|
+
*/
|
|
770
|
+
public address: string | undefined;
|
|
771
|
+
|
|
772
|
+
constructor(
|
|
773
|
+
contact: ZelloContact,
|
|
774
|
+
channelUser: ZelloChannelUser | undefined,
|
|
775
|
+
timestamp: number,
|
|
776
|
+
historyId: string,
|
|
777
|
+
incoming: boolean,
|
|
778
|
+
latitude: number,
|
|
779
|
+
longitude: number,
|
|
780
|
+
accuracy: number,
|
|
781
|
+
address: string | undefined
|
|
782
|
+
) {
|
|
783
|
+
this.contact = contact;
|
|
784
|
+
this.channelUser = channelUser;
|
|
785
|
+
this.timestamp = timestamp;
|
|
786
|
+
this.historyId = historyId;
|
|
787
|
+
this.incoming = incoming;
|
|
788
|
+
this.latitude = latitude;
|
|
789
|
+
this.longitude = longitude;
|
|
790
|
+
this.accuracy = accuracy;
|
|
791
|
+
this.address = address;
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* The configuration for the Zello SDK.
|
|
797
|
+
*/
|
|
798
|
+
export type ZelloConfig = {
|
|
799
|
+
android: {
|
|
800
|
+
/**
|
|
801
|
+
* Whether to enable message push notifications.
|
|
802
|
+
* By setting this to false, the user will not receive any push notifications for incoming messages when the user is offline.
|
|
803
|
+
*/
|
|
804
|
+
enableOfflineMessagePushNotifications: boolean;
|
|
805
|
+
/**
|
|
806
|
+
* Whether to enable the foreground service. A foreground service is necessary for the SDK to function properly in the background.
|
|
807
|
+
* The SDK comes configured with a default foreground service, but you can provide your own if you wish.
|
|
808
|
+
* If this is set to false, the SDK will not work properly when the app is in the background, unless you configure your own foreground service.
|
|
809
|
+
*/
|
|
810
|
+
enableForegroundService: boolean;
|
|
811
|
+
};
|
|
812
|
+
ios: {
|
|
813
|
+
/**
|
|
814
|
+
* Whether your application is being run in a debug or release build.
|
|
815
|
+
*/
|
|
816
|
+
isDebugBuild: boolean;
|
|
817
|
+
};
|
|
818
|
+
};
|