@hortemo/expo-photos 9.0.0 → 10.0.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/ios/ExpoPhotosModule.swift +24 -30
- package/package.json +1 -1
|
@@ -264,43 +264,37 @@ public final class ExpoPhotos: Module {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
AsyncFunction("presentLimitedLibraryPicker") { () async throws -> Void in
|
|
267
|
-
|
|
268
|
-
|
|
267
|
+
try await MainActor.run {
|
|
268
|
+
guard let viewController = self.appContext?.utilities?.currentViewController() else {
|
|
269
|
+
throw ExpoPhotosError.noViewController
|
|
270
|
+
}
|
|
271
|
+
PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController)
|
|
269
272
|
}
|
|
270
|
-
|
|
271
|
-
await PHPhotoLibrary.shared().presentLimitedLibraryPicker(from: viewController)
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
AsyncFunction("pickAssets") { (options: PickAssetsOptions) async throws -> [[String: Any]] in
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
if let selectionLimit = options.selectionLimit {
|
|
283
|
-
config.selectionLimit = selectionLimit
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
if let filter = options.filter {
|
|
287
|
-
config.filter = filter
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
let picker = PHPickerViewController(configuration: config)
|
|
291
|
-
picker.delegate = self
|
|
292
|
-
|
|
293
|
-
return picker
|
|
294
|
-
}
|
|
276
|
+
return try await withCheckedThrowingContinuation { (continuation: CheckedContinuation<[[String: Any]], Error>) in
|
|
277
|
+
Task { @MainActor in
|
|
278
|
+
guard let viewController = self.appContext?.utilities?.currentViewController() else {
|
|
279
|
+
continuation.resume(throwing: ExpoPhotosError.noViewController)
|
|
280
|
+
return
|
|
281
|
+
}
|
|
295
282
|
|
|
296
|
-
|
|
283
|
+
var config = PHPickerConfiguration(photoLibrary: .shared())
|
|
284
|
+
|
|
285
|
+
if let selectionLimit = options.selectionLimit {
|
|
286
|
+
config.selectionLimit = selectionLimit
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if let filter = options.filter {
|
|
290
|
+
config.filter = filter
|
|
291
|
+
}
|
|
297
292
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
self.pickAssetsContinuations[pickerId] = continuation
|
|
293
|
+
let picker = PHPickerViewController(configuration: config)
|
|
294
|
+
picker.delegate = self
|
|
301
295
|
|
|
302
|
-
|
|
303
|
-
|
|
296
|
+
self.pickAssetsContinuations[picker.id] = continuation
|
|
297
|
+
viewController.present(picker, animated: true)
|
|
304
298
|
}
|
|
305
299
|
}
|
|
306
300
|
}
|