Skip to content

Commit 56728e2

Browse files
committed
Updated to iOS native SDK 2.3.2 and Android SDK 3.4.2
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
1 parent a05dea3 commit 56728e2

35 files changed

+415
-249
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.0
1+
2.1.2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.6.0.dll
2+
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.6.0.dll
3+
Assets/PlayServicesResolver/Editor/Google.VersionHandler_v1.2.6.0.dll

Unity4.7OneSignalExample/Assets/PlayServicesResolver/Editor/play-services-resolver_v1.2.2.0.txt

-3
This file was deleted.

Unity4.7OneSignalExample/Assets/Plugins/Android/OneSignal/AndroidManifest.xml

+13
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@
2929

3030
<!-- Solid -->
3131
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
32+
33+
<!-- Huawei -->
34+
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
35+
<uses-permission android:name="com.huawei.android.launcher.permission.READ_SETTINGS" />
36+
<uses-permission android:name="com.huawei.android.launcher.permission.WRITE_SETTINGS" />
37+
38+
<!-- ZUK -->
39+
<uses-permission android:name="android.permission.READ_APP_BADGE" />
40+
41+
<!-- OPPO -->
42+
<uses-permission android:name="com.oppo.launcher.permission.READ_SETTINGS" />
43+
<uses-permission android:name="com.oppo.launcher.permission.WRITE_SETTINGS" />
44+
3245
<!-- End: ShortcutBadger -->
3346

3447
<application>
Binary file not shown.

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

+7-17
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@
5252
#define XC8_AVAILABLE 1
5353
#import <UserNotifications/UserNotifications.h>
5454

55-
@protocol OSUserNotificationCenterDelegate <NSObject>
56-
@optional
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.");
59-
@end
60-
6155
#endif
6256

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

8175

8276

83-
/* iOS 10+
77+
/*
8478
Used as value type for `kOSSettingsKeyInFocusDisplayOption`
85-
for setting the display option of a notification received while the app was in focus
79+
for setting the display option of a notification received while the app was in focus.
8680
*/
8781
typedef OSNotificationDisplayType OSInFocusDisplayOption;
8882

@@ -128,7 +122,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
128122
@property(readonly)NSDictionary* attachments;
129123

130124
/* Action buttons passed */
131-
@property(readonly)NSDictionary *actionButtons;
125+
@property(readonly)NSArray *actionButtons;
132126

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

241235
+ (NSString*)app_id;
242-
236+
243237
// Only use if you passed FALSE to autoRegister
244238
+ (void)registerForPushNotifications;
245239

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

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

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

282-
// - iOS 10 features currently only available on XCode 8 & iOS 10.0+
283-
#if XC8_AVAILABLE
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.");
286-
#endif
287-
288278
@end

Unity4.7OneSignalExample/Assets/Plugins/iOS/OneSignalUnityRuntime.m

+4-10
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
9595
}
9696

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

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

