Skip to content

Commit f816914

Browse files
committed
Updated to OneSignal iOS Native SDK 2.4.2
1 parent 19e602a commit f816914

File tree

12 files changed

+170
-152
lines changed

12 files changed

+170
-152
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.4
1+
2.2.0

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

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -33,85 +33,85 @@
3333

3434
public class OneSignalIOS : OneSignalPlatform {
3535

36-
[System.Runtime.InteropServices.DllImport("__Internal")]
37-
extern static public void _init(string listenerName, string appId, bool autoPrompt, bool inAppLaunchURLs, int displayOption, int logLevel, int visualLogLevel);
36+
[System.Runtime.InteropServices.DllImport("__Internal")]
37+
extern static public void _init(string listenerName, string appId, bool autoPrompt, bool inAppLaunchURLs, int displayOption, int logLevel, int visualLogLevel);
3838

39-
[System.Runtime.InteropServices.DllImport("__Internal")]
40-
extern static public void _registerForPushNotifications();
41-
42-
[System.Runtime.InteropServices.DllImport("__Internal")]
43-
extern static public void _sendTag(string tagName, string tagValue);
39+
[System.Runtime.InteropServices.DllImport("__Internal")]
40+
extern static public void _registerForPushNotifications();
41+
42+
[System.Runtime.InteropServices.DllImport("__Internal")]
43+
extern static public void _sendTag(string tagName, string tagValue);
4444

45-
[System.Runtime.InteropServices.DllImport("__Internal")]
46-
extern static public void _sendTags(string tags);
45+
[System.Runtime.InteropServices.DllImport("__Internal")]
46+
extern static public void _sendTags(string tags);
4747

48-
[System.Runtime.InteropServices.DllImport("__Internal")]
49-
extern static public void _getTags();
48+
[System.Runtime.InteropServices.DllImport("__Internal")]
49+
extern static public void _getTags();
5050

51-
[System.Runtime.InteropServices.DllImport("__Internal")]
52-
extern static public void _deleteTag(string key);
51+
[System.Runtime.InteropServices.DllImport("__Internal")]
52+
extern static public void _deleteTag(string key);
5353

54-
[System.Runtime.InteropServices.DllImport("__Internal")]
55-
extern static public void _deleteTags(string keys);
54+
[System.Runtime.InteropServices.DllImport("__Internal")]
55+
extern static public void _deleteTags(string keys);
5656

57-
[System.Runtime.InteropServices.DllImport("__Internal")]
58-
extern static public void _idsAvailable();
57+
[System.Runtime.InteropServices.DllImport("__Internal")]
58+
extern static public void _idsAvailable();
5959

60-
[System.Runtime.InteropServices.DllImport("__Internal")]
61-
extern static public void _setSubscription(bool enable);
60+
[System.Runtime.InteropServices.DllImport("__Internal")]
61+
extern static public void _setSubscription(bool enable);
6262

63-
[System.Runtime.InteropServices.DllImport("__Internal")]
64-
extern static public void _postNotification(string json);
63+
[System.Runtime.InteropServices.DllImport("__Internal")]
64+
extern static public void _postNotification(string json);
6565

66-
[System.Runtime.InteropServices.DllImport("__Internal")]
67-
extern static public void _syncHashedEmail(string email);
66+
[System.Runtime.InteropServices.DllImport("__Internal")]
67+
extern static public void _syncHashedEmail(string email);
6868

69-
[System.Runtime.InteropServices.DllImport("__Internal")]
70-
extern static public void _promptLocation();
69+
[System.Runtime.InteropServices.DllImport("__Internal")]
70+
extern static public void _promptLocation();
7171

72-
[System.Runtime.InteropServices.DllImport("__Internal")]
73-
extern static public void _setOneSignalLogLevel(int logLevel, int visualLogLevel);
72+
[System.Runtime.InteropServices.DllImport("__Internal")]
73+
extern static public void _setOneSignalLogLevel(int logLevel, int visualLogLevel);
7474

7575

76-
public OneSignalIOS(string gameObjectName, string appId, bool autoPrompt, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
77-
_init(gameObjectName, appId, autoPrompt, inAppLaunchURLs, (int)displayOption, (int)logLevel, (int)visualLevel);
78-
}
76+
public OneSignalIOS(string gameObjectName, string appId, bool autoPrompt, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
77+
_init(gameObjectName, appId, autoPrompt, inAppLaunchURLs, (int)displayOption, (int)logLevel, (int)visualLevel);
78+
}
7979

80-
public void RegisterForPushNotifications() {
81-
_registerForPushNotifications();
82-
}
80+
public void RegisterForPushNotifications() {
81+
_registerForPushNotifications();
82+
}
8383

84-
public void SendTag(string tagName, string tagValue) {
85-
_sendTag(tagName, tagValue);
86-
}
84+
public void SendTag(string tagName, string tagValue) {
85+
_sendTag(tagName, tagValue);
86+
}
8787

88-
public void SendTags(IDictionary<string, string> tags) {
89-
_sendTags(Json.Serialize(tags));
90-
}
88+
public void SendTags(IDictionary<string, string> tags) {
89+
_sendTags(Json.Serialize(tags));
90+
}
9191

92-
public void GetTags() {
93-
_getTags();
94-
}
92+
public void GetTags() {
93+
_getTags();
94+
}
9595

96-
public void DeleteTag(string key) {
97-
_deleteTag(key);
98-
}
96+
public void DeleteTag(string key) {
97+
_deleteTag(key);
98+
}
9999

100-
public void DeleteTags(IList<string> keys) {
101-
_deleteTags(Json.Serialize(keys));
102-
}
100+
public void DeleteTags(IList<string> keys) {
101+
_deleteTags(Json.Serialize(keys));
102+
}
103103

104-
public void IdsAvailable() {
105-
_idsAvailable();
106-
}
104+
public void IdsAvailable() {
105+
_idsAvailable();
106+
}
107107

108-
public void SetSubscription(bool enable) {
109-
_setSubscription(enable);
110-
}
108+
public void SetSubscription(bool enable) {
109+
_setSubscription(enable);
110+
}
111111

112-
public void PostNotification(Dictionary<string, object> data) {
113-
_postNotification(Json.Serialize(data));
114-
}
112+
public void PostNotification(Dictionary<string, object> data) {
113+
_postNotification(Json.Serialize(data));
114+
}
115115

116116

117117
public void SyncHashedEmail(string email) {
@@ -122,8 +122,8 @@ public void PromptLocation() {
122122
_promptLocation();
123123
}
124124

125-
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
126-
_setLogLevel((int)logLevel, (int)visualLevel);
127-
}
125+
public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
126+
_setOneSignalLogLevel((int)logLevel, (int)visualLevel);
127+
}
128128
}
129129
#endif

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2016 OneSignal
4+
* Copyright 2017 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -28,21 +28,18 @@
2828
/***
2929
3030
### Setting up the SDK ###
31-
Follow the documentation from https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk to setup OneSignal in your app.
31+
Follow the documentation from https://documentation.onesignal.com/docs/ios-sdk-setupto setup OneSignal in your app.
3232
3333
### API Reference ###
3434
Follow the documentation from https://documentation.onesignal.com/docs/ios-sdk-api for a detailed explanation of the API.
3535
36-
### FAQ & Troubleshoot ###
37-
FAQ: https://documentation.onesignal.com/docs/frequently-asked-questions-1
38-
Troubleshoot: https://documentation.onesignal.com/docs/common-problems-1
36+
### Troubleshoot ###
37+
Follow the documentation from https://documentation.onesignal.com/docs/troubleshooting-ios to fix common problems.
3938
40-
For help on how to upgrade your code from 1.* SDK to 2.*: https://documentation.onesignal.com/docs/upgrading-to-sdk-20
39+
For help on how to upgrade your code from 1.* SDK to 2.*: https://documentation.onesignal.com/docs/upgrading-to-ios-sdk-20
4140
4241
### More ###
43-
iOS Configuration: https://documentation.onesignal.com/docs/generating-an-ios-push-certificate
44-
REST API: https://documentation.onesignal.com/docs/server-api-overview
45-
Create Notification API: https://documentation.onesignal.com/docs/notifications-create-notification
42+
iOS Push Cert: https://documentation.onesignal.com/docs/generating-an-ios-push-certificate
4643
4744
***/
4845

