react-native-attachment-kit 1.1.1 → 1.2.2

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.
Files changed (29) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +77 -5
  3. package/android/src/main/libs/rnattachmentkit-release.aar +0 -0
  4. package/android/src/newarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +28 -1
  5. package/android/src/oldarch/java/com/rnattachmentkit/RNAttachmentKitModule.kt +28 -1
  6. package/ios/RNAttachmentKit.swift +21 -3
  7. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.abi.json +7188 -4555
  8. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.private.swiftinterface +37 -1
  9. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  10. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios.swiftinterface +37 -1
  11. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/RNAttachmentKit +0 -0
  12. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
  13. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeResources +10 -10
  14. package/ios/RNAttachmentKit.xcframework/ios-arm64/RNAttachmentKit.framework/_CodeSignature/CodeSignature +0 -0
  15. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Assets.car +0 -0
  16. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.abi.json +7188 -4555
  17. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +37 -1
  18. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +37 -1
  20. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +7188 -4555
  21. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +37 -1
  22. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +37 -1
  24. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/RNAttachmentKit +0 -0
  25. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeDirectory +0 -0
  26. package/ios/RNAttachmentKit.xcframework/ios-arm64_x86_64-simulator/RNAttachmentKit.framework/_CodeSignature/CodeResources +22 -22
  27. package/package.json +1 -1
  28. package/src/index.ts +24 -3
  29. package/src/types.ts +64 -1
@@ -490,6 +490,7 @@ extension RNAttachmentKit.RemoteImageViewerViewController : UIKit.UICollectionVi
490
490
  @_Concurrency.MainActor @preconcurrency @objc dynamic public func collectionView(_ collectionView: UIKit.UICollectionView, didSelectItemAt indexPath: Foundation.IndexPath)
491
491
  }
492
492
  extension RNAttachmentKit.RemoteImageViewerViewController {
493
+ @_Concurrency.MainActor @preconcurrency public func willCloseEventBody() -> [Swift.String : Any]
493
494
  @_Concurrency.MainActor @preconcurrency public func videoCloseSnapshot(in container: UIKit.UIView) -> (image: UIKit.UIImage, frame: CoreFoundation.CGRect)?
494
495
  }
