react-native-compressor 1.12.0 → 1.13.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.
|
@@ -7,10 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
import AVFoundation
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
let AlAsset_Library_Scheme = "assets-library"
|
|
14
10
|
class AudioMain{
|
|
15
11
|
static func compress_audio(_ fileUrl: String, optionMap: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
|
|
16
12
|
do {
|
|
@@ -366,18 +366,10 @@ class ImageCompressor {
|
|
|
366
366
|
var size = CGSize.zero
|
|
367
367
|
var scale: CGFloat = 1
|
|
368
368
|
var resizeMode = RCTResizeMode.contain
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
let assetID = imagePath.replacingOccurrences(of: "ph://", with: "")
|
|
370
|
+
let results = PHAsset.fetchAssets(withLocalIdentifiers: [assetID], options: nil)
|
|
371
371
|
|
|
372
|
-
|
|
373
|
-
assetID = imageURL?.absoluteString ?? ""
|
|
374
|
-
results = PHAsset.fetchAssets(withALAssetURLs: [imageURL!], options: nil)
|
|
375
|
-
} else {
|
|
376
|
-
assetID = imagePath.replacingOccurrences(of: "ph://", with: "")
|
|
377
|
-
results = PHAsset.fetchAssets(withLocalIdentifiers: [assetID], options: nil)
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
guard let asset = results?.firstObject else {
|
|
372
|
+
guard let asset = results.firstObject else {
|
|
381
373
|
return
|
|
382
374
|
}
|
|
383
375
|
|
package/ios/Utils/Utils.swift
CHANGED
|
@@ -17,10 +17,7 @@ class Utils {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
static func makeValidUri(filePath: String) -> String {
|
|
20
|
-
|
|
21
|
-
let absoluteUrl = fileWithUrl.deletingLastPathComponent()
|
|
22
|
-
let fileUrl = "file://\(absoluteUrl.path)/\(fileWithUrl.lastPathComponent)"
|
|
23
|
-
return fileUrl;
|
|
20
|
+
return (filePath.starts(with: "file://") ? URL(string: filePath)! : URL(fileURLWithPath: filePath)).absoluteURL.absoluteString
|
|
24
21
|
}
|
|
25
22
|
|
|
26
23
|
static func getFileSize(from urlString: String, completion: @escaping (NSNumber?, Error?) -> Void) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-compressor",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Compress Image, Video, and Audio same like Whatsapp & Auto/Manual Compression | Background Upload | Download File | Create Video Thumbnail",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|