INNER CODE UNIT · Swift
pickFile
cometchat/cometchat-uikit-flutter · packages/cometchat_uikit/ios/Classes/SwiftCometchatChatUikitPlugin.swift:285
private func pickFile(args: [String: Any], result: @escaping FlutterResult) {
filePickerResult = result
let type = args["type"] as? String ?? "file"
let allowMultiple = args["allowMultipleSelection"] as? Bool ?? false
DispatchQueue.main.async {
guard let controller = CometchatChatUikitPlugin.uiViewController else { return }
if type == "image" {
self.imagePicker.mediaTypes = ["public.image"]
controller.present(self.imagePicker, animated: true)
} else if type == "video" {
self.imagePicker.mediaTypes = ["public.movie"]
controller.present(self.imagePicker, animated: true)
} else if type == "imagevideo" {
self.imagePicker.mediaTypes = ["public.image", "public.movie"]
controller.present(self.imagePicker, animated: true)
} else {