com.onesignal.unity.ios 3.0.0-beta.6 → 3.0.2

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.
@@ -138,7 +138,7 @@ namespace OneSignalSDK {
138
138
  _project.AddFile(relativeDestination, entitlementFileName);
139
139
  _project.SetBuildProperty(targetGuid, "CODE_SIGN_ENTITLEMENTS", relativeDestination);
140
140
 
141
- return entitlementsPath;
141
+ return relativeDestination;
142
142
  }
143
143
 
144
144
  /// <summary>
@@ -163,13 +163,17 @@ namespace OneSignalSDK {
163
163
  /// </summary>
164
164
  private void AddNotificationServiceExtension() {
165
165
  #if !UNITY_CLOUD_BUILD
166
- // If file exists then the below has been completed before from another build
167
- // The below will not be updated on Append builds
168
- // Changes would most likely need to be made to support Append builds
169
- if (ExtensionCreatePlist(_outputPath))
166
+ // refresh plist and podfile on appends
167
+ ExtensionCreatePlist(_outputPath);
168
+ ExtensionAddPodsToTarget();
169
+
170
+ var extensionGuid = _project.TargetGuidByName(ServiceExtensionTargetName);
171
+
172
+ // skip target setup if already present
173
+ if (!string.IsNullOrEmpty(extensionGuid))
170
174
  return;
171
175
 
172
- var extensionGuid = _project.AddAppExtension(_project.GetMainTargetGuid(),
176
+ extensionGuid = _project.AddAppExtension(_project.GetMainTargetGuid(),
173
177
  ServiceExtensionTargetName,
174
178
  PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.iOS) + "." + ServiceExtensionTargetName,
175
179
  ServiceExtensionTargetName + "/" + "Info.plist" // Unix path as it's used by Xcode
@@ -196,8 +200,6 @@ namespace OneSignalSDK {
196
200
  projCapability.AddAppGroups(new[] { _appGroupName });
197
201
 
198
202
  projCapability.WriteToFile();
199
-
200
- ExtensionAddPodsToTarget();
201
203
  #endif
202
204
  }
203
205
 
@@ -232,7 +234,7 @@ namespace OneSignalSDK {
232
234
  notificationServicePlist.ReadFromFile(Path.Combine(PluginFilesPath, "Info.plist"));
233
235
  notificationServicePlist.root.SetString("CFBundleShortVersionString", PlayerSettings.bundleVersion);
234
236
  notificationServicePlist.root.SetString("CFBundleVersion", PlayerSettings.iOS.buildNumber);
235
-
237
+
236
238
  notificationServicePlist.WriteToFile(plistPath);
237
239
 
238
240
  return alreadyExists;
@@ -246,13 +248,6 @@ namespace OneSignalSDK {
246
248
  return;
247
249
  }
248
250
 
249
- var podfile = File.ReadAllText(podfilePath);
250
-
251
- var extensionEntryRegex = new Regex($@"target '{ServiceExtensionTargetName}' do\n(.+)\nend");
252
- if (extensionEntryRegex.IsMatch(podfile))
253
- return;
254
-
255
- var versionRegex = new Regex("(?<=<iosPod name=\"OneSignalXCFramework\" version=\").+(?=\" addToAllTargets=\"true\" />)");
256
251
  var dependenciesFilePath = Path.Combine(EditorFilesPath, DependenciesFilename);
257
252
 
258
253
  if (!File.Exists(dependenciesFilePath)) {
@@ -261,16 +256,26 @@ namespace OneSignalSDK {
261
256
  }
262
257
 
263
258
  var dependenciesFile = File.ReadAllText(dependenciesFilePath);
259
+ var dependenciesRegex = new Regex("(?<=<iosPod name=\"OneSignalXCFramework\" version=\").+(?=\" addToAllTargets=\"true\" />)");
264
260
 
265
- if (!versionRegex.IsMatch(dependenciesFile)) {
261
+ if (!dependenciesRegex.IsMatch(dependenciesFile)) {
266
262
  Debug.LogError($"Could not read current iOS framework dependency version from {DependenciesFilename}");
267
263
  return;
268
264
  }
269
265
 
270
- var version = versionRegex.Match(dependenciesFile)
271
- .ToString();
266
+ var podfile = File.ReadAllText(podfilePath);
267
+ var podfileRegex = new Regex($@"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '(.+)'\nend\n");
268
+
269
+ var requiredVersion = dependenciesRegex.Match(dependenciesFile).ToString();
270
+ var requiredTarget = $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '{requiredVersion}'\nend\n";
271
+
272
+ if (!podfileRegex.IsMatch(podfile))
273
+ podfile += requiredTarget;
274
+ else {
275
+ var podfileTarget = podfileRegex.Match(podfile).ToString();
276
+ podfile = podfile.Replace(podfileTarget, requiredTarget);
277
+ }
272
278
 
273
- podfile += $"target '{ServiceExtensionTargetName}' do\n pod 'OneSignalXCFramework', '{version}'\nend\n";
274
279
  File.WriteAllText(podfilePath, podfile);
275
280
  }
276
281
  }
@@ -35,18 +35,12 @@ namespace OneSignalSDK {
35
35
 
36
36
  public static string GetMainTargetGuid(this PBXProject project)
37
37
  => project.GetUnityMainTargetGuid();
38
-
39
- public static string GetFrameworkGuid(this PBXProject project)
40
- => project.GetUnityFrameworkTargetGuid();
41
38
  #else
42
39
  public static string GetMainTargetName(this PBXProject project)
43
40
  => PBXProject.GetUnityTargetName();
44
41
 
45
42
  public static string GetMainTargetGuid(this PBXProject project)
46
43
  => project.TargetGuidByName(PBXProject.GetUnityTargetName());
47
-
48
- public static string GetFrameworkGuid(this PBXProject project)
49
- => GetPBXProjectTargetGuid(project);
50
44
  #endif
51
45
  }
52
46
  }
@@ -97,24 +97,38 @@ namespace OneSignalSDK {
97
97
  _instance = this;
98
98
  }
99
99
 
100
+ /// <param name="response">OSNotification</param>
100
101
  [AOT.MonoPInvokeCallback(typeof(NotificationWillShowInForegroundDelegate))]
101
102
  private static bool _onNotificationReceived(string response) {
102
103
  if (_instance.NotificationWillShow == null)
103
104
  return true;
104
105
 
105
106
  var notification = JsonUtility.FromJson<Notification>(response);
106
-
107
- if (Json.Deserialize(response) is Dictionary<string, object> notifDict && notifDict.ContainsKey("additionalData"))
108
- notification.additionalData = notifDict["additionalData"] as Dictionary<string, object>;
107
+ _fillNotifFromObj(ref notification, Json.Deserialize(response));
109
108
 
110
109
  var resultNotif = _instance.NotificationWillShow(notification);
111
-
112
110
  return resultNotif != null;
113
111
  }
114
112
 
113
+ /// <param name="response">OSNotificationOpenedResult</param>
115
114
  [AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
116
- private static void _onNotificationOpened(string response)
117
- => _instance.NotificationOpened?.Invoke(JsonUtility.FromJson<NotificationOpenedResult>(response));
115
+ private static void _onNotificationOpened(string response) {
116
+ var notifOpenResult = JsonUtility.FromJson<NotificationOpenedResult>(response);
117
+
118
+ if (Json.Deserialize(response) is Dictionary<string, object> resultDict && resultDict.ContainsKey("notification"))
119
+ _fillNotifFromObj(ref notifOpenResult.notification, resultDict["notification"]);
120
+
121
+ if (DidInitialize)
122
+ _instance.NotificationOpened?.Invoke(notifOpenResult);
123
+ else {
124
+ void invokeOpened(string appId) {
125
+ OnInitialize -= invokeOpened;
126
+ _instance.NotificationOpened?.Invoke(notifOpenResult);
127
+ }
128
+
129
+ OnInitialize += invokeOpened;
130
+ }
131
+ }
118
132
 
119
133
  [AOT.MonoPInvokeCallback(typeof(StringListenerDelegate))]
120
134
  private static void _onInAppMessageWillDisplay(string response)
@@ -58,8 +58,10 @@ namespace OneSignalSDK {
58
58
  [DllImport("__Internal")] private static extern bool _getPrivacyConsent();
59
59
  [DllImport("__Internal")] private static extern void _setRequiresPrivacyConsent(bool required);
60
60
  [DllImport("__Internal")] private static extern bool _getRequiresPrivacyConsent();
61
+ [DllImport("__Internal")] private static extern void _setLaunchURLsInApp(bool launchInApp);
61
62
  [DllImport("__Internal")] private static extern void _initialize(string appId);
62
63
  [DllImport("__Internal")] private static extern void _promptForPushNotificationsWithUserResponse(int hashCode, BooleanResponseDelegate callback);
64
+ [DllImport("__Internal")] private static extern void _disablePush(bool disable);
63
65
  [DllImport("__Internal")] private static extern void _postNotification(string optionsJson, int hashCode, StringResponseDelegate callback);
64
66
  [DllImport("__Internal")] private static extern void _setTrigger(string key, string value);
65
67
  [DllImport("__Internal")] private static extern void _setTriggers(string triggersJson);
@@ -80,6 +82,7 @@ namespace OneSignalSDK {
80
82
  [DllImport("__Internal")] private static extern void _setEmail(string email, string authHash, int hashCode, BooleanResponseDelegate callback);
81
83
  [DllImport("__Internal")] private static extern void _setSMSNumber(string smsNumber, string authHash, int hashCode, BooleanResponseDelegate callback);
82
84
 
85
+ [DllImport("__Internal")] private static extern void _removeExternalUserId(int hashCode, BooleanResponseDelegate callback);
83
86
  [DllImport("__Internal")] private static extern void _logoutEmail(int hashCode, BooleanResponseDelegate callback);
84
87
  [DllImport("__Internal")] private static extern void _logoutSMSNumber(int hashCode, BooleanResponseDelegate callback);
85
88
 
@@ -26,6 +26,8 @@
26
26
  */
27
27
 
28
28
  using System;
29
+ using System.Collections.Generic;
30
+ using UnityEngine;
29
31
 
30
32
  namespace OneSignalSDK {
31
33
  public sealed partial class OneSignalIOS : OneSignal {
@@ -76,5 +78,19 @@ namespace OneSignalSDK {
76
78
  public static implicit operator NotificationPermission(NotificationPermissionState source)
77
79
  => (NotificationPermission)source.status;
78
80
  }
81
+
82
+ private static void _fillNotifFromObj(ref Notification notif, object notifObj) {
83
+ if (!(notifObj is Dictionary<string, object> notifDict))
84
+ return;
85
+
86
+ if (notifDict.ContainsKey("additionalData"))
87
+ notif.additionalData = notifDict["additionalData"] as Dictionary<string, object>;
88
+
89
+ if (notifDict.ContainsKey("attachments"))
90
+ notif.attachments = notifDict["attachments"] as Dictionary<string, object>;
91
+
92
+ if (notifDict.ContainsKey("rawPayload") && notifDict["rawPayload"] is Dictionary<string, object> payloadDict)
93
+ notif.rawPayload = Json.Serialize(payloadDict);
94
+ }
79
95
  }
80
96
  }
@@ -86,6 +86,9 @@ namespace OneSignalSDK {
86
86
  set => _setRequiresPrivacyConsent(value);
87
87
  }
88
88
 
89
+ public override void SetLaunchURLsInApp(bool launchInApp)
90
+ => _setLaunchURLsInApp(launchInApp);
91
+
89
92
  public override void Initialize(string appId) {
90
93
  _initialize(appId);
91
94
  _completedInit(appId);
@@ -100,6 +103,14 @@ namespace OneSignalSDK {
100
103
  public override void ClearOneSignalNotifications()
101
104
  => SDKDebug.Info("ClearOneSignalNotifications invoked on iOS, does nothing");
102
105
 
106
+ public override bool PushEnabled {
107
+ get {
108
+ var deviceState = JsonUtility.FromJson<DeviceState>(_getDeviceState());
109
+ return !deviceState.isPushDisabled;
110
+ }
111
+ set => _disablePush(!value);
112
+ }
113
+
103
114
  public override async Task<Dictionary<string, object>> PostNotification(Dictionary<string, object> options) {
104
115
  var (proxy, hashCode) = _setupProxy<string>();
105
116
  _postNotification(Json.Serialize(options), hashCode, StringCallbackProxy);
@@ -181,6 +192,12 @@ namespace OneSignalSDK {
181
192
  return await proxy;
182
193
  }
183
194
 
195
+ public override async Task<bool> RemoveExternalUserId() {
196
+ var (proxy, hashCode) = _setupProxy<bool>();
197
+ _removeExternalUserId(hashCode, BooleanCallbackProxy);
198
+ return await proxy;
199
+ }
200
+
184
201
  public override async Task<bool> LogOutEmail() {
185
202
  var (proxy, hashCode) = _setupProxy<bool>();
186
203
  _logoutEmail(hashCode, BooleanCallbackProxy);
@@ -25,7 +25,7 @@
25
25
  <key>NSExtensionPointIdentifier</key>
26
26
  <string>com.apple.usernotifications.service</string>
27
27
  <key>NSExtensionPrincipalClass</key>
28
- <string>NotificationService</string>
28
+ <string>$(PRODUCT_MODULE_NAME).NotificationService</string>
29
29
  </dict>
30
30
  </dict>
31
31
  </plist>
@@ -12,7 +12,7 @@ PluginImporter:
12
12
  validateReferences: 1
13
13
  platformData:
14
14
  - first:
15
- Any:
15
+ Any:
16
16
  second:
17
17
  enabled: 0
18
18
  settings: {}
@@ -25,13 +25,13 @@ PluginImporter:
25
25
  - first:
26
26
  iPhone: iOS
27
27
  second:
28
- enabled: 1
28
+ enabled: 0
29
29
  settings: {}
30
30
  - first:
31
31
  tvOS: tvOS
32
32
  second:
33
- enabled: 1
33
+ enabled: 0
34
34
  settings: {}
35
- userData:
36
- assetBundleName:
37
- assetBundleVariant:
35
+ userData:
36
+ assetBundleName:
37
+ assetBundleVariant:
@@ -216,15 +216,15 @@ void _setEmailSubscriptionStateChangedCallback(StateListenerDelegate callback) {
216
216
  [[OneSignalObserver sharedObserver] setEmailDelegate:callback];
217
217
  }
218
218
 
219
- void _setSMSSubscriptionStateChangedCallback(StateListenerDelegate callback) {
220
- [[OneSignalObserver sharedObserver] setSmsDelegate:callback];
221
- }
222
-
223
- const char* _getDeviceState() {
224
- auto deviceState = [OneSignal getDeviceState];
225
- auto stateStr = jsonStringFromDictionary([deviceState jsonRepresentation]);
226
- return strdup(stateStr);
227
- }
219
+ void _setSMSSubscriptionStateChangedCallback(StateListenerDelegate callback) {
220
+ [[OneSignalObserver sharedObserver] setSmsDelegate:callback];
221
+ }
222
+
223
+ const char* _getDeviceState() {
224
+ auto deviceState = [OneSignal getDeviceState];
225
+ auto stateStr = jsonStringFromDictionary([deviceState jsonRepresentation]);
226
+ return strdup(stateStr);
227
+ }
228
228
 
229
229
  void _setLogLevel(int logLevel, int alertLevel) {
230
230
  [OneSignal setLogLevel:(ONE_S_LOG_LEVEL) logLevel
@@ -247,6 +247,10 @@ bool _getRequiresPrivacyConsent() {
247
247
  return [OneSignal requiresUserPrivacyConsent];
248
248
  }
249
249
 
250
+ void _setLaunchURLsInApp(bool launchInApp) {
251
+ [OneSignal setLaunchURLsInApp: launchInApp];
252
+ }
253
+
250
254
  void _initialize(const char* appId) {
251
255
  [OneSignal setAppId:TO_NSSTRING(appId)];
252
256
  [OneSignal initWithLaunchOptions:nil];
@@ -258,6 +262,10 @@ void _promptForPushNotificationsWithUserResponse(int hashCode, BooleanResponseDe
258
262
  }];
259
263
  }
260
264
 
265
+ void _disablePush(bool disable) {
266
+ [OneSignal disablePush:disable];
267
+ }
268
+
261
269
  void _postNotification(const char* optionsJson, int hashCode, StringResponseDelegate callback) {
262
270
  NSDictionary *options = objFromJsonString<NSDictionary*>(optionsJson);
263
271
 
@@ -369,6 +377,11 @@ void _setSMSNumber(const char* smsNumber, const char* authHash, int hashCode, Bo
369
377
  withFailure:^(NSError *error) { CALLBACK(NO); }];
370
378
  }
371
379
 
380
+ void _removeExternalUserId(int hashCode, BooleanResponseDelegate callback) {
381
+ [OneSignal removeExternalUserId:^(NSDictionary *results) { CALLBACK(YES); }
382
+ withFailure:^(NSError *error) { CALLBACK(NO); }];
383
+ }
384
+
372
385
  void _logoutEmail(int hashCode, BooleanResponseDelegate callback) {
373
386
  [OneSignal logoutEmailWithSuccess:^{ CALLBACK(YES); }
374
387
  withFailure:^(NSError *error) { CALLBACK(NO); }];
@@ -376,18 +389,18 @@ void _logoutEmail(int hashCode, BooleanResponseDelegate callback) {
376
389
 
377
390
  void _logoutSMSNumber(int hashCode, BooleanResponseDelegate callback) {
378
391
  [OneSignal logoutSMSNumberWithSuccess:^(NSDictionary *results) { CALLBACK(YES); }
379
- withFailure:^(NSError *error) { CALLBACK(NO); }];
380
- }
392
+ withFailure:^(NSError *error) { CALLBACK(NO); }];
393
+ }
381
394
 
382
- void _setLanguage(const char* languageCode, int hashCode, BooleanResponseDelegate callback) {
383
- [OneSignal setLanguage:TO_NSSTRING(languageCode)
384
- withSuccess:^{ CALLBACK(YES); }
385
- withFailure:^(NSError *error) { CALLBACK(NO); }];
386
- }
395
+ void _setLanguage(const char* languageCode, int hashCode, BooleanResponseDelegate callback) {
396
+ [OneSignal setLanguage:TO_NSSTRING(languageCode)
397
+ withSuccess:^{ CALLBACK(YES); }
398
+ withFailure:^(NSError *error) { CALLBACK(NO); }];
399
+ }
387
400
 
388
- void _promptLocation() {
389
- [OneSignal promptLocation];
390
- }
401
+ void _promptLocation() {
402
+ [OneSignal promptLocation];
403
+ }
391
404
 
392
405
  void _setShareLocation(bool share) {
393
406
  [OneSignal setLocationShared:share];
@@ -0,0 +1,32 @@
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
+ #import <UIKit/UIKit.h>
29
+
30
+ @interface UIApplication (OneSignalUnity)
31
+ @end
32
+
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a4a2cda353724bccbd11343516cb4c27
3
+ timeCreated: 1649879476
@@ -0,0 +1,105 @@
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
+ #import "UIApplication+OneSignalUnity.h"
29
+ #import <OneSignal/OneSignal.h>
30
+ #import <objc/runtime.h>
31
+
32
+ // from OneSignalSelectorHelpers.m
33
+ static Class getClassWithProtocolInHierarchy(Class searchClass, Protocol *protocolToFind) {
34
+ if (!class_conformsToProtocol(searchClass, protocolToFind)) {
35
+ if ([searchClass superclass] == [NSObject class])
36
+ return nil;
37
+ Class foundClass = getClassWithProtocolInHierarchy([searchClass superclass], protocolToFind);
38
+ if (foundClass)
39
+ return foundClass;
40
+ return searchClass;
41
+ }
42
+ return searchClass;
43
+ }
44
+
45
+ // from OneSignalSelectorHelpers.m
46
+ BOOL injectSelector(Class newClass, SEL newSel, Class addToClass, SEL makeLikeSel) {
47
+ Method newMeth = class_getInstanceMethod(newClass, newSel);
48
+ IMP imp = method_getImplementation(newMeth);
49
+
50
+ const char* methodTypeEncoding = method_getTypeEncoding(newMeth);
51
+ BOOL existing = class_getInstanceMethod(addToClass, makeLikeSel) != NULL;
52
+
53
+ if (existing) {
54
+ class_addMethod(addToClass, newSel, imp, methodTypeEncoding);
55
+ newMeth = class_getInstanceMethod(addToClass, newSel);
56
+ Method orgMeth = class_getInstanceMethod(addToClass, makeLikeSel);
57
+ method_exchangeImplementations(orgMeth, newMeth);
58
+ }
59
+ else {
60
+ class_addMethod(addToClass, makeLikeSel, imp, methodTypeEncoding);
61
+ }
62
+
63
+ return existing;
64
+ }
65
+
66
+ static bool swizzled = false;
67
+
68
+ @implementation UIApplication (OneSignalUnity)
69
+
70
+ + (void)load {
71
+ method_exchangeImplementations(
72
+ class_getInstanceMethod(self, @selector(setDelegate:)),
73
+ class_getInstanceMethod(self, @selector(setOneSignalUnityDelegate:))
74
+ );
75
+ }
76
+
77
+ - (void)setOneSignalUnityDelegate:(id <UIApplicationDelegate>)delegate {
78
+ if (swizzled) {
79
+ [self setOneSignalUnityDelegate:delegate];
80
+ return;
81
+ }
82
+
83
+ Class delegateClass = getClassWithProtocolInHierarchy([delegate class], @protocol(UIApplicationDelegate));
84
+
85
+ injectSelector(
86
+ self.class, @selector(oneSignalApplication:didFinishLaunchingWithOptions:),
87
+ delegateClass, @selector(application:didFinishLaunchingWithOptions:)
88
+ );
89
+
90
+ swizzled = true;
91
+
92
+ [self setOneSignalUnityDelegate:delegate];
93
+ }
94
+
95
+ - (BOOL)oneSignalApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
96
+ [OneSignal setMSDKType:@"unity"];
97
+ [OneSignal initWithLaunchOptions:launchOptions];
98
+
99
+ if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
100
+ return [self oneSignalApplication:application didFinishLaunchingWithOptions:launchOptions];
101
+
102
+ return YES;
103
+ }
104
+
105
+ @end
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: a8e9b06e260e4c0ca80d5e51137d89d3
3
+ timeCreated: 1649879476
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "com.onesignal.unity.ios",
3
3
  "displayName": "OneSignal Unity SDK - iOS",
4
- "version": "3.0.0-beta.6",
4
+ "version": "3.0.2",
5
5
  "unity": "2018.4",
6
6
  "description": "OneSignal is the market leader in customer engagement, powering mobile push, web push, email, and in-app messages.",
7
7
  "dependencies": {
8
- "com.onesignal.unity.core": "3.0.0-beta.6"
8
+ "com.onesignal.unity.core": "3.0.2"
9
9
  },
10
10
  "keywords": [
11
11
  "push-notifications",