Update SwiftFlutterSmsPlugin.swift
This commit is contained in:
parent
a7afdf6218
commit
7271ee6d37
@ -32,18 +32,4 @@ public class SwiftFlutterSmsPlugin: NSObject, FlutterPlugin, UINavigationControl
|
||||
UIApplication.shared.keyWindow?.rootViewController?.dismiss(animated: true, completion: nil)
|
||||
message = "Sent!"
|
||||
}
|
||||
|
||||
private func saveToFile(image: UIImage) -> Any {
|
||||
guard let data = UIImageJPEGRepresentation(image, 1.0) else {
|
||||
return FlutterError(code: "image_encoding_error", message: "Could not read image", details: nil)
|
||||
}
|
||||
let tempDir = NSTemporaryDirectory()
|
||||
let imageName = "image_picker_\(ProcessInfo().globallyUniqueString).jpg"
|
||||
let filePath = tempDir.appending(imageName)
|
||||
if FileManager.default.createFile(atPath: filePath, contents: data, attributes: nil) {
|
||||
return filePath
|
||||
} else {
|
||||
return FlutterError(code: "image_save_failed", message: "Could not save image to disk", details: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user