Skip to content

Commit

Permalink
Fixed iOS kOSSettingsKeyAutoPrompt setting from 2.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jkasten2 committed Dec 8, 2016
1 parent d2a567d commit 8bf9347
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 34 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.2
2.1.3
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public class OneSignalWPWNS : OneSignalPlatform {
public OneSignalWPWNS(string appId) {
OneSignalSDK_WP_WNS.ExternalInitUnity.Init(appId, (message, inAdditionalData, isActive) => {
if (OneSignal.builder != null && OneSignal.builder.notificationOpenedDelegate != null) {
Dictionary<string, string> additionalData = null;
Dictionary<string, object> additionalData = null;
if (inAdditionalData != null)
additionalData = inAdditionalData.ToDictionary(pair => pair.Key, pair => (string)pair.Value);
additionalData = inAdditionalData.ToDictionary(pair => pair.Key, pair => (object)pair.Value);

OSNotificationOpenedResult result = new OSNotificationOpenedResult();
result.action = new OSNotificationAction();
Expand Down
27 changes: 14 additions & 13 deletions Unity4.7OneSignalExample/Assets/Plugins/iOS/OneSignalUnityRuntime.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
}

- (BOOL)oneSignalApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
initOneSignalObject(launchOptions, nil, 1, true, true);
initOneSignalObject(launchOptions, nil, 1, true, false, true);

if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
return [self oneSignalApplication:application didFinishLaunchingWithOptions:launchOptions];
Expand All @@ -111,34 +111,35 @@ void processNotificationReceived(NSString* notificationString) {
UnitySendMessage(unityListener, "onPushNotificationReceived", [notificationString UTF8String]);
}

void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt, BOOL fromColdStart) {

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

[OneSignal setValue:@"unity" forKey:@"mSDKType"];

[OneSignal initWithLaunchOptions:launchOptions appId:appIdStr handleNotificationReceived:^(OSNotification* notification) {
if (unityListener)
processNotificationReceived([notification stringify]);
}
handleNotificationAction:^(OSNotificationOpenedResult* openResult) {
actionNotification = openResult;
if (unityListener)
processNotificationOpened([openResult stringify]);
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
if (unityListener)
processNotificationReceived([notification stringify]);
}
handleNotificationAction:^(OSNotificationOpenedResult* openResult) {
actionNotification = openResult;
if (unityListener)
processNotificationOpened([openResult stringify]);
} settings:@{kOSSettingsKeyAutoPrompt: @(autoPrompt),
kOSSettingsKeyInFocusDisplayOption: @(displayOption),
kOSSettingsKeyInAppLaunchURL: @(inAppLaunchURL),
@"kOSSettingsKeyInOmitNoAppIdLogging": @(fromColdStart)}];

}

void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {


[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];

unsigned long len = strlen(listenerName);
unityListener = malloc(len + 1);
strcpy(unityListener, listenerName);

initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt);
initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt, false);

if (actionNotification)
processNotificationOpened([actionNotification stringify]);
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.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ - (void) setOneSignalUnityDelegate:(id<UIApplicationDelegate>)delegate {
}

- (BOOL)oneSignalApplication:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
initOneSignalObject(launchOptions, nil, 1, true, true);
initOneSignalObject(launchOptions, nil, 1, true, false, true);

if ([self respondsToSelector:@selector(oneSignalApplication:didFinishLaunchingWithOptions:)])
return [self oneSignalApplication:application didFinishLaunchingWithOptions:launchOptions];
Expand All @@ -111,34 +111,35 @@ void processNotificationReceived(NSString* notificationString) {
UnitySendMessage(unityListener, "onPushNotificationReceived", [notificationString UTF8String]);
}

void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt) {
void initOneSignalObject(NSDictionary* launchOptions, const char* appId, int displayOption, BOOL inAppLaunchURL, BOOL autoPrompt, BOOL fromColdStart) {

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

[OneSignal setValue:@"unity" forKey:@"mSDKType"];

[OneSignal initWithLaunchOptions:launchOptions appId:appIdStr handleNotificationReceived:^(OSNotification* notification) {
if (unityListener)
processNotificationReceived([notification stringify]);
}
handleNotificationAction:^(OSNotificationOpenedResult* openResult) {
actionNotification = openResult;
if (unityListener)
processNotificationOpened([openResult stringify]);
} settings:@{kOSSettingsKeyAutoPrompt : @(autoPrompt), kOSSettingsKeyInFocusDisplayOption : @(displayOption), kOSSettingsKeyInAppLaunchURL : @(inAppLaunchURL)}];
if (unityListener)
processNotificationReceived([notification stringify]);
}
handleNotificationAction:^(OSNotificationOpenedResult* openResult) {
actionNotification = openResult;
if (unityListener)
processNotificationOpened([openResult stringify]);
} settings:@{kOSSettingsKeyAutoPrompt: @(autoPrompt),
kOSSettingsKeyInFocusDisplayOption: @(displayOption),
kOSSettingsKeyInAppLaunchURL: @(inAppLaunchURL),
@"kOSSettingsKeyInOmitNoAppIdLogging": @(fromColdStart)}];

}

void _init(const char* listenerName, const char* appId, BOOL autoPrompt, BOOL inAppLaunchURL, int displayOption, int logLevel, int visualLogLevel) {


[OneSignal setLogLevel:logLevel visualLevel: visualLogLevel];

unsigned long len = strlen(listenerName);
unityListener = malloc(len + 1);
strcpy(unityListener, listenerName);

initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt);
initOneSignalObject(nil, appId, displayOption, inAppLaunchURL, autoPrompt, false);

if (actionNotification)
processNotificationOpened([actionNotification stringify]);
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.2
2.1.3
2 changes: 1 addition & 1 deletion Unity5OneSignalExample/Library/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ PlayerSettings:
metroCertificatePassword:
metroCertificateSubject: OneSignal
metroCertificateIssuer: OneSignal
metroCertificateNotAfter: 80f6110b15e3d101
metroCertificateNotAfter: 809d8e5add6ed301
metroApplicationDescription: UnityGameThriveExample
wsaImages: {}
metroTileShortName:
Expand Down
4 changes: 2 additions & 2 deletions Unity5OneSignalExample/ProjectSettings/GraphicsSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ GraphicsSettings:
useCascadedShadowMaps: 0
m_TierSettings_Tier2:
renderingPath: 1
useCascadedShadowMaps: 0
useCascadedShadowMaps: 1
m_TierSettings_Tier3:
renderingPath: 1
useCascadedShadowMaps: 0
useCascadedShadowMaps: 1
m_DefaultRenderingPath: 1
m_DefaultMobileRenderingPath: 1
m_TierSettings: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ PlayerSettings:
metroCertificatePassword:
metroCertificateSubject: OneSignal
metroCertificateIssuer: OneSignal
metroCertificateNotAfter: 80f6110b15e3d101
metroCertificateNotAfter: 809d8e5add6ed301
metroApplicationDescription: UnityGameThriveExample
wsaImages: {}
metroTileShortName:
Expand Down
Binary file modified Unity5OneSignalSDK.unitypackage
Binary file not shown.

0 comments on commit 8bf9347

Please sign in to comment.