Skip to content

Commit 98035f6

Browse files
authored
Merge pull request #742 from OneSignal/fix/macCatalyst
[Fix] Mac Catalyst build errors
2 parents 65abdaa + 8530e0e commit 98035f6

File tree

5 files changed

+14
-1
lines changed

5 files changed

+14
-1
lines changed

OneSignalExample/Assets/OneSignal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
## [Unreleased]
88
### Fixed
99
- Additional instance of OneSignal error when calling OneSignal methods in Awake()
10+
- iOS Mac Catalyst build error: Use of undeclared identifier 'OneSignalLiveActivitiesManagerImpl'
1011

1112
## [5.1.6]
1213
### Fixed

OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Created by Brian Smith on 5/29/24.
66
//
77

8+
#if !targetEnvironment(macCatalyst)
89
import WidgetKit
910
import SwiftUI
1011

@@ -14,3 +15,4 @@ struct ExampleWidgetBundle: WidgetBundle {
1415
ExampleWidgetLiveActivity()
1516
}
1617
}
18+
#endif

OneSignalExample/iOS/ExampleWidget/ExampleWidgetLiveActivity.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Copyright © 2024 The Chromium Authors. All rights reserved.
77
//
88

9+
#if !targetEnvironment(macCatalyst)
910
import ActivityKit
1011
import WidgetKit
1112
import SwiftUI
@@ -64,3 +65,4 @@ struct ExampleWidgetLiveActivity: Widget {
6465
}
6566
}
6667
}
68+
#endif
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<dependencies>
22
<iosPods>
3-
<iosPod name="OneSignalXCFramework" version="5.2.0" addToAllTargets="true" />
3+
<iosPod name="OneSignalXCFramework" version="5.2.1" addToAllTargets="true" />
44
</iosPods>
55
</dependencies>

com.onesignal.unity.ios/Runtime/Plugins/iOS/OneSignalUnityBridgeLiveActivities.mm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ void _oneSignalExitLiveActivity(const char* activityId, int hashCode, BooleanRes
6262

6363

6464
void _oneSignalSetupDefaultLiveActivity(const char* optionsJson) {
65+
#if !TARGET_OS_MACCATALYST
6566
LiveActivitySetupOptions *laOptions = nil;
6667

6768
if (optionsJson) {
@@ -77,9 +78,11 @@ void _oneSignalSetupDefaultLiveActivity(const char* optionsJson) {
7778
} else {
7879
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setupDefault on iOS < 16.1"]];
7980
}
81+
#endif
8082
}
8183

8284
void _oneSignalStartDefaultLiveActivity(const char* activityId, const char* attributesJson, const char* contentJson) {
85+
#if !TARGET_OS_MACCATALYST
8386
if (@available(iOS 16.1, *)) {
8487
NSDictionary *attributes = oneSignalDictionaryFromJsonString(attributesJson);
8588
NSDictionary *content = oneSignalDictionaryFromJsonString(contentJson);
@@ -88,9 +91,11 @@ void _oneSignalStartDefaultLiveActivity(const char* activityId, const char* attr
8891
} else {
8992
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot startDefault on iOS < 16.1"]];
9093
}
94+
#endif
9195
}
9296

9397
void _oneSignalSetPushToStartToken(const char* activityType, const char* token) {
98+
#if !TARGET_OS_MACCATALYST
9499
NSError* err=nil;
95100

96101
if (@available(iOS 17.2, *)) {
@@ -101,9 +106,11 @@ void _oneSignalSetPushToStartToken(const char* activityType, const char* token)
101106
} else {
102107
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setPushToStartToken on iOS < 17.2"]];
103108
}
109+
#endif
104110
}
105111

106112
void _oneSignalRemovePushToStartToken(const char* activityType) {
113+
#if !TARGET_OS_MACCATALYST
107114
NSError* err=nil;
108115
if (@available(iOS 17.2, *)) {
109116
[OneSignalLiveActivitiesManagerImpl removePushToStartToken:TO_NSSTRING(activityType) error:&err];
@@ -114,5 +121,6 @@ void _oneSignalRemovePushToStartToken(const char* activityType) {
114121
} else {
115122
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot removePushToStartToken on iOS < 17.2"]];
116123
}
124+
#endif
117125
}
118126
}

0 commit comments

Comments
 (0)