com.onesignal.unity.ios 5.0.0 → 5.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.
@@ -71,6 +71,8 @@ typedef void (*ClickListenerDelegate)(const char* notification, const char* resu
71
71
  [OneSignal.Notifications addPermissionObserver:self];
72
72
  [OneSignal.Notifications addForegroundLifecycleListener:self];
73
73
  [OneSignal.Notifications addClickListener:self];
74
+
75
+ _willDisplayEvents = [NSMutableDictionary new];
74
76
  }
75
77
 
76
78
  return self;
@@ -84,10 +86,10 @@ typedef void (*ClickListenerDelegate)(const char* notification, const char* resu
84
86
 
85
87
  - (void)onWillDisplayNotification:(OSNotificationWillDisplayEvent *)event {
86
88
  if (_willDisplayDelegate != nil) {
89
+ _willDisplayEvents[event.notification.notificationId] = event;
90
+
87
91
  NSString *stringNotification = [event.notification stringify];
88
92
  _willDisplayDelegate([stringNotification UTF8String]);
89
-
90
- _willDisplayEvents[event.notification.notificationId] = event;
91
93
  }
92
94
  }
93
95
 
@@ -80,6 +80,7 @@ typedef void (*StateListenerDelegate)(const char* current, const char* previous)
80
80
 
81
81
  /*
82
82
  * Bridge methods
83
+ * We use strdup because Unity attempts to free the memory after we return the value
83
84
  */
84
85
 
85
86
  extern "C" {
@@ -156,11 +157,11 @@ extern "C" {
156
157
  }
157
158
 
158
159
  const char* _pushSubscriptionGetId() {
159
- return [OneSignal.User.pushSubscription.id UTF8String];
160
+ return strdup([OneSignal.User.pushSubscription.id UTF8String]);
160
161
  }
161
162
 
162
163
  const char* _pushSubscriptionGetToken() {
163
- return [OneSignal.User.pushSubscription.token UTF8String];
164
+ return strdup([OneSignal.User.pushSubscription.token UTF8String]);
164
165
  }
165
166
 
166
167
  bool _pushSubscriptionGetOptedIn() {
@@ -96,7 +96,7 @@ static bool swizzled = false;
96
96
 
97
97
  - (BOOL)oneSignalApplication:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
98
98
  [OneSignalWrapper setSdkType:@"unity"];
99
- [OneSignalWrapper setSdkVersion:@"050000"];
99
+ [OneSignalWrapper setSdkVersion:@"050002"];
100
100
  [OneSignal setLaunchOptions:launchOptions];
101
101
 
102
102
  if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
@@ -114,7 +114,7 @@ namespace OneSignalSDK.iOS.Notifications {
114
114
  {
115
115
  // We use Send instead of Post because we need to *not* return to our caller until the
116
116
  // event handlers have returned themselves. This allows a handler to call PreventDefault()
117
- // which will get passed down to Android in InternalNotificationWillDisplayEventArgs.
117
+ // which will get passed down to iOS in InternalNotificationWillDisplayEventArgs.
118
118
  UnityMainThreadDispatch.Send(state => handler(_instance, args));
119
119
  }
120
120
  }
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": "5.0.0",
4
+ "version": "5.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": "5.0.0"
8
+ "com.onesignal.unity.core": "5.0.2"
9
9
  },
10
10
  "keywords": [
11
11
  "push-notifications",