Skip to content

Commit

Permalink
Updated to iOS native SDK 2.3.2 and Android SDK 3.4.2
Browse files Browse the repository at this point in the history
iOS
* Fixes issues with opened and received callbacks.
* Added additional notification_types status for "No Push Token" to help debug issues which will show on the OneSignal dashboard.
* Fixed rare crash with postNotification.
* Fixed issue opening a 2nd URL notification not showing a webview.
* Fixed syncHashedEmail errors and added validation to input.
* Fixed issue where an iOS 10 media notification could hang the main thread when downloading it.

Android
* Added support for badges on older Samsung devices as well as OPPO an ZUK devices.
* Fixed SyncService logcat error.

Other
* Updated to 1.2.6.0 of unity-jar-resolver
  • Loading branch information
jkasten2 committed Dec 6, 2016
1 parent a05dea3 commit 56728e2
Show file tree
Hide file tree
Showing 35 changed files with 415 additions and 249 deletions.
2 changes: 1 addition & 1 deletion Unity4.7OneSignalExample/Assets/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.0
2.1.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.6.0.dll
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.6.0.dll
Assets/PlayServicesResolver/Editor/Google.VersionHandler_v1.2.6.0.dll

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@

<!-- Solid -->
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>

<!-- Huawei -->
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />

<!-- ZUK -->
<uses-permission android:name="android.permission.READ_APP_BADGE" />

<!-- OPPO -->
<uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />

<!-- End: ShortcutBadger -->

<application>
Expand Down
Binary file not shown.
24 changes: 7 additions & 17 deletions Unity4.7OneSignalExample/Assets/Plugins/iOS/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
#define XC8_AVAILABLE 1
#import <UserNotifications/UserNotifications.h>

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

#endif

/* The action type associated to an OSNotificationAction object */
Expand All @@ -80,9 +74,9 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {



/* iOS 10+
/*
Used as value type for `kOSSettingsKeyInFocusDisplayOption`
for setting the display option of a notification received while the app was in focus
for setting the display option of a notification received while the app was in focus.
*/
typedef OSNotificationDisplayType OSInFocusDisplayOption;

Expand Down Expand Up @@ -128,7 +122,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
@property(readonly)NSDictionary* attachments;

/* Action buttons passed */
@property(readonly)NSDictionary *actionButtons;
@property(readonly)NSArray *actionButtons;

/* Holds the original payload received
Keep the raw value for users that would like to root the push */
Expand Down Expand Up @@ -236,10 +230,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)erceivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;

+ (NSString*)app_id;

// Only use if you passed FALSE to autoRegister
+ (void)registerForPushNotifications;

Expand Down Expand Up @@ -271,18 +265,14 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)postNotification:(NSDictionary*)jsonData;
+ (void)postNotification:(NSDictionary*)jsonData onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
+ (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
+ (NSString*)parseNSErrorAsJsonString:(NSError*)error;

// - Request and track user's location
+ (void)promptLocation;
+ (void)setLocationShared:(BOOL)enable;

// - Sends the MD5 and SHA1 of the provided email
// 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.
+ (void)syncHashedEmail:(NSString*)email;

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

@end
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
}

- (BOOL)oneSignalApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] != nil)
initOneSignalObject(launchOptions, nil, 1, true, true);
initOneSignalObject(launchOptions, nil, 1, true, true);

if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
return [self oneSignalApplication:application didFinishLaunchingWithOptions:launchOptions];
Expand Down Expand Up @@ -155,7 +154,6 @@ void _sendTag(const char* tagName, const char* tagValue) {
}

void _sendTags(const char* tags) {

NSString * jsonString = CreateNSString(tags);

NSError* jsonError;
Expand All @@ -164,7 +162,6 @@ void _sendTags(const char* tags) {
NSDictionary* keyValuePairs = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonError];
if (jsonError == nil)
[OneSignal sendTags:keyValuePairs];
else {}
}

void _deleteTag(const char* key) {
Expand All @@ -180,7 +177,6 @@ void _deleteTags(const char* keys) {
NSArray* kk = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];
if (jsonError == nil)
[OneSignal deleteTags:kk];
else { }
}

