From 2d0b10df0cc7833bc24841137ff07f5cb88f21ab Mon Sep 17 00:00:00 2001 From: Anton <88505337+Ankononenko@users.noreply.github.com> Date: Thu, 4 Sep 2025 14:57:50 +0200 Subject: [PATCH 1/2] Fix server communication status, if the value isn't set in the info.plist Prior to the fix the server communication value would default to false, if not set in the info.plist --- .../Assets/Plugins/iOS/UnityRuntime.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m b/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m index 161c91e..8d29f54 100644 --- a/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m +++ b/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m @@ -286,11 +286,18 @@ void pw_addBadgeNumber(int deltaBadge) { pw_setBadgeNumber(badge); } -bool pw_isCommunicationEnabled () { +bool pw_isCommunicationEnabled() { if ([[NSUserDefaults standardUserDefaults] objectForKey:KeyIsServerCommunicationEnabled]) { _isServerCommunicationEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:KeyIsServerCommunicationEnabled]; } else { - _isServerCommunicationEnabled = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"Pushwoosh_ALLOW_SERVER_COMMUNICATION"] boolValue]; + NSString *key = @"Pushwoosh_ALLOW_SERVER_COMMUNICATION"; + id value = [[NSBundle mainBundle] objectForInfoDictionaryKey:key]; + + if (value && ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])) { + _isServerCommunicationEnabled = [value boolValue]; + } else { + _isServerCommunicationEnabled = YES; + } } return _isServerCommunicationEnabled; } From 62a345024bc252cc0cae10a50165c234488ac7e1 Mon Sep 17 00:00:00 2001 From: Anton <88505337+Ankononenko@users.noreply.github.com> Date: Fri, 12 Sep 2025 09:53:28 +0200 Subject: [PATCH 2/2] Remove the extra variable to keep the key --- PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m b/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m index 8d29f54..3a3c109 100644 --- a/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m +++ b/PushwooshUnitySample/Assets/Plugins/iOS/UnityRuntime.m @@ -290,9 +290,7 @@ bool pw_isCommunicationEnabled() { if ([[NSUserDefaults standardUserDefaults] objectForKey:KeyIsServerCommunicationEnabled]) { _isServerCommunicationEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:KeyIsServerCommunicationEnabled]; } else { - NSString *key = @"Pushwoosh_ALLOW_SERVER_COMMUNICATION"; - id value = [[NSBundle mainBundle] objectForInfoDictionaryKey:key]; - + id value = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"Pushwoosh_ALLOW_SERVER_COMMUNICATION"]; if (value && ([value isKindOfClass:[NSNumber class]] || [value isKindOfClass:[NSString class]])) { _isServerCommunicationEnabled = [value boolValue]; } else {