Browse Source

User experience improvement #453

Marino Faggiana 7 years ago
parent
commit
270bf1779f

+ 1 - 1
iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.h

@@ -37,7 +37,7 @@
 - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser deleteButtonPressedForPhotoAtIndex:(NSUInteger)index deleteButton:(UIBarButtonItem *)deleteButton;
 - (BOOL)photoBrowser:(MWPhotoBrowser *)photoBrowser isPhotoSelectedAtIndex:(NSUInteger)index;
 - (void)photoBrowser:(MWPhotoBrowser *)photoBrowser photoAtIndex:(NSUInteger)index selectedChanged:(BOOL)selected;
-- (void)photoBrowserDidFinishModalPresentation:(MWPhotoBrowser *)photoBrowser;
+- (void)photoBrowserDidFinishPresentation:(MWPhotoBrowser *)photoBrowser;
 
 - (void)setControlsHidden:(BOOL)hidden animated:(BOOL)animated permanent:(BOOL)permanent;
 

+ 5 - 9
iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.m

@@ -1373,15 +1373,11 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
 #pragma mark - Misc
 
 - (void)doneButtonPressed:(id)sender {
-    // Only if we're modal and there's a done button
-    if (_doneButton) {    
-        // Dismiss view controller
-        if ([_delegate respondsToSelector:@selector(photoBrowserDidFinishModalPresentation:)]) {
-            // Call delegate method and let them dismiss us
-            [_delegate photoBrowserDidFinishModalPresentation:self];
-        } else  {
-            [self dismissViewControllerAnimated:YES completion:nil];
-        }
+   
+    // Dismiss view controller
+    if ([_delegate respondsToSelector:@selector(photoBrowserDidFinishPresentation:)]) {
+        // Call delegate method and let them dismiss us
+        [_delegate photoBrowserDidFinishPresentation:self];
     }
 }
 

+ 6 - 0
iOSClient/Main/CCDetail.m

@@ -599,6 +599,12 @@
     [self.parentViewController presentViewController:alertController animated:YES completion:NULL];
 }
 
+- (void)photoBrowserDidFinishPresentation:(MWPhotoBrowser *)photoBrowser
+{
+    [self removeAllView];
+    [self.navigationController popViewControllerAnimated:YES];
+}
+
 - (void)triggerProgressTask:(NSNotification *)notification
 {
     NSDictionary *dict = notification.userInfo;