void _getTags() {
Expand All @@ -191,7 +187,7 @@ void _getTags() {

void _idsAvailable() {
[OneSignal IdsAvailable:^(NSString* userId, NSString* pushToken) {
if(pushToken == nil)
if (pushToken == nil)
pushToken = @"";

UnitySendMessage(unityListener, "onIdsAvailable",
Expand All @@ -213,10 +209,8 @@ void _postNotification(const char* jsonData) {
[OneSignal postNotification:jsd onSuccess:^(NSDictionary* results) {
UnitySendMessage(unityListener, "onPostNotificationSuccess", dictionaryToJsonChar(results));
} onFailure:^(NSError* error) {
if (error.userInfo && error.userInfo[@"returned"])
UnitySendMessage(unityListener, "onPostNotificationFailed", dictionaryToJsonChar(error.userInfo[@"returned"]));
else
UnitySendMessage(unityListener, "onPostNotificationFailed", "{\"error\": \"HTTP no response error\"}");
NSString* parsedError = [OneSignal parseNSErrorAsJsonString:error];
UnitySendMessage(unityListener, "onPostNotificationFailed", [parsedError UTF8String]);
}];
}

Expand Down
Binary file modified Unity4.7OneSignalExample/Assets/Plugins/iOS/libOneSignal.a
Binary file not shown.
Binary file modified Unity4.7OneSignalSDK.unitypackage
Binary file not shown.
Binary file not shown.
24 changes: 7 additions & 17 deletions Unity5OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@
#define XC8_AVAILABLE 1
#import <UserNotifications/UserNotifications.h>

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

#endif

/* The action type associated to an OSNotificationAction object */
Expand All @@ -80,9 +74,9 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {



/* iOS 10+
/*
Used as value type for `kOSSettingsKeyInFocusDisplayOption`
for setting the display option of a notification received while the app was in focus
for setting the display option of a notification received while the app was in focus.
*/
typedef OSNotificationDisplayType OSInFocusDisplayOption;

Expand Down Expand Up @@ -128,7 +122,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
@property(readonly)NSDictionary* attachments;

/* Action buttons passed */
@property(readonly)NSDictionary *actionButtons;
@property(readonly)NSArray *actionButtons;

/* Holds the original payload received
Keep the raw value for users that would like to root the push */
Expand Down Expand Up @@ -236,10 +230,10 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)erceivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;
+ (id)initWithLaunchOptions:(NSDictionary*)launchOptions appId:(NSString*)appId handleNotificationReceived:(OSHandleNotificationReceivedBlock)receivedCallback handleNotificationAction:(OSHandleNotificationActionBlock)actionCallback settings:(NSDictionary*)settings;

+ (NSString*)app_id;

// Only use if you passed FALSE to autoRegister
+ (void)registerForPushNotifications;

Expand Down Expand Up @@ -271,18 +265,14 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
+ (void)postNotification:(NSDictionary*)jsonData;
+ (void)postNotification:(NSDictionary*)jsonData onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
+ (void)postNotificationWithJsonString:(NSString*)jsonData onSuccess:(OSResultSuccessBlock)successBlock onFailure:(OSFailureBlock)failureBlock;
+ (NSString*)parseNSErrorAsJsonString:(NSError*)error;

// - Request and track user's location
+ (void)promptLocation;
+ (void)setLocationShared:(BOOL)enable;

// - Sends the MD5 and SHA1 of the provided email
// 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.
+ (void)syncHashedEmail:(NSString*)email;

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

@end
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
}

- (BOOL)oneSignalApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] != nil)
initOneSignalObject(launchOptions, nil, 1, true, true);
initOneSignalObject(launchOptions, nil, 1, true, true);

if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
return [self oneSignalApplication:application didFinishLaunchingWithOptions:launchOptions];
Expand Down Expand Up @@ -155,7 +154,6 @@ void _sendTag(const char* tagName, const char* tagValue) {
}

void _sendTags(const char* tags) {

NSString * jsonString = CreateNSString(tags);

NSError* jsonError;
Expand All @@ -164,7 +162,6 @@ void _sendTags(const char* tags) {
NSDictionary* keyValuePairs = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:&jsonError];
if (jsonError == nil)
[OneSignal sendTags:keyValuePairs];
else {}
}

void _deleteTag(const char* key) {
Expand All @@ -180,7 +177,6 @@ void _deleteTags(const char* keys) {
NSArray* kk = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&jsonError];
if (jsonError == nil)
[OneSignal deleteTags:kk];
else { }
}

void _getTags() {
Expand All @@ -191,7 +187,7 @@ void _getTags() {

void _idsAvailable() {
[OneSignal IdsAvailable:^(NSString* userId, NSString* pushToken) {
if(pushToken == nil)
if (pushToken == nil)
pushToken = @"";

UnitySendMessage(unityListener, "onIdsAvailable",
Expand All @@ -213,10 +209,8 @@ void _postNotification(const char* jsonData) {
[OneSignal postNotification:jsd onSuccess:^(NSDictionary* results) {
UnitySendMessage(unityListener, "onPostNotificationSuccess", dictionaryToJsonChar(results));
} onFailure:^(NSError* error) {
if (error.userInfo && error.userInfo[@"returned"])
UnitySendMessage(unityListener, "onPostNotificationFailed", dictionaryToJsonChar(error.userInfo[@"returned"]));
else
UnitySendMessage(unityListener, "onPostNotificationFailed", "{\"error\": \"HTTP no response error\"}");
NSString* parsedError = [OneSignal parseNSErrorAsJsonString:error];
UnitySendMessage(unityListener, "onPostNotificationFailed", [parsedError UTF8String]);
}];
}

Expand Down
Binary file not shown.
2 changes: 1 addition & 1 deletion Unity5OneSignalExample/Assets/OneSignal/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.1
2.1.2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Assets/PlayServicesResolver/Editor/Google.JarResolver.dll
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
Assets/PlayServicesResolver/Editor/Google.IOSResolver.dll
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.6.0.dll
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.6.0.dll
Assets/PlayServicesResolver/Editor/Google.VersionHandler_v1.2.6.0.dll
Loading

0 comments on commit 56728e2

Please sign in to comment.