Skip to content

Commit

Permalink
Merge pull request #1005 from OneSignal/fix/mac_catalyst_live_activities
Browse files Browse the repository at this point in the history
[Bug] Ignore Live Activities code for Mac Catalyst
  • Loading branch information
nan-li authored Jun 28, 2024
2 parents e7d2ae2 + 0bbd52b commit 075ed4d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

import WidgetKit
import SwiftUI

#if !targetEnvironment(macCatalyst)
@main
struct ExampleWidgetBundle: WidgetBundle {
var body: some Widget {
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
8 changes: 8 additions & 0 deletions src/ios/OneSignalPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ - (void)exitLiveActivity:(CDVInvokedUrlCommand *)command {
}

- (void)setPushToStartToken:(CDVInvokedUrlCommand *)command {
#if !TARGET_OS_MACCATALYST
NSString *activityType = command.arguments[0];
NSString *token = command.arguments[1];
NSError* err=nil;
Expand All @@ -648,9 +649,11 @@ - (void)setPushToStartToken:(CDVInvokedUrlCommand *)command {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setPushToStartToken on iOS < 17.2"]];
}
#endif
}

- (void)removePushToStartToken:(CDVInvokedUrlCommand *)command {
#if !TARGET_OS_MACCATALYST
NSString *activityType = command.arguments[0];
NSError* err=nil;

Expand All @@ -662,9 +665,11 @@ - (void)removePushToStartToken:(CDVInvokedUrlCommand *)command {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot removePushToStartToken on iOS < 17.2"]];
}
#endif
}

- (void)setupDefaultLiveActivity:(CDVInvokedUrlCommand *)command {
#if !TARGET_OS_MACCATALYST
NSDictionary *options = command.arguments[0];
LiveActivitySetupOptions *laOptions = nil;

Expand All @@ -679,9 +684,11 @@ - (void)setupDefaultLiveActivity:(CDVInvokedUrlCommand *)command {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot setupDefault on iOS < 16.1"]];
}
#endif
}

- (void)startDefaultLiveActivity:(CDVInvokedUrlCommand *)command {
#if !TARGET_OS_MACCATALYST
NSString *activityId = command.arguments[0];
NSDictionary *attributes = command.arguments[1];
NSDictionary *content = command.arguments[2];
Expand All @@ -691,5 +698,6 @@ - (void)startDefaultLiveActivity:(CDVInvokedUrlCommand *)command {
} else {
[OneSignalLog onesignalLog:ONE_S_LL_ERROR message:[NSString stringWithFormat:@"cannot startDefault on iOS < 16.1"]];
}
#endif
}
@end

0 comments on commit 075ed4d

Please sign in to comment.