495
496
  public struct Localizer {
@@ -703,6 +704,8 @@ extension RNAttachmentKit.MediaGalleryViewController : UIKit.UICollectionViewDat
703
704
  @_Concurrency.MainActor @preconcurrency public var sourceClipRect: CoreFoundation.CGRect?
704
705
  @_Concurrency.MainActor @preconcurrency public var sourceClipInsets: UIKit.UIEdgeInsets?
705
706
  @_Concurrency.MainActor @preconcurrency public func clipRect(in bounds: CoreFoundation.CGRect) -> CoreFoundation.CGRect?
707
+ @_Concurrency.MainActor @preconcurrency weak public var underView: UIKit.UIView?
708
+ @_Concurrency.MainActor @preconcurrency public func removeUnderLayer()
706
709
  @_Concurrency.MainActor @preconcurrency public func updateMaskView()
707
710
  @_Concurrency.MainActor @preconcurrency public var openDuration: Swift.Double
708
711
  @_Concurrency.MainActor @preconcurrency public var closeDuration: Swift.Double
@@ -832,6 +835,23 @@ public struct ReverseGeocodeError : Swift.Error {
832
835
  public static func apply(_ config: [Swift.String : Any])
833
836
  @objc deinit
834
837
  }
838
+ public struct VideoPreviewOptions {
839
+ public var height: Swift.Int
840
+ public var bitrate: Swift.Int
841
+ public var maxFps: Swift.Double
842
+ public var maxDurationSec: Swift.Double
843
+ public var codec: Swift.String
844
+ public init()
845
+ public init?(any v: Any?)
846
+ }
847
+ public struct VideoPreviewResult {
848
+ public let url: Foundation.URL
849
+ public let width: Swift.Int
850
+ public let height: Swift.Int
851
+ public let duration: Swift.Double
852
+ public let fileSize: Swift.Int64
853
+ public let bitrate: Swift.Int
854
+ }
835
855
  public struct VideoExportOptions {
836
856
  public var maxDurationSec: Swift.Double
837
857
  public var maxFileSizeMB: Swift.Double
@@ -839,6 +859,7 @@ public struct VideoExportOptions {
839
859
  public var defaultQuality: Swift.Int
840
860
  public var codec: Swift.String
841
861
  public var posterFormat: Swift.String
862
+ public var preview: RNAttachmentKit.VideoPreviewOptions?
842
863
  public init()
843
864
  public init(dictionary d: [Swift.String : Any]?)
844
865
  }
@@ -904,6 +925,7 @@ public enum VideoSendIssue {
904
925
  }
905
926
  final public class VideoExporter {
906
927
  public static let sizeMargin: Swift.Double
928
+ public static func tooLongText(maxDurationSec: Swift.Double, languageCode: Swift.String) -> Swift.String
907
929
  public static func sendIssue(sourceDuration: Swift.Double, sourceShortSide: CoreFoundation.CGFloat, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions) -> RNAttachmentKit.VideoSendIssue?
908
930
  public static func fittedQuality(_ want: Swift.Int, sourceShortSide: CoreFoundation.CGFloat, outputDuration: Swift.Double, options: RNAttachmentKit.VideoExportOptions) -> Swift.Int
909
931
  public enum ExportError : Foundation.LocalizedError {
@@ -920,6 +942,8 @@ final public class VideoExporter {
920
942
  final public func cancel()
921
943
  final public func export(asset: Photos.PHAsset, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions, outputDir: Foundation.URL, baseName: Swift.String, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoExportResult
922
944
  final public func export(fileURL: Foundation.URL, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions, outputDir: Foundation.URL, baseName: Swift.String, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoExportResult
945
+ public static func previewWorthMaking(sentShortSide: Swift.Int, sentFileSize: Swift.Int64, sentDuration: Swift.Double, options: RNAttachmentKit.VideoPreviewOptions) -> Swift.Bool
946
+ final public func makePreview(from source: Foundation.URL, options: RNAttachmentKit.VideoPreviewOptions, to url: Foundation.URL, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoPreviewResult
923
947
  public static func encodePoster(_ image: UIKit.UIImage, format: Swift.String, quality: CoreFoundation.CGFloat) -> (data: Foundation.Data, fileExtension: Swift.String)?
924
948
  @objc deinit
925
949
  }
@@ -937,7 +961,8 @@ public struct ViewerVideoItem {
937
961
  public var uri: Swift.String
938
962
  public var duration: Swift.Double?
939
963
  public var cacheFile: Swift.String?
940
- public init(uri: Swift.String, duration: Swift.Double? = nil, cacheFile: Swift.String? = nil)
964
+ public var startTime: Swift.Double?
965
+ public init(uri: Swift.String, duration: Swift.Double? = nil, cacheFile: Swift.String? = nil, startTime: Swift.Double? = nil)
941
966
  public init?(dictionary d: Any?)
942
967
  }
943
968
  @_hasMissingDesignatedInitializers final public class VideoPrepareManager {
@@ -1002,8 +1027,19 @@ public struct AttachmentResult {
1002
1027
  public var videoCodec: Swift.String?
1003
1028
  public var videoBitrate: Swift.Int?
1004
1029
  public var edited: Swift.Bool?
1030
+ public var previewURL: Foundation.URL?
1031
+ public var previewWidth: Swift.Int?
1032
+ public var previewHeight: Swift.Int?
1033
+ public var previewDuration: Swift.Double?
1034
+ public var previewFileSize: Swift.Int64?
1035
+ public var previewBitrate: Swift.Int?
1036
+ public var previewError: Swift.String?
1037
+ public var previewSkipped: Swift.String?
1005
1038
  public var error: Swift.String?
1006
1039
  public var cancelled: Swift.Bool
1040
+ public var previewPath: Swift.String? {
1041
+ get
1042
+ }
1007
1043
  public var path: Swift.String? {
1008
1044
  get
1009
1045
  }
@@ -490,6 +490,7 @@ extension RNAttachmentKit.RemoteImageViewerViewController : UIKit.UICollectionVi
490
490
  @_Concurrency.MainActor @preconcurrency @objc dynamic public func collectionView(_ collectionView: UIKit.UICollectionView, didSelectItemAt indexPath: Foundation.IndexPath)
491
491
  }
492
492
  extension RNAttachmentKit.RemoteImageViewerViewController {
493
+ @_Concurrency.MainActor @preconcurrency public func willCloseEventBody() -> [Swift.String : Any]
493
494
  @_Concurrency.MainActor @preconcurrency public func videoCloseSnapshot(in container: UIKit.UIView) -> (image: UIKit.UIImage, frame: CoreFoundation.CGRect)?
494
495
  }
495
496
  public struct Localizer {
@@ -703,6 +704,8 @@ extension RNAttachmentKit.MediaGalleryViewController : UIKit.UICollectionViewDat
703
704
  @_Concurrency.MainActor @preconcurrency public var sourceClipRect: CoreFoundation.CGRect?
704
705
  @_Concurrency.MainActor @preconcurrency public var sourceClipInsets: UIKit.UIEdgeInsets?
705
706
  @_Concurrency.MainActor @preconcurrency public func clipRect(in bounds: CoreFoundation.CGRect) -> CoreFoundation.CGRect?
707
+ @_Concurrency.MainActor @preconcurrency weak public var underView: UIKit.UIView?
708
+ @_Concurrency.MainActor @preconcurrency public func removeUnderLayer()
706
709
  @_Concurrency.MainActor @preconcurrency public func updateMaskView()
707
710
  @_Concurrency.MainActor @preconcurrency public var openDuration: Swift.Double
708
711
  @_Concurrency.MainActor @preconcurrency public var closeDuration: Swift.Double
@@ -832,6 +835,23 @@ public struct ReverseGeocodeError : Swift.Error {
832
835
  public static func apply(_ config: [Swift.String : Any])
833
836
  @objc deinit
834
837
  }
838
+ public struct VideoPreviewOptions {
839
+ public var height: Swift.Int
840
+ public var bitrate: Swift.Int
841
+ public var maxFps: Swift.Double
842
+ public var maxDurationSec: Swift.Double
843
+ public var codec: Swift.String
844
+ public init()
845
+ public init?(any v: Any?)
846
+ }
847
+ public struct VideoPreviewResult {
848
+ public let url: Foundation.URL
849
+ public let width: Swift.Int
850
+ public let height: Swift.Int
851
+ public let duration: Swift.Double
852
+ public let fileSize: Swift.Int64
853
+ public let bitrate: Swift.Int
854
+ }
835
855
  public struct VideoExportOptions {
836
856
  public var maxDurationSec: Swift.Double
837
857
  public var maxFileSizeMB: Swift.Double
@@ -839,6 +859,7 @@ public struct VideoExportOptions {
839
859
  public var defaultQuality: Swift.Int
840
860
  public var codec: Swift.String
841
861
  public var posterFormat: Swift.String
862
+ public var preview: RNAttachmentKit.VideoPreviewOptions?
842
863
  public init()
843
864
  public init(dictionary d: [Swift.String : Any]?)
844
865
  }
@@ -904,6 +925,7 @@ public enum VideoSendIssue {
904
925
  }
905
926
  final public class VideoExporter {
906
927
  public static let sizeMargin: Swift.Double
928
+ public static func tooLongText(maxDurationSec: Swift.Double, languageCode: Swift.String) -> Swift.String
907
929
  public static func sendIssue(sourceDuration: Swift.Double, sourceShortSide: CoreFoundation.CGFloat, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions) -> RNAttachmentKit.VideoSendIssue?
908
930
  public static func fittedQuality(_ want: Swift.Int, sourceShortSide: CoreFoundation.CGFloat, outputDuration: Swift.Double, options: RNAttachmentKit.VideoExportOptions) -> Swift.Int
909
931
  public enum ExportError : Foundation.LocalizedError {
@@ -920,6 +942,8 @@ final public class VideoExporter {
920
942
  final public func cancel()
921
943
  final public func export(asset: Photos.PHAsset, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions, outputDir: Foundation.URL, baseName: Swift.String, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoExportResult
922
944
  final public func export(fileURL: Foundation.URL, state: RNAttachmentKit.VideoEditState, options: RNAttachmentKit.VideoExportOptions, outputDir: Foundation.URL, baseName: Swift.String, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoExportResult
945
+ public static func previewWorthMaking(sentShortSide: Swift.Int, sentFileSize: Swift.Int64, sentDuration: Swift.Double, options: RNAttachmentKit.VideoPreviewOptions) -> Swift.Bool
946
+ final public func makePreview(from source: Foundation.URL, options: RNAttachmentKit.VideoPreviewOptions, to url: Foundation.URL, progress: @escaping (Swift.Double) -> Swift.Void) throws -> RNAttachmentKit.VideoPreviewResult
923
947
  public static func encodePoster(_ image: UIKit.UIImage, format: Swift.String, quality: CoreFoundation.CGFloat) -> (data: Foundation.Data, fileExtension: Swift.String)?
924
948
  @objc deinit
925
949
  }
@@ -937,7 +961,8 @@ public struct ViewerVideoItem {
937
961
  public var uri: Swift.String
938
962
  public var duration: Swift.Double?
939
963
  public var cacheFile: Swift.String?
940
- public init(uri: Swift.String, duration: Swift.Double? = nil, cacheFile: Swift.String? = nil)
964
+ public var startTime: Swift.Double?
965
+ public init(uri: Swift.String, duration: Swift.Double? = nil, cacheFile: Swift.String? = nil, startTime: Swift.Double? = nil)
941
966
  public init?(dictionary d: Any?)
942
967
  }
943
968
  @_hasMissingDesignatedInitializers final public class VideoPrepareManager {
@@ -1002,8 +1027,19 @@ public struct AttachmentResult {
1002
1027
  public var videoCodec: Swift.String?
1003
1028
  public var videoBitrate: Swift.Int?
1004
1029
  public var edited: Swift.Bool?
1030
+ public var previewURL: Foundation.URL?
1031
+ public var previewWidth: Swift.Int?
1032
+ public var previewHeight: Swift.Int?
1033
+ public var previewDuration: Swift.Double?
1034
+ public var previewFileSize: Swift.Int64?
1035
+ public var previewBitrate: Swift.Int?
1036
+ public var previewError: Swift.String?
1037
+ public var previewSkipped: Swift.String?
1005
1038
  public var error: Swift.String?
1006
1039
  public var cancelled: Swift.Bool
1040
+ public var previewPath: Swift.String? {
1041
+ get
1042
+ }
1007
1043
  public var path: Swift.String? {
1008
1044
  get
1009
1045
  }
@@ -6,7 +6,7 @@
6
6
  <dict>
7
7
  <key>Assets.car</key>
8
8
  <data>
9
- 24XBU3LEblGjGTOAqjhqZ+mB2U0=
9
+ g6yZrbEglkdHc1mfZaxagZ5xtQU=
10
10
  </data>
11
11
  <key>Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib</key>
12
12
  <data>
@@ -30,43 +30,43 @@
30
30
  </data>
31
31
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
32
32
  <data>
33
- HgBJ2YsmrBeU0DS85YgVPkDlLTs=
33
+ cDIKOxZMZjBEDwXWsaQcXFaOwjY=
34
34
  </data>
35
35
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
36
36
  <data>
37
- Ed6Tp4ZdEh1Odi1mGzC5KfR3ub4=
37
+ 5+4785ZK6wAQveUYGwxcd97v3fk=
38
38
  </data>
39
39
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
40
40
  <data>
41
- fkzCLPjLTpoPLvuP7U4zaR7oFNw=
41
+ zVq/ulFQX0DNJyim760INA2BMJY=
42
42
  </data>
43
43
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
44
44
  <data>
45
- Ed6Tp4ZdEh1Odi1mGzC5KfR3ub4=
45
+ 5+4785ZK6wAQveUYGwxcd97v3fk=
46
46
  </data>
47
47
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
48
48
  <data>
49
- CJAZ6C+TQtNC/0MyMl2L2XpFaUk=
49
+ myshBYtNXCHjI6pdLLGzq+k7QaY=
50
50
  </data>
51
51
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
52
52
  <data>
53
- HgBJ2YsmrBeU0DS85YgVPkDlLTs=
53
+ cDIKOxZMZjBEDwXWsaQcXFaOwjY=
54
54
  </data>
55
55
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
56
56
  <data>
57
- rXiwUUI1CzRSug3fqRG9W7EfYXU=
57
+ gDqNg0dOOaQZG+LnUdHe2epfM/Q=
58
58
  </data>
59
59
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
60
60
  <data>
61
- hA3QQl7XlEdD/dLJvtloBIYPppw=
61
+ bqeMNigi/6BVenv9pPCBC0cnOik=
62
62
  </data>
63
63
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
64
64
  <data>
65
- rXiwUUI1CzRSug3fqRG9W7EfYXU=
65
+ gDqNg0dOOaQZG+LnUdHe2epfM/Q=
66
66
  </data>
67
67
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
68
68
  <data>
69
- J5L/JxV9FT2C8tH+lGCtE16c8TY=
69
+ ldCLYzEJSMl9tGbvJKLqqcaexB0=
70
70
  </data>
71
71
  <key>Modules/module.modulemap</key>
72
72
  <data>
@@ -227,7 +227,7 @@
227
227
  <dict>
228
228
  <key>hash2</key>
229
229
  <data>
230
- hcxV/4NZu79SXIpwsHu8Fo8WVAZLQfuKhITugdLFV+I=
230
+ t4fvHNhwvX9Xc+yxU1dNnVy6zn+bhryN6MxDfE4HVwY=
231
231
  </data>
232
232
  </dict>
233
233
  <key>Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib</key>
@@ -262,70 +262,70 @@
262
262
  <dict>
263
263
  <key>hash2</key>
264
264
  <data>
265
- nfoRXkCuOnu5U1wnp4zqqmGx+leb8bfClaFr07ayxcM=
265
+ 5U0ebRft0k3pT7dh7XFPPmlXrsYugnRdA4Lzrg58wbs=
266
266
  </data>
267
267
  </dict>
268
268
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
269
269
  <dict>
270
270
  <key>hash2</key>
271
271
  <data>
272
- RX253JxJd5m5f5B7GitqxHUHfizHOfq8tSMHXN75o34=
272
+ 8S9V0QeM7wYkvdneQjfZzBBJczr//bsYL3LPwAAgn0M=
273
273
  </data>
274
274
  </dict>
275
275
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
276
276
  <dict>
277
277
  <key>hash2</key>
278
278
  <data>
279
- QkdK6zh16vDLhDaCCkHdYOvIw+XgvQ0vqz/xIAJJN6E=
279
+ b5YFkrCnQlPq+ypXoa8FpGaEy8FIGl4lF8SaDOjauKU=
280
280
  </data>
281
281
  </dict>
282
282
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
283
283
  <dict>
284
284
  <key>hash2</key>
285
285
  <data>
286
- RX253JxJd5m5f5B7GitqxHUHfizHOfq8tSMHXN75o34=
286
+ 8S9V0QeM7wYkvdneQjfZzBBJczr//bsYL3LPwAAgn0M=
287
287
  </data>
288
288
  </dict>
289
289
  <key>Modules/RNAttachmentKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
290
290
  <dict>
291
291
  <key>hash2</key>
292
292
  <data>
293
- L2ZN1byGvwKOQa7qpgo/X4J+IbA2ZcksQowMoSI56W8=
293
+ jawPPEoY72pY1VUCBTHs7AyHVJpsM4/uD/n6ijfZ9+4=
294
294
  </data>
295
295
  </dict>
296
296
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
297
297
  <dict>
298
298
  <key>hash2</key>
299
299
  <data>
300
- nfoRXkCuOnu5U1wnp4zqqmGx+leb8bfClaFr07ayxcM=
300
+ 5U0ebRft0k3pT7dh7XFPPmlXrsYugnRdA4Lzrg58wbs=
301
301
  </data>
302
302
  </dict>
303
303
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
304
304
  <dict>
305
305
  <key>hash2</key>
306
306
  <data>
307
- nN80xaeGzDuus0TMWI42dZac58SSKKddo1k17wucRI8=
307
+ 9hRCvQHf4NkqX1nAk8jG2Vlek5vnm/aq9XSQlJzeZqU=
308
308
  </data>
309
309
  </dict>
310
310
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
311
311
  <dict>
312
312
  <key>hash2</key>
313
313
  <data>
314
- vW/Wi94uUAPETo9uOKMafYZ0H7dtvllPw4YAciVQQ+4=
314
+ siL9Prg1AkwGbKYqi7m/6XFHFWw//eIf2qRminOoGtc=
315
315
  </data>
316
316
  </dict>
317
317
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
318
318
  <dict>
319
319
  <key>hash2</key>
320
320
  <data>
321
- nN80xaeGzDuus0TMWI42dZac58SSKKddo1k17wucRI8=
321
+ 9hRCvQHf4NkqX1nAk8jG2Vlek5vnm/aq9XSQlJzeZqU=
322
322
  </data>
323
323
  </dict>
324
324
  <key>Modules/RNAttachmentKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
325
325
  <dict>
326
326
  <key>hash2</key>
327
327
  <data>
328
- xhODjv643cw/fI3FfNPDvnNvOquUgzEOleuZBFaSRuE=
328
+ 5KpS89ua5KyMNFPf1VukiCs8RRbMX9viVdOof9j9eVI=
329
329
  </data>
330
330
  </dict>
331
331
  <key>Modules/module.modulemap</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-attachment-kit",
3
- "version": "1.1.1",
3
+ "version": "1.2.2",
4
4
  "description": "Native attachment kit for React Native — gallery picker, editor, image viewer and media gallery (Turbo Module)",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -67,6 +67,23 @@ if (!RNAttachmentKitModule) {
67
67
  const eventEmitter = new NativeEventEmitter(RNAttachmentKitModule)
68
68
 
69
69
  /** 같은 화면을 중복으로 열려고 할 때 reject 하는 Error (code: "E_ALREADY_OPEN") */
70
+ /** 네이티브 onViewerWillClose 본문 → { currentIndex, videoPositions } (예전 네이티브·다른 Android 뷰어처럼 값이 없으면 undefined) */
71
+ function toViewerWillCloseEvent(e: any): import("./types").ViewerWillCloseEvent | undefined {
72
+ if (!e || typeof e.currentIndex !== 'number') return undefined
73
+ const out: import("./types").ViewerWillCloseEvent = { currentIndex: e.currentIndex }
74
+ const raw = e.videoPositions
75
+ if (raw && typeof raw === 'object') {
76
+ const positions: Record<number, number> = {}
77
+ let any = false
78
+ for (const k of Object.keys(raw)) {
79
+ const i = Number(k), v = raw[k]
80
+ if (Number.isInteger(i) && typeof v === 'number' && isFinite(v)) { positions[i] = v; any = true }
81
+ }
82
+ if (any) out.videoPositions = positions
83
+ }
84
+ return out
85
+ }
86
+
70
87
  function alreadyOpenError(what: string): Error {
71
88
  const err = new Error(`${what} is already open`)
72
89
  ;(err as any).code = "E_ALREADY_OPEN"
@@ -89,7 +106,7 @@ let _editorOpen = false
89
106
  let _asyncImgProcessedSub: { remove: () => void } | null = null
90
107
 
91
108
  export type { AIConfig, AIUsageEvent, AIChargeRequiredEvent } from "./types"
92
- export type { VideoOptions, VideoProgressEvent, ViewerVideo, ProcessingStartEvent, ProcessingStartItem, ThumbnailOptions, SourceRect, SourceClipInsets, ViewerSourceUpdate } from "./types"
109
+ export type { VideoOptions, VideoProgressEvent, ViewerVideo, ViewerWillCloseEvent, ProcessingStartEvent, ProcessingStartItem, ThumbnailOptions, VideoPreviewOptions, SourceRect, SourceClipInsets, ViewerSourceUpdate } from "./types"
93
110
  export type { SelectionChangeEvent, Appearance, AttachLocationResult, MapViewerOptions, ReverseGeocodeOptions, ReverseGeocodeResult, ReverseGeocodeErrorCode, AttachFileResult, AttachFileFailure, LocationThumbnailOptions, LocationThumbnailResult } from "./types"
94
111
  export type { MediaGalleryItem, MediaGalleryOptions, MediaGalleryGridSize, MediaGalleryGridSizeChangedEvent, MediaGalleryTheme, MediaGalleryViewerOptions, MediaGalleryDeleteOption, MediaGalleryItemDeletedEvent, MediaGalleryNeedPageEvent, MediaGalleryClosedEvent, MediaGalleryAppendPayload, MediaGalleryRemovePayload } from "./types"
95
112
 
@@ -379,9 +396,13 @@ const AttachmentKit: RNAttachmentKit = {
379
396
  // 네이티브 "onViewerWillClose"(iOS sendEvent / Android RCTDeviceEventEmitter) 는 앱이 콜백을 넘기지 않아도
380
397
  // 항상 구독합니다 — 이 이벤트가 와야 onPageSelected / onImageDeleted 구독을 정리할 수 있기 때문입니다
381
398
  // (예전엔 options.onViewerWillClose 가 없으면 구독을 안 해서 뷰어를 열 때마다 리스너가 누수됐음).
382
- const closeHandler = () => {
399
+ // Android 는 같은 이벤트가 두 구독(eventEmitter·DeviceEventEmitter)으로 올 수 있어 한 번만
400
+ let closeSent = false
401
+ const closeHandler = (event?: any) => {
402
+ if (closeSent) return
403
+ closeSent = true
383
404
  if (options.onViewerWillClose) {
384
- options.onViewerWillClose()
405
+ options.onViewerWillClose(toViewerWillCloseEvent(event))
385
406
  }
386
407
  if (subscriptionPageSelected) {
387
408
  subscriptionPageSelected.remove()
package/src/types.ts CHANGED
@@ -42,6 +42,20 @@ export interface ImageResult {
42
42
  error?: string
43
43
  /** 앱이 cancelVideoProcessing 으로 취소한 동영상 (uri 없음) */
44
44
  cancelled?: boolean
45
+ /** 동영상: 미리보기 영상 file:// (video.preview 를 줬고 만들었을 때). 소리 없음, 저화질 mp4 (moov 앞쪽) */
46
+ previewUri?: string
47
+ previewWidth?: number
48
+ previewHeight?: number
49
+ /** 초(소수) — preview.maxDurationSec 로 잘랐으면 그 길이 */
50
+ previewDuration?: number
51
+ /** bytes */
52
+ previewFileSize?: number
53
+ /** 평균 비트레이트(bps) — 파일 크기 ÷ 길이 */
54
+ previewBitrate?: number
55
+ /** 미리보기만 실패 (전송본 uri 는 정상). "ENCODE_FAILED" */
56
+ previewError?: string
57
+ /** 일부러 만들지 않음. "SOURCE_SMALL" = 전송본이 미리보기 기준보다 작거나 같음 (짧은 변 ≤ preview.height 이거나 파일이 예상 미리보기보다 작음) */
58
+ previewSkipped?: string
45
59
  }
46
60
 
47
61
  /**
@@ -97,6 +111,20 @@ export interface ThumbnailOptions {
97
111
  }
98
112
 
99
113
  /** 동영상 옵션 (GalleryOptions.video). mediaType 이 "video"/"all" 일 때만 의미 */
114
+ /** video.preview — 목록·카드용 미리보기 영상 (1.2.0). 모두 선택, 0 이하·틀린 값은 기본값 */
115
+ export interface VideoPreviewOptions {
116
+ /** 짧은 변(px). 기본 360. 전송본이 이보다 작거나 같으면 만들지 않음 (previewSkipped "SOURCE_SMALL") */
117
+ height?: number
118
+ /** 평균 비트레이트(bps). 기본 450_000 */
119
+ bitrate?: number
120
+ /** 최대 fps. 기본 24. 원본이 더 낮으면 원본 그대로. iOS 만 — Android(media3 1.4.1)는 원본 fps 유지 */
121
+ maxFps?: number
122
+ /** 앞에서부터 이 길이(초)까지만. 기본 0 = 전송본 전체 */
123
+ maxDurationSec?: number
124
+ /** 기본 "h264" (호환성 때문에 h264 권장) */
125
+ codec?: "h264" | "hevc"
126
+ }
127
+
100
128
  export interface VideoOptions {
101
129
  /** 고를 수 있는 최대 길이(초). 기본 600 (10분). 넘는 동영상은 누르면 안내만. 0 = 제한 없음 */
102
130
  maxDurationSec?: number
@@ -117,6 +145,11 @@ export interface VideoOptions {
117
145
  * onProcessingStart / onImageProcessed 의 thumbnailUri 확장자가 이 값을 따름 (webp 인코딩이 안 되는 드문 경우엔 jpg 로 대신하니, 확장자는 uri 로 확인)
118
146
  */
119
147
  posterFormat?: "webp" | "jpg"
148
+ /**
149
+ * 목록·카드용 미리보기 영상(소리 없음, 저화질 mp4, moov 앞쪽, 키프레임 1초)을 전송본과 함께 만듦 — 전송본(트림·크롭·그리기·음소거가
150
+ * 반영된 파일)에서 만들어 화면이 같음. 결과 previewUri 등. 없거나 false 면 예전과 같음, true 면 기본값 (1.2.0, iOS + Android)
151
+ */
152
+ preview?: boolean | VideoPreviewOptions
120
153
  /** 전송 전 변환 진행률 (동영상마다 0~1, 1% 이상 바뀔 때·최소 0.1초 간격) */
121
154
  onProgress?: (e: VideoProgressEvent) => void
122
155
  /**
@@ -161,6 +194,7 @@ export interface ViewerSourceUpdate extends SourceRect {
161
194
  sourceBorderCorners?: ('topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight')[]
162
195
  sourceClipRect?: SourceRect | null
163
196
  sourceClipInsets?: SourceClipInsets | null
197
+ underlayViewTag?: number | null
164
198
  }
165
199
 
166
200
  export interface GalleryOptions {
@@ -431,6 +465,23 @@ export interface ViewerVideo {
431
465
  cacheFile?: string
432
466
  width?: number
433
467
  height?: number
468
+ /**
469
+ * 초(소수). 이 페이지를 처음 열 때 이 위치부터 재생 (1.2.1). 생략·0 = 처음.
470
+ * 음수이거나 길이 이상이면 처음부터. 열기 애니메이션 동안은 포스터, 영상은 그 위치로 옮긴 뒤에 나타남
471
+ * (처음 장면이 비치지 않음). 다른 페이지로 넘겼다 돌아오면 지금처럼 처음부터. 스트리밍·캐시 파일 모두
472
+ */
473
+ startTime?: number
474
+ }
475
+
476
+ /** onViewerWillClose 인자 (1.2.1) */
477
+ export interface ViewerWillCloseEvent {
478
+ /** 닫을 때 보고 있던 페이지 */
479
+ currentIndex: number
480
+ /**
481
+ * 동영상 페이지 번호 → 마지막 재생 위치(초, 소수). 이번에 재생한 동영상 페이지만 (사진·열지 않은 페이지는 없음).
482
+ * 끝까지 봤으면 길이. 하나도 없으면 생략
483
+ */
484
+ videoPositions?: Record<number, number>
434
485
  }
435
486
 
436
487
  export interface ViewerOptions {
@@ -471,8 +522,20 @@ export interface ViewerOptions {
471
522
  sourceClipRect?: SourceRect
472
523
  /** 잘라내기를 화면 가장자리 여백으로 (예: { top: 상단 바 높이, bottom: 탭 바 높이 }). 설명은 sourceClipRect 참조 */
473
524
  sourceClipInsets?: SourceClipInsets
525
+ /**
526
+ * 앱이 반투명 바 바로 아래 층에 둔 빈 뷰의 RN 태그(findNodeHandle). 열림·닫힘 동안 움직이는 사진과 원래 자리 가림 판의
527
+ * 사본을 이 뷰 안에 그립니다 — 바의 흐림 너머로 사진이 움직이며 바 뒤로 들어가고 나오는 게 보임
528
+ * (잘라내기만으로는 바 밑 부분이 안 보일 뿐). sourceClipRect/Insets 와 같이 씀. iOS + Android useOverlayViewer.
529
+ * 뷰 조건: 화면 크기, 자식 없음, collapsable={false}, pointerEvents="none", 리스트보다 뒤·바보다 앞 순서로 렌더.
530
+ * 자식이 있는 뷰를 넘기면 RN 의 자식 번호가 어긋나 앱이 죽을 수 있습니다.
531
+ */
532
+ underlayViewTag?: number
474
533
  onPageSelected?: (index: number) => void
475
- onViewerWillClose?: () => void
534
+ /**
535
+ * 닫기 시작할 때. 1.2.1 부터 { currentIndex, videoPositions } 를 넘김 — 인자 없이 쓰던 코드도 그대로 동작.
536
+ * (Android 는 useOverlayViewer 뷰어만 videoPositions, 다른 Android 뷰어는 인자 없음)
537
+ */
538
+ onViewerWillClose?: (e?: ViewerWillCloseEvent) => void
476
539
  /**
477
540
  * 상단바에 저장/공유/삭제 아이콘 3개를 표시할지 여부. 기본값 true.
478
541
  */