157156
void _sendTags(const char* tags) {
158-
159157
NSString * jsonString = CreateNSString(tags);
160158

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

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

186182
void _getTags() {
@@ -191,7 +187,7 @@ void _getTags() {
191187

192188
void _idsAvailable() {
193189
[OneSignal IdsAvailable:^(NSString* userId, NSString* pushToken) {
194-
if(pushToken == nil)
190+
if (pushToken == nil)
195191
pushToken = @"";
196192

197193
UnitySendMessage(unityListener, "onIdsAvailable",
@@ -213,10 +209,8 @@ void _postNotification(const char* jsonData) {
213209
[OneSignal postNotification:jsd onSuccess:^(NSDictionary* results) {
214210
UnitySendMessage(unityListener, "onPostNotificationSuccess", dictionaryToJsonChar(results));
215211
} onFailure:^(NSError* error) {
216-
if (error.userInfo && error.userInfo[@"returned"])
217-
UnitySendMessage(unityListener, "onPostNotificationFailed", dictionaryToJsonChar(error.userInfo[@"returned"]));
218-
else
219-
UnitySendMessage(unityListener, "onPostNotificationFailed", "{\"error\": \"HTTP no response error\"}");
212+
NSString* parsedError = [OneSignal parseNSErrorAsJsonString:error];
213+
UnitySendMessage(unityListener, "onPostNotificationFailed", [parsedError UTF8String]);
220214
}];
221215
}
222216

Binary file not shown.

Unity4.7OneSignalSDK.unitypackage

27.8 KB
Binary file not shown.

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

+7-17
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@
5252
#define XC8_AVAILABLE 1
5353
#import <UserNotifications/UserNotifications.h>
5454

55-
@protocol OSUserNotificationCenterDelegate <NSObject>
56-
@optional
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.");
59-
@end
60-
6155
#endif
6256

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

8175

8276

83-
/* iOS 10+
77+
/*
8478
Used as value type for `kOSSettingsKeyInFocusDisplayOption`
85-
for setting the display option of a notification received while the app was in focus
79+
for setting the display option of a notification received while the app was in focus.
8680
*/
8781
typedef OSNotificationDisplayType OSInFocusDisplayOption;
8882

@@ -128,7 +122,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
128122
@property(readonly)NSDictionary* attachments;
129123

130124
/* Action buttons passed */
131-
@property(readonly)NSDictionary *actionButtons;
125+
@property(readonly)NSArray *actionButtons;
132126

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

241235
+ (NSString*)app_id;
242-
236+
243237
// Only use if you passed FALSE to autoRegister
244238
+ (void)registerForPushNotifications;
245239

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

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

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

282-
// - iOS 10 features currently only available on XCode 8 & iOS 10.0+
283-
#if XC8_AVAILABLE
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.");
286-
#endif
287-
288278
@end

Unity5OneSignalExample/Assets/OneSignal/Platforms/iOS/OneSignalUnityRuntime.m

+4-10
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
9595
}
9696

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

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

157156
void _sendTags(const char* tags) {
158-
159157
NSString * jsonString = CreateNSString(tags);
160158

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

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

186182
void _getTags() {
@@ -191,7 +187,7 @@ void _getTags() {
191187

192188
void _idsAvailable() {
193189
[OneSignal IdsAvailable:^(NSString* userId, NSString* pushToken) {
194-
if(pushToken == nil)
190+
if (pushToken == nil)
195191
pushToken = @"";
196192

197193
UnitySendMessage(unityListener, "onIdsAvailable",
@@ -213,10 +209,8 @@ void _postNotification(const char* jsonData) {
213209
[OneSignal postNotification:jsd onSuccess:^(NSDictionary* results) {
214210
UnitySendMessage(unityListener, "onPostNotificationSuccess", dictionaryToJsonChar(results));
215211
} onFailure:^(NSError* error) {
216-
if (error.userInfo && error.userInfo[@"returned"])
217-
UnitySendMessage(unityListener, "onPostNotificationFailed", dictionaryToJsonChar(error.userInfo[@"returned"]));
218-
else
219-
UnitySendMessage(unityListener, "onPostNotificationFailed", "{\"error\": \"HTTP no response error\"}");
212+
NSString* parsedError = [OneSignal parseNSErrorAsJsonString:error];
213+
UnitySendMessage(unityListener, "onPostNotificationFailed", [parsedError UTF8String]);
220214
}];
221215
}
222216

Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.1
1+
2.1.2
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Assets/PlayServicesResolver/Editor/Google.JarResolver.dll
2-
Assets/PlayServicesResolver/Editor/Google.VersionHandler.dll
3-
Assets/PlayServicesResolver/Editor/Google.IOSResolver.dll
1+
Assets/PlayServicesResolver/Editor/Google.IOSResolver_v1.2.6.0.dll
2+
Assets/PlayServicesResolver/Editor/Google.JarResolver_v1.2.6.0.dll
3+
Assets/PlayServicesResolver/Editor/Google.VersionHandler_v1.2.6.0.dll

0 commit comments

Comments
 (0)