Skip to content

Commit a05dea3

Browse files
committed
Updated to latest native SDKs with bug fixes
* Compatibility fixes with other iOS notification plugins - Both local and remote on iOS 10 * Fixed issue with action.actionID and action.type not being set. * Fixed issue with nest additional data values on Android.
1 parent ba315f9 commit a05dea3

File tree

12 files changed

+36
-19
lines changed

12 files changed

+36
-19
lines changed

Unity4.7OneSignalExample/Assets/OneSignal/src/OneSignal.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,14 @@ private void onPushNotificationOpened(string jsonString) {
422422
Dictionary<string, object> jsonObject = Json.Deserialize(jsonString) as Dictionary<string, object>;
423423

424424
OSNotificationAction action = new OSNotificationAction();
425-
if (jsonObject.ContainsKey("actionID")) action.actionID = jsonObject["actionID"] as string;
426-
if (jsonObject.ContainsKey("type"))
427-
action.type = (OSNotificationAction.ActionType)Convert.ToInt32(jsonObject["type"]);
425+
if (jsonObject.ContainsKey("action")) {
426+
Dictionary<string, object> actionJsonObject = jsonObject["action"] as Dictionary<string, object>;
427+
428+
if (actionJsonObject.ContainsKey("actionID"))
429+
action.actionID = actionJsonObject["actionID"] as string;
430+
if (actionJsonObject.ContainsKey("type"))
431+
action.type = (OSNotificationAction.ActionType)Convert.ToInt32(actionJsonObject["type"]);
432+
}
428433

429434
OSNotificationOpenedResult result = new OSNotificationOpenedResult();
430435
result.notification = DictionaryToNotification((Dictionary<string, object>)jsonObject["notification"]);

Unity4.7OneSignalExample/Assets/OneSignal/src/OneSignalAndroid.cs

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public void DeleteTags(IList<string> keys) {
6262
mOneSignal.Call("deleteTags", Json.Serialize(keys));
6363
}
6464

65+
6566
public void IdsAvailable() {
6667
mOneSignal.Call("idsAvailable");
6768
}
Binary file not shown.

Unity4.7OneSignalExample/Assets/Plugins/iOS/OneSignal.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
@protocol OSUserNotificationCenterDelegate <NSObject>
5656
@optional
57-
- (void)userNotificationCenter:(id)center willPresentNotification:(id)notification withCompletionHandler:(void (^)(NSUInteger options))completionHandler;
58-
- (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)response withCompletionHandler:(void (^)())completionHandler;
57+
- (void)userNotificationCenter:(id)center willPresentNotification:(id)notification withCompletionHandler:(void (^)(NSUInteger options))completionHandler __deprecated_msg("Can use your own delegate as normal.");
58+
- (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)response withCompletionHandler:(void (^)())completionHandler __deprecated_msg("Can use your own delegate as normal.");
5959
@end
6060

6161
#endif
@@ -148,6 +148,9 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
148148
Set to false when app is in focus and in-app alerts are disabled, or the remote notification is silent. */
149149
@property(readonly, getter=wasShown)BOOL shown;
150150

151+
/* Set to true if the app was in focus when the notification */
152+
@property(readonly, getter=wasAppInFocus)BOOL isAppInFocus;
153+
151154
/* Set to true when the received notification is silent
152155
Silent means there is no alert, sound, or badge payload in the aps dictionary
153156
requires remote-notification within UIBackgroundModes array of the Info.plist */
@@ -233,7 +236,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
233236
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
234237
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback;
235238
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
236-
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
239+
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)erceivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
237240

238241
+ (NSString*)app_id;
239242

@@ -276,10 +279,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
276279
// Optional method that sends us the user's email as an anonymized hash so that we can better target and personalize notifications sent to that user across their devices.
277280
+ (void)syncHashedEmail:(NSString*)email;
278281

279-
// - iOS 10 BETA features currently only available on XCode 8 & iOS 10.0+
282+
// - iOS 10 features currently only available on XCode 8 & iOS 10.0+
280283
#if XC8_AVAILABLE
281-
+ (void)setNotificationCenterDelegate:(id<OSUserNotificationCenterDelegate>)delegate;
282-
+ (id<OSUserNotificationCenterDelegate>)notificationCenterDelegate;
284+
+ (void)setNotificationCenterDelegate:(id<OSUserNotificationCenterDelegate>)delegate __deprecated_msg("Can use your own delegate as normal.");
285+
+ (id<OSUserNotificationCenterDelegate>)notificationCenterDelegate __deprecated_msg("Can use your own delegate as normal.");
283286
#endif
284287