@@ -150,7 +147,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
150147
requires remote-notification within UIBackgroundModes array of the Info.plist */
151148
@property(readonly, getter=isSilentNotification)BOOL silentNotification;
152149

153-
/* iOS 10+: Indicates wether or not the received notification has mutableContent : 1 assigned to its payload
150+
/* iOS 10+: Indicates whether or not the received notification has mutableContent : 1 assigned to its payload
154151
Used for UNNotificationServiceExtension to launch extension.
155152
*/
156153
#if XC8_AVAILABLE
@@ -177,7 +174,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
177174
typedef void (^OSResultSuccessBlock)(NSDictionary* result);
178175
typedef void (^OSFailureBlock)(NSError* error);
179176

180-
/*Block for notifying avalability of the User's ID and push token*/
177+
/*Block for notifying availability of the User's ID and push token*/
181178
typedef void (^OSIdsAvailableBlock)(NSString* userId, NSString* pushToken);
182179

183180
/*Block for handling the reception of a remote notification */
@@ -186,9 +183,9 @@ typedef void (^OSHandleNotificationReceivedBlock)(OSNotification* notification);
186183
/*Block for handling a user reaction to a notification*/
187184
typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * result);
188185

189-
/*Dictionary of keys to pass alongside the init serttings*/
186+
/*Dictionary of keys to pass alongside the init settings*/
190187

