Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Mac Catalyst build errors #742

Merged
merged 4 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions OneSignalExample/Assets/OneSignal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions OneSignalExample/iOS/ExampleWidget/ExampleWidgetBundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Created by Brian Smith on 5/29/24.
//

#if !targetEnvironment(macCatalyst)
import WidgetKit
import SwiftUI

Expand All @@ -14,3 +15,4 @@ struct ExampleWidgetBundle: WidgetBundle {
ExampleWidgetLiveActivity()
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// Copyright © 2024 The Chromium Authors. All rights reserved.
//

#if !targetEnvironment(macCatalyst)
import ActivityKit
import WidgetKit
import SwiftUI
Expand Down Expand Up @@ -64,3 +65,4 @@ struct ExampleWidgetLiveActivity: Widget {
}
}
}
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<dependencies>
<iosPods>
<iosPod name="OneSignalXCFramework" version="5.2.0" addToAllTargets="true" />
<iosPod name="OneSignalXCFramework" version="5.2.1" addToAllTargets="true" />
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -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, *)) {
Expand All @@ -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];
Expand All @@ -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
}
}
Loading