Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rlepinski committed Sep 27, 2024
1 parent e7797ed commit 52d5f35
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 59 deletions.
41 changes: 29 additions & 12 deletions example/ios/AirshipExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@
6E3A029F2CA62A7100B0C5CF /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E3A029E2CA62A7100B0C5CF /* WidgetKit.framework */; };
6E3A02A12CA62A7100B0C5CF /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E3A02A02CA62A7100B0C5CF /* SwiftUI.framework */; };
6E3A02B22CA62A7400B0C5CF /* ExampleWidgetsExtension.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 6E3A029D2CA62A7100B0C5CF /* ExampleWidgetsExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
6EC755922A4DE34400851ABB /* AirshipExtender.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EC755912A4DE34400851ABB /* AirshipExtender.swift */; };
6EC755922A4DE34400851ABB /* AirshipPluginExtender.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6EC755912A4DE34400851ABB /* AirshipPluginExtender.swift */; };
6ED117C52CA7661200C41C56 /* ExampleWidgetsAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED117C02CA7661100C41C56 /* ExampleWidgetsAttributes.swift */; };
6ED117C62CA7661200C41C56 /* ExampleWidgetsBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED117C12CA7661100C41C56 /* ExampleWidgetsBundle.swift */; };
6ED117C72CA7661200C41C56 /* ExampleWidgetsLiveActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED117C22CA7661100C41C56 /* ExampleWidgetsLiveActivity.swift */; };
6ED117C92CA7661200C41C56 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6ED117BF2CA7661100C41C56 /* Assets.xcassets */; };
6ED117CA2CA7663100C41C56 /* ExampleWidgetsAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6ED117C02CA7661100C41C56 /* ExampleWidgetsAttributes.swift */; };
7F2F1DABF8580D87B80F17E2 /* libPods-AirshipExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 863F8087D5417FA132545EAF /* libPods-AirshipExample.a */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
9919EE652B23C58300A46BFE /* Fonts in Resources */ = {isa = PBXBuildFile; fileRef = 9919EE642B23C58300A46BFE /* Fonts */; };
Expand Down Expand Up @@ -86,7 +91,12 @@
6E4CFD1B29899AB400D131A8 /* AirshipExample.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; name = AirshipExample.entitlements; path = AirshipExample/AirshipExample.entitlements; sourceTree = "<group>"; };
6E69FDBD50BFBDB4EF69D730 /* Pods-AirshipExampleNotificationServiceExtension.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AirshipExampleNotificationServiceExtension.debug.xcconfig"; path = "Target Support Files/Pods-AirshipExampleNotificationServiceExtension/Pods-AirshipExampleNotificationServiceExtension.debug.xcconfig"; sourceTree = "<group>"; };
6EC755902A4DE34400851ABB /* AirshipExample-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AirshipExample-Bridging-Header.h"; sourceTree = "<group>"; };
6EC755912A4DE34400851ABB /* AirshipExtender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirshipExtender.swift; sourceTree = "<group>"; };
6EC755912A4DE34400851ABB /* AirshipPluginExtender.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AirshipPluginExtender.swift; sourceTree = "<group>"; };
6ED117BF2CA7661100C41C56 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
6ED117C02CA7661100C41C56 /* ExampleWidgetsAttributes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWidgetsAttributes.swift; sourceTree = "<group>"; };
6ED117C12CA7661100C41C56 /* ExampleWidgetsBundle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWidgetsBundle.swift; sourceTree = "<group>"; };
6ED117C22CA7661100C41C56 /* ExampleWidgetsLiveActivity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExampleWidgetsLiveActivity.swift; sourceTree = "<group>"; };
6ED117C32CA7661100C41C56 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
7D225AAD537A45E26F8E01F4 /* libPods-AirshipExampleNotificationServiceExtension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AirshipExampleNotificationServiceExtension.a"; sourceTree = BUILT_PRODUCTS_DIR; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = AirshipExample/LaunchScreen.storyboard; sourceTree = "<group>"; };
863F8087D5417FA132545EAF /* libPods-AirshipExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AirshipExample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -163,7 +173,7 @@
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
13B07FB71A68108700A75B9A /* main.m */,
9919EE642B23C58300A46BFE /* Fonts */,
6EC755912A4DE34400851ABB /* AirshipExtender.swift */,
6EC755912A4DE34400851ABB /* AirshipPluginExtender.swift */,
6EC755902A4DE34400851ABB /* AirshipExample-Bridging-Header.h */,
);
name = AirshipExample;
Expand Down Expand Up @@ -194,6 +204,11 @@
6E3A02A22CA62A7100B0C5CF /* ExampleWidgets */ = {
isa = PBXGroup;
children = (
6ED117BF2CA7661100C41C56 /* Assets.xcassets */,
6ED117C02CA7661100C41C56 /* ExampleWidgetsAttributes.swift */,
6ED117C12CA7661100C41C56 /* ExampleWidgetsBundle.swift */,
6ED117C22CA7661100C41C56 /* ExampleWidgetsLiveActivity.swift */,
6ED117C32CA7661100C41C56 /* Info.plist */,
);
path = ExampleWidgets;
sourceTree = "<group>";
Expand Down Expand Up @@ -352,6 +367,7 @@
};
6E3A029C2CA62A7100B0C5CF = {
CreatedOnToolsVersion = 16.0;
LastSwiftMigration = 1600;
};
};
};
Expand Down Expand Up @@ -405,6 +421,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6ED117C92CA7661200C41C56 /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -577,8 +594,9 @@
buildActionMask = 2147483647;
files = (
13B07FBC1A68108700A75B9A /* AppDelegate.mm in Sources */,
6EC755922A4DE34400851ABB /* AirshipExtender.swift in Sources */,
6EC755922A4DE34400851ABB /* AirshipPluginExtender.swift in Sources */,
13B07FC11A68108700A75B9A /* main.m in Sources */,
6ED117CA2CA7663100C41C56 /* ExampleWidgetsAttributes.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -594,6 +612,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6ED117C52CA7661200C41C56 /* ExampleWidgetsAttributes.swift in Sources */,
6ED117C62CA7661200C41C56 /* ExampleWidgetsBundle.swift in Sources */,
6ED117C72CA7661200C41C56 /* ExampleWidgetsLiveActivity.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -825,6 +846,7 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
Expand Down Expand Up @@ -868,6 +890,7 @@
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
Expand Down Expand Up @@ -970,10 +993,7 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down Expand Up @@ -1041,10 +1061,7 @@
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
);
OTHER_LDFLAGS = (
"$(inherited)",
" ",
);
OTHER_LDFLAGS = "$(inherited) ";
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
USE_HERMES = true;
Expand Down
13 changes: 0 additions & 13 deletions example/ios/AirshipExample/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import "AirshipExample-Swift.h"


@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AirshipExtender setup];

self.moduleName = @"AirshipExample";
// You can add your custom initial props in the dictionary below.
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};

for (NSString* family in [UIFont familyNames])
{
NSLog(@"%@", family);

for (NSString* name in [UIFont fontNamesForFamilyName: family])
{
NSLog(@"Family name: %@", name);
}
}

return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,19 @@ import AirshipKit
import AirshipFrameworkProxy
import ActivityKit

@objc
public class AirshipExtender: NSObject {
@objc(AirshipPluginExtender)
public class AirshipPluginExtender: NSObject, AirshipPluginExtenderProtocol {
public static func onAirshipReady() {

fileprivate static let shared: AirshipExtender = AirshipExtender()


@objc
@MainActor
public class func setup() {
if #available(iOS 16.1, *) {
// Can only call this once. It only throws on second call
// Will throw if called more than once
try? LiveActivityManager.shared.setup { configurator in

// Call per widget
await configurator.register(forType: Activity<ExampleWidgetsAttributes>.self, typeReferenceID: "Example") { attributes in
// Track this property as the Airship name for updates
attributes.name
}

}
}
}
Expand Down
8 changes: 7 additions & 1 deletion example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ PODS:
- Airship/Core
- AirshipFrameworkProxy (8.1.0):
- Airship (= 18.9.2)
- AirshipFrameworkProxy/Loader (= 8.1.0)
- AirshipFrameworkProxy/Proxy (= 8.1.0)
- AirshipFrameworkProxy/Loader (8.1.0):
- Airship (= 18.9.2)
- AirshipFrameworkProxy/Proxy (8.1.0):
- Airship (= 18.9.2)
- AirshipServiceExtension (18.9.2)
- boost (1.83.0)
- DoubleConversion (1.1.6)
Expand Down Expand Up @@ -1282,7 +1288,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Airship: 7f891aa9bb142d02f35aaef5ebdb09c2b5730a6d
AirshipFrameworkProxy: c4366c8d20210a298f196688cf365265a35b9c69
AirshipFrameworkProxy: edd1b2a2a56393278af5b9fb014807ee401d517d
AirshipServiceExtension: 0ed795b521a76f8391e13896fbe1dee6ce9196ca
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
Expand Down
8 changes: 4 additions & 4 deletions example/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default function HomeScreen() {

<Button
onPress={async () => {
Airship.liveActivityManager.create({
Airship.iOS.liveActivityManager.create({
typeReferenceId: 'Example',
content: {
state: {
Expand All @@ -209,7 +209,7 @@ export default function HomeScreen() {
});
activities.forEach((element) => {
Airship.iOS.liveActivityManager.end({
activityID: element.id,
activityId: element.id,
typeReferenceId: 'Example',
});
});
Expand All @@ -220,12 +220,12 @@ export default function HomeScreen() {

<Button
onPress={async () => {
const activities = await Airship.liveActivityManager.list({
const activities = await Airship.iOS.liveActivityManager.list({
typeReferenceId: 'Example',
});
activities.forEach((element) => {
Airship.iOS.liveActivityManager.update({
activityID: element.id,
activityId: element.id,
typeReferenceId: 'Example',
content: {
state: {
Expand Down
15 changes: 15 additions & 0 deletions ios/AirshipPluginLoader.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import AirshipFrameworkProxy

@objc(AirshipPluginLoader)
public class AirshipPluginLoader: NSObject, AirshipPluginLoaderProtocol {
@objc
public static var disabled: Bool = false

public static func onApplicationDidFinishLaunching(
launchOptions: [UIApplication.LaunchOptionsKey : Any]?
) {
if (!disabled) {
AirshipReactNative.shared.onLoad(launchOptions: launchOptions)
}
}
}
4 changes: 1 addition & 3 deletions ios/AirshipReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,8 @@ public class AirshipReactNative: NSObject {
}
}


@objc
@MainActor
public func onLoad(
func onLoad(
launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) {
AirshipProxy.shared.delegate = self
Expand Down
15 changes: 1 addition & 14 deletions ios/RTNAirshipBootloader.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,9 @@

@implementation RTNAirshipBootloader

static BOOL disabled = NO;

+ (void)load {
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserverForName:UIApplicationDidFinishLaunchingNotification
object:nil
queue:nil usingBlock:^(NSNotification * _Nonnull note) {

if (!disabled) {
[AirshipReactNative.shared onLoadWithLaunchOptions:note.userInfo];
}
}];
}

+ (void)disable {
disabled = YES;
AirshipPluginLoader.disabled = YES;
}
@end

4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,12 +830,12 @@ export interface LiveActivityCreateRequest extends LiveActivityRequest {
}

export interface LiveActivityUpdateRequest extends LiveActivityRequest {
activityID: string
activityId: string
content: LiveActivityContent
}

export interface LiveActivityEndRequest extends LiveActivityRequest {
activityID: string
activityId: string
content?: LiveActivityContent
dismissalPolicy?: LiveActivityDismissalPolicy
}
Expand Down

0 comments on commit 52d5f35

Please sign in to comment.