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.
Files changed (33) hide show
  1. package/Editor/BuildPostProcessor.cs +297 -0
  2. package/Editor/{PostProcessBuildPlayer_iOS.cs.meta → BuildPostProcessor.cs.meta} +0 -0
  3. package/Editor/OneSignalIOSDependencies.xml +5 -0
  4. package/Editor/OneSignalIOSDependencies.xml.meta +3 -0
  5. package/Editor/PBXProjectExtensions.cs +52 -0
  6. package/Editor/PBXProjectExtensions.cs.meta +3 -0
  7. package/Runtime/AssemblyInfo.cs +28 -1
  8. package/Runtime/OneSignal.iOS.asmdef +4 -3
  9. package/Runtime/OneSignalIOS.Callbacks.cs +174 -0
  10. package/Runtime/OneSignalIOS.Callbacks.cs.meta +3 -0
  11. package/Runtime/OneSignalIOS.Interface.cs +99 -0
  12. package/Runtime/OneSignalIOS.Interface.cs.meta +3 -0
  13. package/Runtime/OneSignalIOS.cs +268 -457
  14. package/Runtime/OneSignalIOS.cs.meta +3 -10
  15. package/Runtime/OneSignalIOSInit.cs +39 -9
  16. package/Runtime/Plugins/iOS/Info.plist.meta +1 -3
  17. package/Runtime/Plugins/iOS/NotificationService.swift +25 -0
  18. package/Runtime/Plugins/iOS/{NotificationService.m.meta → NotificationService.swift.meta} +5 -4
  19. package/Runtime/Plugins/iOS/OneSignalUnityBridge.mm +417 -0
  20. package/Runtime/Plugins/iOS/{OneSignal.h.meta → OneSignalUnityBridge.mm.meta} +16 -5
  21. package/Runtime/Utilities/Later.cs +64 -0
  22. package/Runtime/Utilities/Later.cs.meta +11 -0
  23. package/Runtime/Utilities.meta +3 -0
  24. package/package.json +2 -2
  25. package/Editor/PostProcessBuildPlayer_iOS.cs +0 -399
  26. package/Runtime/Plugins/iOS/NotificationService.h +0 -13
  27. package/Runtime/Plugins/iOS/NotificationService.h.meta +0 -26
  28. package/Runtime/Plugins/iOS/NotificationService.m +0 -40
  29. package/Runtime/Plugins/iOS/OneSignal.h +0 -617
  30. package/Runtime/Plugins/iOS/OneSignalUnityRuntime.m +0 -542
  31. package/Runtime/Plugins/iOS/OneSignalUnityRuntime.m.meta +0 -24
  32. package/Runtime/Plugins/iOS/libOneSignal.a +0 -0
  33. package/Runtime/Plugins/iOS/libOneSignal.a.meta +0 -21