191-
/*Let OneSignal directly promt for push notifications on init*/
188+
/*Let OneSignal directly prompt for push notifications on init*/
192189
extern NSString * const kOSSettingsKeyAutoPrompt;
193190

194191
/*Enable the default in-app alerts*/
@@ -198,7 +195,7 @@ extern NSString * const kOSSettingsKeyInAppAlerts;
198195
extern NSString * const kOSSettingsKeyInAppLaunchURL;
199196

200197
/* iOS10+ -
201-
Set notificaion's in-focus display option.
198+
Set notification's in-focus display option.
202199
Value must be an OSNotificationDisplayType enum
203200
*/
204201
extern NSString * const kOSSettingsKeyInFocusDisplayOption;
@@ -275,4 +272,16 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
275272
// 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.
276273
+ (void)syncHashedEmail:(NSString*)email;
277274

275+
// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
276+
+ (void)setMSDKType:(NSString*)type;
277+
278+
279+
#ifdef XC8_AVAILABLE
280+
// iOS 10 only
281+
// Process from Notification Service Extension.
282+
// Used for iOS Media Attachemtns and Action Buttons.
283+
+ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest *)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
284+
+ (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest *)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
285+
#endif
286+
278287
@end
500 KB
Binary file not shown.

Unity4.7OneSignalSDK.unitypackage

220 KB
Binary file not shown.

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

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2016 OneSignal
4+
* Copyright 2017 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -28,21 +28,18 @@
2828
/***
2929
3030
### Setting up the SDK ###
31-
Follow the documentation from https://documentation.onesignal.com/docs/installing-the-onesignal-ios-sdk to setup OneSignal in your app.
31+
Follow the documentation from https://documentation.onesignal.com/docs/ios-sdk-setupto setup OneSignal in your app.
3232
3333
### API Reference ###
3434
Follow the documentation from https://documentation.onesignal.com/docs/ios-sdk-api for a detailed explanation of the API.
3535
36-
### FAQ & Troubleshoot ###
37-
FAQ: https://documentation.onesignal.com/docs/frequently-asked-questions-1
38-
Troubleshoot: https://documentation.onesignal.com/docs/common-problems-1
36+
### Troubleshoot ###
37+
Follow the documentation from https://documentation.onesignal.com/docs/troubleshooting-ios to fix common problems.
3938
40-
For help on how to upgrade your code from 1.* SDK to 2.*: https://documentation.onesignal.com/docs/upgrading-to-sdk-20
39+
For help on how to upgrade your code from 1.* SDK to 2.*: https://documentation.onesignal.com/docs/upgrading-to-ios-sdk-20
4140
4241
### More ###
43-
iOS Configuration: https://documentation.onesignal.com/docs/generating-an-ios-push-certificate
44-
REST API: https://documentation.onesignal.com/docs/server-api-overview
45-
Create Notification API: https://documentation.onesignal.com/docs/notifications-create-notification
42+
iOS Push Cert: https://documentation.onesignal.com/docs/generating-an-ios-push-certificate
4643
4744
***/
4845

