@legendapp/spark 0.0.2 → 0.0.3
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/package.json +2 -2
- package/patches/dependencies.json +252 -0
- package/patches/expo-application@55.0.19.patch +54 -0
- package/patches/expo-blur@55.0.18.patch +130 -0
- package/patches/expo-device@55.0.21.patch +149 -0
- package/patches/expo-font@55.0.8.patch +55 -0
- package/patches/expo-glass-effect@55.0.11.patch +304 -0
- package/patches/expo-haptics@55.0.18.patch +54 -0
- package/patches/expo-image-manipulator@55.0.21.patch +312 -0
- package/patches/expo-image-picker@55.0.24.patch +327 -0
- package/patches/expo-image@55.0.11.patch +158 -0
- package/patches/expo-keep-awake@55.0.8.patch +41 -0
- package/patches/expo-localization@55.0.19.patch +32 -0
- package/patches/expo-location@55.1.15.patch +190 -0
- package/patches/expo-symbols@55.0.9.patch +286 -0
- package/patches/expo-system-ui@55.0.22.patch +61 -0
- package/patches/expo-web-browser@55.0.20.patch +13 -0
- package/patches/react-native-app-logs@0.3.1.patch +20 -0
- package/patches/react-native-blurhash@2.1.3.patch +318 -0
- package/patches/react-native-community-blur@4.4.1.patch +415 -0
- package/patches/react-native-community-datetimepicker@9.2.2.patch +320 -0
- package/patches/react-native-fast-image@10.9.9.patch +131 -0
- package/patches/react-native-graph@1.4.0.patch +157 -0
- package/patches/react-native-keyboard-controller@1.22.9.patch +16 -0
- package/patches/react-native-masked-view-masked-view@0.3.2.patch +140 -0
- package/patches/react-native-mmkv@4.3.2.patch +40 -0
- package/patches/react-native-nitro-fetch@1.9.0.patch +130 -0
- package/patches/react-native-nitro-zxing@0.3.0.patch +13 -0
- package/patches/react-native-quick-base64@3.0.1.patch +13 -0
- package/patches/react-native-quick-crypto@1.1.9.patch +31 -0
- package/patches/react-native-release-profiler@0.4.5.patch +37 -0
- package/patches/react-native-screen-corner-radius@0.2.3.patch +13 -0
- package/patches/react-native-screens@4.23.0.patch +160 -0
- package/patches/react-native-svg@15.15.3.patch +31 -0
- package/patches/react-native-unistyles@3.6.0.patch +203 -0
- package/patches/react-native-worklets-core@1.6.3.patch +13 -0
- package/patches/react-navigation-native-stack@7.21.0.patch +16 -0
- package/patches/sentry-react-native@8.32.0.patch +76 -0
- package/skills/spark/UPGRADING.md +34 -0
- package/vendor/node_modules/@legendapp/spark-ai/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-audio/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-auth-session/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/build.js +6 -3
- package/vendor/node_modules/@legendapp/spark-cli/dist/dev.js +7 -2
- package/vendor/node_modules/@legendapp/spark-cli/dist/migrations.cjs +3 -0
- package/vendor/node_modules/@legendapp/spark-cli/dist/project.js +13 -1
- package/vendor/node_modules/@legendapp/spark-cli/dist/release.json +11 -11
- package/vendor/node_modules/@legendapp/spark-cli/dist/runtime-input-cache.js +140 -0
- package/vendor/node_modules/@legendapp/spark-cli/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-cli/templates/blank-typescript/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/universal/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-cli/templates/windows/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-clipboard/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-codex/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-commands/package.json +5 -5
- package/vendor/node_modules/@legendapp/spark-context-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/macos/SparkTestDriver.mm +64 -2
- package/vendor/node_modules/@legendapp/spark-desktop-app/package.json +1 -1
- package/vendor/node_modules/@legendapp/spark-desktop-config/autolinking.cjs +3 -2
- package/vendor/node_modules/@legendapp/spark-desktop-config/native-patches.cjs +28 -10
- package/vendor/node_modules/@legendapp/spark-desktop-config/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-desktop-host/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-links/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-desktop-windows/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-documents/package.json +7 -7
- package/vendor/node_modules/@legendapp/spark-drag-drop/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-file-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-global-shortcuts/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-html/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-markdown/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-message-dialog/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-native-menu/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-notifications/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-processes/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-rich-text/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-secure-storage/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-settings/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-settings-ui/package.json +4 -4
- package/vendor/node_modules/@legendapp/spark-sqlite/package.json +3 -3
- package/vendor/node_modules/@legendapp/spark-system/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-tray/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-ui/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-updates/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-webview/package.json +2 -2
- package/vendor/node_modules/@legendapp/spark-window-options/package.json +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
diff --git a/ios/ExpoImagePicker.podspec b/ios/ExpoImagePicker.podspec
|
|
2
|
+
index c9bac13..348e96e 100644
|
|
3
|
+
--- a/ios/ExpoImagePicker.podspec
|
|
4
|
+
+++ b/ios/ExpoImagePicker.podspec
|
|
5
|
+
@@ -11,7 +11,8 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.author = package['author']
|
|
7
|
+
s.homepage = package['homepage']
|
|
8
|
+
s.platforms = {
|
|
9
|
+
- :ios => '15.1'
|
|
10
|
+
+ :ios => '15.1',
|
|
11
|
+
+ :osx => '14.0'
|
|
12
|
+
}
|
|
13
|
+
s.swift_version = '5.9'
|
|
14
|
+
s.source = { git: 'https://github.com/expo/expo.git' }
|
|
15
|
+
diff --git a/ios/ImagePickerExceptions.swift b/ios/ImagePickerExceptions.swift
|
|
16
|
+
index a0810e5..cb6e87c 100644
|
|
17
|
+
--- a/ios/ImagePickerExceptions.swift
|
|
18
|
+
+++ b/ios/ImagePickerExceptions.swift
|
|
19
|
+
@@ -1,3 +1,4 @@
|
|
20
|
+
+#if !os(macOS)
|
|
21
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
22
|
+
|
|
23
|
+
import ExpoModulesCore
|
|
24
|
+
@@ -139,3 +140,4 @@ internal final class FailedToPickLivePhotoException: Exception {
|
|
25
|
+
"Failed to read the selected item as a live photo"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
+#endif
|
|
29
|
+
diff --git a/ios/ImagePickerHandler.swift b/ios/ImagePickerHandler.swift
|
|
30
|
+
index 476910d..4e1dd8d 100644
|
|
31
|
+
--- a/ios/ImagePickerHandler.swift
|
|
32
|
+
+++ b/ios/ImagePickerHandler.swift
|
|
33
|
+
@@ -1,3 +1,4 @@
|
|
34
|
+
+#if !os(macOS)
|
|
35
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
36
|
+
|
|
37
|
+
import PhotosUI
|
|
38
|
+
@@ -106,3 +107,4 @@ extension PHPickerViewController: PickerUIController {
|
|
39
|
+
self.presentationController?.delegate = handler
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
+#endif
|
|
43
|
+
diff --git a/ios/ImagePickerModule.swift b/ios/ImagePickerModule.swift
|
|
44
|
+
index 4b7bf34..f990a2f 100644
|
|
45
|
+
--- a/ios/ImagePickerModule.swift
|
|
46
|
+
+++ b/ios/ImagePickerModule.swift
|
|
47
|
+
@@ -1,3 +1,4 @@
|
|
48
|
+
+#if !os(macOS)
|
|
49
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
50
|
+
|
|
51
|
+
import UIKit
|
|
52
|
+
@@ -249,3 +250,4 @@ public class ImagePickerModule: Module, OnMediaPickingResultHandler {
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
+#endif
|
|
57
|
+
diff --git a/ios/ImagePickerModuleMacOS.swift b/ios/ImagePickerModuleMacOS.swift
|
|
58
|
+
new file mode 100644
|
|
59
|
+
index 0000000..02df7a3
|
|
60
|
+
--- /dev/null
|
|
61
|
+
+++ b/ios/ImagePickerModuleMacOS.swift
|
|
62
|
+
@@ -0,0 +1,111 @@
|
|
63
|
+
+// Copyright 2022-present 650 Industries. All rights reserved.
|
|
64
|
+
+
|
|
65
|
+
+#if os(macOS)
|
|
66
|
+
+import AppKit
|
|
67
|
+
+import AVFoundation
|
|
68
|
+
+import ExpoModulesCore
|
|
69
|
+
+import UniformTypeIdentifiers
|
|
70
|
+
+
|
|
71
|
+
+// macOS has no photo library or camera picker UI. The library opens an NSOpenPanel on image and
|
|
72
|
+
+// movie files; launchCameraAsync is not defined, so the JavaScript layer reports it unavailable.
|
|
73
|
+
+internal struct MacImagePickerOptions: Record {
|
|
74
|
+
+ @Field var mediaTypes: [String] = ["images"]
|
|
75
|
+
+ @Field var allowsMultipleSelection: Bool = false
|
|
76
|
+
+ @Field var selectionLimit: Int = 0
|
|
77
|
+
+ @Field var base64: Bool = false
|
|
78
|
+
+}
|
|
79
|
+
+
|
|
80
|
+
+public class ImagePickerModule: Module {
|
|
81
|
+
+ public func definition() -> ModuleDefinition {
|
|
82
|
+
+ Name("ExponentImagePicker")
|
|
83
|
+
+
|
|
84
|
+
+ AsyncFunction("getCameraPermissionsAsync") { () -> [String: Any] in
|
|
85
|
+
+ Self.cameraPermission(AVCaptureDevice.authorizationStatus(for: .video))
|
|
86
|
+
+ }
|
|
87
|
+
+
|
|
88
|
+
+ AsyncFunction("requestCameraPermissionsAsync") { (promise: Promise) in
|
|
89
|
+
+ AVCaptureDevice.requestAccess(for: .video) { _ in
|
|
90
|
+
+ promise.resolve(Self.cameraPermission(AVCaptureDevice.authorizationStatus(for: .video)))
|
|
91
|
+
+ }
|
|
92
|
+
+ }
|
|
93
|
+
+
|
|
94
|
+
+ // Files the user picks in the open panel need no library permission.
|
|
95
|
+
+ AsyncFunction("getMediaLibraryPermissionsAsync") { (_: Bool) -> [String: Any] in
|
|
96
|
+
+ Self.permission("granted", canAskAgain: true, extra: ["accessPrivileges": "all"])
|
|
97
|
+
+ }
|
|
98
|
+
+
|
|
99
|
+
+ AsyncFunction("requestMediaLibraryPermissionsAsync") { (_: Bool) -> [String: Any] in
|
|
100
|
+
+ Self.permission("granted", canAskAgain: true, extra: ["accessPrivileges": "all"])
|
|
101
|
+
+ }
|
|
102
|
+
+
|
|
103
|
+
+ AsyncFunction("launchImageLibraryAsync") { (options: MacImagePickerOptions, promise: Promise) in
|
|
104
|
+
+ let panel = NSOpenPanel()
|
|
105
|
+
+ panel.canChooseDirectories = false
|
|
106
|
+
+ panel.allowsMultipleSelection = options.allowsMultipleSelection
|
|
107
|
+
+ panel.allowedContentTypes = options.mediaTypes.compactMap { type in
|
|
108
|
+
+ switch type {
|
|
109
|
+
+ case "images", "livePhotos": return UTType.image
|
|
110
|
+
+ case "videos": return UTType.movie
|
|
111
|
+
+ default: return nil
|
|
112
|
+
+ }
|
|
113
|
+
+ }
|
|
114
|
+
+ let finish = { (response: NSApplication.ModalResponse) in
|
|
115
|
+
+ guard response == .OK else {
|
|
116
|
+
+ return promise.resolve(["canceled": true, "assets": NSNull()])
|
|
117
|
+
+ }
|
|
118
|
+
+ let urls = options.selectionLimit > 0 ? Array(panel.urls.prefix(options.selectionLimit)) : panel.urls
|
|
119
|
+
+ promise.resolve(["canceled": false, "assets": urls.map { Self.asset($0, base64: options.base64) }])
|
|
120
|
+
+ }
|
|
121
|
+
+ if let window = NSApp.keyWindow ?? NSApp.mainWindow {
|
|
122
|
+
+ panel.beginSheetModal(for: window, completionHandler: finish)
|
|
123
|
+
+ } else {
|
|
124
|
+
+ panel.begin(completionHandler: finish)
|
|
125
|
+
+ }
|
|
126
|
+
+ }
|
|
127
|
+
+ .runOnQueue(.main)
|
|
128
|
+
+ }
|
|
129
|
+
+
|
|
130
|
+
+ private static func asset(_ url: URL, base64: Bool) -> [String: Any] {
|
|
131
|
+
+ let type = UTType(filenameExtension: url.pathExtension)
|
|
132
|
+
+ let isVideo = type?.conforms(to: .movie) ?? false
|
|
133
|
+
+ var asset: [String: Any] = [
|
|
134
|
+
+ "assetId": NSNull(),
|
|
135
|
+
+ "type": isVideo ? "video" : "image",
|
|
136
|
+
+ "uri": url.absoluteString,
|
|
137
|
+
+ "fileName": url.lastPathComponent,
|
|
138
|
+
+ "fileSize": (try? url.resourceValues(forKeys: [.fileSizeKey]).fileSize) ?? NSNull(),
|
|
139
|
+
+ "mimeType": type?.preferredMIMEType ?? NSNull(),
|
|
140
|
+
+ "exif": NSNull(),
|
|
141
|
+
+ "base64": NSNull(),
|
|
142
|
+
+ "width": 0,
|
|
143
|
+
+ "height": 0
|
|
144
|
+
+ ]
|
|
145
|
+
+ if isVideo {
|
|
146
|
+
+ let track = AVURLAsset(url: url).tracks(withMediaType: .video).first
|
|
147
|
+
+ let size = track.map { $0.naturalSize.applying($0.preferredTransform) } ?? .zero
|
|
148
|
+
+ asset["width"] = abs(size.width)
|
|
149
|
+
+ asset["height"] = abs(size.height)
|
|
150
|
+
+ asset["duration"] = AVURLAsset(url: url).duration.seconds * 1000
|
|
151
|
+
+ } else if let rep = NSImageRep(contentsOf: url) {
|
|
152
|
+
+ asset["width"] = rep.pixelsWide
|
|
153
|
+
+ asset["height"] = rep.pixelsHigh
|
|
154
|
+
+ if base64, let data = try? Data(contentsOf: url) {
|
|
155
|
+
+ asset["base64"] = data.base64EncodedString()
|
|
156
|
+
+ }
|
|
157
|
+
+ }
|
|
158
|
+
+ return asset
|
|
159
|
+
+ }
|
|
160
|
+
+
|
|
161
|
+
+ private static func cameraPermission(_ status: AVAuthorizationStatus) -> [String: Any] {
|
|
162
|
+
+ switch status {
|
|
163
|
+
+ case .authorized: return permission("granted", canAskAgain: true)
|
|
164
|
+
+ case .notDetermined: return permission("undetermined", canAskAgain: true)
|
|
165
|
+
+ default: return permission("denied", canAskAgain: false)
|
|
166
|
+
+ }
|
|
167
|
+
+ }
|
|
168
|
+
+
|
|
169
|
+
+ private static func permission(_ status: String, canAskAgain: Bool, extra: [String: Any] = [:]) -> [String: Any] {
|
|
170
|
+
+ ["status": status, "granted": status == "granted", "canAskAgain": canAskAgain, "expires": "never"].merging(extra) { _, new in new }
|
|
171
|
+
+ }
|
|
172
|
+
+}
|
|
173
|
+
+#endif
|
|
174
|
+
diff --git a/ios/ImagePickerOptions.swift b/ios/ImagePickerOptions.swift
|
|
175
|
+
index bdaf98f..e945b97 100644
|
|
176
|
+
--- a/ios/ImagePickerOptions.swift
|
|
177
|
+
+++ b/ios/ImagePickerOptions.swift
|
|
178
|
+
@@ -1,3 +1,4 @@
|
|
179
|
+
+#if !os(macOS)
|
|
180
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
181
|
+
|
|
182
|
+
import ExpoModulesCore
|
|
183
|
+
@@ -257,3 +258,4 @@ internal enum CameraType: String, Enumerable {
|
|
184
|
+
case back
|
|
185
|
+
case front
|
|
186
|
+
}
|
|
187
|
+
+#endif
|
|
188
|
+
diff --git a/ios/ImagePickerPermissionRequesters.swift b/ios/ImagePickerPermissionRequesters.swift
|
|
189
|
+
index ad92115..2679aaf 100644
|
|
190
|
+
--- a/ios/ImagePickerPermissionRequesters.swift
|
|
191
|
+
+++ b/ios/ImagePickerPermissionRequesters.swift
|
|
192
|
+
@@ -1,3 +1,4 @@
|
|
193
|
+
+#if !os(macOS)
|
|
194
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
195
|
+
|
|
196
|
+
import Photos
|
|
197
|
+
@@ -122,3 +123,4 @@ extension DefaultMediaLibraryPermissionRequester {
|
|
198
|
+
return PHAccessLevel.readWrite
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
+#endif
|
|
202
|
+
diff --git a/ios/ImagePickerResponse.swift b/ios/ImagePickerResponse.swift
|
|
203
|
+
index 21b9bb1..3e693bf 100644
|
|
204
|
+
--- a/ios/ImagePickerResponse.swift
|
|
205
|
+
+++ b/ios/ImagePickerResponse.swift
|
|
206
|
+
@@ -1,3 +1,4 @@
|
|
207
|
+
+#if !os(macOS)
|
|
208
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
209
|
+
|
|
210
|
+
// swiftlint:disable redundant_optional_initialization
|
|
211
|
+
@@ -41,3 +42,4 @@ internal struct AssetInfo: Record {
|
|
212
|
+
@Field var duration: Double? = nil
|
|
213
|
+
@Field var pairedVideoAsset: AssetInfo? = nil
|
|
214
|
+
}
|
|
215
|
+
+#endif
|
|
216
|
+
diff --git a/ios/ImagePickerUtils.swift b/ios/ImagePickerUtils.swift
|
|
217
|
+
index cfd0bcb..eb76f4c 100644
|
|
218
|
+
--- a/ios/ImagePickerUtils.swift
|
|
219
|
+
+++ b/ios/ImagePickerUtils.swift
|
|
220
|
+
@@ -1,3 +1,4 @@
|
|
221
|
+
+#if !os(macOS)
|
|
222
|
+
// Copyright 2024-present 650 Industries. All rights reserved.
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
@@ -14,3 +15,4 @@ func asyncMap<ItemsType: Sequence, ResultType>(
|
|
226
|
+
}
|
|
227
|
+
return values
|
|
228
|
+
}
|
|
229
|
+
+#endif
|
|
230
|
+
diff --git a/ios/ImageUtils.swift b/ios/ImageUtils.swift
|
|
231
|
+
index d9d1cd4..f09532f 100644
|
|
232
|
+
--- a/ios/ImageUtils.swift
|
|
233
|
+
+++ b/ios/ImageUtils.swift
|
|
234
|
+
@@ -1,3 +1,4 @@
|
|
235
|
+
+#if !os(macOS)
|
|
236
|
+
// Copyright 2024-present 650 Industries. All rights reserved.
|
|
237
|
+
|
|
238
|
+
import CoreGraphics
|
|
239
|
+
@@ -390,3 +391,4 @@ internal struct ImageUtils {
|
|
240
|
+
return CGSize(width: width, height: height)
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
+#endif
|
|
244
|
+
diff --git a/ios/MediaHandler.swift b/ios/MediaHandler.swift
|
|
245
|
+
index a0e3a44..e11aec4 100644
|
|
246
|
+
--- a/ios/MediaHandler.swift
|
|
247
|
+
+++ b/ios/MediaHandler.swift
|
|
248
|
+
@@ -1,3 +1,4 @@
|
|
249
|
+
+#if !os(macOS)
|
|
250
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
251
|
+
|
|
252
|
+
import ExpoModulesCore
|
|
253
|
+
@@ -564,3 +565,4 @@ extension PHAssetResourceManager {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
+#endif
|
|
258
|
+
diff --git a/ios/NSItemProvider+Async.swift b/ios/NSItemProvider+Async.swift
|
|
259
|
+
index 08cdf4c..83b2542 100644
|
|
260
|
+
--- a/ios/NSItemProvider+Async.swift
|
|
261
|
+
+++ b/ios/NSItemProvider+Async.swift
|
|
262
|
+
@@ -1,3 +1,4 @@
|
|
263
|
+
+#if !os(macOS)
|
|
264
|
+
import Foundation
|
|
265
|
+
import Photos
|
|
266
|
+
|
|
267
|
+
@@ -30,3 +31,4 @@ internal extension NSItemProvider {
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
+#endif
|
|
272
|
+
diff --git a/ios/StatusBarVisibilityController.swift b/ios/StatusBarVisibilityController.swift
|
|
273
|
+
index 907af58..61cce12 100644
|
|
274
|
+
--- a/ios/StatusBarVisibilityController.swift
|
|
275
|
+
+++ b/ios/StatusBarVisibilityController.swift
|
|
276
|
+
@@ -1,3 +1,4 @@
|
|
277
|
+
+#if !os(macOS)
|
|
278
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
@@ -50,3 +51,4 @@ internal class StatusBarVisibilityController {
|
|
282
|
+
// prints "Hello Fabio!"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
+#endif
|
|
286
|
+
diff --git a/ios/UIImage+fixOrientation.swift b/ios/UIImage+fixOrientation.swift
|
|
287
|
+
index 22849c2..d005706 100644
|
|
288
|
+
--- a/ios/UIImage+fixOrientation.swift
|
|
289
|
+
+++ b/ios/UIImage+fixOrientation.swift
|
|
290
|
+
@@ -1,3 +1,4 @@
|
|
291
|
+
+#if !os(macOS)
|
|
292
|
+
// Copyright 2022-present 650 Industries. All rights reserved.
|
|
293
|
+
|
|
294
|
+
import UIKit
|
|
295
|
+
@@ -78,3 +79,4 @@ extension UIImage {
|
|
296
|
+
return UIImage(cgImage: resultCgImage)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
+#endif
|
|
300
|
+
diff --git a/ios/UIImagePickerControllerExtentsion.swift b/ios/UIImagePickerControllerExtentsion.swift
|
|
301
|
+
index 865a59d..9b3ee35 100644
|
|
302
|
+
--- a/ios/UIImagePickerControllerExtentsion.swift
|
|
303
|
+
+++ b/ios/UIImagePickerControllerExtentsion.swift
|
|
304
|
+
@@ -1,3 +1,4 @@
|
|
305
|
+
+#if !os(macOS)
|
|
306
|
+
// Copyright 2016-present 650 Industries. All rights reserved.
|
|
307
|
+
|
|
308
|
+
extension UIImagePickerController {
|
|
309
|
+
@@ -55,3 +56,4 @@ extension UIImagePickerController {
|
|
310
|
+
return nil
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
+#endif
|
|
314
|
+
diff --git a/ios/VideoUtils.swift b/ios/VideoUtils.swift
|
|
315
|
+
index f78c50d..2b88d16 100644
|
|
316
|
+
--- a/ios/VideoUtils.swift
|
|
317
|
+
+++ b/ios/VideoUtils.swift
|
|
318
|
+
@@ -1,3 +1,4 @@
|
|
319
|
+
+#if !os(macOS)
|
|
320
|
+
// Copyright 2024-present 650 Industries. All rights reserved.
|
|
321
|
+
|
|
322
|
+
import AVFoundation
|
|
323
|
+
@@ -97,3 +98,4 @@ internal struct VideoUtils {
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
+#endif
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
diff --git a/src/ExpoImage.macos.tsx b/src/ExpoImage.macos.tsx
|
|
2
|
+
new file mode 100644
|
|
3
|
+
index 0000000..cd859ac
|
|
4
|
+
--- /dev/null
|
|
5
|
+
+++ b/src/ExpoImage.macos.tsx
|
|
6
|
+
@@ -0,0 +1,128 @@
|
|
7
|
+
+// expo-image on macOS: React Native's Image stands in for the native view, which is UIKit
|
|
8
|
+
+// only. Sources (uri, headers, require(); the largest of several sizes), placeholders while
|
|
9
|
+
+// loading, contentFit, tintColor, the load events and reloadAsync work. Its SDWebImage
|
|
10
|
+
+// caches, blurhash/thumbhash and SF Symbol sources, contentPosition, transitions and
|
|
11
|
+
+// ImageRef sources are not supported; such a source reports onError.
|
|
12
|
+
+import React from 'react';
|
|
13
|
+
+import { Image, StyleSheet, View, type ImageProps, type ImageResizeMode } from 'react-native';
|
|
14
|
+
+
|
|
15
|
+
+import type { ImageContentFit, ImageNativeProps, ImageSource } from './Image.types';
|
|
16
|
+
+
|
|
17
|
+
+const fits: Record<ImageContentFit, ImageResizeMode> = {
|
|
18
|
+
+ cover: 'cover',
|
|
19
|
+
+ contain: 'contain',
|
|
20
|
+
+ fill: 'stretch',
|
|
21
|
+
+ none: 'center',
|
|
22
|
+
+ 'scale-down': 'center',
|
|
23
|
+
+};
|
|
24
|
+
+
|
|
25
|
+
+function largest(sources: ImageNativeProps['source']): ImageSource | undefined {
|
|
26
|
+
+ if (!Array.isArray(sources)) return undefined;
|
|
27
|
+
+ const area = (source: ImageSource) => (source.width ?? 0) * (source.height ?? 0);
|
|
28
|
+
+ const drawable = sources.filter(source => source.uri && !/^(blurhash|thumbhash|sf):\//.test(source.uri));
|
|
29
|
+
+ return drawable.reduce<ImageSource | undefined>((best, next) => (best && area(best) >= area(next) ? best : next), undefined);
|
|
30
|
+
+}
|
|
31
|
+
+
|
|
32
|
+
+// RN Image copies source dimensions into its layout; let contentFit control the size.
|
|
33
|
+
+function ImageWithFit({ source, contentFit, style, ...props }: Omit<ImageProps, 'source'> & {
|
|
34
|
+
+ source: ImageSource & { scale?: number }; contentFit: ImageContentFit;
|
|
35
|
+
+}) {
|
|
36
|
+
+ const { uri, headers, scale = 1 } = source;
|
|
37
|
+
+ const [size, setSize] = React.useState<{ uri: string; width: number; height: number }>();
|
|
38
|
+
+ React.useEffect(() => {
|
|
39
|
+
+ if (contentFit !== 'none' || !uri) return;
|
|
40
|
+
+ let active = true;
|
|
41
|
+
+ Image.getSizeWithHeaders(uri, headers ?? {}).then(({ width, height }) => {
|
|
42
|
+
+ if (active) setSize({ uri, width, height });
|
|
43
|
+
+ }, () => {}); // The Image's onError reports load failures.
|
|
44
|
+
+ return () => { active = false; };
|
|
45
|
+
+ }, [uri, headers, contentFit]);
|
|
46
|
+
+ const width = size && size.uri === uri ? size.width / scale : (source.width ?? 0);
|
|
47
|
+
+ const height = size && size.uri === uri ? size.height / scale : (source.height ?? 0);
|
|
48
|
+
+ return <Image {...props} source={{ uri, headers, scale }} resizeMode={fits[contentFit]} style={[
|
|
49
|
+
+ StyleSheet.absoluteFill, style,
|
|
50
|
+
+ contentFit === 'none' && {
|
|
51
|
+
+ width, height, left: '50%', top: '50%', right: undefined, bottom: undefined,
|
|
52
|
+
+ transform: [{ translateX: -width / 2 }, { translateY: -height / 2 }],
|
|
53
|
+
+ },
|
|
54
|
+
+ ]} />;
|
|
55
|
+
+}
|
|
56
|
+
+
|
|
57
|
+
+class ExpoImage extends React.PureComponent<ImageNativeProps, { attempt: number; loaded: boolean }> {
|
|
58
|
+
+ state = { attempt: 0, loaded: false };
|
|
59
|
+
+
|
|
60
|
+
+ startAnimating = () => {};
|
|
61
|
+
+ stopAnimating = () => {};
|
|
62
|
+
+ lockResourceAsync = async () => {};
|
|
63
|
+
+ unlockResourceAsync = async () => {};
|
|
64
|
+
+ reloadAsync = async () => this.setState(({ attempt }) => ({ attempt: attempt + 1, loaded: false }));
|
|
65
|
+
+
|
|
66
|
+
+ unsupported?: string;
|
|
67
|
+
+
|
|
68
|
+
+ componentDidMount() {
|
|
69
|
+
+ // Image calls startAnimating and reloadAsync through this ref, which holds the native view on iOS.
|
|
70
|
+
+ const ref = this.props.nativeViewRef as React.MutableRefObject<unknown> | undefined;
|
|
71
|
+
+ if (ref) ref.current = this;
|
|
72
|
+
+ this.reportUnsupported();
|
|
73
|
+
+ }
|
|
74
|
+
+
|
|
75
|
+
+ componentDidUpdate() {
|
|
76
|
+
+ this.reportUnsupported();
|
|
77
|
+
+ }
|
|
78
|
+
+
|
|
79
|
+
+ // A source with nothing to draw still settles, once per source, so load and error handlers run.
|
|
80
|
+
+ reportUnsupported() {
|
|
81
|
+
+ const { source } = this.props;
|
|
82
|
+
+ const key = largest(source) || source == null || (Array.isArray(source) && !source.length) ? undefined : JSON.stringify(source);
|
|
83
|
+
+ if (key === this.unsupported) return;
|
|
84
|
+
+ this.unsupported = key;
|
|
85
|
+
+ if (key === undefined) return;
|
|
86
|
+
+ this.props.onLoadStart?.();
|
|
87
|
+
+ this.props.onError?.({ error: 'expo-image cannot draw blurhash, thumbhash, SF Symbol or ImageRef sources on macOS' });
|
|
88
|
+
+ this.props.onLoadEnd?.();
|
|
89
|
+
+ }
|
|
90
|
+
+
|
|
91
|
+
+ render() {
|
|
92
|
+
+ const { source, placeholder, contentFit = 'cover', placeholderContentFit = 'scale-down', tintColor, style, accessibilityLabel, alt,
|
|
93
|
+
+ onLoadStart, onProgress, onLoad, onError, onLoadEnd, onDisplay, containerViewRef, nativeViewRef, ...props } = this.props;
|
|
94
|
+
+ const image = largest(source);
|
|
95
|
+
+ const fallback = largest(placeholder);
|
|
96
|
+
+ const tint = tintColor == null ? null : { tintColor: tintColor as string };
|
|
97
|
+
+ return (
|
|
98
|
+
+ <View ref={containerViewRef as never} {...(props as object)} accessibilityLabel={accessibilityLabel ?? alt} style={[styles.container, style]}>
|
|
99
|
+
+ {!this.state.loaded && fallback && (
|
|
100
|
+
+ <ImageWithFit source={fallback} contentFit={placeholderContentFit} style={tint} />
|
|
101
|
+
+ )}
|
|
102
|
+
+ {image && (
|
|
103
|
+
+ <ImageWithFit
|
|
104
|
+
+ key={this.state.attempt}
|
|
105
|
+
+ source={image}
|
|
106
|
+
+ contentFit={contentFit}
|
|
107
|
+
+ style={tint}
|
|
108
|
+
+ onLoadStart={() => onLoadStart?.()}
|
|
109
|
+
+ onProgress={event => onProgress?.({ loaded: event.nativeEvent.loaded, total: event.nativeEvent.total })}
|
|
110
|
+
+ onLoad={event => {
|
|
111
|
+
+ const loaded = (width: number, height: number) => {
|
|
112
|
+
+ this.setState({ loaded: true });
|
|
113
|
+
+ onLoad?.({ cacheType: 'none', source: { url: image.uri!, width, height, mediaType: null } });
|
|
114
|
+
+ onLoadEnd?.();
|
|
115
|
+
+ onDisplay?.();
|
|
116
|
+
+ };
|
|
117
|
+
+ // React Native macOS scales a 1x image's size by the screen's; getSize reads its pixels.
|
|
118
|
+
+ const { width, height } = event.nativeEvent.source;
|
|
119
|
+
+ Image.getSize(image.uri!).then(size => loaded(size.width, size.height), () => loaded(width, height));
|
|
120
|
+
+ }}
|
|
121
|
+
+ onError={event => {
|
|
122
|
+
+ onError?.({ error: String(event.nativeEvent.error) });
|
|
123
|
+
+ onLoadEnd?.();
|
|
124
|
+
+ }}
|
|
125
|
+
+ />
|
|
126
|
+
+ )}
|
|
127
|
+
+ </View>
|
|
128
|
+
+ );
|
|
129
|
+
+ }
|
|
130
|
+
+}
|
|
131
|
+
+
|
|
132
|
+
+const styles = StyleSheet.create({ container: { overflow: 'hidden' } });
|
|
133
|
+
+
|
|
134
|
+
+export default ExpoImage;
|
|
135
|
+
diff --git a/src/ImageModule.macos.ts b/src/ImageModule.macos.ts
|
|
136
|
+
new file mode 100644
|
|
137
|
+
index 0000000..1ffc9e3
|
|
138
|
+
--- /dev/null
|
|
139
|
+
+++ b/src/ImageModule.macos.ts
|
|
140
|
+
@@ -0,0 +1,18 @@
|
|
141
|
+
+// expo-image on macOS has no native module; see ExpoImage.macos.tsx.
|
|
142
|
+
+import { Image } from 'react-native';
|
|
143
|
+
+
|
|
144
|
+
+import type { ImageNativeModule } from './Image.types';
|
|
145
|
+
+
|
|
146
|
+
+const unsupported = (name: string) => () => Promise.reject(new Error(`Image.${name} is not supported on macOS`));
|
|
147
|
+
+
|
|
148
|
+
+export default {
|
|
149
|
+
+ Image: class {},
|
|
150
|
+
+ prefetch: (urls: string[]) => Promise.all(urls.map(url => Image.prefetch(url))).then(() => true, () => false),
|
|
151
|
+
+ clearMemoryCache: async () => false,
|
|
152
|
+
+ clearDiskCache: async () => false,
|
|
153
|
+
+ configureCache: () => {},
|
|
154
|
+
+ getCachePathAsync: async () => null,
|
|
155
|
+
+ loadAsync: unsupported('loadAsync'),
|
|
156
|
+
+ generateBlurhashAsync: unsupported('generateBlurhashAsync'),
|
|
157
|
+
+ generateThumbhashAsync: unsupported('generateThumbhashAsync'),
|
|
158
|
+
+} as unknown as ImageNativeModule;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
diff --git a/ios/KeepAwakeModule.swift b/ios/KeepAwakeModule.swift
|
|
2
|
+
index 835b4f1..22aac25 100644
|
|
3
|
+
--- a/ios/KeepAwakeModule.swift
|
|
4
|
+
+++ b/ios/KeepAwakeModule.swift
|
|
5
|
+
@@ -30,7 +30,9 @@ public final class KeepAwakeModule: Module {
|
|
6
|
+
return UIApplication.shared.isIdleTimerDisabled
|
|
7
|
+
}
|
|
8
|
+
#elseif os(macOS)
|
|
9
|
+
- return false
|
|
10
|
+
+ return DispatchQueue.main.sync {
|
|
11
|
+
+ return displaySleepActivity != nil
|
|
12
|
+
+ }
|
|
13
|
+
#endif
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@@ -48,10 +50,25 @@ public final class KeepAwakeModule: Module {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
+#if os(macOS)
|
|
21
|
+
+// macOS has no idle timer to disable; a process activity holds the display and system awake instead.
|
|
22
|
+
+private var displaySleepActivity: NSObjectProtocol?
|
|
23
|
+
+#endif
|
|
24
|
+
+
|
|
25
|
+
private func setActivated(_ activated: Bool) {
|
|
26
|
+
#if os(iOS) || os(tvOS)
|
|
27
|
+
DispatchQueue.main.async {
|
|
28
|
+
UIApplication.shared.isIdleTimerDisabled = activated
|
|
29
|
+
}
|
|
30
|
+
+ #elseif os(macOS)
|
|
31
|
+
+ DispatchQueue.main.async {
|
|
32
|
+
+ if activated, displaySleepActivity == nil {
|
|
33
|
+
+ displaySleepActivity = ProcessInfo.processInfo.beginActivity(
|
|
34
|
+
+ options: [.idleDisplaySleepDisabled, .idleSystemSleepDisabled], reason: "expo-keep-awake")
|
|
35
|
+
+ } else if !activated, let activity = displaySleepActivity {
|
|
36
|
+
+ ProcessInfo.processInfo.endActivity(activity)
|
|
37
|
+
+ displaySleepActivity = nil
|
|
38
|
+
+ }
|
|
39
|
+
+ }
|
|
40
|
+
#endif
|
|
41
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
diff --git a/ios/ExpoLocalization.podspec b/ios/ExpoLocalization.podspec
|
|
2
|
+
index 29b720d..117b6a0 100644
|
|
3
|
+
--- a/ios/ExpoLocalization.podspec
|
|
4
|
+
+++ b/ios/ExpoLocalization.podspec
|
|
5
|
+
@@ -12,6 +12,7 @@ Pod::Spec.new do |s|
|
|
6
|
+
s.homepage = package['homepage']
|
|
7
|
+
s.platforms = {
|
|
8
|
+
:ios => '15.1',
|
|
9
|
+
+ :osx => '14.0',
|
|
10
|
+
:tvos => '15.1'
|
|
11
|
+
}
|
|
12
|
+
s.swift_version = '5.9'
|
|
13
|
+
diff --git a/ios/LocalizationModule.swift b/ios/LocalizationModule.swift
|
|
14
|
+
index ffc4593..df54b76 100644
|
|
15
|
+
--- a/ios/LocalizationModule.swift
|
|
16
|
+
+++ b/ios/LocalizationModule.swift
|
|
17
|
+
@@ -8,7 +8,14 @@ let CALENDAR_SETTINGS_CHANGED = "onCalendarSettingsChanged"
|
|
18
|
+
|
|
19
|
+
let OBSERVED_EVENTS: Set<Notification.Name> = [
|
|
20
|
+
// swiftlint:disable legacy_objc_type
|
|
21
|
+
- UIApplication.significantTimeChangeNotification,
|
|
22
|
+
+ // macOS has no significant-time-change notification; a time zone change is the closest.
|
|
23
|
+
+ {
|
|
24
|
+
+ #if os(macOS)
|
|
25
|
+
+ return Notification.Name.NSSystemTimeZoneDidChange
|
|
26
|
+
+ #else
|
|
27
|
+
+ return UIApplication.significantTimeChangeNotification
|
|
28
|
+
+ #endif
|
|
29
|
+
+ }(),
|
|
30
|
+
NSLocale.currentLocaleDidChangeNotification
|
|
31
|
+
// swiftlint:enable legacy_objc_type
|
|
32
|
+
]
|