@@ -1,458 +1,269 @@
1
- /*
2
- * Modified MIT License
3
- *
4
- * Copyright 2017 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.Runtime.InteropServices;
29
- using System.Collections.Generic;
30
- using System;
31
-
32
- class OneSignalIOS : IOneSignalPlatform
33
- {
34
- [DllImport("__Internal")]
35
- public static extern void _init(string listenerName, string appId, bool autoPrompt, bool inAppLaunchUrLs,
36
- int displayOption, int logLevel, int visualLogLevel, bool requiresUserPrivacyConsent);
37
-
38
- [DllImport("__Internal")]
39
- public static extern void _registerForPushNotifications();
40
-
41
- [DllImport("__Internal")]
42
- public static extern void _sendTag(string tagName, string tagValue);
43
-
44
- [DllImport("__Internal")]
45
- public static extern void _sendTags(string tags);
46
-
47
- [DllImport("__Internal")]
48
- public static extern void _getTags(string delegateId);
49
-
50
- [DllImport("__Internal")]
51
- public static extern void _deleteTag(string key);
52
-
53
- [DllImport("__Internal")]
54
- public static extern void _deleteTags(string keys);
55
-
56
- [DllImport("__Internal")]
57
- public static extern void _idsAvailable(string delegateId);
58
-
59
- [DllImport("__Internal")]
60
- public static extern void _setSubscription(bool enable);
61
-
62
- [DllImport("__Internal")]
63
- public static extern void _postNotification(string delegateIdSuccess, string delegateIdFailure, string json);
64
-
65
- [DllImport("__Internal")]
66
- public static extern void _syncHashedEmail(string email);
67
-
68
- [DllImport("__Internal")]
69
- public static extern void _promptLocation();
70
-
71
- [DllImport("__Internal")]
72
- public static extern void _setInFocusDisplayType(int type);
73
-
74
- [DllImport("__Internal")]
75
- public static extern void _promptForPushNotificationsWithUserResponse();
76
-
77
- [DllImport("__Internal")]
78
- public static extern void _addPermissionObserver();
79
-
80
- [DllImport("__Internal")]
81
- public static extern void _removePermissionObserver();
82
-
83
- [DllImport("__Internal")]
84
- public static extern void _addSubscriptionObserver();
85
-
86
- [DllImport("__Internal")]
87
- public static extern void _removeSubscriptionObserver();
88
-
89
- [DllImport("__Internal")]
90
- public static extern void _addEmailSubscriptionObserver();
91
-
92
- [DllImport("__Internal")]
93
- public static extern void _removeEmailSubscriptionObserver();
94
-
95
- [DllImport("__Internal")]
96
- public static extern string _getPermissionSubscriptionState();
97
-
98
- [DllImport("__Internal")]
99
- public static extern void _setUnauthenticatedEmail(string delegateIdSuccess, string delegateIdFailure,
100
- string email);
101
-
102
- [DllImport("__Internal")]
103
- public static extern void _setEmail(string delegateIdSuccess, string delegateIdFailure, string email,
104
- string emailAuthCode);
105
-
106
- [DllImport("__Internal")]
107
- public static extern void _logoutEmail(string delegateIdSuccess, string delegateIdFailure);
108
-
109
- [DllImport("__Internal")]
110
- public static extern void _setOneSignalLogLevel(int logLevel, int visualLogLevel);
111
-
112
- [DllImport("__Internal")]
113
- public static extern void _userDidProvideConsent(bool consent);
114
-
115
- [DllImport("__Internal")]
116
- public static extern bool _userProvidedConsent();
117
-
118
- [DllImport("__Internal")]
119
- public static extern void _setRequiresUserPrivacyConsent(bool required);
120
-
121
- [DllImport("__Internal")]
122
- public static extern void _setLocationShared(bool enable);
123
-
124
- [DllImport("__Internal")]
125
- public static extern void _setExternalUserId(string delegateId, string externalId);
126
-
127
- [DllImport("__Internal")]
128
- public static extern void _setExternalUserIdWithAuthToken(string delegateId, string delegateIdFailure,
129
- string externalId, string authHashToken);
130
-
131
- [DllImport("__Internal")]
132
- public static extern void _removeExternalUserId(string delegateId);
133
-
134
- [DllImport("__Internal")]
135
- public static extern void _addTriggers(string triggers);
136
-
137
- [DllImport("__Internal")]
138
- public static extern void _removeTriggerForKey(string key);
139
-
140
- [DllImport("__Internal")]
141
- public static extern void _removeTriggersForKeys(string keys);
142
-
143
- [DllImport("__Internal")]
144
- public static extern string _getTriggerValueForKey(string key);
145
-
146
- [DllImport("__Internal")]
147
- public static extern void _pauseInAppMessages(bool pause);
148
-
149
- [DllImport("__Internal")]
150
- public static extern void _sendOutcome(string delegateId, string name);
151
-
152
- [DllImport("__Internal")]
153
- public static extern void _sendUniqueOutcome(string delegateId, string name);
154
-
155
- [DllImport("__Internal")]
156
- public static extern void _sendOutcomeWithValue(string delegateId, string name, float value);
157
-
158
- public void Init()
159
- {
160
- bool autoPrompt = true, inAppLaunchUrl = true;
161
- if (OneSignal.builder.iOSSettings != null)
162
- {
163
- if (OneSignal.builder.iOSSettings.ContainsKey(OneSignal.kOSSettingsAutoPrompt))
164
- autoPrompt = OneSignal.builder.iOSSettings[OneSignal.kOSSettingsAutoPrompt];
165
- if (OneSignal.builder.iOSSettings.ContainsKey(OneSignal.kOSSettingsInAppLaunchURL))
166
- inAppLaunchUrl = OneSignal.builder.iOSSettings[OneSignal.kOSSettingsInAppLaunchURL];
167
- }
168
-
169
- _init(OneSignal.GameObjectName, OneSignal.builder.appID,
170
- autoPrompt, inAppLaunchUrl, (int) OneSignal.inFocusDisplayType,
171
- (int) OneSignal.logLevel, (int) OneSignal.visualLogLevel, OneSignal.requiresUserConsent);
172
- }
173
-
174
- public void SetLocationShared(bool shared)
175
- {
176
- _setLocationShared(shared);
177
- }
178
-
179
- public void RegisterForPushNotifications()
180
- {
181
- _registerForPushNotifications();
182
- }
183
-
184
- public void SendTag(string tagName, string tagValue)
185
- {
186
- _sendTag(tagName, tagValue);
187
- }
188
-
189
- public void SendTags(IDictionary<string, string> tags)
190
- {
191
- _sendTags(Json.Serialize(tags));
192
- }
193
-
194
- public void GetTags(string delegateId)
195
- {
196
- _getTags(delegateId);
197
- }
198
-
199
- public void DeleteTag(string key)
200
- {
201
- _deleteTag(key);
202
- }
203
-
204
- public void DeleteTags(IList<string> keys)
205
- {
206
- _deleteTags(Json.Serialize(keys));
207
- }
208
-
209
- public void IdsAvailable(string delegateId)
210
- {
211
- _idsAvailable(delegateId);
212
- }
213
-
214
- public void SetSubscription(bool enable)
215
- {
216
- _setSubscription(enable);
217
- }
218
-
219
- public void PostNotification(string delegateIdSuccess, string delegateIdFailure,
220
- Dictionary<string, object> data)
221
- {
222
- _postNotification(delegateIdSuccess, delegateIdFailure, Json.Serialize(data));
223
- }
224
-
225
- public void SyncHashedEmail(string email)
226
- {
227
- _syncHashedEmail(email);
228
- }
229
-
230
- public void PromptLocation()
231
- {
232
- _promptLocation();
233
- }
234
-
235
- public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
236
- {
237
- _setOneSignalLogLevel((int) logLevel, (int) visualLevel);
238
- }
239
-
240
- public void SetInFocusDisplaying(OneSignal.OSInFocusDisplayOption display)
241
- {
242
- _setInFocusDisplayType((int) display);
243
- }
244
-
245
- public void PromptForPushNotificationsWithUserResponse()
246
- {
247
- _promptForPushNotificationsWithUserResponse();
248
- }
249
-
250
- public void AddPermissionObserver()
251
- {
252
- _addPermissionObserver();
253
- }
254
-
255
- public void RemovePermissionObserver()
256
- {
257
- _removePermissionObserver();
258
- }
259
-
260
- public void AddSubscriptionObserver()
261
- {
262
- _addSubscriptionObserver();
263
- }
264
-
265
- public void RemoveSubscriptionObserver()
266
- {
267
- _removeSubscriptionObserver();
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
  }