285288
@end
Binary file not shown.

Unity4.7OneSignalSDK.unitypackage

309 KB
Binary file not shown.
Binary file not shown.

Unity5OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignal.h

+9-6
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
@protocol OSUserNotificationCenterDelegate <NSObject>
5656
@optional
57-
- (void)userNotificationCenter:(id)center willPresentNotification:(id)notification withCompletionHandler:(void (^)(NSUInteger options))completionHandler;
58-
- (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)response withCompletionHandler:(void (^)())completionHandler;
57+
- (void)userNotificationCenter:(id)center willPresentNotification:(id)notification withCompletionHandler:(void (^)(NSUInteger options))completionHandler __deprecated_msg("Can use your own delegate as normal.");
58+
- (void)userNotificationCenter:(id)center didReceiveNotificationResponse:(id)response withCompletionHandler:(void (^)())completionHandler __deprecated_msg("Can use your own delegate as normal.");
5959
@end
6060

6161
#endif
@@ -148,6 +148,9 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
148148
Set to false when app is in focus and in-app alerts are disabled, or the remote notification is silent. */
149149
@property(readonly, getter=wasShown)BOOL shown;
150150

151+
/* Set to true if the app was in focus when the notification */
152+
@property(readonly, getter=wasAppInFocus)BOOL isAppInFocus;
153+
151154
/* Set to true when the received notification is silent
152155
Silent means there is no alert, sound, or badge payload in the aps dictionary
153156
requires remote-notification within UIBackgroundModes array of the Info.plist */
@@ -233,7 +236,7 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
233236
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
234237
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback;
235238
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
236-
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
239+
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)erceivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
237240

238241
+ (NSString*)app_id;
239242

@@ -276,10 +279,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
276279
// Optional method that sends us the user's email as an anonymized hash so that we can better target and personalize notifications sent to that user across their devices.
277280
+ (void)syncHashedEmail:(NSString*)email;
278281

279-
// - iOS 10 BETA features currently only available on XCode 8 & iOS 10.0+
282+
// - iOS 10 features currently only available on XCode 8 & iOS 10.0+
280283
#if XC8_AVAILABLE
281-
+ (void)setNotificationCenterDelegate:(id<OSUserNotificationCenterDelegate>)delegate;
282-
+ (id<OSUserNotificationCenterDelegate>)notificationCenterDelegate;
284+
+ (void)setNotificationCenterDelegate:(id<OSUserNotificationCenterDelegate>)delegate __deprecated_msg("Can use your own delegate as normal.");
285+
+ (id<OSUserNotificationCenterDelegate>)notificationCenterDelegate __deprecated_msg("Can use your own delegate as normal.");
283286
#endif
284287

285288
@end
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.1.1

Unity5OneSignalExample/Assets/OneSignal/src/OneSignal.cs

+8-3
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,14 @@ private void onPushNotificationOpened(string jsonString) {
422422
Dictionary<string, object> jsonObject = Json.Deserialize(jsonString) as Dictionary<string, object>;
423423

424424
OSNotificationAction action = new OSNotificationAction();
425-
if (jsonObject.ContainsKey("actionID")) action.actionID = jsonObject["actionID"] as string;
426-
if (jsonObject.ContainsKey("type"))
427-
action.type = (OSNotificationAction.ActionType)Convert.ToInt32(jsonObject["type"]);
425+
if (jsonObject.ContainsKey("action")) {
426+
Dictionary<string, object> actionJsonObject = jsonObject["action"] as Dictionary<string, object>;
427+
428+
if (actionJsonObject.ContainsKey("actionID"))
429+
action.actionID = actionJsonObject["actionID"] as string;
430+
if (actionJsonObject.ContainsKey("type"))
431+
action.type = (OSNotificationAction.ActionType)Convert.ToInt32(actionJsonObject["type"]);
432+
}
428433

429434
OSNotificationOpenedResult result = new OSNotificationOpenedResult();
430435
result.notification = DictionaryToNotification((Dictionary<string, object>)jsonObject["notification"]);

Unity5OneSignalSDK.unitypackage

312 KB
Binary file not shown.

0 commit comments

Comments
 (0)