com.onesignal.unity.ios 2.14.6 → 3.0.0-beta.4
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/Editor/BuildPostProcessor.cs +297 -0
- package/Editor/{PostProcessBuildPlayer_iOS.cs.meta → BuildPostProcessor.cs.meta} +0 -0
- package/Editor/OneSignalIOSDependencies.xml +5 -0
- package/Editor/OneSignalIOSDependencies.xml.meta +3 -0
- package/Editor/PBXProjectExtensions.cs +52 -0
- package/Editor/PBXProjectExtensions.cs.meta +3 -0
- package/Runtime/AssemblyInfo.cs +28 -1
- package/Runtime/OneSignal.iOS.asmdef +4 -3
- package/Runtime/OneSignalIOS.Callbacks.cs +174 -0
- package/Runtime/OneSignalIOS.Callbacks.cs.meta +3 -0
- package/Runtime/OneSignalIOS.Interface.cs +99 -0
- package/Runtime/OneSignalIOS.Interface.cs.meta +3 -0
- package/Runtime/OneSignalIOS.cs +268 -457
- package/Runtime/OneSignalIOS.cs.meta +3 -10
- package/Runtime/OneSignalIOSInit.cs +39 -9
- package/Runtime/Plugins/iOS/Info.plist.meta +1 -3
- package/Runtime/Plugins/iOS/NotificationService.swift +25 -0
- package/Runtime/Plugins/iOS/{NotificationService.m.meta → NotificationService.swift.meta} +5 -4
- package/Runtime/Plugins/iOS/OneSignalUnityBridge.mm +417 -0
- package/Runtime/Plugins/iOS/{OneSignal.h.meta → OneSignalUnityBridge.mm.meta} +16 -5
- package/Runtime/Utilities/Later.cs +64 -0
- package/Runtime/Utilities/Later.cs.meta +11 -0
- package/Runtime/Utilities.meta +3 -0
- package/package.json +2 -2
- package/Editor/PostProcessBuildPlayer_iOS.cs +0 -399
- package/Runtime/Plugins/iOS/NotificationService.h +0 -13
- package/Runtime/Plugins/iOS/NotificationService.h.meta +0 -26
- package/Runtime/Plugins/iOS/NotificationService.m +0 -40
- package/Runtime/Plugins/iOS/OneSignal.h +0 -617
- package/Runtime/Plugins/iOS/OneSignalUnityRuntime.m +0 -542
- package/Runtime/Plugins/iOS/OneSignalUnityRuntime.m.meta +0 -24
- package/Runtime/Plugins/iOS/libOneSignal.a +0 -0
- package/Runtime/Plugins/iOS/libOneSignal.a.meta +0 -21
package/Runtime/OneSignalIOS.cs
CHANGED
|
@@ -1,458 +1,269 @@
|
|
|
1
|
-
|
|
2
|
-
* Modified MIT License
|
|
3
|
-
*
|
|
4
|
-
* Copyright
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* 1. The above copyright notice and this permission notice shall be included in
|
|
14
|
-
* all copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* 2. All copies of substantial portions of the Software may only be used in connection
|
|
17
|
-
* with services provided by OneSignal.
|
|
18
|
-
*
|
|
19
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
-
* THE SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
using System.
|
|
29
|
-
using System.
|
|
30
|
-
using System;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
public void AddEmailSubscriptionObserver()
|
|
271
|
-
{
|
|
272
|
-
_addEmailSubscriptionObserver();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
public void RemoveEmailSubscriptionObserver()
|
|
276
|
-
{
|
|
277
|
-
_removeEmailSubscriptionObserver();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
public void SetEmail(string delegateIdSuccess, string delegateIdFailure, string email)
|
|
281
|
-
{
|
|
282
|
-
_setUnauthenticatedEmail(delegateIdSuccess, delegateIdFailure, email);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
public void SetEmail(string delegateIdSuccess, string delegateIdFailure, string email, string emailAuthCode)
|
|
286
|
-
{
|
|
287
|
-
_setEmail(delegateIdSuccess, delegateIdFailure, email, emailAuthCode);
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
public void LogoutEmail(string delegateIdSuccess, string delegateIdFailure)
|
|
291
|
-
{
|
|
292
|
-
_logoutEmail(delegateIdSuccess, delegateIdFailure);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
public void UserDidProvideConsent(bool consent)
|
|
296
|
-
{
|
|
297
|
-
_userDidProvideConsent(consent);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
public bool UserProvidedConsent()
|
|
301
|
-
{
|
|
302
|
-
return _userProvidedConsent();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
public void SetRequiresUserPrivacyConsent(bool required)
|
|
306
|
-
{
|
|
307
|
-
_setRequiresUserPrivacyConsent(required);
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
public void SetExternalUserId(string delegateId, string externalId)
|
|
311
|
-
{
|
|
312
|
-
_setExternalUserId(delegateId, externalId);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
public void SetExternalUserId(string delegateId, string delegateIdFailure, string externalId,
|
|
316
|
-
string externalIdAuthHash)
|
|
317
|
-
{
|
|
318
|
-
_setExternalUserIdWithAuthToken(delegateId, delegateIdFailure, externalId, externalIdAuthHash);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
public void RemoveExternalUserId(string delegateId)
|
|
322
|
-
{
|
|
323
|
-
_removeExternalUserId(delegateId);
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
public void AddTrigger(string key, object value)
|
|
327
|
-
{
|
|
328
|
-
IDictionary<string, object> trigger = new Dictionary<string, object>() {{key, value}};
|
|
329
|
-
_addTriggers(Json.Serialize(trigger));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
public void AddTriggers(IDictionary<string, object> triggers)
|
|
333
|
-
{
|
|
334
|
-
_addTriggers(Json.Serialize(triggers));
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
public void RemoveTriggerForKey(string key)
|
|
338
|
-
{
|
|
339
|
-
_removeTriggerForKey(key);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
public void RemoveTriggersForKeys(IList<string> keys)
|
|
343
|
-
{
|
|
344
|
-
_removeTriggersForKeys(Json.Serialize(keys));
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
public object GetTriggerValueForKey(string key)
|
|
348
|
-
{
|
|
349
|
-
Dictionary<string, object> triggerValue =
|
|
350
|
-
Json.Deserialize(_getTriggerValueForKey(key)) as Dictionary<string, object>;
|
|
351
|
-
return triggerValue["value"];
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
public void PauseInAppMessages(bool pause)
|
|
355
|
-
{
|
|
356
|
-
_pauseInAppMessages(pause);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
public void EnableVibrate(bool enable)
|
|
360
|
-
{
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
public void EnableSound(bool enable)
|
|
364
|
-
{
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
public void ClearOneSignalNotifications()
|
|
368
|
-
{
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
public void SendOutcome(string delegateId, string name)
|
|
372
|
-
{
|
|
373
|
-
_sendOutcome(delegateId, name);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
public void SendUniqueOutcome(string delegateId, string name)
|
|
377
|
-
{
|
|
378
|
-
_sendUniqueOutcome(delegateId, name);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
public void SendOutcomeWithValue(string delegateId, string name, float value)
|
|
382
|
-
{
|
|
383
|
-
_sendOutcomeWithValue(delegateId, name, value);
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
public OSPermissionSubscriptionState GetPermissionSubscriptionState()
|
|
387
|
-
{
|
|
388
|
-
return OneSignalPlatformHelper.ParsePermissionSubscriptionState(this, _getPermissionSubscriptionState());
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
public OSPermissionStateChanges ParseOSPermissionStateChanges(string jsonStat)
|
|
392
|
-
{
|
|
393
|
-
return OneSignalPlatformHelper.ParseOSPermissionStateChanges(this, jsonStat);
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
public OSEmailSubscriptionStateChanges ParseOSEmailSubscriptionStateChanges(string jsonState)
|
|
397
|
-
{
|
|
398
|
-
return OneSignalPlatformHelper.ParseOSEmailSubscriptionStateChanges(this, jsonState);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
public OSSubscriptionStateChanges ParseOSSubscriptionStateChanges(string jsonStat)
|
|
402
|
-
{
|
|
403
|
-
return OneSignalPlatformHelper.ParseOSSubscriptionStateChanges(this, jsonStat);
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
public OSPermissionState ParseOSPermissionState(object stateDict)
|
|
407
|
-
{
|
|
408
|
-
var stateDictCasted = stateDict as Dictionary<string, object>;
|
|
409
|
-
|
|
410
|
-
var state = new OSPermissionState();
|
|
411
|
-
state.hasPrompted = Convert.ToBoolean(stateDictCasted["hasPrompted"]);
|
|
412
|
-
state.status = (OSNotificationPermission) Convert.ToInt32(stateDictCasted["status"]);
|
|
413
|
-
|
|
414
|
-
return state;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
public OSSubscriptionState ParseOSSubscriptionState(object stateDict)
|
|
418
|
-
{
|
|
419
|
-
var stateDictCasted = stateDict as Dictionary<string, object>;
|
|
420
|
-
|
|
421
|
-
var state = new OSSubscriptionState();
|
|
422
|
-
state.subscribed = Convert.ToBoolean(stateDictCasted["subscribed"]);
|
|
423
|
-
state.userSubscriptionSetting = Convert.ToBoolean(stateDictCasted["userSubscriptionSetting"]);
|
|
424
|
-
state.userId = stateDictCasted["userId"] as string;
|
|
425
|
-
state.pushToken = stateDictCasted["pushToken"] as string;
|
|
426
|
-
|
|
427
|
-
return state;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
public OSEmailSubscriptionState ParseOSEmailSubscriptionState(object stateDict)
|
|
431
|
-
{
|
|
432
|
-
var stateDictCasted = stateDict as Dictionary<string, object>;
|
|
433
|
-
|
|
434
|
-
var state = new OSEmailSubscriptionState();
|
|
435
|
-
|
|
436
|
-
if (stateDictCasted.ContainsKey("emailUserId"))
|
|
437
|
-
{
|
|
438
|
-
state.emailUserId = stateDictCasted["emailUserId"] as string;
|
|
439
|
-
}
|
|
440
|
-
else
|
|
441
|
-
{
|
|
442
|
-
state.emailUserId = "";
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
if (stateDictCasted.ContainsKey("emailAddress"))
|
|
446
|
-
{
|
|
447
|
-
state.emailAddress = stateDictCasted["emailAddress"] as string;
|
|
448
|
-
}
|
|
449
|
-
else
|
|
450
|
-
{
|
|
451
|
-
state.emailAddress = "";
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
state.subscribed = stateDictCasted.ContainsKey("emailUserId") && stateDictCasted["emailUserId"] != null;
|
|
455
|
-
|
|
456
|
-
return state;
|
|
457
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Modified MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2022 OneSignal
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* 1. The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* 2. All copies of substantial portions of the Software may only be used in connection
|
|
17
|
+
* with services provided by OneSignal.
|
|
18
|
+
*
|
|
19
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
25
|
+
* THE SOFTWARE.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
using System.Collections.Generic;
|
|
29
|
+
using System.Linq;
|
|
30
|
+
using System.Threading.Tasks;
|
|
31
|
+
|
|
32
|
+
namespace OneSignalSDK {
|
|
33
|
+
public sealed partial class OneSignalIOS : OneSignal {
|
|
34
|
+
public override event NotificationWillShowDelegate NotificationWillShow;
|
|
35
|
+
public override event NotificationActionDelegate NotificationOpened;
|
|
36
|
+
public override event InAppMessageLifecycleDelegate InAppMessageWillDisplay;
|
|
37
|
+
public override event InAppMessageLifecycleDelegate InAppMessageDidDisplay;
|
|
38
|
+
public override event InAppMessageLifecycleDelegate InAppMessageWillDismiss;
|
|
39
|
+
public override event InAppMessageLifecycleDelegate InAppMessageDidDismiss;
|
|
40
|
+
public override event InAppMessageActionDelegate InAppMessageTriggeredAction;
|
|
41
|
+
public override event StateChangeDelegate<NotificationPermission> NotificationPermissionChanged;
|
|
42
|
+
public override event StateChangeDelegate<PushSubscriptionState> PushSubscriptionStateChanged;
|
|
43
|
+
public override event StateChangeDelegate<EmailSubscriptionState> EmailSubscriptionStateChanged;
|
|
44
|
+
public override event StateChangeDelegate<SMSSubscriptionState> SMSSubscriptionStateChanged;
|
|
45
|
+
|
|
46
|
+
public override NotificationPermission NotificationPermission {
|
|
47
|
+
get {
|
|
48
|
+
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
49
|
+
if (deviceState["notificationPermissionStatus"] is long status)
|
|
50
|
+
return (NotificationPermission) status;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
SDKDebug.Error("Could not deserialize device state for permissions");
|
|
54
|
+
return NotificationPermission.NotDetermined;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public override PushSubscriptionState PushSubscriptionState {
|
|
59
|
+
get {
|
|
60
|
+
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
61
|
+
return new PushSubscriptionState {
|
|
62
|
+
userId = deviceState["userId"] as string,
|
|
63
|
+
pushToken = deviceState["pushToken"] as string,
|
|
64
|
+
isSubscribed = (bool) deviceState["isSubscribed"],
|
|
65
|
+
isPushDisabled = (bool) deviceState["isPushDisabled"],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
SDKDebug.Error("Could not deserialize device state for push");
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public override EmailSubscriptionState EmailSubscriptionState {
|
|
75
|
+
get {
|
|
76
|
+
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
77
|
+
return new EmailSubscriptionState {
|
|
78
|
+
emailUserId = deviceState["emailUserId"] as string,
|
|
79
|
+
emailAddress = deviceState["emailAddress"] as string,
|
|
80
|
+
isSubscribed = (bool) deviceState["isEmailSubscribed"],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
SDKDebug.Error("Could not deserialize device state for email");
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public override SMSSubscriptionState SMSSubscriptionState {
|
|
90
|
+
get {
|
|
91
|
+
if (Json.Deserialize(_getDeviceState()) is Dictionary<string, object> deviceState) {
|
|
92
|
+
return new SMSSubscriptionState {
|
|
93
|
+
smsUserId = deviceState["smsUserId"] as string,
|
|
94
|
+
smsNumber = deviceState["smsNumber"] as string,
|
|
95
|
+
isSubscribed = (bool) deviceState["isSMSSubscribed"],
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
SDKDebug.Error("Could not deserialize device state for sms");
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
public override LogLevel LogLevel {
|
|
105
|
+
get => _logLevel;
|
|
106
|
+
set {
|
|
107
|
+
_logLevel = value;
|
|
108
|
+
_setLogLevel((int) _logLevel, (int) _alertLevel);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public override LogLevel AlertLevel {
|
|
113
|
+
get => _alertLevel;
|
|
114
|
+
set {
|
|
115
|
+
_alertLevel = value;
|
|
116
|
+
_setLogLevel((int) _logLevel, (int) _alertLevel);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public override bool PrivacyConsent {
|
|
121
|
+
get => _getPrivacyConsent();
|
|
122
|
+
set => _setPrivacyConsent(value);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public override bool RequiresPrivacyConsent {
|
|
126
|
+
get => _getRequiresPrivacyConsent();
|
|
127
|
+
set => _setRequiresPrivacyConsent(value);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public override void Initialize(string appId) {
|
|
131
|
+
_initialize(appId);
|
|
132
|
+
_completedInit(appId);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
public override async Task<NotificationPermission> PromptForPushNotificationsWithUserResponse() {
|
|
136
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
137
|
+
_promptForPushNotificationsWithUserResponse(hashCode, BooleanCallbackProxy);
|
|
138
|
+
return await proxy ? NotificationPermission.Authorized : NotificationPermission.Denied;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public override void ClearOneSignalNotifications()
|
|
142
|
+
=> SDKDebug.Info("ClearOneSignalNotifications invoked on iOS, does nothing");
|
|
143
|
+
|
|
144
|
+
public override async Task<Dictionary<string, object>> PostNotification(Dictionary<string, object> options) {
|
|
145
|
+
var (proxy, hashCode) = _setupProxy<string>();
|
|
146
|
+
_postNotification(Json.Serialize(options), hashCode, StringCallbackProxy);
|
|
147
|
+
return Json.Deserialize(await proxy) as Dictionary<string, object>;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
public override void SetTrigger(string key, string value)
|
|
151
|
+
=> _setTrigger(key, value);
|
|
152
|
+
|
|
153
|
+
public override void SetTriggers(Dictionary<string, string> triggers)
|
|
154
|
+
=> _setTriggers(Json.Serialize(triggers));
|
|
155
|
+
|
|
156
|
+
public override void RemoveTrigger(string key)
|
|
157
|
+
=> _removeTrigger(key);
|
|
158
|
+
|
|
159
|
+
public override void RemoveTriggers(params string[] keys)
|
|
160
|
+
=> _removeTriggers(Json.Serialize(keys));
|
|
161
|
+
|
|
162
|
+
public override string GetTrigger(string key)
|
|
163
|
+
=> _getTrigger(key);
|
|
164
|
+
|
|
165
|
+
public override Dictionary<string, string> GetTriggers() {
|
|
166
|
+
var triggersDict = Json.Deserialize(_getTriggers()) as Dictionary<string, object>;
|
|
167
|
+
return triggersDict?.ToDictionary(item => item.Key,
|
|
168
|
+
item => item.Value as string
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
public override bool InAppMessagesArePaused {
|
|
173
|
+
get => _getInAppMessagesArePaused();
|
|
174
|
+
set => _setInAppMessagesArePaused(value);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public override async Task<bool> SendTag(string key, object value) {
|
|
178
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
179
|
+
_sendTag(key, value.ToString(), hashCode, BooleanCallbackProxy);
|
|
180
|
+
return await proxy;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
public override async Task<bool> SendTags(Dictionary<string, object> tags) {
|
|
184
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
185
|
+
_sendTags(Json.Serialize(tags), hashCode, BooleanCallbackProxy);
|
|
186
|
+
return await proxy;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public override async Task<Dictionary<string, object>> GetTags() {
|
|
190
|
+
var (proxy, hashCode) = _setupProxy<string>();
|
|
191
|
+
_getTags(hashCode, StringCallbackProxy);
|
|
192
|
+
return Json.Deserialize(await proxy) as Dictionary<string, object>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public override async Task<bool> DeleteTag(string key) {
|
|
196
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
197
|
+
_deleteTag(key, hashCode, BooleanCallbackProxy);
|
|
198
|
+
return await proxy;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public override async Task<bool> DeleteTags(params string[] keys) {
|
|
202
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
203
|
+
_deleteTags(Json.Serialize(keys), hashCode, BooleanCallbackProxy);
|
|
204
|
+
return await proxy;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
public override async Task<bool> SetExternalUserId(string externalId, string authHash = null) {
|
|
208
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
209
|
+
_setExternalUserId(externalId, authHash, hashCode, BooleanCallbackProxy);
|
|
210
|
+
return await proxy;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
public override async Task<bool> SetEmail(string email, string authHash = null) {
|
|
214
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
215
|
+
_setEmail(email, authHash, hashCode, BooleanCallbackProxy);
|
|
216
|
+
return await proxy;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
public override async Task<bool> SetSMSNumber(string smsNumber, string authHash = null) {
|
|
220
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
221
|
+
_setSMSNumber(smsNumber, authHash, hashCode, BooleanCallbackProxy);
|
|
222
|
+
return await proxy;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public override async Task<bool> LogOutEmail() {
|
|
226
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
227
|
+
_logoutEmail(hashCode, BooleanCallbackProxy);
|
|
228
|
+
return await proxy;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public override async Task<bool> LogOutSMS() {
|
|
232
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
233
|
+
_logoutSMSNumber(hashCode, BooleanCallbackProxy);
|
|
234
|
+
return await proxy;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
public override async Task<bool> SetLanguage(string languageCode) {
|
|
238
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
239
|
+
_setLanguage(languageCode, hashCode, BooleanCallbackProxy);
|
|
240
|
+
return await proxy;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
public override void PromptLocation()
|
|
244
|
+
=> _promptLocation();
|
|
245
|
+
|
|
246
|
+
public override bool ShareLocation {
|
|
247
|
+
get => _getShareLocation();
|
|
248
|
+
set => _setShareLocation(value);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
public override async Task<bool> SendOutcome(string name) {
|
|
252
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
253
|
+
_sendOutcome(name, hashCode, BooleanCallbackProxy);
|
|
254
|
+
return await proxy;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public override async Task<bool> SendUniqueOutcome(string name) {
|
|
258
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
259
|
+
_sendUniqueOutcome(name, hashCode, BooleanCallbackProxy);
|
|
260
|
+
return await proxy;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
public override async Task<bool> SendOutcomeWithValue(string name, float value) {
|
|
264
|
+
var (proxy, hashCode) = _setupProxy<bool>();
|
|
265
|
+
_sendOutcomeWithValue(name, value, hashCode, BooleanCallbackProxy);
|
|
266
|
+
return await proxy;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
458
269
|
}
|