@@ -150,7 +147,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
150147
requires remote-notification within UIBackgroundModes array of the Info.plist */
151148
@property(readonly, getter=isSilentNotification)BOOL silentNotification;
152149

153-
/* iOS 10+: Indicates wether or not the received notification has mutableContent : 1 assigned to its payload
150+
/* iOS 10+: Indicates whether or not the received notification has mutableContent : 1 assigned to its payload
154151
Used for UNNotificationServiceExtension to launch extension.
155152
*/
156153
#if XC8_AVAILABLE
@@ -177,7 +174,7 @@ typedef OSNotificationDisplayType OSInFocusDisplayOption;
177174
typedef void (^OSResultSuccessBlock)(NSDictionary* result);
178175
typedef void (^OSFailureBlock)(NSError* error);
179176

180-
/*Block for notifying avalability of the User's ID and push token*/
177+
/*Block for notifying availability of the User's ID and push token*/
181178
typedef void (^OSIdsAvailableBlock)(NSString* userId, NSString* pushToken);
182179

183180
/*Block for handling the reception of a remote notification */
@@ -186,9 +183,9 @@ typedef void (^OSHandleNotificationReceivedBlock)(OSNotification* notification);
186183
/*Block for handling a user reaction to a notification*/
187184
typedef void (^OSHandleNotificationActionBlock)(OSNotificationOpenedResult * result);
188185

189-
/*Dictionary of keys to pass alongside the init serttings*/
186+
/*Dictionary of keys to pass alongside the init settings*/
190187

191-
/*Let OneSignal directly promt for push notifications on init*/
188+
/*Let OneSignal directly prompt for push notifications on init*/
192189
extern NSString * const kOSSettingsKeyAutoPrompt;
193190

194191
/*Enable the default in-app alerts*/
@@ -198,7 +195,7 @@ extern NSString * const kOSSettingsKeyInAppAlerts;
198195
extern NSString * const kOSSettingsKeyInAppLaunchURL;
199196

200197
/* iOS10+ -
201-
Set notificaion's in-focus display option.
198+
Set notification's in-focus display option.
202199
Value must be an OSNotificationDisplayType enum
203200
*/
204201
extern NSString * const kOSSettingsKeyInFocusDisplayOption;
@@ -275,4 +272,16 @@ typedef NS_ENUM(NSUInteger, ONE_S_LOG_LEVEL) {
275272
// 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.
276273
+ (void)syncHashedEmail:(NSString*)email;
277274

275+
// Only used for wrapping SDKs, such as Unity, Cordova, Xamarin, etc.
276+
+ (void)setMSDKType:(NSString*)type;
277+
278+
279+
#ifdef XC8_AVAILABLE
280+
// iOS 10 only
281+
// Process from Notification Service Extension.
282+
// Used for iOS Media Attachemtns and Action Buttons.
283+
+ (UNMutableNotificationContent*)didReceiveNotificationExtensionRequest:(UNNotificationRequest *)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
284+
+ (UNMutableNotificationContent*)serviceExtensionTimeWillExpireRequest:(UNNotificationRequest *)request withMutableNotificationContent:(UNMutableNotificationContent*)replacementContent;
285+
#endif
286+
278287
@end
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.4
1+
2.2.0

0 commit comments

Comments
 (0)