From 0e2c259f4154c3935fa06f1540106e20eecff9ea Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 2 Jul 2024 17:40:12 -0400 Subject: [PATCH 1/4] Bump OneSignal iOS SDK to 5.2.1 Fixes OneSignal iOS SDK mac catalyst build error --- com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml b/com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml index 983cc715..e88e91eb 100644 --- a/com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml +++ b/com.onesignal.unity.ios/Editor/OneSignaliOSDependencies.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file From a9a0dc768b6004ad4b4ee4d0301eddbc88062e4f Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 2 Jul 2024 17:49:29 -0400 Subject: [PATCH 2/4] Exclude live activities from mac catalyst builds Live activities use ActivityKit which is not available for Mac Catalyst and causes Mac Catalyst build errors. --- .../Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm b/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm index c6273fb1..fee816ae 100644 --- a/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm +++ b/com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm @@ -62,6 +62,7 @@ void _oneSignalExitLiveActivity(const char* activityId, int hashCode, BooleanRes void _oneSignalSetupDefaultLiveActivity(const char* optionsJson) { + #if !TARGET_OS_MACCATALYST LiveActivitySetupOptions *laOptions = nil; if (optionsJson) { @@ -77,9 +78,11 @@ void _oneSignalSetupDefaultLiveActivity(const char* optionsJson) { } else { [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setupDefault on iOS < 16.1"]]; } + #endif } void _oneSignalStartDefaultLiveActivity(const char* activityId, const char* attributesJson, const char* contentJson) { + #if !TARGET_OS_MACCATALYST if (@available(iOS 16.1, *)) { NSDictionary *attributes = oneSignalDictionaryFromJsonString(attributesJson); NSDictionary *content = oneSignalDictionaryFromJsonString(contentJson); @@ -88,9 +91,11 @@ void _oneSignalStartDefaultLiveActivity(const char* activityId, const char* attr } else { [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot startDefault on iOS < 16.1"]]; } + #endif } void _oneSignalSetPushToStartToken(const char* activityType, const char* token) { + #if !TARGET_OS_MACCATALYST NSError* err=nil; if (@available(iOS 17.2, *)) { @@ -101,9 +106,11 @@ void _oneSignalSetPushToStartToken(const char* activityType, const char* token) } else { [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setPushToStartToken on iOS < 17.2"]]; } + #endif } void _oneSignalRemovePushToStartToken(const char* activityType) { + #if !TARGET_OS_MACCATALYST NSError* err=nil; if (@available(iOS 17.2, *)) { [OneSignalLiveActivitiesManagerImpl removePushToStartToken:TO_NSSTRING(activityType) error:&err]; @@ -114,5 +121,6 @@ void _oneSignalRemovePushToStartToken(const char* activityType) { } else { [OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot removePushToStartToken on iOS < 17.2"]]; } + #endif } } \ No newline at end of file From eb20cb36426ae1bb2b72cd6a0d2b18d59ade7a8a Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 2 Jul 2024 17:51:31 -0400 Subject: [PATCH 3/4] Exclude example widget from mac catalyst builds Causes build errors due to ActivityKit not being available on mac catalyst. --- OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift | 2 ++ .../iOS/ExampleWidget/ExampleWidgetLiveActivity.swift | 2 ++ 2 files changed, 4 insertions(+) diff --git a/OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift b/OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift index 2edbef04..5454c36b 100644 --- a/OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift +++ b/OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift @@ -5,6 +5,7 @@ // Created by Brian Smith on 5/29/24. // +#if !targetEnvironment(macCatalyst) import WidgetKit import SwiftUI @@ -14,3 +15,4 @@ struct ExampleWidgetBundle: WidgetBundle { ExampleWidgetLiveActivity() } } +#endif diff --git a/OneSignalExample/iOS/ExampleWidget/ExampleWidgetLiveActivity.swift b/OneSignalExample/iOS/ExampleWidget/ExampleWidgetLiveActivity.swift index 5291428c..6d627f52 100644 --- a/OneSignalExample/iOS/ExampleWidget/ExampleWidgetLiveActivity.swift +++ b/OneSignalExample/iOS/ExampleWidget/ExampleWidgetLiveActivity.swift @@ -6,6 +6,7 @@ // Copyright © 2024 The Chromium Authors. All rights reserved. // +#if !targetEnvironment(macCatalyst) import ActivityKit import WidgetKit import SwiftUI @@ -64,3 +65,4 @@ struct ExampleWidgetLiveActivity: Widget { } } } +#endif From 8530e0e961d75d52067f3a5023e93d52f8e99fb2 Mon Sep 17 00:00:00 2001 From: Shepherd Date: Tue, 2 Jul 2024 17:54:34 -0400 Subject: [PATCH 4/4] Update CHANGELOG --- OneSignalExample/Assets/OneSignal/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/OneSignalExample/Assets/OneSignal/CHANGELOG.md b/OneSignalExample/Assets/OneSignal/CHANGELOG.md index e5093214..b152a454 100644 --- a/OneSignalExample/Assets/OneSignal/CHANGELOG.md +++ b/OneSignalExample/Assets/OneSignal/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - Additional instance of OneSignal error when calling OneSignal methods in Awake() +- iOS Mac Catalyst build error: Use of undeclared identifier 'OneSignalLiveActivitiesManagerImpl' ## [5.1.6] ### Fixed