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,668 @@
|
|
|
1
|
+
import plist from '@expo/plist';
|
|
2
|
+
|
|
3
|
+
import type { ExtensionType } from '../config';
|
|
4
|
+
|
|
5
|
+
function deepMerge(target: any, source: any): any {
|
|
6
|
+
const output = { ...target };
|
|
7
|
+
|
|
8
|
+
if (isObject(target) && isObject(source)) {
|
|
9
|
+
Object.keys(source).forEach((key) => {
|
|
10
|
+
if (isObject(source[key])) {
|
|
11
|
+
if (!(key in target)) {
|
|
12
|
+
output[key] = source[key];
|
|
13
|
+
} else {
|
|
14
|
+
output[key] = deepMerge(target[key], source[key]);
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
output[key] = source[key];
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return output;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function isObject(item: any): boolean {
|
|
26
|
+
return item && typeof item === 'object' && !Array.isArray(item);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Centralized type characteristics for all extension types.
|
|
31
|
+
* Use this map to avoid scattered type checks throughout the codebase.
|
|
32
|
+
*/
|
|
33
|
+
interface TypeCharacteristics {
|
|
34
|
+
requiresCode: boolean; // Needs Swift files, code signing, build settings
|
|
35
|
+
targetType: 'application' | 'app_extension'; // Xcode target creation type
|
|
36
|
+
embedType: 'foundation-extension' | 'app-clip' | 'none'; // How to embed in parent app
|
|
37
|
+
frameworks: string[]; // Frameworks to link
|
|
38
|
+
productType: string; // Xcode product type
|
|
39
|
+
extensionPointIdentifier: string; // Extension point (empty for standalone)
|
|
40
|
+
defaultUsesAppGroups: boolean; // Should use app groups by default
|
|
41
|
+
requiresEntitlements: boolean; // Needs entitlements file
|
|
42
|
+
basePlist: Record<string, any>; // Base Info.plist structure for this type
|
|
43
|
+
supportsActivationRules: boolean; // Can use activationRules config
|
|
44
|
+
activationRulesLocation: 'direct' | 'attributes' | 'none'; // Where to place NSExtensionActivationRule
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const TYPE_CHARACTERISTICS: Record<ExtensionType, TypeCharacteristics> =
|
|
48
|
+
{
|
|
49
|
+
widget: {
|
|
50
|
+
requiresCode: true,
|
|
51
|
+
targetType: 'app_extension',
|
|
52
|
+
embedType: 'foundation-extension',
|
|
53
|
+
frameworks: ['WidgetKit', 'SwiftUI', 'ActivityKit', 'AppIntents'],
|
|
54
|
+
productType: 'com.apple.product-type.app-extension',
|
|
55
|
+
extensionPointIdentifier: 'com.apple.widgetkit-extension',
|
|
56
|
+
defaultUsesAppGroups: true,
|
|
57
|
+
requiresEntitlements: true,
|
|
58
|
+
basePlist: {},
|
|
59
|
+
supportsActivationRules: false,
|
|
60
|
+
activationRulesLocation: 'none',
|
|
61
|
+
},
|
|
62
|
+
clip: {
|
|
63
|
+
requiresCode: true,
|
|
64
|
+
targetType: 'application',
|
|
65
|
+
embedType: 'app-clip',
|
|
66
|
+
frameworks: [], // SwiftUI auto-linked
|
|
67
|
+
productType:
|
|
68
|
+
'com.apple.product-type.application.on-demand-install-capable',
|
|
69
|
+
extensionPointIdentifier: '',
|
|
70
|
+
defaultUsesAppGroups: true,
|
|
71
|
+
requiresEntitlements: true,
|
|
72
|
+
basePlist: {
|
|
73
|
+
CFBundleShortVersionString: '$(MARKETING_VERSION)',
|
|
74
|
+
UIApplicationSupportsIndirectInputEvents: true,
|
|
75
|
+
NSAppClip: {
|
|
76
|
+
NSAppClipRequestEphemeralUserNotification: false,
|
|
77
|
+
NSAppClipRequestLocationConfirmation: false,
|
|
78
|
+
},
|
|
79
|
+
UILaunchStoryboardName: 'SplashScreen',
|
|
80
|
+
UIUserInterfaceStyle: 'Automatic',
|
|
81
|
+
},
|
|
82
|
+
supportsActivationRules: false,
|
|
83
|
+
activationRulesLocation: 'none',
|
|
84
|
+
},
|
|
85
|
+
stickers: {
|
|
86
|
+
requiresCode: false, // Asset-only
|
|
87
|
+
targetType: 'app_extension',
|
|
88
|
+
embedType: 'foundation-extension',
|
|
89
|
+
frameworks: [],
|
|
90
|
+
productType: 'com.apple.product-type.app-extension.messages-sticker-pack',
|
|
91
|
+
extensionPointIdentifier: 'com.apple.message-payload-provider',
|
|
92
|
+
defaultUsesAppGroups: false,
|
|
93
|
+
requiresEntitlements: false,
|
|
94
|
+
basePlist: {
|
|
95
|
+
NSStickerSharingLevel: 'OS',
|
|
96
|
+
NSExtension: {
|
|
97
|
+
NSExtensionPrincipalClass: 'StickerBrowserViewController',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
supportsActivationRules: false,
|
|
101
|
+
activationRulesLocation: 'none',
|
|
102
|
+
},
|
|
103
|
+
messages: {
|
|
104
|
+
requiresCode: true,
|
|
105
|
+
targetType: 'app_extension',
|
|
106
|
+
embedType: 'foundation-extension',
|
|
107
|
+
frameworks: ['Messages'],
|
|
108
|
+
productType: 'com.apple.product-type.app-extension',
|
|
109
|
+
extensionPointIdentifier: 'com.apple.message-payload-provider',
|
|
110
|
+
defaultUsesAppGroups: true,
|
|
111
|
+
requiresEntitlements: true,
|
|
112
|
+
basePlist: {
|
|
113
|
+
NSExtension: {
|
|
114
|
+
NSExtensionPrincipalClass:
|
|
115
|
+
'$(PRODUCT_MODULE_NAME).MessagesViewController',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
supportsActivationRules: false,
|
|
119
|
+
activationRulesLocation: 'none',
|
|
120
|
+
},
|
|
121
|
+
share: {
|
|
122
|
+
requiresCode: true,
|
|
123
|
+
targetType: 'app_extension',
|
|
124
|
+
embedType: 'foundation-extension',
|
|
125
|
+
frameworks: ['Social', 'MobileCoreServices'],
|
|
126
|
+
productType: 'com.apple.product-type.app-extension',
|
|
127
|
+
extensionPointIdentifier: 'com.apple.share-services',
|
|
128
|
+
defaultUsesAppGroups: true,
|
|
129
|
+
requiresEntitlements: true,
|
|
130
|
+
basePlist: {
|
|
131
|
+
NSExtension: {
|
|
132
|
+
NSExtensionPrincipalClass:
|
|
133
|
+
'$(PRODUCT_MODULE_NAME).ShareViewController',
|
|
134
|
+
NSExtensionAttributes: {
|
|
135
|
+
NSExtensionActivationRule: {
|
|
136
|
+
NSExtensionActivationSupportsText: true,
|
|
137
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: 1,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
supportsActivationRules: true,
|
|
143
|
+
activationRulesLocation: 'attributes',
|
|
144
|
+
},
|
|
145
|
+
action: {
|
|
146
|
+
requiresCode: true,
|
|
147
|
+
targetType: 'app_extension',
|
|
148
|
+
embedType: 'foundation-extension',
|
|
149
|
+
frameworks: [],
|
|
150
|
+
productType: 'com.apple.product-type.app-extension',
|
|
151
|
+
extensionPointIdentifier: 'com.apple.ui-services',
|
|
152
|
+
defaultUsesAppGroups: false,
|
|
153
|
+
requiresEntitlements: true,
|
|
154
|
+
basePlist: {
|
|
155
|
+
NSExtension: {
|
|
156
|
+
// NSExtensionMainStoryboard or NSExtensionPrincipalClass set conditionally
|
|
157
|
+
// NSExtensionActivationRule set from activationRules config
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
supportsActivationRules: true,
|
|
161
|
+
activationRulesLocation: 'direct',
|
|
162
|
+
},
|
|
163
|
+
safari: {
|
|
164
|
+
requiresCode: true,
|
|
165
|
+
targetType: 'app_extension',
|
|
166
|
+
embedType: 'foundation-extension',
|
|
167
|
+
frameworks: [],
|
|
168
|
+
productType: 'com.apple.product-type.app-extension',
|
|
169
|
+
extensionPointIdentifier: 'com.apple.Safari.web-extension',
|
|
170
|
+
defaultUsesAppGroups: false,
|
|
171
|
+
requiresEntitlements: true,
|
|
172
|
+
basePlist: {},
|
|
173
|
+
supportsActivationRules: false,
|
|
174
|
+
activationRulesLocation: 'none',
|
|
175
|
+
},
|
|
176
|
+
'notification-content': {
|
|
177
|
+
requiresCode: true,
|
|
178
|
+
targetType: 'app_extension',
|
|
179
|
+
embedType: 'foundation-extension',
|
|
180
|
+
frameworks: [],
|
|
181
|
+
productType: 'com.apple.product-type.app-extension',
|
|
182
|
+
extensionPointIdentifier: 'com.apple.usernotifications.content-extension',
|
|
183
|
+
defaultUsesAppGroups: false,
|
|
184
|
+
requiresEntitlements: true,
|
|
185
|
+
basePlist: {},
|
|
186
|
+
supportsActivationRules: false,
|
|
187
|
+
activationRulesLocation: 'none',
|
|
188
|
+
},
|
|
189
|
+
'notification-service': {
|
|
190
|
+
requiresCode: true,
|
|
191
|
+
targetType: 'app_extension',
|
|
192
|
+
embedType: 'foundation-extension',
|
|
193
|
+
frameworks: [],
|
|
194
|
+
productType: 'com.apple.product-type.app-extension',
|
|
195
|
+
extensionPointIdentifier: 'com.apple.usernotifications.service',
|
|
196
|
+
defaultUsesAppGroups: false,
|
|
197
|
+
requiresEntitlements: true,
|
|
198
|
+
basePlist: {},
|
|
199
|
+
supportsActivationRules: false,
|
|
200
|
+
activationRulesLocation: 'none',
|
|
201
|
+
},
|
|
202
|
+
intent: {
|
|
203
|
+
requiresCode: true,
|
|
204
|
+
targetType: 'app_extension',
|
|
205
|
+
embedType: 'foundation-extension',
|
|
206
|
+
frameworks: [],
|
|
207
|
+
productType: 'com.apple.product-type.app-extension',
|
|
208
|
+
extensionPointIdentifier: 'com.apple.intents-service',
|
|
209
|
+
defaultUsesAppGroups: false,
|
|
210
|
+
requiresEntitlements: true,
|
|
211
|
+
basePlist: {},
|
|
212
|
+
supportsActivationRules: false,
|
|
213
|
+
activationRulesLocation: 'none',
|
|
214
|
+
},
|
|
215
|
+
'intent-ui': {
|
|
216
|
+
requiresCode: true,
|
|
217
|
+
targetType: 'app_extension',
|
|
218
|
+
embedType: 'foundation-extension',
|
|
219
|
+
frameworks: [],
|
|
220
|
+
productType: 'com.apple.product-type.app-extension',
|
|
221
|
+
extensionPointIdentifier: 'com.apple.intents-ui-service',
|
|
222
|
+
defaultUsesAppGroups: false,
|
|
223
|
+
requiresEntitlements: true,
|
|
224
|
+
basePlist: {},
|
|
225
|
+
supportsActivationRules: false,
|
|
226
|
+
activationRulesLocation: 'none',
|
|
227
|
+
},
|
|
228
|
+
spotlight: {
|
|
229
|
+
requiresCode: true,
|
|
230
|
+
targetType: 'app_extension',
|
|
231
|
+
embedType: 'foundation-extension',
|
|
232
|
+
frameworks: [],
|
|
233
|
+
productType: 'com.apple.product-type.app-extension',
|
|
234
|
+
extensionPointIdentifier: 'com.apple.spotlight.import',
|
|
235
|
+
defaultUsesAppGroups: false,
|
|
236
|
+
requiresEntitlements: true,
|
|
237
|
+
basePlist: {},
|
|
238
|
+
supportsActivationRules: false,
|
|
239
|
+
activationRulesLocation: 'none',
|
|
240
|
+
},
|
|
241
|
+
'bg-download': {
|
|
242
|
+
requiresCode: true,
|
|
243
|
+
targetType: 'app_extension',
|
|
244
|
+
embedType: 'foundation-extension',
|
|
245
|
+
frameworks: [],
|
|
246
|
+
productType: 'com.apple.product-type.app-extension',
|
|
247
|
+
extensionPointIdentifier:
|
|
248
|
+
'com.apple.background-asset-downloader-extension',
|
|
249
|
+
defaultUsesAppGroups: true,
|
|
250
|
+
requiresEntitlements: true,
|
|
251
|
+
basePlist: {},
|
|
252
|
+
supportsActivationRules: false,
|
|
253
|
+
activationRulesLocation: 'none',
|
|
254
|
+
},
|
|
255
|
+
'quicklook-thumbnail': {
|
|
256
|
+
requiresCode: true,
|
|
257
|
+
targetType: 'app_extension',
|
|
258
|
+
embedType: 'foundation-extension',
|
|
259
|
+
frameworks: [],
|
|
260
|
+
productType: 'com.apple.product-type.app-extension',
|
|
261
|
+
extensionPointIdentifier: 'com.apple.quicklook.thumbnail',
|
|
262
|
+
defaultUsesAppGroups: false,
|
|
263
|
+
requiresEntitlements: true,
|
|
264
|
+
basePlist: {},
|
|
265
|
+
supportsActivationRules: false,
|
|
266
|
+
activationRulesLocation: 'none',
|
|
267
|
+
},
|
|
268
|
+
'location-push': {
|
|
269
|
+
requiresCode: true,
|
|
270
|
+
targetType: 'app_extension',
|
|
271
|
+
embedType: 'foundation-extension',
|
|
272
|
+
frameworks: [],
|
|
273
|
+
productType: 'com.apple.product-type.app-extension',
|
|
274
|
+
extensionPointIdentifier: 'com.apple.location.push.service',
|
|
275
|
+
defaultUsesAppGroups: false,
|
|
276
|
+
requiresEntitlements: true,
|
|
277
|
+
basePlist: {},
|
|
278
|
+
supportsActivationRules: false,
|
|
279
|
+
activationRulesLocation: 'none',
|
|
280
|
+
},
|
|
281
|
+
'credentials-provider': {
|
|
282
|
+
requiresCode: true,
|
|
283
|
+
targetType: 'app_extension',
|
|
284
|
+
embedType: 'foundation-extension',
|
|
285
|
+
frameworks: [],
|
|
286
|
+
productType: 'com.apple.product-type.app-extension',
|
|
287
|
+
extensionPointIdentifier:
|
|
288
|
+
'com.apple.authentication-services-credential-provider-ui',
|
|
289
|
+
defaultUsesAppGroups: false,
|
|
290
|
+
requiresEntitlements: true,
|
|
291
|
+
basePlist: {},
|
|
292
|
+
supportsActivationRules: false,
|
|
293
|
+
activationRulesLocation: 'none',
|
|
294
|
+
},
|
|
295
|
+
'account-auth': {
|
|
296
|
+
requiresCode: true,
|
|
297
|
+
targetType: 'app_extension',
|
|
298
|
+
embedType: 'foundation-extension',
|
|
299
|
+
frameworks: [],
|
|
300
|
+
productType: 'com.apple.product-type.app-extension',
|
|
301
|
+
extensionPointIdentifier:
|
|
302
|
+
'com.apple.authentication-services-account-authentication-modification-ui',
|
|
303
|
+
defaultUsesAppGroups: false,
|
|
304
|
+
requiresEntitlements: true,
|
|
305
|
+
basePlist: {},
|
|
306
|
+
supportsActivationRules: false,
|
|
307
|
+
activationRulesLocation: 'none',
|
|
308
|
+
},
|
|
309
|
+
'app-intent': {
|
|
310
|
+
requiresCode: true,
|
|
311
|
+
targetType: 'app_extension',
|
|
312
|
+
embedType: 'foundation-extension',
|
|
313
|
+
frameworks: [],
|
|
314
|
+
productType: 'com.apple.product-type.extensionkit-extension',
|
|
315
|
+
extensionPointIdentifier: 'com.apple.appintents-extension',
|
|
316
|
+
defaultUsesAppGroups: false,
|
|
317
|
+
requiresEntitlements: true,
|
|
318
|
+
basePlist: {},
|
|
319
|
+
supportsActivationRules: false,
|
|
320
|
+
activationRulesLocation: 'none',
|
|
321
|
+
},
|
|
322
|
+
'device-activity-monitor': {
|
|
323
|
+
requiresCode: true,
|
|
324
|
+
targetType: 'app_extension',
|
|
325
|
+
embedType: 'foundation-extension',
|
|
326
|
+
frameworks: [],
|
|
327
|
+
productType: 'com.apple.product-type.app-extension',
|
|
328
|
+
extensionPointIdentifier: 'com.apple.deviceactivity.monitor-extension',
|
|
329
|
+
defaultUsesAppGroups: false,
|
|
330
|
+
requiresEntitlements: true,
|
|
331
|
+
basePlist: {},
|
|
332
|
+
supportsActivationRules: false,
|
|
333
|
+
activationRulesLocation: 'none',
|
|
334
|
+
},
|
|
335
|
+
matter: {
|
|
336
|
+
requiresCode: true,
|
|
337
|
+
targetType: 'app_extension',
|
|
338
|
+
embedType: 'foundation-extension',
|
|
339
|
+
frameworks: [],
|
|
340
|
+
productType: 'com.apple.product-type.app-extension',
|
|
341
|
+
extensionPointIdentifier:
|
|
342
|
+
'com.apple.matter.support.extension.device-setup',
|
|
343
|
+
defaultUsesAppGroups: false,
|
|
344
|
+
requiresEntitlements: true,
|
|
345
|
+
basePlist: {},
|
|
346
|
+
supportsActivationRules: false,
|
|
347
|
+
activationRulesLocation: 'none',
|
|
348
|
+
},
|
|
349
|
+
watch: {
|
|
350
|
+
requiresCode: true,
|
|
351
|
+
targetType: 'application',
|
|
352
|
+
embedType: 'none',
|
|
353
|
+
frameworks: [],
|
|
354
|
+
productType: 'com.apple.product-type.application',
|
|
355
|
+
extensionPointIdentifier: '',
|
|
356
|
+
defaultUsesAppGroups: false,
|
|
357
|
+
requiresEntitlements: true,
|
|
358
|
+
basePlist: {},
|
|
359
|
+
supportsActivationRules: false,
|
|
360
|
+
activationRulesLocation: 'none',
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
export function getTargetInfoPlistForType(
|
|
365
|
+
type: ExtensionType,
|
|
366
|
+
customProperties?: Record<string, any>,
|
|
367
|
+
shareExtensionConfig?: {
|
|
368
|
+
activationRules?: { type: string; maxCount?: number }[];
|
|
369
|
+
preprocessingFile?: string;
|
|
370
|
+
},
|
|
371
|
+
entry?: string,
|
|
372
|
+
mainAppSchemes?: string[],
|
|
373
|
+
targetsConfig?: any[],
|
|
374
|
+
targetIcon?: string
|
|
375
|
+
): string {
|
|
376
|
+
const typeCharacteristics = TYPE_CHARACTERISTICS[type];
|
|
377
|
+
if (!typeCharacteristics) {
|
|
378
|
+
throw new Error(`Unknown extension type: ${type}`);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
let basePlist: Record<string, any> = {
|
|
382
|
+
CFBundleDisplayName: '$(PRODUCT_NAME)',
|
|
383
|
+
CFBundleName: '$(PRODUCT_NAME)',
|
|
384
|
+
CFBundleIdentifier: '$(PRODUCT_BUNDLE_IDENTIFIER)',
|
|
385
|
+
CFBundlePackageType: '$(PRODUCT_BUNDLE_PACKAGE_TYPE)',
|
|
386
|
+
CFBundleDevelopmentRegion: '$(DEVELOPMENT_LANGUAGE)',
|
|
387
|
+
CFBundleShortVersionString: '$(MARKETING_VERSION)',
|
|
388
|
+
CFBundleInfoDictionaryVersion: '6.0',
|
|
389
|
+
CFBundleVersion: '$(CURRENT_PROJECT_VERSION)',
|
|
390
|
+
CFBundleExecutable: '$(EXECUTABLE_NAME)',
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
// Merge type-specific basePlist properties
|
|
394
|
+
basePlist = deepMerge(basePlist, typeCharacteristics.basePlist);
|
|
395
|
+
|
|
396
|
+
// Automatically add NSExtensionPointIdentifier if specified
|
|
397
|
+
if (typeCharacteristics.extensionPointIdentifier) {
|
|
398
|
+
basePlist.NSExtension = {
|
|
399
|
+
NSExtensionPointIdentifier: typeCharacteristics.extensionPointIdentifier,
|
|
400
|
+
...(basePlist.NSExtension || {}),
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Handle activation rules for types that support them
|
|
405
|
+
if (typeCharacteristics.supportsActivationRules) {
|
|
406
|
+
const activationRules = shareExtensionConfig
|
|
407
|
+
? buildShareExtensionActivationRules(
|
|
408
|
+
shareExtensionConfig.activationRules,
|
|
409
|
+
shareExtensionConfig.preprocessingFile
|
|
410
|
+
)
|
|
411
|
+
: typeCharacteristics.activationRulesLocation === 'direct'
|
|
412
|
+
? { TRUEPREDICATE: true } // Default for action extensions
|
|
413
|
+
: {
|
|
414
|
+
// Default for share extensions
|
|
415
|
+
NSExtensionActivationSupportsText: true,
|
|
416
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: 1,
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
if (typeCharacteristics.activationRulesLocation === 'attributes') {
|
|
420
|
+
// Share extensions use NSExtensionAttributes
|
|
421
|
+
basePlist.NSExtension = {
|
|
422
|
+
...basePlist.NSExtension,
|
|
423
|
+
NSExtensionAttributes: {
|
|
424
|
+
NSExtensionActivationRule: activationRules,
|
|
425
|
+
...(shareExtensionConfig?.preprocessingFile && {
|
|
426
|
+
NSExtensionJavaScriptPreprocessingFile:
|
|
427
|
+
shareExtensionConfig.preprocessingFile.replace(/\.[^/.]+$/, ''), // Remove extension
|
|
428
|
+
}),
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
} else if (typeCharacteristics.activationRulesLocation === 'direct') {
|
|
432
|
+
// Action extensions use NSExtensionActivationRule directly
|
|
433
|
+
basePlist.NSExtension = {
|
|
434
|
+
...basePlist.NSExtension,
|
|
435
|
+
NSExtensionActivationRule:
|
|
436
|
+
Object.keys(activationRules).length === 1 &&
|
|
437
|
+
'TRUEPREDICATE' in activationRules
|
|
438
|
+
? 'TRUEPREDICATE'
|
|
439
|
+
: activationRules,
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Override NSExtensionPrincipalClass for React Native extensions
|
|
445
|
+
// Note: Messages extensions keep MessagesViewController as it MUST extend MSMessagesAppViewController
|
|
446
|
+
if (entry && (type === 'share' || type === 'action' || type === 'clip')) {
|
|
447
|
+
const nsExtension = { ...basePlist.NSExtension };
|
|
448
|
+
|
|
449
|
+
// Remove NSExtensionMainStoryboard for action extensions using React Native
|
|
450
|
+
if (
|
|
451
|
+
typeCharacteristics.activationRulesLocation === 'direct' &&
|
|
452
|
+
nsExtension.NSExtensionMainStoryboard
|
|
453
|
+
) {
|
|
454
|
+
delete nsExtension.NSExtensionMainStoryboard;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// For action extensions, ensure NSExtensionActivationRule stays directly under NSExtension
|
|
458
|
+
// but preserve NSExtensionAttributes if it contains other keys like NSExtensionIcon
|
|
459
|
+
if (typeCharacteristics.activationRulesLocation === 'direct') {
|
|
460
|
+
const activationRule = nsExtension.NSExtensionActivationRule;
|
|
461
|
+
const existingAttributes = nsExtension.NSExtensionAttributes || {};
|
|
462
|
+
|
|
463
|
+
// Build NSExtensionAttributes with icon if provided, preserving other attributes
|
|
464
|
+
const finalAttributes: Record<string, any> = { ...existingAttributes };
|
|
465
|
+
|
|
466
|
+
// Remove NSExtensionActivationRule from attributes if it exists (should be direct)
|
|
467
|
+
if (finalAttributes.NSExtensionActivationRule) {
|
|
468
|
+
delete finalAttributes.NSExtensionActivationRule;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Add NSExtensionIcon if targetIcon is provided (for action extensions)
|
|
472
|
+
if (targetIcon && type === 'action') {
|
|
473
|
+
finalAttributes.NSExtensionIcon = {
|
|
474
|
+
// NSExtensionIconName can be an SF Symbol name (e.g., "photo.fill")
|
|
475
|
+
// or an image asset name. iOS automatically detects SF Symbols vs image assets.
|
|
476
|
+
NSExtensionIconName: targetIcon,
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Only include NSExtensionAttributes if there are remaining attributes
|
|
481
|
+
const extensionDict: Record<string, any> = {
|
|
482
|
+
...nsExtension,
|
|
483
|
+
NSExtensionActivationRule: activationRule,
|
|
484
|
+
NSExtensionPrincipalClass:
|
|
485
|
+
'$(PRODUCT_MODULE_NAME).ReactNativeViewController',
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
if (Object.keys(finalAttributes).length > 0) {
|
|
489
|
+
extensionDict.NSExtensionAttributes = finalAttributes;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
basePlist.NSExtension = extensionDict;
|
|
493
|
+
} else {
|
|
494
|
+
basePlist.NSExtension = {
|
|
495
|
+
...nsExtension,
|
|
496
|
+
NSExtensionPrincipalClass:
|
|
497
|
+
'$(PRODUCT_MODULE_NAME).ReactNativeViewController',
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
} else if (
|
|
501
|
+
typeCharacteristics.activationRulesLocation === 'direct' &&
|
|
502
|
+
!entry
|
|
503
|
+
) {
|
|
504
|
+
// Native action extension needs NSExtensionMainStoryboard
|
|
505
|
+
basePlist.NSExtension = {
|
|
506
|
+
...basePlist.NSExtension,
|
|
507
|
+
NSExtensionMainStoryboard: 'MainInterface',
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
// Auto-inject LSApplicationQueriesSchemes from main app's URL schemes
|
|
512
|
+
// This allows extensions to query/open the main app via URL schemes
|
|
513
|
+
if (mainAppSchemes && mainAppSchemes.length > 0) {
|
|
514
|
+
const existingSchemes = customProperties?.LSApplicationQueriesSchemes || [];
|
|
515
|
+
const allSchemes = [...new Set([...mainAppSchemes, ...existingSchemes])];
|
|
516
|
+
|
|
517
|
+
basePlist.LSApplicationQueriesSchemes = allSchemes;
|
|
518
|
+
// Note: Logged at caller level in withXcodeChanges for better context
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Embed targets config for runtime access via expo-constants
|
|
522
|
+
// This makes Constants.expoConfig.extra.targets available in extensions
|
|
523
|
+
if (targetsConfig && targetsConfig.length > 0) {
|
|
524
|
+
basePlist.ExpoTargetsConfig = targetsConfig;
|
|
525
|
+
// Note: Logged at caller level in withXcodeChanges for better context
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
if (customProperties) {
|
|
529
|
+
basePlist = deepMerge(basePlist, customProperties);
|
|
530
|
+
|
|
531
|
+
// For action extensions, ensure NSExtensionActivationRule structure is correct
|
|
532
|
+
// Custom properties might have added NSExtensionAttributes with NSExtensionActivationRule
|
|
533
|
+
// Move it to direct level, but preserve other attributes like NSExtensionIcon
|
|
534
|
+
if (
|
|
535
|
+
typeCharacteristics.activationRulesLocation === 'direct' &&
|
|
536
|
+
basePlist.NSExtension?.NSExtensionAttributes?.NSExtensionActivationRule
|
|
537
|
+
) {
|
|
538
|
+
// Move NSExtensionActivationRule from NSExtensionAttributes to directly under NSExtension
|
|
539
|
+
const activationRule =
|
|
540
|
+
basePlist.NSExtension.NSExtensionAttributes.NSExtensionActivationRule;
|
|
541
|
+
delete basePlist.NSExtension.NSExtensionAttributes
|
|
542
|
+
.NSExtensionActivationRule;
|
|
543
|
+
|
|
544
|
+
// Only remove NSExtensionAttributes if it's now empty (preserve other attributes like NSExtensionIcon)
|
|
545
|
+
if (
|
|
546
|
+
Object.keys(basePlist.NSExtension.NSExtensionAttributes).length === 0
|
|
547
|
+
) {
|
|
548
|
+
delete basePlist.NSExtension.NSExtensionAttributes;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
basePlist.NSExtension.NSExtensionActivationRule = activationRule;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// Merge actionIcon from customProperties if provided (allows override via infoPlist)
|
|
555
|
+
if (
|
|
556
|
+
typeCharacteristics.activationRulesLocation === 'direct' &&
|
|
557
|
+
customProperties.NSExtension?.NSExtensionAttributes?.NSExtensionIcon
|
|
558
|
+
) {
|
|
559
|
+
// Custom icon already set via infoPlist, use it
|
|
560
|
+
if (!basePlist.NSExtension.NSExtensionAttributes) {
|
|
561
|
+
basePlist.NSExtension.NSExtensionAttributes = {};
|
|
562
|
+
}
|
|
563
|
+
basePlist.NSExtension.NSExtensionAttributes.NSExtensionIcon =
|
|
564
|
+
customProperties.NSExtension.NSExtensionAttributes.NSExtensionIcon;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
return plist.build(basePlist);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export function getFrameworksForType(type: ExtensionType): string[] {
|
|
572
|
+
return TYPE_CHARACTERISTICS[type].frameworks;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/**
|
|
576
|
+
* Build NSExtensionActivationRule from share/action extension config
|
|
577
|
+
* Used for both share extensions (with NSExtensionAttributes) and action extensions
|
|
578
|
+
* @see https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html
|
|
579
|
+
*/
|
|
580
|
+
export function buildShareExtensionActivationRules(
|
|
581
|
+
activationRules?: {
|
|
582
|
+
type: string;
|
|
583
|
+
maxCount?: number;
|
|
584
|
+
}[],
|
|
585
|
+
preprocessingFile?: string
|
|
586
|
+
): Record<string, any> {
|
|
587
|
+
if (!activationRules || activationRules.length === 0) {
|
|
588
|
+
// Default: text and url
|
|
589
|
+
return {
|
|
590
|
+
NSExtensionActivationSupportsText: true,
|
|
591
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: 1,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return activationRules.reduce(
|
|
596
|
+
(acc, rule) => {
|
|
597
|
+
const maxCount = rule.maxCount ?? 1;
|
|
598
|
+
|
|
599
|
+
switch (rule.type) {
|
|
600
|
+
case 'text':
|
|
601
|
+
return {
|
|
602
|
+
...acc,
|
|
603
|
+
NSExtensionActivationSupportsText: true,
|
|
604
|
+
};
|
|
605
|
+
case 'url':
|
|
606
|
+
// If preprocessing file exists, enable webpage support
|
|
607
|
+
if (preprocessingFile) {
|
|
608
|
+
return {
|
|
609
|
+
...acc,
|
|
610
|
+
NSExtensionActivationSupportsWebPageWithMaxCount: maxCount,
|
|
611
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: maxCount,
|
|
612
|
+
};
|
|
613
|
+
}
|
|
614
|
+
return {
|
|
615
|
+
...acc,
|
|
616
|
+
NSExtensionActivationSupportsWebURLWithMaxCount: maxCount,
|
|
617
|
+
};
|
|
618
|
+
case 'webpage':
|
|
619
|
+
// Explicit webpage support (requires preprocessing file)
|
|
620
|
+
return {
|
|
621
|
+
...acc,
|
|
622
|
+
NSExtensionActivationSupportsWebPageWithMaxCount: maxCount,
|
|
623
|
+
};
|
|
624
|
+
case 'image':
|
|
625
|
+
return {
|
|
626
|
+
...acc,
|
|
627
|
+
NSExtensionActivationSupportsImageWithMaxCount: maxCount,
|
|
628
|
+
};
|
|
629
|
+
case 'video':
|
|
630
|
+
return {
|
|
631
|
+
...acc,
|
|
632
|
+
NSExtensionActivationSupportsMovieWithMaxCount: maxCount,
|
|
633
|
+
};
|
|
634
|
+
case 'file':
|
|
635
|
+
return {
|
|
636
|
+
...acc,
|
|
637
|
+
NSExtensionActivationSupportsFileWithMaxCount: maxCount,
|
|
638
|
+
};
|
|
639
|
+
default:
|
|
640
|
+
console.warn(
|
|
641
|
+
`[expo-targets] Unknown share/action extension content type: ${rule.type}`
|
|
642
|
+
);
|
|
643
|
+
return acc;
|
|
644
|
+
}
|
|
645
|
+
},
|
|
646
|
+
{} as Record<string, any>
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
export function productTypeForType(type: ExtensionType): string {
|
|
651
|
+
return TYPE_CHARACTERISTICS[type].productType;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
export const EXTENSION_POINT_IDENTIFIERS: Record<ExtensionType, string> =
|
|
655
|
+
Object.fromEntries(
|
|
656
|
+
Object.entries(TYPE_CHARACTERISTICS).map(([type, config]) => [
|
|
657
|
+
type,
|
|
658
|
+
config.extensionPointIdentifier,
|
|
659
|
+
])
|
|
660
|
+
) as Record<ExtensionType, string>;
|
|
661
|
+
|
|
662
|
+
export const SHOULD_USE_APP_GROUPS_BY_DEFAULT: Record<ExtensionType, boolean> =
|
|
663
|
+
Object.fromEntries(
|
|
664
|
+
Object.entries(TYPE_CHARACTERISTICS).map(([type, config]) => [
|
|
665
|
+
type,
|
|
666
|
+
config.defaultUsesAppGroups,
|
|
667
|
+
])
|
|
668
|
+
) as Record<ExtensionType, boolean>;
|