Marino Faggiana 7 жил өмнө
parent
commit
21df418fe5

+ 6 - 6
iOSClient/Library/MWPhotoBrowser/MWPhotoBrowser.m

@@ -957,32 +957,32 @@ static void * MWVideoPlayerObservation = &MWVideoPlayerObservation;
 
 - (CGRect)frameForToolbarAtOrientation:(UIInterfaceOrientation)orientation {
     
-    CGFloat _safeAreaBottom = 0;
+    CGFloat safeAreaBottom = 0;
     CGFloat height = 49;
     
     // iOS 11 safeArea
     if (@available(iOS 11, *)) {
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     } 
 
     if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone && UIInterfaceOrientationIsLandscape(orientation))
         height = 39;
     
-    return CGRectIntegral(CGRectMake(0, self.view.bounds.size.height - height - _safeAreaBottom, self.view.bounds.size.width, height ));
+    return CGRectIntegral(CGRectMake(0, self.view.bounds.size.height - height - safeAreaBottom, self.view.bounds.size.width, height ));
 }
 
 - (CGRect)frameForCaptionView:(MWCaptionView *)captionView atIndex:(NSUInteger)index {
     
     // iOS 11 safeArea
-    CGFloat _safeAreaBottom = 0;
+    CGFloat safeAreaBottom = 0;
     if (@available(iOS 11, *)) {
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
 
     CGRect pageFrame = [self frameForPageAtIndex:index];
     CGSize captionSize = [captionView sizeThatFits:CGSizeMake(pageFrame.size.width, 0)];
     CGRect captionFrame = CGRectMake(pageFrame.origin.x,
-                                     pageFrame.size.height - captionSize.height - (_toolbar.superview?_toolbar.frame.size.height:0) - _safeAreaBottom,
+                                     pageFrame.size.height - captionSize.height - (_toolbar.superview?_toolbar.frame.size.height:0) - safeAreaBottom,
                                      pageFrame.size.width,
                                      captionSize.height);
     return CGRectIntegral(captionFrame);

+ 17 - 17
iOSClient/Main/CCDetail.m

@@ -182,13 +182,13 @@
 
 - (void)createToolbar
 {
-    CGFloat _safeAreaBottom = 0;
+    CGFloat safeAreaBottom = 0;
     
     if (@available(iOS 11, *)) {
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
 
-    _toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - TOOLBAR_HEIGHT - _safeAreaBottom, self.view.bounds.size.width, TOOLBAR_HEIGHT)];
+    _toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom, self.view.bounds.size.width, TOOLBAR_HEIGHT)];
     
     UIBarButtonItem *flexible = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
     UIBarButtonItem *fixedSpaceMini = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
@@ -271,10 +271,10 @@
 - (void)viewDocument
 {
     NSString *fileName;
-    CGFloat _safeAreaBottom = 0;
+    CGFloat safeAreaBottom = 0;
     
     if (@available(iOS 11, *)) {
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
     
     if (_sourceDirectoryLocal) {
@@ -302,7 +302,7 @@
     WKWebViewConfiguration *wkConfig = [[WKWebViewConfiguration alloc] init];
     wkConfig.preferences = wkPreferences;
     
-    self.webView = [[WKWebView alloc] initWithFrame:(CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - _safeAreaBottom)) configuration:wkConfig];
+    self.webView = [[WKWebView alloc] initWithFrame:(CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom)) configuration:wkConfig];
     self.webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
 
     [self.webView setBackgroundColor:[UIColor whiteColor]];
@@ -913,17 +913,17 @@
 - (void)readerPDF:(NSString *)fileName password:(NSString *)password
 {
     ReaderDocument *documentPDF = [ReaderDocument withDocumentFilePath:fileName password:password];
-    CGFloat _safeAreaBottom = 0;
+    CGFloat safeAreaBottom = 0;
     
     if (@available(iOS 11, *)) {
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
     
     if (documentPDF != nil) {
         
         self.readerPDFViewController = [[ReaderViewController alloc] initWithReaderDocument:documentPDF];
         self.readerPDFViewController.delegate = self;
-        self.readerPDFViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - _safeAreaBottom);
+        self.readerPDFViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom);
         [self.readerPDFViewController updateContentViews];
 
         [self addChildViewController:self.readerPDFViewController];
@@ -942,23 +942,23 @@
 
 - (void)handleSingleTapReader
 {
-    UILayoutGuide *_layoutGuide;
-    CGFloat _safeAreaTop = 0;
-    CGFloat _safeAreaBottom = 0;
+    UILayoutGuide *layoutGuide;
+    CGFloat safeAreaTop = 0;
+    CGFloat safeAreaBottom = 0;
     
     if (@available(iOS 11, *)) {
-        _layoutGuide = [UIApplication sharedApplication].delegate.window.safeAreaLayoutGuide;
-        _safeAreaTop = [UIApplication sharedApplication].delegate.window.safeAreaInsets.top;
-        _safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        layoutGuide = [UIApplication sharedApplication].delegate.window.safeAreaLayoutGuide;
+        safeAreaTop = [UIApplication sharedApplication].delegate.window.safeAreaInsets.top;
+        safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
     }
     
     self.navigationController.navigationBarHidden = !self.navigationController.navigationBarHidden;
     _toolbar.hidden = !_toolbar.isHidden;
     
     if (_toolbar.isHidden) {
-        self.readerPDFViewController.view.frame = CGRectMake(0, _safeAreaTop, self.view.bounds.size.width, self.view.bounds.size.height - _safeAreaTop - _safeAreaBottom);
+        self.readerPDFViewController.view.frame = CGRectMake(0, safeAreaTop, self.view.bounds.size.width, self.view.bounds.size.height - safeAreaTop - safeAreaBottom);
     } else {
-        self.readerPDFViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - _safeAreaBottom);
+        self.readerPDFViewController.view.frame = CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - TOOLBAR_HEIGHT - safeAreaBottom);
     }
     [self.readerPDFViewController updateContentViews];
 }

+ 10 - 2
iOSClient/Main/CCMain.m

@@ -3040,7 +3040,8 @@
     _reMenuBackgroundView.frame = CGRectMake(0, navigationBarH, self.view.frame.size.width, self.view.frame.size.height);
         
     [UIView animateWithDuration:0.2 animations:^{
-                
+        
+        CGFloat safeAreaBottom = 0;
         float height = (self.view.frame.size.height + navigationBarH) - (menu.menuView.frame.size.height - self.navigationController.navigationBar.frame.size.height + 3);
         
         if (height < self.tabBarController.tabBar.frame.size.height)
@@ -3048,7 +3049,14 @@
         
         _reMenuBackgroundView.frame = CGRectMake(0, self.view.frame.size.height + navigationBarH, self.view.frame.size.width, - height);
         
-        [self.tabBarController.view addSubview:_reMenuBackgroundView];
+        if (@available(iOS 11, *)) {
+            safeAreaBottom = [UIApplication sharedApplication].delegate.window.safeAreaInsets.bottom;
+        }
+        
+        CGFloat validStartY = self.view.frame.size.height - (self.tabBarController.tabBar.frame.size.height + safeAreaBottom) ;
+        
+        if (_reMenuBackgroundView.frame.origin.y < validStartY)
+            [self.tabBarController.view addSubview:_reMenuBackgroundView];
     }];
 }