@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.
@@ -264,43 +264,37 @@ public final class ExpoPhotos: Module {
264
264
  }
265
265
 
266
266
  AsyncFunction("presentLimitedLibraryPicker") { () async throws -> Void in
267
- guard let viewController = self.appContext?.utilities?.currentViewController() else {
268
- throw ExpoPhotosError.noViewController
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
- guard let viewController = self.appContext?.utilities?.currentViewController() else {
276
- throw ExpoPhotosError.noViewController
277
- }
278
-
279
- let picker: PHPickerViewController = await MainActor.run {
280
- var config = PHPickerConfiguration(photoLibrary: .shared())
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
- let pickerId = await MainActor.run { picker.id }
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
- return try await withCheckedThrowingContinuation {
299
- (continuation: CheckedContinuation<[[String: Any]], Error>) in
300
- self.pickAssetsContinuations[pickerId] = continuation
293
+ let picker = PHPickerViewController(configuration: config)
294
+ picker.delegate = self
301
295
 
302
- Task {
303
- await viewController.present(picker, animated: true, completion: nil)
296
+ self.pickAssetsContinuations[picker.id] = continuation
297
+ viewController.present(picker, animated: true)
304
298
  }
305
299
  }
306
300
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hortemo/expo-photos",
3
- "version": "9.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "Expo module exposing advanced iOS Photos APIs.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",