@@ -236,7 +236,7 @@ export class MySwifty extends SwiftyCamViewController {
236
236
}
237
237
238
238
public closePicker ( ) {
239
- rootVC ( ) . dismissViewControllerAnimatedCompletion ( true , ( ) => {
239
+ this . getParentViewController ( ) . dismissViewControllerAnimatedCompletion ( true , ( ) => {
240
240
this . pickerDelegate = null ;
241
241
} ) ;
242
242
}
@@ -418,6 +418,7 @@ export class MySwifty extends SwiftyCamViewController {
418
418
this . _imageConfirmBg . addSubview ( retakeBtn ) ;
419
419
this . _imageConfirmBg . addSubview ( saveBtn ) ;
420
420
this . view . addSubview ( this . _imageConfirmBg ) ;
421
+ this . _owner . get ( ) . sendEvent ( CameraPlus . confirmScreenShownEvent ) ;
421
422
} else {
422
423
// no confirmation - just save
423
424
this . savePhoto ( ) ;
@@ -429,6 +430,7 @@ export class MySwifty extends SwiftyCamViewController {
429
430
if ( this . _imageConfirmBg ) {
430
431
this . _imageConfirmBg . removeFromSuperview ( ) ;
431
432
this . _imageConfirmBg = null ;
433
+ this . _owner . get ( ) . sendEvent ( CameraPlus . confirmScreenDismissedEvent ) ;
432
434
}
433
435
}
434
436
@@ -450,6 +452,15 @@ export class MySwifty extends SwiftyCamViewController {
450
452
return UIImagePickerController . isSourceTypeAvailable ( UIImagePickerControllerSourceType . Camera ) ;
451
453
}
452
454
455
+ public getParentViewController ( ) {
456
+ var responder : UIResponder = this . view ;
457
+ do {
458
+ responder = responder . nextResponder ;
459
+ } while ( responder && ! ( NSStringFromClass ( responder . class ( ) ) === 'UIViewControllerImpl' ) ) ;
460
+
461
+ return < UIViewController > responder ;
462
+ }
463
+
453
464
public chooseFromLibrary ( options ?: IChooseOptions ) : Promise < any > {
454
465
return new Promise ( ( resolve , reject ) => {
455
466
this . _pickerDelegate = null ;
@@ -493,7 +504,7 @@ export class MySwifty extends SwiftyCamViewController {
493
504
494
505
imagePickerController . modalPresentationStyle = UIModalPresentationStyle . CurrentContext ;
495
506
496
- rootVC ( ) . presentViewControllerAnimatedCompletion ( imagePickerController , true , null ) ;
507
+ this . getParentViewController ( ) . presentViewControllerAnimatedCompletion ( imagePickerController , true , null ) ;
497
508
} ) ;
498
509
}
499
510
@@ -733,11 +744,6 @@ export class CameraPlus extends CameraPlusBase {
733
744
}
734
745
}
735
746
736
- const rootVC = function ( ) {
737
- let appWindow = UIApplication . sharedApplication . keyWindow ;
738
- return appWindow . rootViewController ;
739
- } ;
740
-
741
747
const createButton = function (
742
748
target : any ,
743
749
frame : CGRect ,
0 commit comments