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,120 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import Messages
|
|
3
|
+
|
|
4
|
+
// Principal class for Messages extension - required by iMessage
|
|
5
|
+
// This hosts the React Native view as a child view controller
|
|
6
|
+
@objc(MessagesViewController)
|
|
7
|
+
class MessagesViewController: MSMessagesAppViewController {
|
|
8
|
+
@objc static weak var shared: MSMessagesAppViewController?
|
|
9
|
+
private var reactViewController: ReactNativeViewController?
|
|
10
|
+
|
|
11
|
+
override func viewDidLoad() {
|
|
12
|
+
super.viewDidLoad()
|
|
13
|
+
MessagesViewController.shared = self
|
|
14
|
+
setupReactViewController()
|
|
15
|
+
setupNotificationObservers()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
deinit {
|
|
19
|
+
NotificationCenter.default.removeObserver(self)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private func setupReactViewController() {
|
|
23
|
+
let messagesData = loadMessagesData()
|
|
24
|
+
|
|
25
|
+
let reactVC = ReactNativeViewController(messagesData: messagesData)
|
|
26
|
+
addChild(reactVC)
|
|
27
|
+
reactVC.view.frame = view.bounds
|
|
28
|
+
reactVC.view.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
29
|
+
view.addSubview(reactVC.view)
|
|
30
|
+
reactVC.didMove(toParent: self)
|
|
31
|
+
|
|
32
|
+
self.reactViewController = reactVC
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private func loadMessagesData() -> [String: Any] {
|
|
36
|
+
var data: [String: Any] = [:]
|
|
37
|
+
|
|
38
|
+
// Load presentation style
|
|
39
|
+
data["presentationStyle"] = self.presentationStyle == .compact ? "compact" : "expanded"
|
|
40
|
+
|
|
41
|
+
// Load conversation data
|
|
42
|
+
if let conversation = self.activeConversation {
|
|
43
|
+
data["conversationId"] = conversation.localParticipantIdentifier.uuidString
|
|
44
|
+
data["remoteParticipantIds"] = conversation.remoteParticipantIdentifiers.map { $0.uuidString }
|
|
45
|
+
data["participantCount"] = conversation.remoteParticipantIdentifiers.count + 1
|
|
46
|
+
|
|
47
|
+
// Load selected message if present
|
|
48
|
+
if let message = conversation.selectedMessage {
|
|
49
|
+
data["hasSelectedMessage"] = true
|
|
50
|
+
var msgData: [String: Any] = [:]
|
|
51
|
+
|
|
52
|
+
if let url = message.url?.absoluteString {
|
|
53
|
+
msgData["url"] = url
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if let layout = message.layout as? MSMessageTemplateLayout {
|
|
57
|
+
if let caption = layout.caption { msgData["caption"] = caption }
|
|
58
|
+
if let subcaption = layout.subcaption { msgData["subcaption"] = subcaption }
|
|
59
|
+
if let trailing = layout.trailingCaption { msgData["trailingCaption"] = trailing }
|
|
60
|
+
if let trailingSub = layout.trailingSubcaption { msgData["trailingSubcaption"] = trailingSub }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
data["selectedMessage"] = msgData
|
|
64
|
+
} else {
|
|
65
|
+
data["hasSelectedMessage"] = false
|
|
66
|
+
}
|
|
67
|
+
} else {
|
|
68
|
+
data["participantCount"] = 1
|
|
69
|
+
data["remoteParticipantIds"] = []
|
|
70
|
+
data["hasSelectedMessage"] = false
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return data
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// MARK: - Notification Handling
|
|
77
|
+
|
|
78
|
+
private func setupNotificationObservers() {
|
|
79
|
+
print("[MessagesViewController] Setting up notification observers")
|
|
80
|
+
NotificationCenter.default.addObserver(
|
|
81
|
+
forName: NSNotification.Name("ExpoTargetsCloseExtension"),
|
|
82
|
+
object: nil,
|
|
83
|
+
queue: .main
|
|
84
|
+
) { [weak self] notification in
|
|
85
|
+
print("[MessagesViewController] Received ExpoTargetsCloseExtension notification")
|
|
86
|
+
print("[MessagesViewController] Current presentation style:", self?.presentationStyle == .compact ? "compact" : "expanded")
|
|
87
|
+
self?.closeExtension()
|
|
88
|
+
}
|
|
89
|
+
print("[MessagesViewController] Notification observer registered successfully")
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private func closeExtension() {
|
|
93
|
+
print("[MessagesViewController] closeExtension() called")
|
|
94
|
+
print("[MessagesViewController] Current presentation style:", self.presentationStyle == .compact ? "compact" : "expanded")
|
|
95
|
+
|
|
96
|
+
// For Messages extensions, minimize to compact mode instead of dismissing
|
|
97
|
+
print("[MessagesViewController] Calling requestPresentationStyle(.compact)")
|
|
98
|
+
self.requestPresentationStyle(.compact)
|
|
99
|
+
print("[MessagesViewController] requestPresentationStyle(.compact) returned")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// MARK: - Messages Lifecycle
|
|
103
|
+
|
|
104
|
+
override func didTransition(to presentationStyle: MSMessagesAppPresentationStyle) {
|
|
105
|
+
super.didTransition(to: presentationStyle)
|
|
106
|
+
|
|
107
|
+
let styleString = presentationStyle == .compact ? "compact" : "expanded"
|
|
108
|
+
print("[MessagesViewController] didTransition to:", styleString)
|
|
109
|
+
|
|
110
|
+
// Notify React Native of presentation style change
|
|
111
|
+
print("[MessagesViewController] Posting MSMessagesAppPresentationStyleDidChange notification")
|
|
112
|
+
NotificationCenter.default.post(
|
|
113
|
+
name: NSNotification.Name("MSMessagesAppPresentationStyleDidChange"),
|
|
114
|
+
object: nil,
|
|
115
|
+
userInfo: ["presentationStyle": styleString]
|
|
116
|
+
)
|
|
117
|
+
print("[MessagesViewController] Notification posted successfully")
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
import React
|
|
3
|
+
import React_RCTAppDelegate
|
|
4
|
+
import ReactAppDependencyProvider
|
|
5
|
+
|
|
6
|
+
// Extension-compatible delegate using standard RCT pattern
|
|
7
|
+
private class ExtensionReactDelegate: RCTDefaultReactNativeFactoryDelegate {
|
|
8
|
+
var bundleRoot: String
|
|
9
|
+
|
|
10
|
+
init(bundleRoot: String) {
|
|
11
|
+
self.bundleRoot = bundleRoot
|
|
12
|
+
super.init()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
override func sourceURL(for bridge: RCTBridge) -> URL? {
|
|
16
|
+
bundleURL()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
override func bundleURL() -> URL? {
|
|
20
|
+
#if DEBUG
|
|
21
|
+
let settings = RCTBundleURLProvider.sharedSettings()
|
|
22
|
+
settings.enableDev = true
|
|
23
|
+
settings.enableMinification = false
|
|
24
|
+
|
|
25
|
+
// Use target-specific bundle root with query parameter
|
|
26
|
+
if let bundleURL = settings.jsBundleURL(forBundleRoot: bundleRoot) {
|
|
27
|
+
if var components = URLComponents(url: bundleURL, resolvingAgainstBaseURL: false) {
|
|
28
|
+
components.queryItems = (components.queryItems ?? []) + [
|
|
29
|
+
URLQueryItem(name: "target", value: "{{TARGET_NAME}}")
|
|
30
|
+
]
|
|
31
|
+
return components.url ?? bundleURL
|
|
32
|
+
}
|
|
33
|
+
return bundleURL
|
|
34
|
+
}
|
|
35
|
+
return nil
|
|
36
|
+
#else
|
|
37
|
+
// In release, load from main bundle
|
|
38
|
+
guard let bundleURL = Bundle.main.url(forResource: "main", withExtension: "jsbundle") else {
|
|
39
|
+
return Bundle.main.url(forResource: "index", withExtension: "jsbundle")
|
|
40
|
+
}
|
|
41
|
+
return bundleURL
|
|
42
|
+
#endif
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
class ReactNativeViewController: UIViewController {
|
|
47
|
+
private var reactNativeFactory: RCTReactNativeFactory?
|
|
48
|
+
private var reactNativeFactoryDelegate: RCTReactNativeFactoryDelegate?
|
|
49
|
+
private var rootView: UIView?
|
|
50
|
+
private var isCleanedUp = false
|
|
51
|
+
private var initialExtensionData: [String: Any]?
|
|
52
|
+
|
|
53
|
+
// MARK: - Extension Data
|
|
54
|
+
|
|
55
|
+
{{EXTENSION_DATA_PROPERTIES}}
|
|
56
|
+
|
|
57
|
+
// MARK: - Lifecycle
|
|
58
|
+
|
|
59
|
+
// For messages extensions: accept data from parent MessagesViewController
|
|
60
|
+
convenience init(messagesData: [String: Any]) {
|
|
61
|
+
self.init(nibName: nil, bundle: nil)
|
|
62
|
+
self.initialExtensionData = messagesData
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
deinit {
|
|
66
|
+
cleanupAfterClose()
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override func viewDidLoad() {
|
|
70
|
+
super.viewDidLoad()
|
|
71
|
+
|
|
72
|
+
// Set the contentScaleFactor for proper rendering
|
|
73
|
+
self.view.contentScaleFactor = UIScreen.main.scale
|
|
74
|
+
isCleanedUp = false
|
|
75
|
+
|
|
76
|
+
setupNotificationObservers()
|
|
77
|
+
|
|
78
|
+
// If data was passed from parent (messages), use it directly
|
|
79
|
+
if let extensionData = self.initialExtensionData {
|
|
80
|
+
setupReactNativeView(with: extensionData)
|
|
81
|
+
} else {
|
|
82
|
+
// Otherwise load it ourselves (share, action, etc.)
|
|
83
|
+
{{LOAD_EXTENSION_DATA}}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
|
88
|
+
super.touchesBegan(touches, with: event)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
override func viewWillDisappear(_ animated: Bool) {
|
|
92
|
+
super.viewWillDisappear(animated)
|
|
93
|
+
if isBeingDismissed {
|
|
94
|
+
cleanupAfterClose()
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
override func viewDidDisappear(_ animated: Bool) {
|
|
99
|
+
super.viewDidDisappear(animated)
|
|
100
|
+
cleanupAfterClose()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// MARK: - React Native Setup
|
|
104
|
+
|
|
105
|
+
private func setupReactNativeView(with sharedData: [String: Any]?) {
|
|
106
|
+
// Create delegate with target-specific bundle root
|
|
107
|
+
reactNativeFactoryDelegate = ExtensionReactDelegate(bundleRoot: "{{BUNDLE_ROOT}}")
|
|
108
|
+
reactNativeFactoryDelegate!.dependencyProvider = RCTAppDependencyProvider()
|
|
109
|
+
|
|
110
|
+
// Create factory using standard RCT pattern
|
|
111
|
+
reactNativeFactory = RCTReactNativeFactory(delegate: reactNativeFactoryDelegate!)
|
|
112
|
+
|
|
113
|
+
// Capture current view properties
|
|
114
|
+
let currentBounds = self.view.bounds
|
|
115
|
+
let currentScale = UIScreen.main.scale
|
|
116
|
+
|
|
117
|
+
var initialProps = sharedData ?? [:]
|
|
118
|
+
|
|
119
|
+
// Add screen metrics for React Native
|
|
120
|
+
initialProps["initialViewWidth"] = currentBounds.width
|
|
121
|
+
initialProps["initialViewHeight"] = currentBounds.height
|
|
122
|
+
initialProps["pixelRatio"] = currentScale
|
|
123
|
+
initialProps["fontScale"] = UIFont.preferredFont(forTextStyle: .body).pointSize / 17.0
|
|
124
|
+
|
|
125
|
+
// Create root view using factory
|
|
126
|
+
let rootView = reactNativeFactory!.rootViewFactory.view(
|
|
127
|
+
withModuleName: "{{MODULE_NAME}}",
|
|
128
|
+
initialProperties: initialProps
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
rootView.backgroundColor = .clear
|
|
132
|
+
rootView.frame = view.bounds
|
|
133
|
+
rootView.autoresizingMask = [.flexibleWidth, .flexibleHeight]
|
|
134
|
+
|
|
135
|
+
// Explicitly enable user interaction
|
|
136
|
+
rootView.isUserInteractionEnabled = true
|
|
137
|
+
self.view.isUserInteractionEnabled = true
|
|
138
|
+
|
|
139
|
+
view.addSubview(rootView)
|
|
140
|
+
self.rootView = rootView
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private func cleanupAfterClose() {
|
|
144
|
+
if isCleanedUp { return }
|
|
145
|
+
isCleanedUp = true
|
|
146
|
+
|
|
147
|
+
NotificationCenter.default.removeObserver(self)
|
|
148
|
+
|
|
149
|
+
// Remove React Native view and deallocate resources
|
|
150
|
+
view.subviews.forEach { subview in
|
|
151
|
+
if subview is RCTRootView {
|
|
152
|
+
subview.removeFromSuperview()
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
reactNativeFactory = nil
|
|
157
|
+
reactNativeFactoryDelegate = nil
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// MARK: - Notification Handling
|
|
161
|
+
|
|
162
|
+
private func setupNotificationObservers() {
|
|
163
|
+
NotificationCenter.default.addObserver(
|
|
164
|
+
forName: NSNotification.Name("ExpoTargetsCloseExtension"),
|
|
165
|
+
object: nil,
|
|
166
|
+
queue: .main
|
|
167
|
+
) { [weak self] _ in
|
|
168
|
+
self?.closeExtension()
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
NotificationCenter.default.addObserver(
|
|
172
|
+
forName: NSNotification.Name("ExpoTargetsOpenHostApp"),
|
|
173
|
+
object: nil,
|
|
174
|
+
queue: .main
|
|
175
|
+
) { [weak self] notification in
|
|
176
|
+
if let userInfo = notification.userInfo,
|
|
177
|
+
let path = userInfo["path"] as? String {
|
|
178
|
+
self?.openHostApp(path: path)
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private func closeExtension() {
|
|
184
|
+
extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
|
|
185
|
+
cleanupAfterClose()
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private func openHostApp(path: String) {
|
|
189
|
+
guard let bundleIdentifier = Bundle.main.bundleIdentifier else { return }
|
|
190
|
+
// Remove common extension suffixes to get host app bundle ID
|
|
191
|
+
let extensionSuffixes = [".ShareExtension", ".share", ".action", ".clip"]
|
|
192
|
+
var appBundleId = bundleIdentifier
|
|
193
|
+
|
|
194
|
+
for suffix in extensionSuffixes {
|
|
195
|
+
appBundleId = appBundleId.replacingOccurrences(of: suffix, with: "")
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
guard let url = URL(string: "\(appBundleId)://\(path)") else { return }
|
|
199
|
+
|
|
200
|
+
// Use extensionContext.open() which is the proper way to open URLs in extensions
|
|
201
|
+
if let context = extensionContext {
|
|
202
|
+
context.open(url, completionHandler: { success in
|
|
203
|
+
if success {
|
|
204
|
+
// Close extension after opening host app
|
|
205
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
|
206
|
+
self?.closeExtension()
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
} else {
|
|
211
|
+
// Fallback: try responder chain (shouldn't normally be needed)
|
|
212
|
+
var responder: UIResponder? = self
|
|
213
|
+
while responder != nil {
|
|
214
|
+
if let application = responder as? UIApplication {
|
|
215
|
+
application.open(url, options: [:], completionHandler: nil)
|
|
216
|
+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
|
|
217
|
+
self?.closeExtension()
|
|
218
|
+
}
|
|
219
|
+
return
|
|
220
|
+
}
|
|
221
|
+
responder = responder?.next
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// MARK: - Error Handling
|
|
227
|
+
|
|
228
|
+
private func showError(_ message: String) {
|
|
229
|
+
let alert = UIAlertController(
|
|
230
|
+
title: "Error",
|
|
231
|
+
message: message,
|
|
232
|
+
preferredStyle: .alert
|
|
233
|
+
)
|
|
234
|
+
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in
|
|
235
|
+
self.extensionContext?.completeRequest(returningItems: nil)
|
|
236
|
+
})
|
|
237
|
+
present(alert, animated: true)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Action Extension Data Loading
|
|
2
|
+
|
|
3
|
+
private var actionText: String?
|
|
4
|
+
private var actionURL: String?
|
|
5
|
+
private var actionImages: [String] = []
|
|
6
|
+
private var actionFiles: [String] = []
|
|
7
|
+
|
|
8
|
+
private func loadActionContent() async {
|
|
9
|
+
guard let extensionItem = extensionContext?.inputItems.first as? NSExtensionItem,
|
|
10
|
+
let attachments = extensionItem.attachments else {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
await withTaskGroup(of: Void.self) { group in
|
|
15
|
+
for attachment in attachments {
|
|
16
|
+
// Load text
|
|
17
|
+
if attachment.hasItemConformingToTypeIdentifier("public.plain-text") {
|
|
18
|
+
group.addTask {
|
|
19
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.plain-text")
|
|
20
|
+
if let text = data as? String {
|
|
21
|
+
await MainActor.run {
|
|
22
|
+
self.actionText = text
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Load URL
|
|
29
|
+
if attachment.hasItemConformingToTypeIdentifier("public.url") {
|
|
30
|
+
group.addTask {
|
|
31
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.url")
|
|
32
|
+
if let url = data as? URL {
|
|
33
|
+
await MainActor.run {
|
|
34
|
+
self.actionURL = url.absoluteString
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Load images
|
|
41
|
+
if attachment.hasItemConformingToTypeIdentifier("public.image") {
|
|
42
|
+
group.addTask {
|
|
43
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.image")
|
|
44
|
+
if let url = data as? URL {
|
|
45
|
+
await MainActor.run {
|
|
46
|
+
self.actionImages.append(url.absoluteString)
|
|
47
|
+
}
|
|
48
|
+
} else if let image = data as? UIImage, let pngData = image.pngData() {
|
|
49
|
+
let tempURL = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".png")
|
|
50
|
+
try? pngData.write(to: tempURL)
|
|
51
|
+
await MainActor.run {
|
|
52
|
+
self.actionImages.append(tempURL.absoluteString)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Load files
|
|
59
|
+
if attachment.hasItemConformingToTypeIdentifier("public.file-url") {
|
|
60
|
+
group.addTask {
|
|
61
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.file-url")
|
|
62
|
+
if let url = data as? URL {
|
|
63
|
+
await MainActor.run {
|
|
64
|
+
self.actionFiles.append(url.absoluteString)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private func loadAttachmentItem(_ attachment: NSItemProvider, typeIdentifier: String) async -> NSSecureCoding? {
|
|
74
|
+
await withCheckedContinuation { continuation in
|
|
75
|
+
attachment.loadItem(forTypeIdentifier: typeIdentifier, options: nil) { data, error in
|
|
76
|
+
if error != nil {
|
|
77
|
+
continuation.resume(returning: nil)
|
|
78
|
+
} else {
|
|
79
|
+
continuation.resume(returning: data)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private func getActionDataProps() -> [String: Any] {
|
|
86
|
+
var data: [String: Any] = [:]
|
|
87
|
+
|
|
88
|
+
if let text = actionText {
|
|
89
|
+
data["text"] = text
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if let url = actionURL {
|
|
93
|
+
data["url"] = url
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if !actionImages.isEmpty {
|
|
97
|
+
data["images"] = actionImages
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if !actionFiles.isEmpty {
|
|
101
|
+
data["files"] = actionFiles
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return data
|
|
105
|
+
}
|
|
106
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// App Clip Data Loading
|
|
2
|
+
|
|
3
|
+
private var clipInvocationURL: String?
|
|
4
|
+
private var clipMetadata: [String: Any] = [:]
|
|
5
|
+
|
|
6
|
+
private func loadClipContent() {
|
|
7
|
+
// App Clips typically receive data via URL and scene activation
|
|
8
|
+
// This is populated from scene delegate / app launch
|
|
9
|
+
if let userActivity = extensionContext?.intent as? NSUserActivity,
|
|
10
|
+
let url = userActivity.webpageURL {
|
|
11
|
+
clipInvocationURL = url.absoluteString
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private func getClipDataProps() -> [String: Any] {
|
|
16
|
+
var data: [String: Any] = [:]
|
|
17
|
+
|
|
18
|
+
if let url = clipInvocationURL {
|
|
19
|
+
data["invocationURL"] = url
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if !clipMetadata.isEmpty {
|
|
23
|
+
data["metadata"] = clipMetadata
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return data
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Messages Extension Data Loading
|
|
2
|
+
// Note: This is embedded in ReactNativeViewController, but for messages extensions,
|
|
3
|
+
// the MessagesViewController (MSMessagesAppViewController) is the parent and passes
|
|
4
|
+
// data down. This code provides default values.
|
|
5
|
+
|
|
6
|
+
private var presentationStyle: String = "compact"
|
|
7
|
+
private var conversationId: String?
|
|
8
|
+
private var remoteParticipantIds: [String] = []
|
|
9
|
+
private var hasSelectedMessage: Bool = false
|
|
10
|
+
private var selectedMessageData: [String: Any]?
|
|
11
|
+
|
|
12
|
+
private func loadMessagesContent() {
|
|
13
|
+
// For messages extensions, the parent MessagesViewController handles
|
|
14
|
+
// the MSMessagesAppViewController and passes data as initialProps.
|
|
15
|
+
// This method is a no-op to maintain compatibility with the template structure.
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
private func getMessagesDataProps() -> [String: Any] {
|
|
19
|
+
// Return default data - the actual data comes from parent MessagesViewController
|
|
20
|
+
// via initialProps in viewDidLoad
|
|
21
|
+
var data: [String: Any] = [:]
|
|
22
|
+
data["presentationStyle"] = presentationStyle
|
|
23
|
+
data["participantCount"] = 1
|
|
24
|
+
data["remoteParticipantIds"] = remoteParticipantIds
|
|
25
|
+
data["hasSelectedMessage"] = false
|
|
26
|
+
return data
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Share Extension Data Loading
|
|
2
|
+
|
|
3
|
+
private var sharedText: String?
|
|
4
|
+
private var sharedURL: String?
|
|
5
|
+
private var sharedImages: [String] = []
|
|
6
|
+
private var sharedFiles: [String] = []
|
|
7
|
+
private var preprocessedWebData: [String: Any]?
|
|
8
|
+
|
|
9
|
+
private func loadSharedContent() async {
|
|
10
|
+
guard let extensionItem = extensionContext?.inputItems.first as? NSExtensionItem,
|
|
11
|
+
let attachments = extensionItem.attachments else {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
await withTaskGroup(of: Void.self) { group in
|
|
16
|
+
for attachment in attachments {
|
|
17
|
+
// Load text
|
|
18
|
+
if attachment.hasItemConformingToTypeIdentifier("public.plain-text") {
|
|
19
|
+
group.addTask {
|
|
20
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.plain-text")
|
|
21
|
+
if let text = data as? String {
|
|
22
|
+
await MainActor.run {
|
|
23
|
+
self.sharedText = text
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Load URL
|
|
30
|
+
if attachment.hasItemConformingToTypeIdentifier("public.url") {
|
|
31
|
+
group.addTask {
|
|
32
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.url")
|
|
33
|
+
if let url = data as? URL {
|
|
34
|
+
await MainActor.run {
|
|
35
|
+
self.sharedURL = url.absoluteString
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Load images
|
|
42
|
+
if attachment.hasItemConformingToTypeIdentifier("public.image") {
|
|
43
|
+
group.addTask {
|
|
44
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.image")
|
|
45
|
+
if let url = data as? URL {
|
|
46
|
+
await MainActor.run {
|
|
47
|
+
self.sharedImages.append(url.absoluteString)
|
|
48
|
+
}
|
|
49
|
+
} else if let image = data as? UIImage, let pngData = image.pngData() {
|
|
50
|
+
let tempURL = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString + ".png")
|
|
51
|
+
try? pngData.write(to: tempURL)
|
|
52
|
+
await MainActor.run {
|
|
53
|
+
self.sharedImages.append(tempURL.absoluteString)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Load files
|
|
60
|
+
if attachment.hasItemConformingToTypeIdentifier("public.file-url") {
|
|
61
|
+
group.addTask {
|
|
62
|
+
let data = await self.loadAttachmentItem(attachment, typeIdentifier: "public.file-url")
|
|
63
|
+
if let url = data as? URL {
|
|
64
|
+
await MainActor.run {
|
|
65
|
+
self.sharedFiles.append(url.absoluteString)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
{{PREPROCESSING_DATA_LOAD}}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
private func loadAttachmentItem(_ attachment: NSItemProvider, typeIdentifier: String) async -> NSSecureCoding? {
|
|
77
|
+
await withCheckedContinuation { continuation in
|
|
78
|
+
attachment.loadItem(forTypeIdentifier: typeIdentifier, options: nil) { data, error in
|
|
79
|
+
if error != nil {
|
|
80
|
+
continuation.resume(returning: nil)
|
|
81
|
+
} else {
|
|
82
|
+
continuation.resume(returning: data)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private func getSharedDataProps() -> [String: Any] {
|
|
89
|
+
var data: [String: Any] = [:]
|
|
90
|
+
|
|
91
|
+
if let text = sharedText {
|
|
92
|
+
data["text"] = text
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if let url = sharedURL {
|
|
96
|
+
data["url"] = url
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if !sharedImages.isEmpty {
|
|
100
|
+
data["images"] = sharedImages
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if !sharedFiles.isEmpty {
|
|
104
|
+
data["files"] = sharedFiles
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if let preprocessedData = preprocessedWebData {
|
|
108
|
+
data["preprocessedWebData"] = preprocessedData
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return data
|
|
112
|
+
}
|
|
113
|
+
|