expo-targets 2.4.1 → 2.5.1
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/android/src/main/java/expo/modules/targets/ExpoTargetsConfig.kt +36 -0
- package/android/src/main/java/expo/modules/targets/ExpoTargetsRemoteViewsProvider.kt +10 -1
- package/android/src/main/java/expo/modules/targets/appIntents/ExpoTargetsAppIntentsModule.kt +175 -0
- package/android/src/main/java/expo/modules/targets/notification/ExpoTargetsNotificationModule.kt +2 -2
- package/android/src/main/java/expo/modules/targets/storage/ExpoTargetsStorageModule.kt +5 -13
- package/bin/export-safari-bundle.js +20 -1
- package/build/plugin/src/config.d.ts +55 -4
- package/build/plugin/src/config.d.ts.map +1 -1
- package/build/plugin/src/config.js +1 -52
- package/build/plugin/src/config.js.map +1 -1
- package/build/plugin/src/domain/typeSets.d.ts +31 -0
- package/build/plugin/src/domain/typeSets.d.ts.map +1 -0
- package/build/plugin/src/domain/typeSets.js +70 -0
- package/build/plugin/src/domain/typeSets.js.map +1 -0
- package/build/plugin/src/domain/types.d.ts +9 -0
- package/build/plugin/src/domain/types.d.ts.map +1 -0
- package/build/plugin/src/domain/types.js +10 -0
- package/build/plugin/src/domain/types.js.map +1 -0
- package/build/src/Target.d.ts.map +1 -1
- package/build/src/Target.js +5 -13
- package/build/src/Target.js.map +1 -1
- package/build/src/index.d.ts +3 -3
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +3 -2
- package/build/src/index.js.map +1 -1
- package/build/src/modules/appIntents/index.d.ts +39 -1
- package/build/src/modules/appIntents/index.d.ts.map +1 -1
- package/build/src/modules/appIntents/index.js +67 -3
- package/build/src/modules/appIntents/index.js.map +1 -1
- package/build/src/modules/contentBlocker/index.js +2 -2
- package/build/src/modules/contentBlocker/index.js.map +1 -1
- package/build/src/modules/extension/index.js +2 -2
- package/build/src/modules/extension/index.js.map +1 -1
- package/build/src/modules/extensionBundle/ExtensionUpdatesApi.js +1 -1
- package/build/src/modules/extensionBundle/ExtensionUpdatesApi.js.map +1 -1
- package/build/src/modules/extensionBundle/enableExtensionUpdates.d.ts.map +1 -1
- package/build/src/modules/extensionBundle/enableExtensionUpdates.js +2 -8
- package/build/src/modules/extensionBundle/enableExtensionUpdates.js.map +1 -1
- package/build/src/modules/extensionBundle/nativeInstall.js +2 -2
- package/build/src/modules/extensionBundle/nativeInstall.js.map +1 -1
- package/build/src/modules/fileProvider/index.js +2 -2
- package/build/src/modules/fileProvider/index.js.map +1 -1
- package/build/src/modules/liveActivity/index.d.ts +1 -1
- package/build/src/modules/liveActivity/index.d.ts.map +1 -1
- package/build/src/modules/liveActivity/index.js +2 -2
- package/build/src/modules/liveActivity/index.js.map +1 -1
- package/build/src/modules/messages/index.js +2 -2
- package/build/src/modules/messages/index.js.map +1 -1
- package/build/src/modules/notification/index.js +2 -2
- package/build/src/modules/notification/index.js.map +1 -1
- package/build/src/modules/storage/appGroup.d.ts +7 -0
- package/build/src/modules/storage/appGroup.d.ts.map +1 -0
- package/build/src/modules/storage/appGroup.js +25 -0
- package/build/src/modules/storage/appGroup.js.map +1 -0
- package/build/src/modules/storage/index.d.ts +19 -3
- package/build/src/modules/storage/index.d.ts.map +1 -1
- package/build/src/modules/storage/index.js +37 -4
- package/build/src/modules/storage/index.js.map +1 -1
- package/build/src/modules/targetsConfig.d.ts.map +1 -1
- package/build/src/modules/targetsConfig.js +1 -13
- package/build/src/modules/targetsConfig.js.map +1 -1
- package/build/src/resolveHostProduct.d.ts.map +1 -1
- package/build/src/resolveHostProduct.js +2 -1
- package/build/src/resolveHostProduct.js.map +1 -1
- package/build/src/widgets.d.ts +1 -1
- package/build/src/widgets.d.ts.map +1 -1
- package/build/src/widgets.js +4 -4
- package/build/src/widgets.js.map +1 -1
- package/cli/build/checks/bundleIds.d.ts +4 -0
- package/cli/build/checks/bundleIds.d.ts.map +1 -0
- package/cli/build/checks/bundleIds.js +38 -0
- package/cli/build/checks/bundleIds.js.map +1 -0
- package/cli/build/checks/configFilename.js +1 -1
- package/cli/build/checks/configFilename.js.map +1 -1
- package/cli/build/checks/heavyExclusions.d.ts.map +1 -1
- package/cli/build/checks/heavyExclusions.js +2 -8
- package/cli/build/checks/heavyExclusions.js.map +1 -1
- package/cli/build/checks/updateScript.d.ts.map +1 -1
- package/cli/build/checks/updateScript.js +2 -8
- package/cli/build/checks/updateScript.js.map +1 -1
- package/cli/build/doctor.d.ts.map +1 -1
- package/cli/build/doctor.js +2 -0
- package/cli/build/doctor.js.map +1 -1
- package/cli/build/exportExtensionBundles.d.ts.map +1 -1
- package/cli/build/exportExtensionBundles.js +2 -8
- package/cli/build/exportExtensionBundles.js.map +1 -1
- package/cli/build/exportSafari.d.ts +13 -1
- package/cli/build/exportSafari.d.ts.map +1 -1
- package/cli/build/exportSafari.js +77 -22
- package/cli/build/exportSafari.js.map +1 -1
- package/cli/build/extensionBundle/constants.d.ts +1 -3
- package/cli/build/extensionBundle/constants.d.ts.map +1 -1
- package/cli/build/extensionBundle/constants.js +4 -17
- package/cli/build/extensionBundle/constants.js.map +1 -1
- package/cli/build/index.js +4 -3
- package/cli/build/index.js.map +1 -1
- package/cli/build/project.d.ts +3 -1
- package/cli/build/project.d.ts.map +1 -1
- package/cli/build/project.js +11 -111
- package/cli/build/project.js.map +1 -1
- package/cli/build/scaffold/copyTemplate.d.ts.map +1 -1
- package/cli/build/scaffold/copyTemplate.js +11 -3
- package/cli/build/scaffold/copyTemplate.js.map +1 -1
- package/cli/build/scaffold/prompts.d.ts.map +1 -1
- package/cli/build/scaffold/prompts.js +14 -9
- package/cli/build/scaffold/prompts.js.map +1 -1
- package/cli/build/scaffold/reactNativeTemplate.d.ts.map +1 -1
- package/cli/build/scaffold/reactNativeTemplate.js +3 -10
- package/cli/build/scaffold/reactNativeTemplate.js.map +1 -1
- package/cli/build/scaffold/resolveAppGroup.d.ts +3 -2
- package/cli/build/scaffold/resolveAppGroup.d.ts.map +1 -1
- package/cli/build/scaffold/resolveAppGroup.js +11 -51
- package/cli/build/scaffold/resolveAppGroup.js.map +1 -1
- package/cli/build/scaffold/scaffoldTarget.d.ts.map +1 -1
- package/cli/build/scaffold/scaffoldTarget.js +5 -3
- package/cli/build/scaffold/scaffoldTarget.js.map +1 -1
- package/cli/build/scaffold/templates/iosHandlers.d.ts +11 -0
- package/cli/build/scaffold/templates/iosHandlers.d.ts.map +1 -0
- package/cli/build/scaffold/templates/iosHandlers.js +1073 -0
- package/cli/build/scaffold/templates/iosHandlers.js.map +1 -0
- package/cli/build/sync.d.ts.map +1 -1
- package/cli/build/sync.js +29 -16
- package/cli/build/sync.js.map +1 -1
- package/cli/build/testing/fixtureProject.d.ts +8 -0
- package/cli/build/testing/fixtureProject.d.ts.map +1 -0
- package/cli/build/{targetConfigFile.js → testing/fixtureProject.js} +25 -25
- package/cli/build/testing/fixtureProject.js.map +1 -0
- package/cli/build/types.d.ts +3 -0
- package/cli/build/types.d.ts.map +1 -1
- package/expo-module.config.json +2 -1
- package/ios/ExpoTargetsAppIntentDispatcher.swift +48 -0
- package/ios/ExpoTargetsAppIntentsModule.swift +24 -1
- package/metro/build/withTargets.d.ts +2 -1
- package/metro/build/withTargets.d.ts.map +1 -1
- package/metro/build/withTargets.js +6 -4
- package/metro/build/withTargets.js.map +1 -1
- package/package.json +15 -2
- package/plugin/README.md +107 -0
- package/plugin/build/android/appIntentShortcuts.d.ts +31 -0
- package/plugin/build/android/appIntentShortcuts.d.ts.map +1 -0
- package/plugin/build/android/appIntentShortcuts.js +115 -0
- package/plugin/build/android/appIntentShortcuts.js.map +1 -0
- package/plugin/build/android/withAndroidAppIntents.d.ts +12 -0
- package/plugin/build/android/withAndroidAppIntents.d.ts.map +1 -0
- package/plugin/build/android/withAndroidAppIntents.js +67 -0
- package/plugin/build/android/withAndroidAppIntents.js.map +1 -0
- package/plugin/build/android/withAndroidTarget.d.ts.map +1 -1
- package/plugin/build/android/withAndroidTarget.js +3 -0
- package/plugin/build/android/withAndroidTarget.js.map +1 -1
- package/plugin/build/android/withAndroidTargetsConfig.d.ts.map +1 -1
- package/plugin/build/android/withAndroidTargetsConfig.js +3 -1
- package/plugin/build/android/withAndroidTargetsConfig.js.map +1 -1
- package/plugin/build/codegen/collectRuntimeConfigs.d.ts.map +1 -1
- package/plugin/build/codegen/collectRuntimeConfigs.js +2 -10
- package/plugin/build/codegen/collectRuntimeConfigs.js.map +1 -1
- package/plugin/build/config.d.ts +55 -4
- package/plugin/build/config.d.ts.map +1 -1
- package/plugin/build/config.js +1 -52
- package/plugin/build/config.js.map +1 -1
- package/plugin/build/domain/appGroups.d.ts +18 -0
- package/plugin/build/domain/appGroups.d.ts.map +1 -1
- package/plugin/build/domain/appGroups.js +44 -0
- package/plugin/build/domain/appGroups.js.map +1 -1
- package/plugin/build/domain/bundleIds.d.ts +49 -5
- package/plugin/build/domain/bundleIds.d.ts.map +1 -1
- package/plugin/build/domain/bundleIds.js +109 -6
- package/plugin/build/domain/bundleIds.js.map +1 -1
- package/plugin/build/domain/characteristics.d.ts +2 -0
- package/plugin/build/domain/characteristics.d.ts.map +1 -1
- package/plugin/build/domain/characteristics.js +64 -8
- package/plugin/build/domain/characteristics.js.map +1 -1
- package/plugin/build/domain/entitlements.d.ts +28 -0
- package/plugin/build/domain/entitlements.d.ts.map +1 -0
- package/plugin/build/domain/entitlements.js +108 -0
- package/plugin/build/domain/entitlements.js.map +1 -0
- package/plugin/build/domain/index.d.ts +7 -3
- package/plugin/build/domain/index.d.ts.map +1 -1
- package/plugin/build/domain/index.js +26 -3
- package/plugin/build/domain/index.js.map +1 -1
- package/plugin/build/domain/rnCompat.d.ts +2 -3
- package/plugin/build/domain/rnCompat.d.ts.map +1 -1
- package/plugin/build/domain/rnCompat.js +6 -13
- package/plugin/build/domain/rnCompat.js.map +1 -1
- package/plugin/build/domain/typeSets.d.ts +31 -0
- package/plugin/build/domain/typeSets.d.ts.map +1 -0
- package/plugin/build/domain/typeSets.js +70 -0
- package/plugin/build/domain/typeSets.js.map +1 -0
- package/plugin/build/ensureHostAppGroups.d.ts.map +1 -1
- package/plugin/build/ensureHostAppGroups.js +10 -4
- package/plugin/build/ensureHostAppGroups.js.map +1 -1
- package/plugin/build/index.d.ts.map +1 -1
- package/plugin/build/index.js +4 -2
- package/plugin/build/index.js.map +1 -1
- package/plugin/build/ios/apply/fs/assets.d.ts +5 -0
- package/plugin/build/ios/apply/fs/assets.d.ts.map +1 -1
- package/plugin/build/ios/apply/fs/assets.js +32 -3
- package/plugin/build/ios/apply/fs/assets.js.map +1 -1
- package/plugin/build/ios/apply/pbx/safariWebBundle.d.ts.map +1 -1
- package/plugin/build/ios/apply/pbx/safariWebBundle.js +5 -7
- package/plugin/build/ios/apply/pbx/safariWebBundle.js.map +1 -1
- package/plugin/build/ios/cng/controlCodegen.d.ts +2 -0
- package/plugin/build/ios/cng/controlCodegen.d.ts.map +1 -1
- package/plugin/build/ios/cng/controlCodegen.js +13 -1
- package/plugin/build/ios/cng/controlCodegen.js.map +1 -1
- package/plugin/build/ios/cng/entitiesCodegen.d.ts +10 -0
- package/plugin/build/ios/cng/entitiesCodegen.d.ts.map +1 -0
- package/plugin/build/ios/cng/entitiesCodegen.js +152 -0
- package/plugin/build/ios/cng/entitiesCodegen.js.map +1 -0
- package/plugin/build/ios/cng/intentsCodegen.d.ts +33 -2
- package/plugin/build/ios/cng/intentsCodegen.d.ts.map +1 -1
- package/plugin/build/ios/cng/intentsCodegen.js +253 -12
- package/plugin/build/ios/cng/intentsCodegen.js.map +1 -1
- package/plugin/build/ios/cng/withExpoTargetsGenerated.d.ts +4 -1
- package/plugin/build/ios/cng/withExpoTargetsGenerated.d.ts.map +1 -1
- package/plugin/build/ios/cng/withExpoTargetsGenerated.js +150 -12
- package/plugin/build/ios/cng/withExpoTargetsGenerated.js.map +1 -1
- package/plugin/build/ios/config-plugins/withEntitlements.d.ts +2 -0
- package/plugin/build/ios/config-plugins/withEntitlements.d.ts.map +1 -1
- package/plugin/build/ios/config-plugins/withEntitlements.js +3 -0
- package/plugin/build/ios/config-plugins/withEntitlements.js.map +1 -1
- package/plugin/build/ios/config-plugins/withIOSTarget.d.ts +2 -0
- package/plugin/build/ios/config-plugins/withIOSTarget.d.ts.map +1 -1
- package/plugin/build/ios/config-plugins/withIOSTarget.js +18 -90
- package/plugin/build/ios/config-plugins/withIOSTarget.js.map +1 -1
- package/plugin/build/ios/plan/buildInfoPlist.d.ts.map +1 -1
- package/plugin/build/ios/plan/buildInfoPlist.js +11 -0
- package/plugin/build/ios/plan/buildInfoPlist.js.map +1 -1
- package/plugin/build/ios/plan/buildSettings.d.ts.map +1 -1
- package/plugin/build/ios/plan/buildSettings.js +2 -3
- package/plugin/build/ios/plan/buildSettings.js.map +1 -1
- package/plugin/build/ios/plan/entitlements.d.ts +6 -2
- package/plugin/build/ios/plan/entitlements.d.ts.map +1 -1
- package/plugin/build/ios/plan/entitlements.js +20 -23
- package/plugin/build/ios/plan/entitlements.js.map +1 -1
- package/plugin/build/ios/plan/identity.d.ts.map +1 -1
- package/plugin/build/ios/plan/identity.js +6 -5
- package/plugin/build/ios/plan/identity.js.map +1 -1
- package/plugin/build/ios/plan/safariWebBundle.d.ts.map +1 -1
- package/plugin/build/ios/plan/safariWebBundle.js +1 -0
- package/plugin/build/ios/plan/safariWebBundle.js.map +1 -1
- package/plugin/build/ios/plan/swiftSources.d.ts.map +1 -1
- package/plugin/build/ios/plan/swiftSources.js +7 -11
- package/plugin/build/ios/plan/swiftSources.js.map +1 -1
- package/plugin/build/ios/plan/types.d.ts +4 -0
- package/plugin/build/ios/plan/types.d.ts.map +1 -1
- package/plugin/build/ios/utils/asset.d.ts +7 -0
- package/plugin/build/ios/utils/asset.d.ts.map +1 -1
- package/plugin/build/ios/utils/asset.js +11 -0
- package/plugin/build/ios/utils/asset.js.map +1 -1
- package/plugin/build/ios/utils/plist.d.ts +0 -11
- package/plugin/build/ios/utils/plist.d.ts.map +1 -1
- package/plugin/build/ios/utils/plist.js +0 -32
- package/plugin/build/ios/utils/plist.js.map +1 -1
- package/plugin/build/targetsRoot.d.ts +32 -0
- package/plugin/build/targetsRoot.d.ts.map +1 -0
- package/plugin/build/targetsRoot.js +160 -0
- package/plugin/build/targetsRoot.js.map +1 -0
- package/plugin/build/withTargetsDir.d.ts.map +1 -1
- package/plugin/build/withTargetsDir.js +57 -30
- package/plugin/build/withTargetsDir.js.map +1 -1
- package/cli/build/targetConfigFile.d.ts +0 -12
- package/cli/build/targetConfigFile.d.ts.map +0 -1
- package/cli/build/targetConfigFile.js.map +0 -1
- package/plugin/build/ios/safari/exportSafariWebBundleCli.d.ts +0 -2
- package/plugin/build/ios/safari/exportSafariWebBundleCli.d.ts.map +0 -1
- package/plugin/build/ios/safari/exportSafariWebBundleCli.js +0 -75
- package/plugin/build/ios/safari/exportSafariWebBundleCli.js.map +0 -1
|
@@ -0,0 +1,1073 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Swift principal classes for native-only extension types, one per type.
|
|
4
|
+
* Class names match `defaultPrincipalClassForType`, so the generated
|
|
5
|
+
* Info.plist finds them without a target-level NSExtensionPrincipalClass.
|
|
6
|
+
* Seeded from the example apps' handlers (which build in the device matrix).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.IOS_HANDLER_TEMPLATES = void 0;
|
|
10
|
+
exports.IOS_HANDLER_TEMPLATES = {
|
|
11
|
+
'notification-service': {
|
|
12
|
+
fileName: 'NotificationService.swift',
|
|
13
|
+
source: (appGroup) => `import UserNotifications
|
|
14
|
+
|
|
15
|
+
class NotificationService: UNNotificationServiceExtension {
|
|
16
|
+
var contentHandler: ((UNNotificationContent) -> Void)?
|
|
17
|
+
var bestAttemptContent: UNMutableNotificationContent?
|
|
18
|
+
|
|
19
|
+
private let appGroup = "${appGroup}"
|
|
20
|
+
|
|
21
|
+
override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
|
|
22
|
+
self.contentHandler = contentHandler
|
|
23
|
+
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
|
|
24
|
+
if let bestAttemptContent {
|
|
25
|
+
bestAttemptContent.title = "\\(bestAttemptContent.title) [expo-targets]"
|
|
26
|
+
persistMutationMarker(bestAttemptContent.title)
|
|
27
|
+
contentHandler(bestAttemptContent)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override func serviceExtensionTimeWillExpire() {
|
|
32
|
+
if let contentHandler, let bestAttemptContent {
|
|
33
|
+
contentHandler(bestAttemptContent)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/// Journey-readable proof that NSE ran (Simulator lock-screen AX is flaky).
|
|
38
|
+
private func persistMutationMarker(_ title: String) {
|
|
39
|
+
guard let container = FileManager.default.containerURL(
|
|
40
|
+
forSecurityApplicationGroupIdentifier: appGroup
|
|
41
|
+
) else {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
let url = container.appendingPathComponent("nse-last-title.txt")
|
|
45
|
+
try? title.write(to: url, atomically: true, encoding: .utf8)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`,
|
|
49
|
+
},
|
|
50
|
+
'photo-editing': {
|
|
51
|
+
fileName: 'PhotoEditingViewController.swift',
|
|
52
|
+
source: (appGroup) => `import Photos
|
|
53
|
+
import PhotosUI
|
|
54
|
+
import UIKit
|
|
55
|
+
import CoreImage
|
|
56
|
+
|
|
57
|
+
/// Minimal photo-editing extension — applies a grayscale filter and returns output.
|
|
58
|
+
@objc(PhotoEditingViewController)
|
|
59
|
+
class PhotoEditingViewController: UIViewController, PHContentEditingController {
|
|
60
|
+
private var input: PHContentEditingInput?
|
|
61
|
+
private let appGroup = "${appGroup}"
|
|
62
|
+
private let imageView = UIImageView()
|
|
63
|
+
private let markerLabel: UILabel = {
|
|
64
|
+
let label = UILabel()
|
|
65
|
+
label.text = "ET PhotoEdit Extension"
|
|
66
|
+
label.textAlignment = .center
|
|
67
|
+
label.font = .systemFont(ofSize: 15, weight: .semibold)
|
|
68
|
+
label.textColor = .white
|
|
69
|
+
label.translatesAutoresizingMaskIntoConstraints = false
|
|
70
|
+
label.accessibilityIdentifier = "photo-edit-marker"
|
|
71
|
+
return label
|
|
72
|
+
}()
|
|
73
|
+
|
|
74
|
+
private let formatIdentifier = (Bundle.main.bundleIdentifier ?? "app") + ".grayscale"
|
|
75
|
+
private let formatVersion = "1.0"
|
|
76
|
+
|
|
77
|
+
override func viewDidLoad() {
|
|
78
|
+
super.viewDidLoad()
|
|
79
|
+
view.backgroundColor = .black
|
|
80
|
+
imageView.contentMode = .scaleAspectFit
|
|
81
|
+
imageView.translatesAutoresizingMaskIntoConstraints = false
|
|
82
|
+
view.addSubview(imageView)
|
|
83
|
+
view.addSubview(markerLabel)
|
|
84
|
+
NSLayoutConstraint.activate([
|
|
85
|
+
imageView.topAnchor.constraint(equalTo: view.topAnchor),
|
|
86
|
+
imageView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
|
87
|
+
imageView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
|
88
|
+
imageView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
|
89
|
+
markerLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
|
90
|
+
markerLabel.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -24),
|
|
91
|
+
])
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var shouldShowCancelConfirmation: Bool { false }
|
|
95
|
+
|
|
96
|
+
func canHandle(_ adjustmentData: PHAdjustmentData) -> Bool {
|
|
97
|
+
adjustmentData.formatIdentifier == formatIdentifier
|
|
98
|
+
&& adjustmentData.formatVersion == formatVersion
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
func startContentEditing(
|
|
102
|
+
with contentEditingInput: PHContentEditingInput,
|
|
103
|
+
placeholderImage: UIImage
|
|
104
|
+
) {
|
|
105
|
+
input = contentEditingInput
|
|
106
|
+
imageView.image = grayscale(placeholderImage) ?? placeholderImage
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
func finishContentEditing(
|
|
110
|
+
completionHandler: @escaping (PHContentEditingOutput?) -> Void
|
|
111
|
+
) {
|
|
112
|
+
guard let input else {
|
|
113
|
+
completionHandler(nil)
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
let output = PHContentEditingOutput(contentEditingInput: input)
|
|
117
|
+
output.adjustmentData = PHAdjustmentData(
|
|
118
|
+
formatIdentifier: formatIdentifier,
|
|
119
|
+
formatVersion: formatVersion,
|
|
120
|
+
data: Data("grayscale".utf8)
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
// Done-persistence marker for host agent-device asserts.
|
|
124
|
+
if let defaults = UserDefaults(suiteName: appGroup) {
|
|
125
|
+
defaults.set("expo-targets uitest photo-edit done", forKey: "photoEdit:lastDone")
|
|
126
|
+
defaults.set(Date().timeIntervalSince1970, forKey: "photoEdit:lastDoneAt")
|
|
127
|
+
defaults.set("grayscale", forKey: "photoEdit:lastFilter")
|
|
128
|
+
defaults.synchronize()
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
DispatchQueue.global(qos: .userInitiated).async {
|
|
132
|
+
defer { completionHandler(output) }
|
|
133
|
+
guard
|
|
134
|
+
let url = input.fullSizeImageURL,
|
|
135
|
+
let data = try? Data(contentsOf: url),
|
|
136
|
+
let image = UIImage(data: data),
|
|
137
|
+
let gray = self.grayscale(image),
|
|
138
|
+
let jpeg = gray.jpegData(compressionQuality: 0.92)
|
|
139
|
+
else {
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
try? jpeg.write(to: output.renderedContentURL, options: .atomic)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
func cancelContentEditing() {}
|
|
147
|
+
|
|
148
|
+
private func grayscale(_ image: UIImage) -> UIImage? {
|
|
149
|
+
guard let ciImage = CIImage(image: image) else { return nil }
|
|
150
|
+
let filter = CIFilter(name: "CIPhotoEffectMono")
|
|
151
|
+
filter?.setValue(ciImage, forKey: kCIInputImageKey)
|
|
152
|
+
guard let output = filter?.outputImage else { return nil }
|
|
153
|
+
let context = CIContext()
|
|
154
|
+
guard let cg = context.createCGImage(output, from: output.extent) else {
|
|
155
|
+
return nil
|
|
156
|
+
}
|
|
157
|
+
return UIImage(cgImage: cg)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
`,
|
|
161
|
+
},
|
|
162
|
+
'file-provider': {
|
|
163
|
+
fileName: 'FileProviderExtension.swift',
|
|
164
|
+
source: (appGroup) => `import FileProvider
|
|
165
|
+
import Foundation
|
|
166
|
+
import UniformTypeIdentifiers
|
|
167
|
+
|
|
168
|
+
private let appGroupId = "${appGroup}"
|
|
169
|
+
private let seedIdentifier = NSFileProviderItemIdentifier(
|
|
170
|
+
"NDQ0NDQ0NDQtNDQ0NC00NDQ0LTQ0NDQtNDQ0NDQ0NDQ0NDQ0"
|
|
171
|
+
)
|
|
172
|
+
private let seedFilename = "et-fp-seed.txt"
|
|
173
|
+
private let seedBody = Data("expo-targets file-provider seed\\nET FileProv\\n".utf8)
|
|
174
|
+
|
|
175
|
+
/// Modern File Provider principal (Replicated + Enumerating) — required on iOS 16+.
|
|
176
|
+
/// Do not \`@objc\`-rename: Info.plist uses \`$(PRODUCT_MODULE_NAME).FileProviderExtension\`.
|
|
177
|
+
final class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension,
|
|
178
|
+
NSFileProviderEnumerating
|
|
179
|
+
{
|
|
180
|
+
private let domain: NSFileProviderDomain
|
|
181
|
+
|
|
182
|
+
required init(domain: NSFileProviderDomain) {
|
|
183
|
+
self.domain = domain
|
|
184
|
+
super.init()
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
func invalidate() {}
|
|
188
|
+
|
|
189
|
+
func item(
|
|
190
|
+
for identifier: NSFileProviderItemIdentifier,
|
|
191
|
+
request: NSFileProviderRequest,
|
|
192
|
+
completionHandler: @escaping (NSFileProviderItem?, Error?) -> Void
|
|
193
|
+
) -> Progress {
|
|
194
|
+
let progress = Progress(totalUnitCount: 1)
|
|
195
|
+
completionHandler(FileProviderItem(identifier: identifier), nil)
|
|
196
|
+
progress.completedUnitCount = 1
|
|
197
|
+
return progress
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
func fetchContents(
|
|
201
|
+
for itemIdentifier: NSFileProviderItemIdentifier,
|
|
202
|
+
version requestedVersion: NSFileProviderItemVersion?,
|
|
203
|
+
request: NSFileProviderRequest,
|
|
204
|
+
completionHandler: @escaping (URL?, NSFileProviderItem?, Error?) -> Void
|
|
205
|
+
) -> Progress {
|
|
206
|
+
let progress = Progress(totalUnitCount: 1)
|
|
207
|
+
let item = FileProviderItem(identifier: itemIdentifier)
|
|
208
|
+
let url = FileManager.default.temporaryDirectory
|
|
209
|
+
.appendingPathComponent(item.filename)
|
|
210
|
+
do {
|
|
211
|
+
try seedBody.write(to: url, options: .atomic)
|
|
212
|
+
Self.writeAppGroupMarker()
|
|
213
|
+
completionHandler(url, item, nil)
|
|
214
|
+
} catch {
|
|
215
|
+
completionHandler(nil, nil, error)
|
|
216
|
+
}
|
|
217
|
+
progress.completedUnitCount = 1
|
|
218
|
+
return progress
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
func createItem(
|
|
222
|
+
basedOn itemTemplate: NSFileProviderItem,
|
|
223
|
+
fields: NSFileProviderItemFields,
|
|
224
|
+
contents url: URL?,
|
|
225
|
+
options: NSFileProviderCreateItemOptions = [],
|
|
226
|
+
request: NSFileProviderRequest,
|
|
227
|
+
completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, Error?) ->
|
|
228
|
+
Void
|
|
229
|
+
) -> Progress {
|
|
230
|
+
// Disk-import / remote create: echo a valid versioned item (do not
|
|
231
|
+
// return unsupported — that aborts Replicated bring-up of root).
|
|
232
|
+
let progress = Progress(totalUnitCount: 1)
|
|
233
|
+
let created = FileProviderItem(identifier: itemTemplate.itemIdentifier)
|
|
234
|
+
completionHandler(created, [], false, nil)
|
|
235
|
+
progress.completedUnitCount = 1
|
|
236
|
+
return progress
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
func modifyItem(
|
|
240
|
+
_ item: NSFileProviderItem,
|
|
241
|
+
baseVersion version: NSFileProviderItemVersion,
|
|
242
|
+
changedFields: NSFileProviderItemFields,
|
|
243
|
+
contents newContents: URL?,
|
|
244
|
+
options: NSFileProviderModifyItemOptions = [],
|
|
245
|
+
request: NSFileProviderRequest,
|
|
246
|
+
completionHandler: @escaping (NSFileProviderItem?, NSFileProviderItemFields, Bool, Error?) ->
|
|
247
|
+
Void
|
|
248
|
+
) -> Progress {
|
|
249
|
+
let progress = Progress(totalUnitCount: 1)
|
|
250
|
+
completionHandler(FileProviderItem(identifier: item.itemIdentifier), [], false, nil)
|
|
251
|
+
progress.completedUnitCount = 1
|
|
252
|
+
return progress
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
func deleteItem(
|
|
256
|
+
identifier: NSFileProviderItemIdentifier,
|
|
257
|
+
baseVersion version: NSFileProviderItemVersion,
|
|
258
|
+
options: NSFileProviderDeleteItemOptions = [],
|
|
259
|
+
request: NSFileProviderRequest,
|
|
260
|
+
completionHandler: @escaping (Error?) -> Void
|
|
261
|
+
) -> Progress {
|
|
262
|
+
let progress = Progress(totalUnitCount: 1)
|
|
263
|
+
completionHandler(nil)
|
|
264
|
+
progress.completedUnitCount = 1
|
|
265
|
+
return progress
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
func enumerator(
|
|
269
|
+
for containerItemIdentifier: NSFileProviderItemIdentifier,
|
|
270
|
+
request: NSFileProviderRequest
|
|
271
|
+
) throws -> NSFileProviderEnumerator {
|
|
272
|
+
FileProviderEnumerator(enumeratedItemIdentifier: containerItemIdentifier)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
private static func writeAppGroupMarker() {
|
|
276
|
+
let defaults = UserDefaults(suiteName: appGroupId)
|
|
277
|
+
defaults?.set("ET FileProv", forKey: "fp:marker")
|
|
278
|
+
defaults?.set(seedFilename, forKey: "fp:lastFile")
|
|
279
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "fp:lastAt")
|
|
280
|
+
defaults?.synchronize()
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
final class FileProviderItem: NSObject, NSFileProviderItem {
|
|
285
|
+
let itemIdentifier: NSFileProviderItemIdentifier
|
|
286
|
+
let parentItemIdentifier: NSFileProviderItemIdentifier
|
|
287
|
+
let filename: String
|
|
288
|
+
let capabilities: NSFileProviderItemCapabilities
|
|
289
|
+
let documentSize: NSNumber?
|
|
290
|
+
let creationDate: Date?
|
|
291
|
+
let contentModificationDate: Date?
|
|
292
|
+
let itemVersion: NSFileProviderItemVersion
|
|
293
|
+
let contentType: UTType
|
|
294
|
+
let isDownloaded: Bool
|
|
295
|
+
let isDownloading: Bool
|
|
296
|
+
let isUploaded: Bool
|
|
297
|
+
let isUploading: Bool
|
|
298
|
+
|
|
299
|
+
init(identifier: NSFileProviderItemIdentifier) {
|
|
300
|
+
itemIdentifier = identifier
|
|
301
|
+
let now = Date()
|
|
302
|
+
creationDate = now
|
|
303
|
+
contentModificationDate = now
|
|
304
|
+
// Replicated API requires itemVersion on every item
|
|
305
|
+
// (__FILEPROVIDER_BAD_ITEM_MISSING_ITEMVERSION__).
|
|
306
|
+
itemVersion = NSFileProviderItemVersion(
|
|
307
|
+
contentVersion: Data("c1".utf8),
|
|
308
|
+
metadataVersion: Data("m1".utf8)
|
|
309
|
+
)
|
|
310
|
+
isDownloaded = true
|
|
311
|
+
isDownloading = false
|
|
312
|
+
isUploaded = true
|
|
313
|
+
isUploading = false
|
|
314
|
+
if identifier == .rootContainer || identifier == .workingSet {
|
|
315
|
+
parentItemIdentifier = .rootContainer
|
|
316
|
+
filename = identifier == .workingSet ? "Working Set" : "ET FileProv"
|
|
317
|
+
contentType = .folder
|
|
318
|
+
capabilities = [.allowsReading, .allowsContentEnumerating]
|
|
319
|
+
documentSize = nil
|
|
320
|
+
} else if identifier == seedIdentifier {
|
|
321
|
+
parentItemIdentifier = .rootContainer
|
|
322
|
+
filename = seedFilename
|
|
323
|
+
contentType = .plainText
|
|
324
|
+
capabilities = [.allowsReading]
|
|
325
|
+
documentSize = NSNumber(value: seedBody.count)
|
|
326
|
+
} else {
|
|
327
|
+
parentItemIdentifier = .rootContainer
|
|
328
|
+
filename = identifier.rawValue.isEmpty ? "item" : identifier.rawValue
|
|
329
|
+
contentType = .folder
|
|
330
|
+
capabilities = [.allowsReading, .allowsContentEnumerating]
|
|
331
|
+
documentSize = nil
|
|
332
|
+
}
|
|
333
|
+
super.init()
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
final class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
|
|
338
|
+
private let enumeratedItemIdentifier: NSFileProviderItemIdentifier
|
|
339
|
+
|
|
340
|
+
init(enumeratedItemIdentifier: NSFileProviderItemIdentifier) {
|
|
341
|
+
self.enumeratedItemIdentifier = enumeratedItemIdentifier
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
func invalidate() {}
|
|
345
|
+
|
|
346
|
+
func enumerateItems(
|
|
347
|
+
for observer: NSFileProviderEnumerationObserver,
|
|
348
|
+
startingAt page: NSFileProviderPage
|
|
349
|
+
) {
|
|
350
|
+
if enumeratedItemIdentifier == .rootContainer
|
|
351
|
+
|| enumeratedItemIdentifier == .workingSet
|
|
352
|
+
{
|
|
353
|
+
let defaults = UserDefaults(suiteName: appGroupId)
|
|
354
|
+
defaults?.set("ET FileProv", forKey: "fp:marker")
|
|
355
|
+
defaults?.set(seedFilename, forKey: "fp:lastFile")
|
|
356
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "fp:lastAt")
|
|
357
|
+
defaults?.synchronize()
|
|
358
|
+
observer.didEnumerate([FileProviderItem(identifier: seedIdentifier)])
|
|
359
|
+
} else {
|
|
360
|
+
observer.didEnumerate([])
|
|
361
|
+
}
|
|
362
|
+
observer.finishEnumerating(upTo: nil)
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
func enumerateChanges(
|
|
366
|
+
for observer: NSFileProviderChangeObserver,
|
|
367
|
+
from syncAnchor: NSFileProviderSyncAnchor
|
|
368
|
+
) {
|
|
369
|
+
observer.finishEnumeratingChanges(upTo: syncAnchor, moreComing: false)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
func currentSyncAnchor(
|
|
373
|
+
completionHandler: @escaping (NSFileProviderSyncAnchor?) -> Void
|
|
374
|
+
) {
|
|
375
|
+
completionHandler(NSFileProviderSyncAnchor(Data([0])))
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
`,
|
|
379
|
+
},
|
|
380
|
+
spotlight: {
|
|
381
|
+
fileName: 'ImportExtension.swift',
|
|
382
|
+
source: (appGroup) => `import CoreSpotlight
|
|
383
|
+
import Foundation
|
|
384
|
+
import UniformTypeIdentifiers
|
|
385
|
+
|
|
386
|
+
/// Spotlight import principal — attributes files of our custom UTI for search.
|
|
387
|
+
@objc(ImportExtension)
|
|
388
|
+
final class ImportExtension: CSImportExtension {
|
|
389
|
+
override func update(
|
|
390
|
+
_ attributes: CSSearchableItemAttributeSet,
|
|
391
|
+
forFileAt contentURL: URL
|
|
392
|
+
) throws {
|
|
393
|
+
let name = contentURL.deletingPathExtension().lastPathComponent
|
|
394
|
+
attributes.displayName = "ET Spotlight Import"
|
|
395
|
+
attributes.title = "ET Spotlight Import"
|
|
396
|
+
attributes.contentDescription = "expo-targets spotlight importer: \\(name)"
|
|
397
|
+
attributes.keywords = ["expo-targets", "ET Spotlight", name]
|
|
398
|
+
|
|
399
|
+
let defaults = UserDefaults(suiteName: "${appGroup}")
|
|
400
|
+
defaults?.set(contentURL.lastPathComponent, forKey: "spotlight:lastFile")
|
|
401
|
+
defaults?.set("ET Spotlight Import", forKey: "spotlight:marker")
|
|
402
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "spotlight:lastAt")
|
|
403
|
+
defaults?.synchronize()
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
`,
|
|
407
|
+
},
|
|
408
|
+
'bg-download': {
|
|
409
|
+
fileName: 'BackgroundDownloadHandler.swift',
|
|
410
|
+
source: (_appGroup) => `import Foundation
|
|
411
|
+
import UIKit
|
|
412
|
+
|
|
413
|
+
/// Minimal bg-download stub scaffolded by expo-targets.
|
|
414
|
+
@objc(BackgroundDownloadHandler)
|
|
415
|
+
class BackgroundDownloadHandler: NSObject {
|
|
416
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
417
|
+
}
|
|
418
|
+
`,
|
|
419
|
+
},
|
|
420
|
+
'quicklook-thumbnail': {
|
|
421
|
+
fileName: 'ThumbnailProvider.swift',
|
|
422
|
+
source: (appGroup) => `import QuickLookThumbnailing
|
|
423
|
+
import UIKit
|
|
424
|
+
|
|
425
|
+
/// Quick Look thumbnail principal — Files browse of \`.etqlt\` should invoke this.
|
|
426
|
+
@objc(ThumbnailProvider)
|
|
427
|
+
class ThumbnailProvider: QLThumbnailProvider {
|
|
428
|
+
override func provideThumbnail(
|
|
429
|
+
for request: QLFileThumbnailRequest,
|
|
430
|
+
_ handler: @escaping (QLThumbnailReply?, Error?) -> Void
|
|
431
|
+
) {
|
|
432
|
+
let defaults = UserDefaults(suiteName: "${appGroup}")
|
|
433
|
+
defaults?.set(request.fileURL.lastPathComponent, forKey: "qlThumb:lastFile")
|
|
434
|
+
defaults?.set("ET QL Thumb", forKey: "qlThumb:marker")
|
|
435
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "qlThumb:lastAt")
|
|
436
|
+
defaults?.synchronize()
|
|
437
|
+
|
|
438
|
+
let size = request.maximumSize
|
|
439
|
+
handler(
|
|
440
|
+
QLThumbnailReply(contextSize: size, currentContextDrawing: {
|
|
441
|
+
UIColor.systemTeal.setFill()
|
|
442
|
+
UIBezierPath(rect: CGRect(origin: .zero, size: size)).fill()
|
|
443
|
+
|
|
444
|
+
let label = "ET QL Thumb" as NSString
|
|
445
|
+
let attrs: [NSAttributedString.Key: Any] = [
|
|
446
|
+
.font: UIFont.boldSystemFont(ofSize: max(10, min(size.width, size.height) * 0.14)),
|
|
447
|
+
.foregroundColor: UIColor.white,
|
|
448
|
+
]
|
|
449
|
+
let textSize = label.size(withAttributes: attrs)
|
|
450
|
+
let origin = CGPoint(
|
|
451
|
+
x: (size.width - textSize.width) / 2,
|
|
452
|
+
y: (size.height - textSize.height) / 2
|
|
453
|
+
)
|
|
454
|
+
label.draw(at: origin, withAttributes: attrs)
|
|
455
|
+
return true
|
|
456
|
+
}),
|
|
457
|
+
nil
|
|
458
|
+
)
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
`,
|
|
462
|
+
},
|
|
463
|
+
'location-push': {
|
|
464
|
+
fileName: 'LocationPushService.swift',
|
|
465
|
+
source: (appGroup) => `import CoreLocation
|
|
466
|
+
import Foundation
|
|
467
|
+
|
|
468
|
+
/// Location push service extension — records payload receipt in App Group.
|
|
469
|
+
@objc(LocationPushService)
|
|
470
|
+
class LocationPushService: NSObject, CLLocationPushServiceExtension {
|
|
471
|
+
private let appGroup = "${appGroup}"
|
|
472
|
+
|
|
473
|
+
func didReceiveLocationPushPayload(
|
|
474
|
+
_ payload: Data,
|
|
475
|
+
completion: @escaping () -> Void
|
|
476
|
+
) {
|
|
477
|
+
if let defaults = UserDefaults(suiteName: appGroup) {
|
|
478
|
+
defaults.set(payload.count, forKey: "lastPushPayloadBytes")
|
|
479
|
+
defaults.set(Date().timeIntervalSince1970, forKey: "lastPushAt")
|
|
480
|
+
}
|
|
481
|
+
completion()
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
`,
|
|
485
|
+
},
|
|
486
|
+
'credentials-provider': {
|
|
487
|
+
fileName: 'CredentialProviderViewController.swift',
|
|
488
|
+
source: (_appGroup) => `import AuthenticationServices
|
|
489
|
+
import UIKit
|
|
490
|
+
|
|
491
|
+
/// Credentials provider extension — ASCredentialProviderViewController principal.
|
|
492
|
+
@objc(CredentialProviderViewController)
|
|
493
|
+
class CredentialProviderViewController: ASCredentialProviderViewController {}
|
|
494
|
+
`,
|
|
495
|
+
},
|
|
496
|
+
'account-auth': {
|
|
497
|
+
fileName: 'AccountAuthViewController.swift',
|
|
498
|
+
source: (_appGroup) => `import AuthenticationServices
|
|
499
|
+
import UIKit
|
|
500
|
+
|
|
501
|
+
/// Account authentication modification UI extension principal.
|
|
502
|
+
@objc(AccountAuthViewController)
|
|
503
|
+
class AccountAuthViewController: ASAccountAuthenticationModificationViewController {}
|
|
504
|
+
`,
|
|
505
|
+
},
|
|
506
|
+
'device-activity-monitor': {
|
|
507
|
+
fileName: 'DeviceActivityMonitorExtension.swift',
|
|
508
|
+
source: (_appGroup) => `import DeviceActivity
|
|
509
|
+
import Foundation
|
|
510
|
+
|
|
511
|
+
/// DeviceActivity monitor extension principal.
|
|
512
|
+
@objc(DeviceActivityMonitorExtension)
|
|
513
|
+
class DeviceActivityMonitorExtension: DeviceActivityMonitor {}
|
|
514
|
+
`,
|
|
515
|
+
},
|
|
516
|
+
matter: {
|
|
517
|
+
fileName: 'MatterSupportExtension.swift',
|
|
518
|
+
source: (_appGroup) => `import Foundation
|
|
519
|
+
import UIKit
|
|
520
|
+
|
|
521
|
+
/// Minimal matter stub scaffolded by expo-targets.
|
|
522
|
+
@objc(MatterSupportExtension)
|
|
523
|
+
class MatterSupportExtension: NSObject {
|
|
524
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
525
|
+
}
|
|
526
|
+
`,
|
|
527
|
+
},
|
|
528
|
+
'content-blocker': {
|
|
529
|
+
fileName: 'ContentBlockerRequestHandler.swift',
|
|
530
|
+
source: (_appGroup) => `import Foundation
|
|
531
|
+
|
|
532
|
+
class ContentBlockerRequestHandler: NSObject, NSExtensionRequestHandling {
|
|
533
|
+
func beginRequest(with context: NSExtensionContext) {
|
|
534
|
+
let attachment = NSItemProvider(
|
|
535
|
+
contentsOf: Bundle.main.url(forResource: "blockerList", withExtension: "json")
|
|
536
|
+
)!
|
|
537
|
+
let item = NSExtensionItem()
|
|
538
|
+
item.attachments = [attachment]
|
|
539
|
+
context.completeRequest(returningItems: [item], completionHandler: nil)
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
`,
|
|
543
|
+
},
|
|
544
|
+
keyboard: {
|
|
545
|
+
fileName: 'KeyboardViewController.swift',
|
|
546
|
+
source: (_appGroup) => `import UIKit
|
|
547
|
+
|
|
548
|
+
/// Custom keyboard with a tappable key for agent-device typing proof.
|
|
549
|
+
@objc(KeyboardViewController)
|
|
550
|
+
class KeyboardViewController: UIInputViewController {
|
|
551
|
+
override func viewDidLoad() {
|
|
552
|
+
super.viewDidLoad()
|
|
553
|
+
view.backgroundColor = .secondarySystemBackground
|
|
554
|
+
|
|
555
|
+
let stack = UIStackView()
|
|
556
|
+
stack.axis = .horizontal
|
|
557
|
+
stack.spacing = 8
|
|
558
|
+
stack.translatesAutoresizingMaskIntoConstraints = false
|
|
559
|
+
view.addSubview(stack)
|
|
560
|
+
|
|
561
|
+
let key = UIButton(type: .system)
|
|
562
|
+
key.setTitle("ET", for: .normal)
|
|
563
|
+
key.titleLabel?.font = .systemFont(ofSize: 28, weight: .semibold)
|
|
564
|
+
key.accessibilityIdentifier = "keyboard-key-et"
|
|
565
|
+
key.accessibilityLabel = "ET"
|
|
566
|
+
key.isAccessibilityElement = true
|
|
567
|
+
key.backgroundColor = .systemBlue.withAlphaComponent(0.15)
|
|
568
|
+
key.layer.cornerRadius = 10
|
|
569
|
+
key.contentEdgeInsets = UIEdgeInsets(top: 20, left: 36, bottom: 20, right: 36)
|
|
570
|
+
key.addTarget(self, action: #selector(insertEt), for: .touchUpInside)
|
|
571
|
+
stack.addArrangedSubview(key)
|
|
572
|
+
|
|
573
|
+
NSLayoutConstraint.activate([
|
|
574
|
+
stack.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
|
575
|
+
stack.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
|
576
|
+
key.widthAnchor.constraint(greaterThanOrEqualToConstant: 120),
|
|
577
|
+
key.heightAnchor.constraint(greaterThanOrEqualToConstant: 64),
|
|
578
|
+
])
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
@objc private func insertEt() {
|
|
582
|
+
textDocumentProxy.insertText("ET")
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
`,
|
|
586
|
+
},
|
|
587
|
+
'file-provider-ui': {
|
|
588
|
+
fileName: 'DocumentActionViewController.swift',
|
|
589
|
+
source: (_appGroup) => `import FileProviderUI
|
|
590
|
+
import UIKit
|
|
591
|
+
|
|
592
|
+
/// Minimal File Provider UI action extension — real FPUIActionExtensionViewController.
|
|
593
|
+
@objc(DocumentActionViewController)
|
|
594
|
+
class DocumentActionViewController: FPUIActionExtensionViewController {
|
|
595
|
+
override func prepare(forAction actionIdentifier: String, itemIdentifiers: [NSFileProviderItemIdentifier]) {
|
|
596
|
+
let label = UILabel()
|
|
597
|
+
label.text = "ET FileProvUI"
|
|
598
|
+
label.textAlignment = .center
|
|
599
|
+
label.translatesAutoresizingMaskIntoConstraints = false
|
|
600
|
+
label.accessibilityIdentifier = "file-provider-ui-marker"
|
|
601
|
+
view.backgroundColor = .systemBackground
|
|
602
|
+
view.addSubview(label)
|
|
603
|
+
NSLayoutConstraint.activate([
|
|
604
|
+
label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
|
605
|
+
label.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
|
606
|
+
])
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
override func prepare(forError error: Error) {
|
|
610
|
+
prepare(forAction: "error", itemIdentifiers: [])
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
`,
|
|
614
|
+
},
|
|
615
|
+
'broadcast-upload': {
|
|
616
|
+
fileName: 'SampleHandler.swift',
|
|
617
|
+
source: (_appGroup) => `import Foundation
|
|
618
|
+
import UIKit
|
|
619
|
+
|
|
620
|
+
/// Minimal broadcast-upload stub scaffolded by expo-targets.
|
|
621
|
+
@objc(SampleHandler)
|
|
622
|
+
class SampleHandler: NSObject {
|
|
623
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
624
|
+
}
|
|
625
|
+
`,
|
|
626
|
+
},
|
|
627
|
+
'broadcast-setup-ui': {
|
|
628
|
+
fileName: 'BroadcastSetupViewController.swift',
|
|
629
|
+
source: (_appGroup) => `import Foundation
|
|
630
|
+
import UIKit
|
|
631
|
+
|
|
632
|
+
/// Minimal broadcast-setup-ui stub scaffolded by expo-targets.
|
|
633
|
+
@objc(BroadcastSetupViewController)
|
|
634
|
+
class BroadcastSetupViewController: NSObject {
|
|
635
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
636
|
+
}
|
|
637
|
+
`,
|
|
638
|
+
},
|
|
639
|
+
'call-directory': {
|
|
640
|
+
fileName: 'CallDirectoryHandler.swift',
|
|
641
|
+
source: (appGroup) => `import CallKit
|
|
642
|
+
import Foundation
|
|
643
|
+
|
|
644
|
+
/// Call Directory extension — blocks demo numbers seeded by the host via App Group.
|
|
645
|
+
@objc(CallDirectoryHandler)
|
|
646
|
+
class CallDirectoryHandler: CXCallDirectoryProvider {
|
|
647
|
+
private let appGroup = "${appGroup}"
|
|
648
|
+
private let blockedKey = "blockedNumbers"
|
|
649
|
+
|
|
650
|
+
override func beginRequest(with context: CXCallDirectoryExtensionContext) {
|
|
651
|
+
context.delegate = self
|
|
652
|
+
|
|
653
|
+
let numbers = loadBlockedNumbers()
|
|
654
|
+
for number in numbers.sorted() {
|
|
655
|
+
context.addBlockingEntry(withNextSequentialPhoneNumber: number)
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
context.completeRequest()
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
private func loadBlockedNumbers() -> [CXCallDirectoryPhoneNumber] {
|
|
662
|
+
if let stored = UserDefaults(suiteName: appGroup)?
|
|
663
|
+
.array(forKey: blockedKey) as? [Int64],
|
|
664
|
+
!stored.isEmpty
|
|
665
|
+
{
|
|
666
|
+
return stored.map { CXCallDirectoryPhoneNumber($0) }
|
|
667
|
+
}
|
|
668
|
+
// Journey default when host has not seeded yet.
|
|
669
|
+
return [5555551234]
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
extension CallDirectoryHandler: CXCallDirectoryExtensionContextDelegate {
|
|
674
|
+
func requestFailed(
|
|
675
|
+
for extensionContext: CXCallDirectoryExtensionContext,
|
|
676
|
+
withError error: Error
|
|
677
|
+
) {
|
|
678
|
+
extensionContext.cancelRequest(withError: error)
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
`,
|
|
682
|
+
},
|
|
683
|
+
'message-filter': {
|
|
684
|
+
fileName: 'MessageFilterExtension.swift',
|
|
685
|
+
source: (appGroup) => `import Foundation
|
|
686
|
+
import IdentityLookup
|
|
687
|
+
|
|
688
|
+
/// Real IdentityLookup message filter — filters probe SMS and records App Group markers.
|
|
689
|
+
@objc(MessageFilterExtension)
|
|
690
|
+
final class MessageFilterExtension: ILMessageFilterExtension {}
|
|
691
|
+
|
|
692
|
+
extension MessageFilterExtension: ILMessageFilterQueryHandling {
|
|
693
|
+
func handle(
|
|
694
|
+
_ queryRequest: ILMessageFilterQueryRequest,
|
|
695
|
+
context: ILMessageFilterExtensionContext,
|
|
696
|
+
completion: @escaping (ILMessageFilterQueryResponse) -> Void
|
|
697
|
+
) {
|
|
698
|
+
let response = ILMessageFilterQueryResponse()
|
|
699
|
+
let body = (queryRequest.messageBody ?? "").lowercased()
|
|
700
|
+
let sender = (queryRequest.sender ?? "").lowercased()
|
|
701
|
+
let isProbe =
|
|
702
|
+
body.contains("expo-targets") || body.contains("et filter")
|
|
703
|
+
|| sender.contains("555")
|
|
704
|
+
|
|
705
|
+
// Filter probe traffic so SMS Filtering enablement has an observable effect.
|
|
706
|
+
response.action = isProbe ? .filter : .none
|
|
707
|
+
|
|
708
|
+
let defaults = UserDefaults(
|
|
709
|
+
suiteName: "${appGroup}"
|
|
710
|
+
)
|
|
711
|
+
defaults?.set(queryRequest.messageBody ?? "", forKey: "msgFilter:lastBody")
|
|
712
|
+
defaults?.set(queryRequest.sender ?? "", forKey: "msgFilter:lastSender")
|
|
713
|
+
defaults?.set(
|
|
714
|
+
isProbe ? "filter" : "none",
|
|
715
|
+
forKey: "msgFilter:lastAction"
|
|
716
|
+
)
|
|
717
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "msgFilter:lastAt")
|
|
718
|
+
defaults?.synchronize()
|
|
719
|
+
|
|
720
|
+
completion(response)
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
`,
|
|
724
|
+
},
|
|
725
|
+
'unwanted-communication': {
|
|
726
|
+
fileName: 'ClassificationViewController.swift',
|
|
727
|
+
source: (appGroup) => `import IdentityLookup
|
|
728
|
+
import IdentityLookupUI
|
|
729
|
+
import UIKit
|
|
730
|
+
|
|
731
|
+
/// Unwanted Communication Reporting principal — Settings Phone → SMS/Call Reporting.
|
|
732
|
+
@objc(ClassificationViewController)
|
|
733
|
+
class ClassificationViewController: ILClassificationUIExtensionViewController {
|
|
734
|
+
private let markerLabel = UILabel()
|
|
735
|
+
private let appGroup = "${appGroup}"
|
|
736
|
+
|
|
737
|
+
override func viewDidLoad() {
|
|
738
|
+
super.viewDidLoad()
|
|
739
|
+
view.backgroundColor = .systemBackground
|
|
740
|
+
|
|
741
|
+
markerLabel.text = "ET Unwanted"
|
|
742
|
+
markerLabel.accessibilityIdentifier = "uc-classification-marker"
|
|
743
|
+
markerLabel.accessibilityLabel = "ET Unwanted"
|
|
744
|
+
markerLabel.textAlignment = .center
|
|
745
|
+
markerLabel.font = .preferredFont(forTextStyle: .title2)
|
|
746
|
+
markerLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
747
|
+
view.addSubview(markerLabel)
|
|
748
|
+
|
|
749
|
+
NSLayoutConstraint.activate([
|
|
750
|
+
markerLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
|
751
|
+
markerLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
|
752
|
+
markerLabel.leadingAnchor.constraint(
|
|
753
|
+
greaterThanOrEqualTo: view.leadingAnchor,
|
|
754
|
+
constant: 16
|
|
755
|
+
),
|
|
756
|
+
markerLabel.trailingAnchor.constraint(
|
|
757
|
+
lessThanOrEqualTo: view.trailingAnchor,
|
|
758
|
+
constant: -16
|
|
759
|
+
),
|
|
760
|
+
])
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
override func prepare(for request: ILClassificationRequest) {
|
|
764
|
+
let defaults = UserDefaults(suiteName: appGroup)
|
|
765
|
+
defaults?.set("ET Unwanted", forKey: "uc:marker")
|
|
766
|
+
defaults?.set(String(describing: type(of: request)), forKey: "uc:lastRequest")
|
|
767
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "uc:lastAt")
|
|
768
|
+
defaults?.synchronize()
|
|
769
|
+
extensionContext.isReadyForClassificationResponse = true
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
override func classificationResponse(
|
|
773
|
+
for request: ILClassificationRequest
|
|
774
|
+
) -> ILClassificationResponse {
|
|
775
|
+
ILClassificationResponse(action: .reportJunk)
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
`,
|
|
779
|
+
},
|
|
780
|
+
'network-packet-tunnel': {
|
|
781
|
+
fileName: 'PacketTunnelProvider.swift',
|
|
782
|
+
source: (_appGroup) => `import NetworkExtension
|
|
783
|
+
|
|
784
|
+
/// Minimal packet tunnel — real NEPacketTunnelProvider subclass.
|
|
785
|
+
/// Full VPN requires Network Extension entitlement (os-limit in agent-device).
|
|
786
|
+
@objc(PacketTunnelProvider)
|
|
787
|
+
class PacketTunnelProvider: NEPacketTunnelProvider {
|
|
788
|
+
override func startTunnel(
|
|
789
|
+
options: [String: NSObject]?,
|
|
790
|
+
completionHandler: @escaping (Error?) -> Void
|
|
791
|
+
) {
|
|
792
|
+
completionHandler(
|
|
793
|
+
NSError(
|
|
794
|
+
domain: "ETNETunnel",
|
|
795
|
+
code: 1,
|
|
796
|
+
userInfo: [
|
|
797
|
+
NSLocalizedDescriptionKey:
|
|
798
|
+
"expo-targets: Network Extension entitlement required",
|
|
799
|
+
]
|
|
800
|
+
)
|
|
801
|
+
)
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
override func stopTunnel(
|
|
805
|
+
with reason: NEProviderStopReason,
|
|
806
|
+
completionHandler: @escaping () -> Void
|
|
807
|
+
) {
|
|
808
|
+
completionHandler()
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
`,
|
|
812
|
+
},
|
|
813
|
+
'network-app-proxy': {
|
|
814
|
+
fileName: 'AppProxyProvider.swift',
|
|
815
|
+
source: (_appGroup) => `import NetworkExtension
|
|
816
|
+
|
|
817
|
+
/// Minimal app proxy — real NEAppProxyProvider subclass.
|
|
818
|
+
@objc(AppProxyProvider)
|
|
819
|
+
class AppProxyProvider: NEAppProxyProvider {
|
|
820
|
+
override func startProxy(
|
|
821
|
+
options: [String: Any]?,
|
|
822
|
+
completionHandler: @escaping (Error?) -> Void
|
|
823
|
+
) {
|
|
824
|
+
completionHandler(
|
|
825
|
+
NSError(
|
|
826
|
+
domain: "ETNEProxy",
|
|
827
|
+
code: 1,
|
|
828
|
+
userInfo: [
|
|
829
|
+
NSLocalizedDescriptionKey:
|
|
830
|
+
"expo-targets: Network Extension entitlement required",
|
|
831
|
+
]
|
|
832
|
+
)
|
|
833
|
+
)
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
override func stopProxy(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) {
|
|
837
|
+
completionHandler()
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {
|
|
841
|
+
false
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
`,
|
|
845
|
+
},
|
|
846
|
+
'network-dns-proxy': {
|
|
847
|
+
fileName: 'DNSProxyProvider.swift',
|
|
848
|
+
source: (_appGroup) => `import NetworkExtension
|
|
849
|
+
|
|
850
|
+
/// Minimal DNS proxy — real NEDNSProxyProvider subclass.
|
|
851
|
+
@objc(DNSProxyProvider)
|
|
852
|
+
class DNSProxyProvider: NEDNSProxyProvider {
|
|
853
|
+
override func startProxy(
|
|
854
|
+
options: [String: Any]?,
|
|
855
|
+
completionHandler: @escaping (Error?) -> Void
|
|
856
|
+
) {
|
|
857
|
+
completionHandler(
|
|
858
|
+
NSError(
|
|
859
|
+
domain: "ETNEDNS",
|
|
860
|
+
code: 1,
|
|
861
|
+
userInfo: [
|
|
862
|
+
NSLocalizedDescriptionKey:
|
|
863
|
+
"expo-targets: Network Extension entitlement required",
|
|
864
|
+
]
|
|
865
|
+
)
|
|
866
|
+
)
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
override func stopProxy(
|
|
870
|
+
with reason: NEProviderStopReason,
|
|
871
|
+
completionHandler: @escaping () -> Void
|
|
872
|
+
) {
|
|
873
|
+
completionHandler()
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
override func handleNewFlow(_ flow: NEAppProxyFlow) -> Bool {
|
|
877
|
+
false
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
`,
|
|
881
|
+
},
|
|
882
|
+
'network-filter-data': {
|
|
883
|
+
fileName: 'FilterDataProvider.swift',
|
|
884
|
+
source: (_appGroup) => `import NetworkExtension
|
|
885
|
+
|
|
886
|
+
/// Minimal filter data provider — real NEFilterDataProvider subclass.
|
|
887
|
+
@objc(FilterDataProvider)
|
|
888
|
+
class FilterDataProvider: NEFilterDataProvider {
|
|
889
|
+
override func startFilter(completionHandler: @escaping (Error?) -> Void) {
|
|
890
|
+
completionHandler(
|
|
891
|
+
NSError(
|
|
892
|
+
domain: "ETNEFilter",
|
|
893
|
+
code: 1,
|
|
894
|
+
userInfo: [
|
|
895
|
+
NSLocalizedDescriptionKey:
|
|
896
|
+
"expo-targets: Network Extension entitlement required",
|
|
897
|
+
]
|
|
898
|
+
)
|
|
899
|
+
)
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
override func stopFilter(
|
|
903
|
+
with reason: NEProviderStopReason,
|
|
904
|
+
completionHandler: @escaping () -> Void
|
|
905
|
+
) {
|
|
906
|
+
completionHandler()
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
`,
|
|
910
|
+
},
|
|
911
|
+
'shield-action': {
|
|
912
|
+
fileName: 'ShieldActionExtension.swift',
|
|
913
|
+
source: (_appGroup) => `import ManagedSettingsUI
|
|
914
|
+
import UIKit
|
|
915
|
+
|
|
916
|
+
/// Shield action extension — responds to shield button taps.
|
|
917
|
+
@objc(ShieldActionExtension)
|
|
918
|
+
class ShieldActionExtension: ShieldActionDelegate {
|
|
919
|
+
func handle(
|
|
920
|
+
action: ShieldAction,
|
|
921
|
+
for application: ApplicationToken,
|
|
922
|
+
completionHandler: @escaping (ShieldActionResponse) -> Void
|
|
923
|
+
) {
|
|
924
|
+
completionHandler(.close)
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
`,
|
|
928
|
+
},
|
|
929
|
+
'shield-config': {
|
|
930
|
+
fileName: 'ShieldConfigurationExtension.swift',
|
|
931
|
+
source: (_appGroup) => `import ManagedSettings
|
|
932
|
+
import ManagedSettingsUI
|
|
933
|
+
import UIKit
|
|
934
|
+
|
|
935
|
+
/// Shield configuration extension — supplies shield UI metadata.
|
|
936
|
+
@objc(ShieldConfigurationExtension)
|
|
937
|
+
class ShieldConfigurationExtension: ShieldConfigurationDataSource {
|
|
938
|
+
override func configuration(shielding application: Application) -> ShieldConfiguration {
|
|
939
|
+
ShieldConfiguration()
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
`,
|
|
943
|
+
},
|
|
944
|
+
'classkit-context': {
|
|
945
|
+
fileName: 'ClassKitContextProvider.swift',
|
|
946
|
+
source: (_appGroup) => `import Foundation
|
|
947
|
+
import UIKit
|
|
948
|
+
|
|
949
|
+
/// Minimal classkit-context stub scaffolded by expo-targets.
|
|
950
|
+
@objc(ClassKitContextProvider)
|
|
951
|
+
class ClassKitContextProvider: NSObject {
|
|
952
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
953
|
+
}
|
|
954
|
+
`,
|
|
955
|
+
},
|
|
956
|
+
'authentication-services': {
|
|
957
|
+
fileName: 'AuthenticationServicesHandler.swift',
|
|
958
|
+
source: (_appGroup) => `import AuthenticationServices
|
|
959
|
+
import Foundation
|
|
960
|
+
|
|
961
|
+
/// App SSO identity-provider extension — authorization request handler principal.
|
|
962
|
+
@objc(AuthenticationServicesHandler)
|
|
963
|
+
class AuthenticationServicesHandler: NSObject,
|
|
964
|
+
ASAuthorizationProviderExtensionAuthorizationRequestHandler
|
|
965
|
+
{
|
|
966
|
+
func prepareInterface(
|
|
967
|
+
for authorizationRequest: ASAuthorizationProviderExtensionAuthorizationRequest
|
|
968
|
+
) {
|
|
969
|
+
authorizationRequest.completeRequest()
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
`,
|
|
973
|
+
},
|
|
974
|
+
'spotlight-delegate': {
|
|
975
|
+
fileName: 'SpotlightDelegate.swift',
|
|
976
|
+
source: (_appGroup) => `import Foundation
|
|
977
|
+
import UIKit
|
|
978
|
+
|
|
979
|
+
/// Minimal spotlight-delegate stub scaffolded by expo-targets.
|
|
980
|
+
@objc(SpotlightDelegate)
|
|
981
|
+
class SpotlightDelegate: NSObject {
|
|
982
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
983
|
+
}
|
|
984
|
+
`,
|
|
985
|
+
},
|
|
986
|
+
'quicklook-preview': {
|
|
987
|
+
fileName: 'PreviewViewController.swift',
|
|
988
|
+
source: (appGroup) => `import QuickLook
|
|
989
|
+
import UIKit
|
|
990
|
+
|
|
991
|
+
/// Quick Look preview principal — proves Files → Quick Look opens our extension UI.
|
|
992
|
+
@objc(PreviewViewController)
|
|
993
|
+
class PreviewViewController: UIViewController, QLPreviewingController {
|
|
994
|
+
private let markerLabel = UILabel()
|
|
995
|
+
|
|
996
|
+
override func viewDidLoad() {
|
|
997
|
+
super.viewDidLoad()
|
|
998
|
+
view.backgroundColor = .systemBackground
|
|
999
|
+
|
|
1000
|
+
markerLabel.text = "ET QL Preview"
|
|
1001
|
+
markerLabel.accessibilityIdentifier = "ql-preview-marker"
|
|
1002
|
+
markerLabel.accessibilityLabel = "ET QL Preview"
|
|
1003
|
+
markerLabel.textAlignment = .center
|
|
1004
|
+
markerLabel.font = .preferredFont(forTextStyle: .title2)
|
|
1005
|
+
markerLabel.translatesAutoresizingMaskIntoConstraints = false
|
|
1006
|
+
view.addSubview(markerLabel)
|
|
1007
|
+
|
|
1008
|
+
NSLayoutConstraint.activate([
|
|
1009
|
+
markerLabel.centerXAnchor.constraint(equalTo: view.centerXAnchor),
|
|
1010
|
+
markerLabel.centerYAnchor.constraint(equalTo: view.centerYAnchor),
|
|
1011
|
+
markerLabel.leadingAnchor.constraint(
|
|
1012
|
+
greaterThanOrEqualTo: view.leadingAnchor,
|
|
1013
|
+
constant: 16
|
|
1014
|
+
),
|
|
1015
|
+
markerLabel.trailingAnchor.constraint(
|
|
1016
|
+
lessThanOrEqualTo: view.trailingAnchor,
|
|
1017
|
+
constant: -16
|
|
1018
|
+
),
|
|
1019
|
+
])
|
|
1020
|
+
}
|
|
1021
|
+
|
|
1022
|
+
func preparePreviewOfFile(
|
|
1023
|
+
at url: URL,
|
|
1024
|
+
completionHandler handler: @escaping (Error?) -> Void
|
|
1025
|
+
) {
|
|
1026
|
+
let defaults = UserDefaults(suiteName: "${appGroup}")
|
|
1027
|
+
defaults?.set(url.lastPathComponent, forKey: "qlPreview:lastFile")
|
|
1028
|
+
defaults?.set("ET QL Preview", forKey: "qlPreview:marker")
|
|
1029
|
+
defaults?.set(Date().timeIntervalSince1970, forKey: "qlPreview:lastAt")
|
|
1030
|
+
defaults?.synchronize()
|
|
1031
|
+
handler(nil)
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
`,
|
|
1035
|
+
},
|
|
1036
|
+
'print-service': {
|
|
1037
|
+
fileName: 'PrinterExtension.swift',
|
|
1038
|
+
source: (_appGroup) => `import Foundation
|
|
1039
|
+
import UIKit
|
|
1040
|
+
|
|
1041
|
+
/// Minimal print-service stub scaffolded by expo-targets.
|
|
1042
|
+
@objc(PrinterExtension)
|
|
1043
|
+
class PrinterExtension: NSObject {
|
|
1044
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
1045
|
+
}
|
|
1046
|
+
`,
|
|
1047
|
+
},
|
|
1048
|
+
'smart-card': {
|
|
1049
|
+
fileName: 'Token.swift',
|
|
1050
|
+
source: (_appGroup) => `import Foundation
|
|
1051
|
+
import UIKit
|
|
1052
|
+
|
|
1053
|
+
/// Minimal smart-card stub scaffolded by expo-targets.
|
|
1054
|
+
@objc(Token)
|
|
1055
|
+
class Token: NSObject {
|
|
1056
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
1057
|
+
}
|
|
1058
|
+
`,
|
|
1059
|
+
},
|
|
1060
|
+
'virtual-conference': {
|
|
1061
|
+
fileName: 'VirtualConferenceProvider.swift',
|
|
1062
|
+
source: (_appGroup) => `import Foundation
|
|
1063
|
+
import UIKit
|
|
1064
|
+
|
|
1065
|
+
/// Minimal virtual-conference stub scaffolded by expo-targets.
|
|
1066
|
+
@objc(VirtualConferenceProvider)
|
|
1067
|
+
class VirtualConferenceProvider: NSObject {
|
|
1068
|
+
// Extension principal — replace with full Apple API conformance as needed.
|
|
1069
|
+
}
|
|
1070
|
+
`,
|
|
1071
|
+
},
|
|
1072
|
+
};
|
|
1073
|
+
//# sourceMappingURL=iosHandlers.js.map
|