@@ -88,7 +88,7 @@ static void injectSelector(Class newClass, SEL newSel, Class addToClass, SEL mak
88
88
89
89
@interface OSUnityPermissionAndSubscriptionObserver : NSObject <OSPermissionObserver, OSSubscriptionObserver>
90
90
- (void )onOSPermissionChanged : (OSPermissionStateChanges*)stateChanges ;
91
- - (void )onOSSubscriptionChanged : (OSSubscriptionStateChanges*)stateChanges ;
91
+ - (void )onOSSubscriptionChanged : (OSSubscriptionStateChanges*)stateChanges ;
92
92
- (void )onOSEmailSubscriptionChanged : (OSEmailSubscriptionStateChanges *)stateChanges ;
93
93
@end
94
94
@@ -99,10 +99,10 @@ - (void)onOSPermissionChanged:(OSPermissionStateChanges*)stateChanges {
99
99
100
100
- (void )onOSSubscriptionChanged : (OSSubscriptionStateChanges*)stateChanges {
101
101
UnitySendMessage (unityListener, " onOSSubscriptionChanged" , dictionaryToJsonChar ([stateChanges toDictionary ]));
102
- }
103
-
104
- - (void )onOSEmailSubscriptionStateChanged : (OSEmailSubscriptionStateChanges *)stateChanges {
105
- UnitySendMessage (unityListener, " onOSEmailSubscriptionStateChanged" , dictionaryToJsonChar ([stateChanges toDictionary ]));
102
+ }
103
+
104
+ - (void )onOSEmailSubscriptionStateChanged : (OSEmailSubscriptionStateChanges *)stateChanges {
105
+ UnitySendMessage (unityListener, " onOSEmailSubscriptionStateChanged" , dictionaryToJsonChar ([stateChanges toDictionary ]));
106
106
}
107
107
@end
108
108
@@ -116,10 +116,10 @@ + (void)load {
116
116
117
117
static Class delegateClass = nil ;
118
118
119
- - (void ) setOneSignalUnityDelegate : (id <UIApplicationDelegate>)delegate {
120
- if (delegateClass) {
121
- [self setOneSignalUnityDelegate: delegate];
122
- return ;
119
+ - (void ) setOneSignalUnityDelegate : (id <UIApplicationDelegate>)delegate {
120
+ if (delegateClass) {
121
+ [self setOneSignalUnityDelegate: delegate];
122
+ return ;
123
123
}
124
124
125
125
delegateClass = getClassWithProtocolInHierarchy ([delegate class ], @protocol (UIApplicationDelegate));
@@ -167,8 +167,8 @@ void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int dis
167
167
168
168
}
169
169
170
- void _init (const char * listenerName, const char * appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel, bool requiresUserPrivacyConsent) {
171
- [OneSignal setRequiresUserPrivacyConsent: requiresUserPrivacyConsent];
170
+ void _init (const char * listenerName, const char * appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel, bool requiresUserPrivacyConsent) {
171
+ [OneSignal setRequiresUserPrivacyConsent: requiresUserPrivacyConsent];
172
172
173
173
[OneSignal setLogLevel: logLevel visualLevel: visualLogLevel];
174
174
@@ -282,17 +282,17 @@ void _addSubscriptionObserver() {
282
282
283
283
void _removeSubscriptionObserver () {
284
284
[OneSignal removeSubscriptionObserver: osUnityObserver];
285
- }
286
-
287
- void _addEmailSubscriptionObserver () {
288
- if (!osUnityObserver)
289
- osUnityObserver = [OSUnityPermissionAndSubscriptionObserver alloc ];
290
-
291
- [OneSignal addEmailSubscriptionObserver: osUnityObserver];
292
- }
293
-
294
- void _removeEmailSubscriptionObserver () {
295
- [OneSignal removeEmailSubscriptionObserver: osUnityObserver];
285
+ }
286
+
287
+ void _addEmailSubscriptionObserver () {
288
+ if (!osUnityObserver)
289
+ osUnityObserver = [OSUnityPermissionAndSubscriptionObserver alloc ];
290
+
291
+ [OneSignal addEmailSubscriptionObserver: osUnityObserver];
292
+ }
293
+
294
+ void _removeEmailSubscriptionObserver () {
295
+ [OneSignal removeEmailSubscriptionObserver: osUnityObserver];
296
296
}
297
297
298
298
char * _getPermissionSubscriptionState () {
@@ -307,48 +307,56 @@ void _promptForPushNotificationsWithUserResponse() {
307
307
308
308
void _setOneSignalLogLevel (int logLevel, int visualLogLevel) {
309
309
[OneSignal setLogLevel: logLevel visualLevel: visualLogLevel];
310
- }
311
-
312
- // email
313
-
314
- void _setUnauthenticatedEmail (const char *email) {
315
- [OneSignal setEmail: CreateNSString (email) withSuccess: ^{
316
- UnitySendMessage (unityListener, " onSetEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
317
- } withFailure: ^(NSError *error) {
318
- UnitySendMessage (unityListener, " onSetEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
319
- }];
320
- }
321
-
322
- void _setEmail (const char *email, const char *emailAuthCode) {
323
- [OneSignal setEmail: CreateNSString (email) withEmailAuthHashToken: CreateNSString (emailAuthCode) withSuccess: ^{
324
- UnitySendMessage (unityListener, " onSetEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
325
- } withFailure: ^(NSError *error) {
326
- UnitySendMessage (unityListener, " onSetEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
327
- }];
328
- }
329
-
330
- void _logoutEmail () {
331
- [OneSignal logoutEmailWithSuccess: ^{
332
- UnitySendMessage (unityListener, " onLogoutEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
333
- } withFailure: ^(NSError *error) {
334
- UnitySendMessage (unityListener, " onLogoutEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
335
- }];
336
- }
337
-
338
- void _userDidProvideConsent (bool consent) {
339
- [OneSignal consentGranted: consent];
340
- }
341
-
342
- bool _userProvidedConsent () {
343
- return ![OneSignal requiresUserPrivacyConsent ];
344
- }
345
-
346
- void _setRequiresUserPrivacyConsent (bool required) {
347
- [OneSignal setRequiresUserPrivacyConsent: required];
348
- }
349
-
350
- void _setLocationShared (bool shared) {
351
- [OneSignal setLocationShared: shared];
310
+ }
311
+
312
+ // email
313
+
314
+ void _setUnauthenticatedEmail (const char *email) {
315
+ [OneSignal setEmail: CreateNSString (email) withSuccess: ^{
316
+ UnitySendMessage (unityListener, " onSetEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
317
+ } withFailure: ^(NSError *error) {
318
+ UnitySendMessage (unityListener, " onSetEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
319
+ }];
320
+ }
321
+
322
+ void _setEmail (const char *email, const char *emailAuthCode) {
323
+ [OneSignal setEmail: CreateNSString (email) withEmailAuthHashToken: CreateNSString (emailAuthCode) withSuccess: ^{
324
+ UnitySendMessage (unityListener, " onSetEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
325
+ } withFailure: ^(NSError *error) {
326
+ UnitySendMessage (unityListener, " onSetEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
327
+ }];
328
+ }
329
+
330
+ void _logoutEmail () {
331
+ [OneSignal logoutEmailWithSuccess: ^{
332
+ UnitySendMessage (unityListener, " onLogoutEmailSuccess" , dictionaryToJsonChar (@{@" status" : @" success" }));
333
+ } withFailure: ^(NSError *error) {
334
+ UnitySendMessage (unityListener, " onLogoutEmailFailure" , [[OneSignal parseNSErrorAsJsonString: error] UTF8String ]);
335
+ }];
336
+ }
337
+
338
+ void _userDidProvideConsent (bool consent) {
339
+ [OneSignal consentGranted: consent];
340
+ }
341
+
342
+ bool _userProvidedConsent () {
343
+ return ![OneSignal requiresUserPrivacyConsent ];
344
+ }
345
+
346
+ void _setRequiresUserPrivacyConsent (bool required) {
347
+ [OneSignal setRequiresUserPrivacyConsent: required];
348
+ }
349
+
350
+ void _setLocationShared (bool shared) {
351
+ [OneSignal setLocationShared: shared];
352
+ }
353
+
354
+ void _setExternalUserId (const char *externalId) {
355
+ [OneSignal setExternalUserId: CreateNSString (externalId)];
356
+ }
357
+
358
+ void _removeExternalUserId () {
359
+ [OneSignal removeExternalUserId ];
352
360
}
353
361
354
362
@end
0 commit comments