@hortemo/expo-photos 9.0.0 → 11.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/build/PHImage.d.ts +2 -2
- package/build/PHImage.d.ts.map +1 -1
- package/build/PHImage.js.map +1 -1
- package/build/PHVideo.d.ts +2 -2
- package/build/PHVideo.d.ts.map +1 -1
- package/build/PHVideo.js.map +1 -1
- package/ios/ExpoPhotosModule.swift +27 -32
- package/package.json +2 -5
- package/src/PHImage.tsx +1 -1
- package/src/PHVideo.tsx +1 -1
package/build/PHImage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewProps } from "react-native";
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
2
2
|
import { PHImageContentMode, PHImageRequestOptions, RequestImageTargetSize, UIViewContentMode } from "./ExpoPhotos.types";
|
|
3
3
|
export interface PHImageLoadEvent {
|
|
4
4
|
size: {
|
|
@@ -25,5 +25,5 @@ export interface PHImageViewProps extends ViewProps {
|
|
|
25
25
|
nativeEvent: PHImageErrorEvent;
|
|
26
26
|
}) => void;
|
|
27
27
|
}
|
|
28
|
-
export declare function PHImageView({ requestOptions, contentMode, ...rest }: PHImageViewProps):
|
|
28
|
+
export declare function PHImageView({ requestOptions, contentMode, ...rest }: PHImageViewProps): any;
|
|
29
29
|
//# sourceMappingURL=PHImage.d.ts.map
|
package/build/PHImage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PHImage.d.ts","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PHImage.d.ts","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,sBAA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BAAkB,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,CAChD,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport { ViewProps } from \"react-native\";\nimport {\n PHImageContentMode,\n PHImageRequestOptions,\n RequestImageTargetSize,\n UIViewContentMode,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHImageLoadEvent {\n size: { width: number; height: number };\n scale: number;\n}\n\nexport interface PHImageErrorEvent {\n message: string;\n}\n\nexport interface PHImageViewRequestOptions extends PHImageRequestOptions {\n contentMode?: PHImageContentMode;\n targetSize?: RequestImageTargetSize;\n}\n\nexport interface PHImageViewProps extends ViewProps {\n localIdentifier: string;\n contentMode?: UIViewContentMode;\n requestOptions?: PHImageViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHImageLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHImageErrorEvent }) => void;\n}\n\nconst NativePHImageView = requireNativeViewManager(\"ExpoPhotos\", \"PHImageView\");\n\nexport function PHImageView({\n requestOptions,\n contentMode,\n ...rest\n}: PHImageViewProps) {\n return (\n <NativePHImageView\n viewContentMode={contentMode}\n requestContentMode={requestOptions?.contentMode}\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n resizeMode={requestOptions?.resizeMode}\n targetSize={requestOptions?.targetSize}\n {...rest}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PHImage.js","sourceRoot":"","sources":["../src/PHImage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AA+B7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAC1B,cAAc,EACd,WAAW,EACX,GAAG,IAAI,EACU;IACjB,OAAO,CACL,CAAC,iBAAiB,CAChB,eAAe,CAAC,CAAC,WAAW,CAAC,CAC7B,kBAAkB,CAAC,CAAC,cAAc,EAAE,WAAW,CAAC,CAChD,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,UAAU,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CACvC,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport type { ViewProps } from \"react-native\";\nimport {\n PHImageContentMode,\n PHImageRequestOptions,\n RequestImageTargetSize,\n UIViewContentMode,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHImageLoadEvent {\n size: { width: number; height: number };\n scale: number;\n}\n\nexport interface PHImageErrorEvent {\n message: string;\n}\n\nexport interface PHImageViewRequestOptions extends PHImageRequestOptions {\n contentMode?: PHImageContentMode;\n targetSize?: RequestImageTargetSize;\n}\n\nexport interface PHImageViewProps extends ViewProps {\n localIdentifier: string;\n contentMode?: UIViewContentMode;\n requestOptions?: PHImageViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHImageLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHImageErrorEvent }) => void;\n}\n\nconst NativePHImageView = requireNativeViewManager(\"ExpoPhotos\", \"PHImageView\");\n\nexport function PHImageView({\n requestOptions,\n contentMode,\n ...rest\n}: PHImageViewProps) {\n return (\n <NativePHImageView\n viewContentMode={contentMode}\n requestContentMode={requestOptions?.contentMode}\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n resizeMode={requestOptions?.resizeMode}\n targetSize={requestOptions?.targetSize}\n {...rest}\n />\n );\n}\n"]}
|
package/build/PHVideo.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ViewProps } from "react-native";
|
|
1
|
+
import type { ViewProps } from "react-native";
|
|
2
2
|
import { PHVideoLoadEvent, PHVideoErrorEvent, PHVideoRequestOptions } from "./ExpoPhotos.types";
|
|
3
3
|
export interface PHVideoViewRequestOptions extends PHVideoRequestOptions {
|
|
4
4
|
}
|
|
@@ -12,5 +12,5 @@ export interface PHVideoViewProps extends ViewProps {
|
|
|
12
12
|
nativeEvent: PHVideoErrorEvent;
|
|
13
13
|
}) => void;
|
|
14
14
|
}
|
|
15
|
-
export declare function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps):
|
|
15
|
+
export declare function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps): any;
|
|
16
16
|
//# sourceMappingURL=PHVideo.d.ts.map
|
package/build/PHVideo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PHVideo.d.ts","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"PHVideo.d.ts","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;CAAG;AAE3E,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,yBAAyB,CAAC;IAC3C,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,gBAAgB,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE,iBAAiB,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/D;AAID,wBAAgB,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,EAAE,gBAAgB,OAQxE"}
|
package/build/PHVideo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PHVideo.js","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAiB7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAoB;IACvE,OAAO,CACL,CAAC,iBAAiB,CAChB,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport { ViewProps } from \"react-native\";\nimport {\n PHVideoLoadEvent,\n PHVideoErrorEvent,\n PHVideoRequestOptions,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHVideoViewRequestOptions extends PHVideoRequestOptions {}\n\nexport interface PHVideoViewProps extends ViewProps {\n localIdentifier: string;\n requestOptions?: PHVideoViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHVideoLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHVideoErrorEvent }) => void;\n}\n\nconst NativePHVideoView = requireNativeViewManager(\"ExpoPhotos\", \"PHVideoView\");\n\nexport function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps) {\n return (\n <NativePHVideoView\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n {...rest}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PHVideo.js","sourceRoot":"","sources":["../src/PHVideo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAiB7D,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,IAAI,EAAoB;IACvE,OAAO,CACL,CAAC,iBAAiB,CAChB,sBAAsB,CAAC,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAC/D,YAAY,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,CAC3C,IAAI,IAAI,CAAC,EACT,CACH,CAAC;AACJ,CAAC","sourcesContent":["import { requireNativeViewManager } from \"expo-modules-core\";\nimport type { ViewProps } from \"react-native\";\nimport {\n PHVideoLoadEvent,\n PHVideoErrorEvent,\n PHVideoRequestOptions,\n} from \"./ExpoPhotos.types\";\n\nexport interface PHVideoViewRequestOptions extends PHVideoRequestOptions {}\n\nexport interface PHVideoViewProps extends ViewProps {\n localIdentifier: string;\n requestOptions?: PHVideoViewRequestOptions;\n onLoad?: (event: { nativeEvent: PHVideoLoadEvent }) => void;\n onError?: (event: { nativeEvent: PHVideoErrorEvent }) => void;\n}\n\nconst NativePHVideoView = requireNativeViewManager(\"ExpoPhotos\", \"PHVideoView\");\n\nexport function PHVideoView({ requestOptions, ...rest }: PHVideoViewProps) {\n return (\n <NativePHVideoView\n isNetworkAccessAllowed={requestOptions?.isNetworkAccessAllowed}\n deliveryMode={requestOptions?.deliveryMode}\n {...rest}\n />\n );\n}\n"]}
|
|
@@ -264,43 +264,40 @@ 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
|
|
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
|
+
}
|
|
292
282
|
|
|
293
|
-
|
|
294
|
-
|
|
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
|
+
}
|
|
295
292
|
|
|
296
|
-
|
|
293
|
+
let picker = PHPickerViewController(configuration: config)
|
|
294
|
+
picker.delegate = self
|
|
297
295
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
self.pickAssetsContinuations[pickerId] = continuation
|
|
296
|
+
// Disable swipe to dismiss, which does not trigger delegate
|
|
297
|
+
picker.isModalInPresentation = true
|
|
301
298
|
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
self.pickAssetsContinuations[picker.id] = continuation
|
|
300
|
+
viewController.present(picker, animated: true)
|
|
304
301
|
}
|
|
305
302
|
}
|
|
306
303
|
}
|
|
@@ -359,12 +356,10 @@ extension ExpoPhotos: PHPickerViewControllerDelegate {
|
|
|
359
356
|
public func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) {
|
|
360
357
|
picker.dismiss(animated: true, completion: nil)
|
|
361
358
|
|
|
362
|
-
guard let continuation = self.pickAssetsContinuations
|
|
359
|
+
guard let continuation = self.pickAssetsContinuations.removeValue(forKey: picker.id) else {
|
|
363
360
|
return
|
|
364
361
|
}
|
|
365
362
|
|
|
366
|
-
self.pickAssetsContinuations.removeValue(forKey: picker.id)
|
|
367
|
-
|
|
368
363
|
let assetIdentifiers = results.compactMap { $0.assetIdentifier }
|
|
369
364
|
var assets: [[String: Any]] = []
|
|
370
365
|
PHAsset.fetchAssets(withLocalIdentifiers: assetIdentifiers, options: nil).enumerateObjects {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hortemo/expo-photos",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.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",
|
|
@@ -29,11 +29,8 @@
|
|
|
29
29
|
"homepage": "https://github.com/hortemo/expo-photos#readme",
|
|
30
30
|
"dependencies": {},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/react": "~19.1.0",
|
|
33
32
|
"eslint": "^9.24.0",
|
|
34
|
-
"expo": "^
|
|
35
|
-
"expo-module-scripts": "^5.0.7",
|
|
36
|
-
"react-native": "0.81.4"
|
|
33
|
+
"expo-module-scripts": "^5.0.7"
|
|
37
34
|
},
|
|
38
35
|
"peerDependencies": {
|
|
39
36
|
"expo": "*",
|
package/src/PHImage.tsx
CHANGED
package/src/PHVideo.tsx
CHANGED