@@ -18,8 +18,6 @@ class MultipleImagePicker: NSObject, TLPhotosPickerViewControllerDelegate,UINavi
1818 var videoAssets = [ PHAsset] ( )
1919 var videoCount = 0
2020 // controller
21- var controller = UIViewController ( )
22-
2321
2422
2523
@@ -52,11 +50,14 @@ class MultipleImagePicker: NSObject, TLPhotosPickerViewControllerDelegate,UINavi
5250 }
5351
5452 func dismissComplete( ) {
55-
53+ DispatchQueue . main. async {
54+ self . getTopMostViewController ( ) ? . dismiss ( animated: true , completion: nil )
55+ }
5656 }
5757
5858 @objc ( openPicker: withResolver: withRejecter: )
5959 func openPicker( options: NSDictionary , resolve: @escaping RCTPromiseResolveBlock , reject: @escaping RCTPromiseRejectBlock ) -> Void {
60+ videoCount = 0
6061 self . setConfiguration ( options: options, resolve: resolve, reject: reject)
6162 let viewController = CustomPhotoPickerViewController ( )
6263 viewController. delegate = self
@@ -70,7 +71,6 @@ class MultipleImagePicker: NSObject, TLPhotosPickerViewControllerDelegate,UINavi
7071 viewController. modalTransitionStyle = . coverVertical
7172 viewController. modalPresentationStyle = . overCurrentContext
7273
73- controller = viewController
7474 DispatchQueue . main. async {
7575 self . getTopMostViewController ( ) ? . present ( viewController, animated: true , completion: nil )
7676 }
@@ -275,7 +275,7 @@ class MultipleImagePicker: NSObject, TLPhotosPickerViewControllerDelegate,UINavi
275275 print ( " maxVideo " , maxVideo)
276276 if ( phAsset. mediaType == . video) {
277277 if ( videoCount == maxVideo as! Int ) {
278- showExceededMaximumAlert ( vc: self . controller , isVideo: true )
278+ showExceededMaximumAlert ( vc: self . getTopMostViewController ( ) ! , isVideo: true )
279279 return false
280280 }
281281 videoCount += 1
0 commit comments