Skip to content

Commit 754054b

Browse files
author
Joseph Kalash
committed
Bump to latest iOS & Android versions + remove all InAppAlerts in favor of InFocusDisplayOption
1 parent 68997eb commit 754054b

File tree

13 files changed

+22
-27
lines changed

13 files changed

+22
-27
lines changed
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.16.0
1+
2.0.0

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public UnityBuilder InFocusDisplaying(OSInFocusDisplayOption display) {
162162
// You can then call RegisterForPushNotifications at a better point in your game to prompt them.
163163
// inAppLaunchURL = (iOS) Set false to force a ULRL to launch through Safari instead of in-app webview.
164164
public UnityBuilder Settings(Dictionary<string, bool> settings) {
165-
//bool autoPrompt, bool inAppAlerts, bool inAppLaunchURL
165+
//bool autoPrompt, bool inAppLaunchURL
166166
#if UNITY_IPHONE
167167
iOSSettings = settings;
168168
#endif
@@ -214,18 +214,15 @@ private static void Init() {
214214
oneSignalPlatform = new OneSignalAndroid(gameObjectName, builder.googleProjectNumber, builder.appID, builder.displayOption, logLevel, visualLogLevel);
215215
#elif UNITY_IPHONE
216216
//extract settings
217-
bool autoPrompt = true, inAppAlerts = true, inAppLaunchURL = true;
218-
219-
if (builder.displayOption == OSInFocusDisplayOption.None)
220-
inAppAlerts = false;
217+
bool autoPrompt = true,inAppLaunchURL = true;
221218

222219
if (builder.iOSSettings != null) {
223220
if(builder.iOSSettings.ContainsKey(kOSSettingsAutoPrompt))
224221
autoPrompt = builder.iOSSettings[kOSSettingsAutoPrompt];
225222
if (builder.iOSSettings.ContainsKey(kOSSettingsInAppLaunchURL))
226223
inAppLaunchURL = builder.iOSSettings[kOSSettingsInAppLaunchURL];
227224
}
228-
oneSignalPlatform = new OneSignalIOS(gameObjectName, builder.appID, autoPrompt, inAppAlerts, inAppLaunchURL, builder.displayOption, logLevel, visualLogLevel);
225+
oneSignalPlatform = new OneSignalIOS(gameObjectName, builder.appID, autoPrompt, inAppLaunchURL, builder.displayOption, logLevel, visualLogLevel);
229226
#elif UNITY_WP_8_1
230227
oneSignalPlatform = new OneSignalWPWNS(builder.appID);
231228
#endif

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class OneSignalIOS : OneSignalPlatform {
3535

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

3939
[System.Runtime.InteropServices.DllImport("__Internal")]
4040
extern static public void _registerForPushNotifications();
@@ -73,8 +73,8 @@ public class OneSignalIOS : OneSignalPlatform {
7373
extern static public void _setLogLevel(int logLevel, int visualLogLevel);
7474

7575

76-
public OneSignalIOS(string gameObjectName, string appId, bool autoPrompt, bool inAppAlerts, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
77-
_init(gameObjectName, appId, autoPrompt, inAppAlerts, inAppLaunchURLs, (int)displayOption, (int)logLevel, (int)visualLevel);
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);
7878
}
7979

8080
public void RegisterForPushNotifications() {

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void processNotificationReceived(NSString* notificationString) {
112112
UnitySendMessage(unityListener, "onPushNotificationReceived", [notificationString UTF8String]);
113113
}
114114

115-
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, BOOL inAppAlerts, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
115+
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
116116

117117
NSString* appIdStr = (appId ? [NSString stringWithUTF8String: appId] : nil);
118118

@@ -126,11 +126,11 @@ void initOneSignalObject(NSDictionary* launchOptions, const char* appId, BOOL in
126126
actionNotification = openResult;
127127
if (unityListener)
128128
processNotificationOpened([openResult stringify]);
129-
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInAppAlerts : @(inAppAlerts), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
129+
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
130130

131131
}
132132

133-
void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppAlerts, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {
133+
void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {
134134

135135

136136
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
@@ -139,7 +139,7 @@ void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL in
139139
unityListener = malloc(len + 1);
140140
strcpy(unityListener, listenerName);
141141

142-
initOneSignalObject(nil, appId, inAppAlerts, inAppLaunchURL, displayOption, autoPrompt);
142+
initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt);
143143

144144
if (actionNotification)
145145
processNotificationOpened([actionNotification stringify]);
Binary file not shown.

Unity4.7OneSignalSDK.unitypackage

-114 Bytes
Binary file not shown.
Binary file not shown.

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void processNotificationReceived(NSString* notificationString) {
112112
UnitySendMessage(unityListener, "onPushNotificationReceived", [notificationString UTF8String]);
113113
}
114114

115-
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, BOOL inAppAlerts, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
115+
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
116116

117117
NSString* appIdStr = (appId ? [NSString stringWithUTF8String: appId] : nil);
118118

@@ -126,11 +126,11 @@ void initOneSignalObject(NSDictionary* launchOptions, const char* appId, BOOL in
126126
actionNotification = openResult;
127127
if (unityListener)
128128
processNotificationOpened([openResult stringify]);
129-
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInAppAlerts : @(inAppAlerts), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
129+
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
130130

131131
}
132132

133-
void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppAlerts, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {
133+
void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {
134134

135135

136136
[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];
@@ -139,7 +139,7 @@ void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL in
139139
unityListener = malloc(len + 1);
140140
strcpy(unityListener, listenerName);
141141

142-
initOneSignalObject(nil, appId, inAppAlerts, inAppLaunchURL, displayOption, autoPrompt);
142+
initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt);
143143

144144
if (actionNotification)
145145
processNotificationOpened([actionNotification stringify]);
Binary file not shown.

Unity5OneSignalExample/Assets/OneSignal/src/OneSignal.cs

+3-6
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public UnityBuilder InFocusDisplaying(OSInFocusDisplayOption display) {
162162
// You can then call RegisterForPushNotifications at a better point in your game to prompt them.
163163
// inAppLaunchURL = (iOS) Set false to force a ULRL to launch through Safari instead of in-app webview.
164164
public UnityBuilder Settings(Dictionary<string, bool> settings) {
165-
//bool autoPrompt, bool inAppAlerts, bool inAppLaunchURL
165+
//bool autoPrompt, bool inAppLaunchURL
166166
#if UNITY_IPHONE
167167
iOSSettings = settings;
168168
#endif
@@ -214,18 +214,15 @@ private static void Init() {
214214
oneSignalPlatform = new OneSignalAndroid(gameObjectName, builder.googleProjectNumber, builder.appID, builder.displayOption, logLevel, visualLogLevel);
215215
#elif UNITY_IPHONE
216216
//extract settings
217-
bool autoPrompt = true, inAppAlerts = true, inAppLaunchURL = true;
218-
219-
if (builder.displayOption == OSInFocusDisplayOption.None)
220-
inAppAlerts = false;
217+
bool autoPrompt = true,inAppLaunchURL = true;
221218

222219
if (builder.iOSSettings != null) {
223220
if(builder.iOSSettings.ContainsKey(kOSSettingsAutoPrompt))
224221
autoPrompt = builder.iOSSettings[kOSSettingsAutoPrompt];
225222
if (builder.iOSSettings.ContainsKey(kOSSettingsInAppLaunchURL))
226223
inAppLaunchURL = builder.iOSSettings[kOSSettingsInAppLaunchURL];
227224
}
228-
oneSignalPlatform = new OneSignalIOS(gameObjectName, builder.appID, autoPrompt, inAppAlerts, inAppLaunchURL, builder.displayOption, logLevel, visualLogLevel);
225+
oneSignalPlatform = new OneSignalIOS(gameObjectName, builder.appID, autoPrompt, inAppLaunchURL, builder.displayOption, logLevel, visualLogLevel);
229226
#elif UNITY_WP_8_1
230227
oneSignalPlatform = new OneSignalWPWNS(builder.appID);
231228
#endif

Unity5OneSignalExample/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
}

Unity5OneSignalExample/Assets/OneSignal/src/OneSignalIOS.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
public class OneSignalIOS : OneSignalPlatform {
3535

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

3939
[System.Runtime.InteropServices.DllImport("__Internal")]
4040
extern static public void _registerForPushNotifications();
@@ -73,8 +73,8 @@ public class OneSignalIOS : OneSignalPlatform {
7373
extern static public void _setLogLevel(int logLevel, int visualLogLevel);
7474

7575

76-
public OneSignalIOS(string gameObjectName, string appId, bool autoPrompt, bool inAppAlerts, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {
77-
_init(gameObjectName, appId, autoPrompt, inAppAlerts, inAppLaunchURLs, (int)displayOption, (int)logLevel, (int)visualLevel);
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);
7878
}
7979

8080
public void RegisterForPushNotifications() {

Unity5OneSignalSDK.unitypackage

-294 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)