expo-targets 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +2 -0
- package/README.md +244 -0
- package/android/build.gradle +22 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsLogger.kt +98 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsReceiver.kt +136 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsRemoteViewsProvider.kt +72 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetProvider.kt +47 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetSync.kt +78 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsWidgetUpdateReceiver.kt +30 -0
- package/android/src/main/java/expo/modules/targets/extension/ExpoTargetsExtensionModule.kt +27 -0
- package/android/src/main/java/expo/modules/targets/messages/ExpoTargetsMessagesModule.kt +40 -0
- package/android/src/main/java/expo/modules/targets/storage/ExpoTargetsStorageModule.kt +119 -0
- package/app.plugin.js +1 -0
- package/build/metro/src/index.d.ts +2 -0
- package/build/metro/src/index.d.ts.map +1 -0
- package/build/metro/src/index.js +6 -0
- package/build/metro/src/index.js.map +1 -0
- package/build/metro/src/withTargetsMetro.d.ts +6 -0
- package/build/metro/src/withTargetsMetro.d.ts.map +1 -0
- package/build/metro/src/withTargetsMetro.js +171 -0
- package/build/metro/src/withTargetsMetro.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.js +56 -0
- package/build/plugin/src/android/config-plugins/withAndroidColors.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.js +70 -0
- package/build/plugin/src/android/config-plugins/withAndroidManifest.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.js +41 -0
- package/build/plugin/src/android/config-plugins/withAndroidModule.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.js +75 -0
- package/build/plugin/src/android/config-plugins/withAndroidResources.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts +28 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.js +28 -0
- package/build/plugin/src/android/config-plugins/withAndroidTarget.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.js +86 -0
- package/build/plugin/src/android/config-plugins/withGradleModule.js.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts +7 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.d.ts.map +1 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.js +23 -0
- package/build/plugin/src/android/config-plugins/withGradleSettings.js.map +1 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts +7 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.js +31 -0
- package/build/plugin/src/android/withAndroidAppBuildGradle.js.map +1 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts +3 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.js +24 -0
- package/build/plugin/src/android/withAndroidKotlinGradleProperty.js.map +1 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts +3 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.js +27 -0
- package/build/plugin/src/android/withAndroidProjectKotlinVersion.js.map +1 -0
- package/build/plugin/src/android/withAndroidTarget.d.ts +10 -0
- package/build/plugin/src/android/withAndroidTarget.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidTarget.js +22 -0
- package/build/plugin/src/android/withAndroidTarget.js.map +1 -0
- package/build/plugin/src/android/withAndroidWidget.d.ts +13 -0
- package/build/plugin/src/android/withAndroidWidget.d.ts.map +1 -0
- package/build/plugin/src/android/withAndroidWidget.js +564 -0
- package/build/plugin/src/android/withAndroidWidget.js.map +1 -0
- package/build/plugin/src/config.d.ts +141 -0
- package/build/plugin/src/config.d.ts.map +1 -0
- package/build/plugin/src/config.js +54 -0
- package/build/plugin/src/config.js.map +1 -0
- package/build/plugin/src/index.d.ts +9 -0
- package/build/plugin/src/index.d.ts.map +1 -0
- package/build/plugin/src/index.js +11 -0
- package/build/plugin/src/index.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts +11 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.js +49 -0
- package/build/plugin/src/ios/config-plugins/withEntitlements.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts +17 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js +152 -0
- package/build/plugin/src/ios/config-plugins/withIOSTarget.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts +8 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.js +25 -0
- package/build/plugin/src/ios/config-plugins/withIosColorset.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts +8 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.js +52 -0
- package/build/plugin/src/ios/config-plugins/withIosStickerPack.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.d.ts +12 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.js +162 -0
- package/build/plugin/src/ios/config-plugins/withPodfile.js.map +1 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts +15 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.d.ts.map +1 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js +646 -0
- package/build/plugin/src/ios/config-plugins/withXcodeChanges.js.map +1 -0
- package/build/plugin/src/ios/target.d.ts +41 -0
- package/build/plugin/src/ios/target.d.ts.map +1 -0
- package/build/plugin/src/ios/target.js +574 -0
- package/build/plugin/src/ios/target.js.map +1 -0
- package/build/plugin/src/ios/utils/asset.d.ts +60 -0
- package/build/plugin/src/ios/utils/asset.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/asset.js +375 -0
- package/build/plugin/src/ios/utils/asset.js.map +1 -0
- package/build/plugin/src/ios/utils/file.d.ts +33 -0
- package/build/plugin/src/ios/utils/file.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/file.js +88 -0
- package/build/plugin/src/ios/utils/file.js.map +1 -0
- package/build/plugin/src/ios/utils/index.d.ts +12 -0
- package/build/plugin/src/ios/utils/index.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/index.js +38 -0
- package/build/plugin/src/ios/utils/index.js.map +1 -0
- package/build/plugin/src/ios/utils/paths.d.ts +128 -0
- package/build/plugin/src/ios/utils/paths.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/paths.js +141 -0
- package/build/plugin/src/ios/utils/paths.js.map +1 -0
- package/build/plugin/src/ios/utils/plist.d.ts +29 -0
- package/build/plugin/src/ios/utils/plist.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/plist.js +114 -0
- package/build/plugin/src/ios/utils/plist.js.map +1 -0
- package/build/plugin/src/ios/utils/podfile.d.ts +82 -0
- package/build/plugin/src/ios/utils/podfile.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/podfile.js +408 -0
- package/build/plugin/src/ios/utils/podfile.js.map +1 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.d.ts +11 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.js +263 -0
- package/build/plugin/src/ios/utils/reactNativeSwift.js.map +1 -0
- package/build/plugin/src/ios/utils/xcode.d.ts +185 -0
- package/build/plugin/src/ios/utils/xcode.d.ts.map +1 -0
- package/build/plugin/src/ios/utils/xcode.js +706 -0
- package/build/plugin/src/ios/utils/xcode.js.map +1 -0
- package/build/plugin/src/logger.d.ts +10 -0
- package/build/plugin/src/logger.d.ts.map +1 -0
- package/build/plugin/src/logger.js +62 -0
- package/build/plugin/src/logger.js.map +1 -0
- package/build/plugin/src/parseTargetConfig.d.ts +3 -0
- package/build/plugin/src/parseTargetConfig.d.ts.map +1 -0
- package/build/plugin/src/parseTargetConfig.js +113 -0
- package/build/plugin/src/parseTargetConfig.js.map +1 -0
- package/build/plugin/src/withTargetsDir.d.ts +6 -0
- package/build/plugin/src/withTargetsDir.d.ts.map +1 -0
- package/build/plugin/src/withTargetsDir.js +90 -0
- package/build/plugin/src/withTargetsDir.js.map +1 -0
- package/build/src/Target.d.ts +43 -0
- package/build/src/Target.d.ts.map +1 -0
- package/build/src/Target.js +128 -0
- package/build/src/Target.js.map +1 -0
- package/build/src/index.d.ts +9 -0
- package/build/src/index.d.ts.map +1 -0
- package/build/src/index.js +27 -0
- package/build/src/index.js.map +1 -0
- package/build/src/modules/extension/index.d.ts +18 -0
- package/build/src/modules/extension/index.d.ts.map +1 -0
- package/build/src/modules/extension/index.js +44 -0
- package/build/src/modules/extension/index.js.map +1 -0
- package/build/src/modules/messages/index.d.ts +40 -0
- package/build/src/modules/messages/index.d.ts.map +1 -0
- package/build/src/modules/messages/index.js +94 -0
- package/build/src/modules/messages/index.js.map +1 -0
- package/build/src/modules/storage/index.d.ts +16 -0
- package/build/src/modules/storage/index.d.ts.map +1 -0
- package/build/src/modules/storage/index.js +122 -0
- package/build/src/modules/storage/index.js.map +1 -0
- package/expo-module.config.json +17 -0
- package/ios/ExpoTargetsExtension.podspec +23 -0
- package/ios/ExpoTargetsExtensionModule.swift +181 -0
- package/ios/ExpoTargetsMessages.podspec +23 -0
- package/ios/ExpoTargetsMessagesModule.swift +267 -0
- package/ios/ExpoTargetsStorage.podspec +23 -0
- package/ios/ExpoTargetsStorageModule.swift +91 -0
- package/ios/Tests/.swiftlint.yml +52 -0
- package/ios/Tests/Helpers/MockExtensionContext.swift +58 -0
- package/ios/Tests/Helpers/MockUserDefaults.swift +70 -0
- package/ios/Tests/Helpers/MockWidgetCenter.swift +71 -0
- package/ios/Tests/Helpers/TestHelpers.swift +90 -0
- package/ios/Tests/Integration/TargetIntegrationTests.swift +478 -0
- package/ios/Tests/Main/AllTests.swift +80 -0
- package/ios/Tests/Package.swift +66 -0
- package/ios/Tests/Performance/StoragePerformanceTests.swift +461 -0
- package/ios/Tests/Unit/Extension/ExpoTargetsExtensionModuleTests.swift +501 -0
- package/ios/Tests/Unit/Storage/ExpoTargetsStorageModuleTests.swift +578 -0
- package/ios/Tests/Unit/Template/ShareExtensionTemplateTests.swift +421 -0
- package/ios/Tests/XCTestPlan.xctestplan +87 -0
- package/metro/src/index.ts +1 -0
- package/metro/src/withTargetsMetro.ts +247 -0
- package/metro/tsconfig.build.json +9 -0
- package/package.json +74 -0
- package/plugin/src/android/withAndroidAppBuildGradle.ts +34 -0
- package/plugin/src/android/withAndroidTarget.ts +26 -0
- package/plugin/src/android/withAndroidWidget.ts +778 -0
- package/plugin/src/config.ts +255 -0
- package/plugin/src/index.ts +19 -0
- package/plugin/src/ios/config-plugins/withEntitlements.ts +69 -0
- package/plugin/src/ios/config-plugins/withIOSTarget.ts +179 -0
- package/plugin/src/ios/config-plugins/withIosColorset.ts +29 -0
- package/plugin/src/ios/config-plugins/withIosStickerPack.ts +65 -0
- package/plugin/src/ios/config-plugins/withPodfile.ts +238 -0
- package/plugin/src/ios/config-plugins/withXcodeChanges.ts +891 -0
- package/plugin/src/ios/target.ts +668 -0
- package/plugin/src/ios/templates/MessagesViewController.swift +120 -0
- package/plugin/src/ios/templates/ReactNativeViewController.swift +240 -0
- package/plugin/src/ios/templates/action-extension-data.swift +106 -0
- package/plugin/src/ios/templates/clip-extension-data.swift +28 -0
- package/plugin/src/ios/templates/messages-extension-data.swift +28 -0
- package/plugin/src/ios/templates/share-extension-data.swift +113 -0
- package/plugin/src/ios/utils/asset.ts +490 -0
- package/plugin/src/ios/utils/file.ts +80 -0
- package/plugin/src/ios/utils/index.ts +12 -0
- package/plugin/src/ios/utils/paths.ts +253 -0
- package/plugin/src/ios/utils/plist.ts +101 -0
- package/plugin/src/ios/utils/podfile.ts +534 -0
- package/plugin/src/ios/utils/reactNativeSwift.ts +283 -0
- package/plugin/src/ios/utils/xcode.ts +989 -0
- package/plugin/src/logger.ts +63 -0
- package/plugin/src/parseTargetConfig.ts +115 -0
- package/plugin/src/types/normalize-colors.d.ts +3 -0
- package/plugin/src/withTargetsDir.ts +120 -0
- package/plugin/tsconfig.build.json +9 -0
- package/plugin/tsconfig.json +9 -0
- package/src/Target.ts +239 -0
- package/src/index.ts +52 -0
- package/src/modules/extension/index.ts +54 -0
- package/src/modules/messages/index.ts +124 -0
- package/src/modules/storage/index.ts +126 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSharedData = exports.openHostApp = exports.close = exports.Extension = void 0;
|
|
4
|
+
const expo_modules_core_1 = require("expo-modules-core");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const ExpoTargetsExtensionModule = (0, expo_modules_core_1.requireNativeModule)('ExpoTargetsExtension');
|
|
7
|
+
class Extension {
|
|
8
|
+
close() {
|
|
9
|
+
console.log('[Extension] close() called, platform:', react_native_1.Platform.OS);
|
|
10
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
11
|
+
console.log('[Extension] Calling native closeExtension()');
|
|
12
|
+
ExpoTargetsExtensionModule.closeExtension();
|
|
13
|
+
console.log('[Extension] Native closeExtension() returned');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
openHostApp(path = '') {
|
|
17
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
18
|
+
ExpoTargetsExtensionModule.openHostApp(path);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
getSharedData() {
|
|
22
|
+
if (react_native_1.Platform.OS === 'ios') {
|
|
23
|
+
return ExpoTargetsExtensionModule.getSharedData();
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.Extension = Extension;
|
|
29
|
+
const close = () => {
|
|
30
|
+
const ext = new Extension();
|
|
31
|
+
ext.close();
|
|
32
|
+
};
|
|
33
|
+
exports.close = close;
|
|
34
|
+
const openHostApp = (path = '') => {
|
|
35
|
+
const ext = new Extension();
|
|
36
|
+
ext.openHostApp(path);
|
|
37
|
+
};
|
|
38
|
+
exports.openHostApp = openHostApp;
|
|
39
|
+
const getSharedData = () => {
|
|
40
|
+
const ext = new Extension();
|
|
41
|
+
return ext.getSharedData();
|
|
42
|
+
};
|
|
43
|
+
exports.getSharedData = getSharedData;
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/extension/index.ts"],"names":[],"mappings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AAG,CAAC,aAAa,EAAE,CAAC;AAC7B,CAAC,CAAC;AAHW,QAAA,aAAa,iBAGxB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export type PresentationStyle = 'compact' | 'expanded';
|
|
2
|
+
export interface MessageLayout {
|
|
3
|
+
caption: string;
|
|
4
|
+
subcaption?: string;
|
|
5
|
+
trailingCaption?: string;
|
|
6
|
+
trailingSubcaption?: string;
|
|
7
|
+
imageUrl?: string;
|
|
8
|
+
mediaFileUrl?: string;
|
|
9
|
+
url?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ConversationInfo {
|
|
12
|
+
conversationId: string;
|
|
13
|
+
remoteParticipantIds: string[];
|
|
14
|
+
participantCount: number;
|
|
15
|
+
hasSelectedMessage: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SelectedMessage {
|
|
18
|
+
url?: string;
|
|
19
|
+
caption?: string;
|
|
20
|
+
subcaption?: string;
|
|
21
|
+
trailingCaption?: string;
|
|
22
|
+
trailingSubcaption?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class Messages {
|
|
25
|
+
getPresentationStyle(): PresentationStyle | null;
|
|
26
|
+
requestPresentationStyle(style: PresentationStyle): void;
|
|
27
|
+
sendMessage(layout: MessageLayout): void;
|
|
28
|
+
sendUpdate(layout: MessageLayout, sessionId: string): void;
|
|
29
|
+
createSession(): string | null;
|
|
30
|
+
getConversationInfo(): ConversationInfo | null;
|
|
31
|
+
addEventListener(eventName: 'onPresentationStyleChange', listener: (style: PresentationStyle) => void): any;
|
|
32
|
+
}
|
|
33
|
+
export declare const getPresentationStyle: () => PresentationStyle | null;
|
|
34
|
+
export declare const requestPresentationStyle: (style: PresentationStyle) => void;
|
|
35
|
+
export declare const sendMessage: (layout: MessageLayout) => void;
|
|
36
|
+
export declare const sendUpdate: (layout: MessageLayout, sessionId: string) => void;
|
|
37
|
+
export declare const createSession: () => string | null;
|
|
38
|
+
export declare const getConversationInfo: () => ConversationInfo | null;
|
|
39
|
+
export declare const addEventListener: (eventName: 'onPresentationStyleChange', listener: (style: PresentationStyle) => void) => any;
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/messages/index.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,UAAU,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,EAAE,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,qBAAa,QAAQ;IACnB,oBAAoB,IAAI,iBAAiB,GAAG,IAAI;IAKhD,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI;IAKxD,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAKxC,UAAU,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAK1D,aAAa,IAAI,MAAM,GAAG,IAAI;IAK9B,mBAAmB,IAAI,gBAAgB,GAAG,IAAI;IAK9C,gBAAgB,CACd,SAAS,EAAE,2BAA2B,EACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI;CAY/C;AAGD,eAAO,MAAM,oBAAoB,QAAO,iBAAiB,GAAG,IAG3D,CAAC;AAEF,eAAO,MAAM,wBAAwB,UAAW,iBAAiB,KAAG,IAGnE,CAAC;AAEF,eAAO,MAAM,WAAW,WAAY,aAAa,KAAG,IAGnD,CAAC;AAEF,eAAO,MAAM,UAAU,WAAY,aAAa,aAAa,MAAM,KAAG,IAGrE,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,IAGzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,gBAAgB,GAAG,IAGzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAChB,2BAA2B,oBACpB,iBAAiB,KAAK,IAAI,QAW7C,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addEventListener = exports.getConversationInfo = exports.createSession = exports.sendUpdate = exports.sendMessage = exports.requestPresentationStyle = exports.getPresentationStyle = exports.Messages = void 0;
|
|
4
|
+
const expo_modules_core_1 = require("expo-modules-core");
|
|
5
|
+
const react_native_1 = require("react-native");
|
|
6
|
+
const ExpoTargetsMessagesModule = (0, expo_modules_core_1.requireNativeModule)('ExpoTargetsMessages');
|
|
7
|
+
class Messages {
|
|
8
|
+
getPresentationStyle() {
|
|
9
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
10
|
+
return null;
|
|
11
|
+
return ExpoTargetsMessagesModule.getPresentationStyle();
|
|
12
|
+
}
|
|
13
|
+
requestPresentationStyle(style) {
|
|
14
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
15
|
+
return;
|
|
16
|
+
ExpoTargetsMessagesModule.requestPresentationStyle(style);
|
|
17
|
+
}
|
|
18
|
+
sendMessage(layout) {
|
|
19
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
20
|
+
return;
|
|
21
|
+
ExpoTargetsMessagesModule.sendMessage(layout);
|
|
22
|
+
}
|
|
23
|
+
sendUpdate(layout, sessionId) {
|
|
24
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
25
|
+
return;
|
|
26
|
+
ExpoTargetsMessagesModule.sendUpdate(layout, sessionId);
|
|
27
|
+
}
|
|
28
|
+
createSession() {
|
|
29
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
30
|
+
return null;
|
|
31
|
+
return ExpoTargetsMessagesModule.createSession();
|
|
32
|
+
}
|
|
33
|
+
getConversationInfo() {
|
|
34
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
35
|
+
return null;
|
|
36
|
+
return ExpoTargetsMessagesModule.getConversationInfo();
|
|
37
|
+
}
|
|
38
|
+
addEventListener(eventName, listener) {
|
|
39
|
+
if (react_native_1.Platform.OS !== 'ios') {
|
|
40
|
+
return { remove: () => { } };
|
|
41
|
+
}
|
|
42
|
+
return ExpoTargetsMessagesModule.addListener(eventName, (event) => {
|
|
43
|
+
listener(event.presentationStyle);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.Messages = Messages;
|
|
48
|
+
// Standalone functions for backwards compatibility
|
|
49
|
+
const getPresentationStyle = () => {
|
|
50
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
51
|
+
return null;
|
|
52
|
+
return ExpoTargetsMessagesModule.getPresentationStyle();
|
|
53
|
+
};
|
|
54
|
+
exports.getPresentationStyle = getPresentationStyle;
|
|
55
|
+
const requestPresentationStyle = (style) => {
|
|
56
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
57
|
+
return;
|
|
58
|
+
ExpoTargetsMessagesModule.requestPresentationStyle(style);
|
|
59
|
+
};
|
|
60
|
+
exports.requestPresentationStyle = requestPresentationStyle;
|
|
61
|
+
const sendMessage = (layout) => {
|
|
62
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
63
|
+
return;
|
|
64
|
+
ExpoTargetsMessagesModule.sendMessage(layout);
|
|
65
|
+
};
|
|
66
|
+
exports.sendMessage = sendMessage;
|
|
67
|
+
const sendUpdate = (layout, sessionId) => {
|
|
68
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
69
|
+
return;
|
|
70
|
+
ExpoTargetsMessagesModule.sendUpdate(layout, sessionId);
|
|
71
|
+
};
|
|
72
|
+
exports.sendUpdate = sendUpdate;
|
|
73
|
+
const createSession = () => {
|
|
74
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
75
|
+
return null;
|
|
76
|
+
return ExpoTargetsMessagesModule.createSession();
|
|
77
|
+
};
|
|
78
|
+
exports.createSession = createSession;
|
|
79
|
+
const getConversationInfo = () => {
|
|
80
|
+
if (react_native_1.Platform.OS !== 'ios')
|
|
81
|
+
return null;
|
|
82
|
+
return ExpoTargetsMessagesModule.getConversationInfo();
|
|
83
|
+
};
|
|
84
|
+
exports.getConversationInfo = getConversationInfo;
|
|
85
|
+
const addEventListener = (eventName, listener) => {
|
|
86
|
+
if (react_native_1.Platform.OS !== 'ios') {
|
|
87
|
+
return { remove: () => { } };
|
|
88
|
+
}
|
|
89
|
+
return ExpoTargetsMessagesModule.addListener(eventName, (event) => {
|
|
90
|
+
listener(event.presentationStyle);
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
exports.addEventListener = addEventListener;
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/messages/index.ts"],"names":[],"mappings":";;;AAAA,yDAAwD;AACxD,+CAAwC;AAExC,MAAM,yBAAyB,GAAG,IAAA,uCAAmB,EAAC,qBAAqB,CAAC,CAAC;AA6B7E,MAAa,QAAQ;IACnB,oBAAoB;QAClB,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK;YAAE,OAAO,IAAI,CAAC;QACvC,OAAO,y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EAAE;IACF,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,yBAAyB,CAAC,WAAW,CAC1C,SAAS,EACT,CAAC,KAA+C,EAAE,EAAE;QAClD,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACpC,CAAC,CACF,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare class AppGroupStorage {
|
|
2
|
+
private readonly appGroup;
|
|
3
|
+
constructor(appGroup: string);
|
|
4
|
+
set(key: string, value: any): void;
|
|
5
|
+
get<T = any>(key: string): T | null;
|
|
6
|
+
remove(key: string): void;
|
|
7
|
+
clear(): void;
|
|
8
|
+
setData(data: Record<string, any>): void;
|
|
9
|
+
getData<T extends Record<string, any>>(): T;
|
|
10
|
+
getKeys(): string[];
|
|
11
|
+
refresh(targetName?: string): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function refreshAllTargets(): void;
|
|
14
|
+
export declare function clearSharedData(appGroup: string): void;
|
|
15
|
+
export declare function getTargetsConfigFromBundle(): any[] | null;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/storage/index.ts"],"names":[],"mappings":"AAIA,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,MAAM;IAE7C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG;IAwB3B,GAAG,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI;IAsBnC,MAAM,CAAC,GAAG,EAAE,MAAM;IAIlB,KAAK;IAIL,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAMjC,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC;IA4B3C,OAAO,IAAI,MAAM,EAAE;IASnB,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM;CAG5B;AAED,wBAAgB,iBAAiB,SAEhC;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,QAG/C;AAED,wBAAgB,0BAA0B,IAAI,GAAG,EAAE,GAAG,IAAI,CAOzD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getTargetsConfigFromBundle = exports.clearSharedData = exports.refreshAllTargets = exports.AppGroupStorage = void 0;
|
|
4
|
+
const expo_modules_core_1 = require("expo-modules-core");
|
|
5
|
+
const ExpoTargetsStorageModule = (0, expo_modules_core_1.requireNativeModule)('ExpoTargetsStorage');
|
|
6
|
+
class AppGroupStorage {
|
|
7
|
+
constructor(appGroup) {
|
|
8
|
+
this.appGroup = appGroup;
|
|
9
|
+
}
|
|
10
|
+
set(key, value) {
|
|
11
|
+
if (value === null || value === undefined) {
|
|
12
|
+
ExpoTargetsStorageModule.remove(key, this.appGroup);
|
|
13
|
+
}
|
|
14
|
+
else if (typeof value === 'number') {
|
|
15
|
+
ExpoTargetsStorageModule.setInt(key, Math.floor(value), this.appGroup);
|
|
16
|
+
}
|
|
17
|
+
else if (typeof value === 'string') {
|
|
18
|
+
ExpoTargetsStorageModule.setString(key, value, this.appGroup);
|
|
19
|
+
}
|
|
20
|
+
else if (typeof value === 'boolean') {
|
|
21
|
+
ExpoTargetsStorageModule.setInt(key, value ? 1 : 0, this.appGroup);
|
|
22
|
+
}
|
|
23
|
+
else if (Array.isArray(value)) {
|
|
24
|
+
ExpoTargetsStorageModule.setString(key, JSON.stringify(value), this.appGroup);
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
ExpoTargetsStorageModule.setString(key, JSON.stringify(value), this.appGroup);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get(key) {
|
|
31
|
+
try {
|
|
32
|
+
const value = ExpoTargetsStorageModule.get(key, this.appGroup);
|
|
33
|
+
if (value === null || value === undefined) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
if (typeof value === 'string') {
|
|
37
|
+
try {
|
|
38
|
+
return JSON.parse(value);
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
console.warn(`Failed to get value for key "${key}":`, error);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
remove(key) {
|
|
52
|
+
ExpoTargetsStorageModule.remove(key, this.appGroup);
|
|
53
|
+
}
|
|
54
|
+
clear() {
|
|
55
|
+
ExpoTargetsStorageModule.clearAll(this.appGroup);
|
|
56
|
+
}
|
|
57
|
+
setData(data) {
|
|
58
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
59
|
+
this.set(key, value);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getData() {
|
|
63
|
+
try {
|
|
64
|
+
const rawData = ExpoTargetsStorageModule.getAllData(this.appGroup);
|
|
65
|
+
if (!rawData || typeof rawData !== 'object') {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
const parsedData = {};
|
|
69
|
+
Object.entries(rawData).forEach(([key, value]) => {
|
|
70
|
+
if (typeof value === 'string') {
|
|
71
|
+
try {
|
|
72
|
+
parsedData[key] = JSON.parse(value);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
parsedData[key] = value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
parsedData[key] = value;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return parsedData;
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
console.warn('Failed to get all data:', error);
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
getKeys() {
|
|
90
|
+
try {
|
|
91
|
+
return ExpoTargetsStorageModule.getAllKeys(this.appGroup);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
console.warn('Failed to get all keys:', error);
|
|
95
|
+
return [];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
refresh(targetName) {
|
|
99
|
+
ExpoTargetsStorageModule.refreshTarget(targetName);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.AppGroupStorage = AppGroupStorage;
|
|
103
|
+
function refreshAllTargets() {
|
|
104
|
+
ExpoTargetsStorageModule.refreshTarget(undefined);
|
|
105
|
+
}
|
|
106
|
+
exports.refreshAllTargets = refreshAllTargets;
|
|
107
|
+
function clearSharedData(appGroup) {
|
|
108
|
+
const storage = new AppGroupStorage(appGroup);
|
|
109
|
+
storage.clear();
|
|
110
|
+
}
|
|
111
|
+
exports.clearSharedData = clearSharedData;
|
|
112
|
+
function getTargetsConfigFromBundle() {
|
|
113
|
+
try {
|
|
114
|
+
return ExpoTargetsStorageModule.getTargetsConfig();
|
|
115
|
+
}
|
|
116
|
+
catch (error) {
|
|
117
|
+
console.warn('Failed to read targets config from bundle:', error);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.getTargetsConfigFromBundle = getTargetsConfigFromBundle;
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/modules/storage/index.ts"],"names":[],"mappings":";;;AAAA,yDAAwD;AAExD,MAAM,wBAAwB,GAAG,IAAA,uCAAmB,EAAC,oBAAoB,CAAC,CAAC;AAE3E,MAAa,eAAe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0B;IACxC,IAAI,CAAC;QACH,OAAO,wBAAwB,CAAC,gBAAgB,EAAE,CAAC;IACrD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,4CAA4C,EAAE,KAAK,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAPD,gEAOC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"platforms": ["ios", "android"],
|
|
3
|
+
"ios": {
|
|
4
|
+
"modules": [
|
|
5
|
+
"ExpoTargetsStorageModule",
|
|
6
|
+
"ExpoTargetsExtensionModule",
|
|
7
|
+
"ExpoTargetsMessagesModule"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
"android": {
|
|
11
|
+
"modules": [
|
|
12
|
+
"expo.modules.targets.storage.ExpoTargetsStorageModule",
|
|
13
|
+
"expo.modules.targets.extension.ExpoTargetsExtensionModule",
|
|
14
|
+
"expo.modules.targets.messages.ExpoTargetsMessagesModule"
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'ExpoTargetsExtension'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = 'Expo Targets Extension Module - Extension utilities for share, action, and clip extensions'
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.authors = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = { :ios => '13.0' }
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.source = { :git => package['repository']['url'], :tag => "v#{package['version']}" }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
|
|
20
|
+
s.source_files = "**/*.{h,m,mm,swift,hpp,cpp}"
|
|
21
|
+
s.exclude_files = "Tests/**/*"
|
|
22
|
+
end
|
|
23
|
+
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import ExpoModulesCore
|
|
2
|
+
import UIKit
|
|
3
|
+
|
|
4
|
+
public class ExpoTargetsExtensionModule: Module {
|
|
5
|
+
public func definition() -> ModuleDefinition {
|
|
6
|
+
Name("ExpoTargetsExtension")
|
|
7
|
+
|
|
8
|
+
Function("closeExtension") { () -> Void in
|
|
9
|
+
NSLog("[ExpoTargetsExtension] closeExtension() called from JS")
|
|
10
|
+
DispatchQueue.main.async {
|
|
11
|
+
NSLog("[ExpoTargetsExtension] Posting ExpoTargetsCloseExtension notification on main thread")
|
|
12
|
+
NotificationCenter.default.post(name: NSNotification.Name("ExpoTargetsCloseExtension"), object: nil)
|
|
13
|
+
NSLog("[ExpoTargetsExtension] Notification posted successfully")
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Function("openHostApp") { (path: String) -> Void in
|
|
18
|
+
DispatchQueue.main.async {
|
|
19
|
+
let userInfo: [String: String] = ["path": path]
|
|
20
|
+
NotificationCenter.default.post(name: NSNotification.Name("ExpoTargetsOpenHostApp"), object: nil, userInfo: userInfo)
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Function("getSharedData") { () -> [String: Any]? in
|
|
25
|
+
guard let extensionContext = self.findExtensionContext() else { return nil }
|
|
26
|
+
guard let extensionItem = extensionContext.inputItems.first as? NSExtensionItem else { return nil }
|
|
27
|
+
guard let attachments = extensionItem.attachments else { return nil }
|
|
28
|
+
|
|
29
|
+
var result: [String: Any] = [:]
|
|
30
|
+
let group = DispatchGroup()
|
|
31
|
+
|
|
32
|
+
for attachment in attachments {
|
|
33
|
+
// Text
|
|
34
|
+
if attachment.hasItemConformingToTypeIdentifier("public.plain-text") {
|
|
35
|
+
group.enter()
|
|
36
|
+
attachment.loadItem(forTypeIdentifier: "public.plain-text", options: nil) { data, error in
|
|
37
|
+
defer { group.leave() }
|
|
38
|
+
if let text = data as? String {
|
|
39
|
+
result["text"] = text
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// URL
|
|
45
|
+
if attachment.hasItemConformingToTypeIdentifier("public.url") {
|
|
46
|
+
group.enter()
|
|
47
|
+
attachment.loadItem(forTypeIdentifier: "public.url", options: nil) { data, error in
|
|
48
|
+
defer { group.leave() }
|
|
49
|
+
if let url = data as? URL {
|
|
50
|
+
result["url"] = url.absoluteString
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Images
|
|
56
|
+
if attachment.hasItemConformingToTypeIdentifier("public.image") {
|
|
57
|
+
group.enter()
|
|
58
|
+
attachment.loadItem(forTypeIdentifier: "public.image", options: nil) { data, error in
|
|
59
|
+
defer { group.leave() }
|
|
60
|
+
if let url = data as? URL {
|
|
61
|
+
var images = result["images"] as? [String] ?? []
|
|
62
|
+
images.append(url.absoluteString)
|
|
63
|
+
result["images"] = images
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
group.wait()
|
|
70
|
+
return result.isEmpty ? nil : result
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private func findExtensionContext() -> NSExtensionContext? {
|
|
75
|
+
// First, try to find through window hierarchy
|
|
76
|
+
let windows: [UIWindow]
|
|
77
|
+
if #available(iOS 15.0, *) {
|
|
78
|
+
let scenes = UIApplication.shared.connectedScenes
|
|
79
|
+
let windowScenes = scenes.compactMap { $0 as? UIWindowScene }
|
|
80
|
+
windows = windowScenes.flatMap { $0.windows }
|
|
81
|
+
} else {
|
|
82
|
+
windows = UIApplication.shared.windows
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
for window in windows {
|
|
86
|
+
if let rootVC = window.rootViewController {
|
|
87
|
+
if let context = findExtensionContext(in: rootVC) {
|
|
88
|
+
return context
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Fallback: search through responder chain from any visible window
|
|
94
|
+
for window in windows {
|
|
95
|
+
var responder: UIResponder? = window.rootViewController
|
|
96
|
+
while responder != nil {
|
|
97
|
+
if let viewController = responder as? UIViewController {
|
|
98
|
+
if let context = viewController.extensionContext {
|
|
99
|
+
return context
|
|
100
|
+
}
|
|
101
|
+
// Also check nested view controllers
|
|
102
|
+
if let context = findExtensionContext(in: viewController) {
|
|
103
|
+
return context
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
responder = responder?.next
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return nil
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
private func findExtensionContext(in viewController: UIViewController) -> NSExtensionContext? {
|
|
114
|
+
// Check the view controller itself
|
|
115
|
+
if let context = viewController.extensionContext {
|
|
116
|
+
return context
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Check presented view controllers
|
|
120
|
+
if let presented = viewController.presentedViewController {
|
|
121
|
+
if let context = findExtensionContext(in: presented) {
|
|
122
|
+
return context
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Check child view controllers
|
|
127
|
+
for childVC in viewController.children {
|
|
128
|
+
if let context = findExtensionContext(in: childVC) {
|
|
129
|
+
return context
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Check container view controllers
|
|
134
|
+
if let navController = viewController as? UINavigationController {
|
|
135
|
+
if let topVC = navController.topViewController {
|
|
136
|
+
if let context = findExtensionContext(in: topVC) {
|
|
137
|
+
return context
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
if let visibleVC = navController.visibleViewController {
|
|
141
|
+
if let context = findExtensionContext(in: visibleVC) {
|
|
142
|
+
return context
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if let tabController = viewController as? UITabBarController {
|
|
148
|
+
if let selectedVC = tabController.selectedViewController {
|
|
149
|
+
if let context = findExtensionContext(in: selectedVC) {
|
|
150
|
+
return context
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return nil
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
@discardableResult
|
|
159
|
+
private func openURL(_ url: URL) -> Bool {
|
|
160
|
+
// Use responder chain to find UIApplication
|
|
161
|
+
// extensionContext.open() doesn't work reliably in share extensions
|
|
162
|
+
var responder: UIResponder? = UIApplication.shared.delegate as? UIResponder
|
|
163
|
+
|
|
164
|
+
while responder != nil {
|
|
165
|
+
if let application = responder as? UIApplication {
|
|
166
|
+
application.open(url, options: [:], completionHandler: nil)
|
|
167
|
+
return true
|
|
168
|
+
}
|
|
169
|
+
responder = responder?.next
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Fallback: try UIApplication.shared directly
|
|
173
|
+
if UIApplication.shared.canOpenURL(url) {
|
|
174
|
+
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
175
|
+
return true
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
return false
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'json'
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = 'ExpoTargetsMessages'
|
|
7
|
+
s.version = package['version']
|
|
8
|
+
s.summary = package['description']
|
|
9
|
+
s.description = 'Expo Targets Messages Module - Messages framework integration for iMessage apps'
|
|
10
|
+
s.license = package['license']
|
|
11
|
+
s.authors = package['author']
|
|
12
|
+
s.homepage = package['homepage']
|
|
13
|
+
s.platforms = { :ios => '13.0' }
|
|
14
|
+
s.swift_version = '5.4'
|
|
15
|
+
s.source = { :git => package['repository']['url'], :tag => "v#{package['version']}" }
|
|
16
|
+
s.static_framework = true
|
|
17
|
+
|
|
18
|
+
s.dependency 'ExpoModulesCore'
|
|
19
|
+
s.frameworks = 'Messages'
|
|
20
|
+
|
|
21
|
+
s.source_files = "ExpoTargetsMessagesModule.swift"
|
|
22
|
+
end
|
|
23
|
+
|