Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions ios/Audio/AudioMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@


import AVFoundation



let AlAsset_Library_Scheme = "assets-library"
class AudioMain{
static func compress_audio(_ fileUrl: String, optionMap: NSDictionary, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
do {
Expand Down
14 changes: 3 additions & 11 deletions ios/Image/ImageCompressor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,18 +366,10 @@ class ImageCompressor {
var size = CGSize.zero
var scale: CGFloat = 1
var resizeMode = RCTResizeMode.contain
var assetID = ""
var results: PHFetchResult<PHAsset>?
let assetID = imagePath.replacingOccurrences(of: "ph://", with: "")
let results = PHAsset.fetchAssets(withLocalIdentifiers: [assetID], options: nil)

if imageURL?.scheme?.caseInsensitiveCompare("assets-library") == .orderedSame {
assetID = imageURL?.absoluteString ?? ""
results = PHAsset.fetchAssets(withALAssetURLs: [imageURL!], options: nil)
} else {
assetID = imagePath.replacingOccurrences(of: "ph://", with: "")
results = PHAsset.fetchAssets(withLocalIdentifiers: [assetID], options: nil)
}

guard let asset = results?.firstObject else {
guard let asset = results.firstObject else {
return
}

Expand Down
5 changes: 1 addition & 4 deletions ios/Utils/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ class Utils {
}

static func makeValidUri(filePath: String) -> String {
let fileWithUrl = URL(fileURLWithPath: filePath)
let absoluteUrl = fileWithUrl.deletingLastPathComponent()
let fileUrl = "file://\(absoluteUrl.path)/\(fileWithUrl.lastPathComponent)"
return fileUrl;
return (filePath.starts(with: "file://") ? URL(string: filePath)! : URL(fileURLWithPath: filePath)).absoluteURL.absoluteString
}

static func getFileSize(from urlString: String, completion: @escaping (NSNumber?, Error?) -> Void) {
Expand Down
1 change: 0 additions & 1 deletion ios/Video/VideoMain.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import AssetsLibrary
import AVFoundation
import Photos
import MobileCoreServices
Expand Down
Loading