Bladeren bron

improved code

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 2 jaren geleden
bovenliggende
commit
0c21664280

+ 1 - 2
iOSClient/Main/Collection Common/NCCollectionViewCommon.swift

@@ -972,8 +972,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
 
         if listMenuItems.count > 0 {
             UIMenuController.shared.menuItems = listMenuItems
-            UIMenuController.shared.setTargetRect(CGRect(x: touchPoint.x, y: touchPoint.y, width: 0, height: 0), in: collectionView)
-            UIMenuController.shared.setMenuVisible(true, animated: true)
+            UIMenuController.shared.showMenu(from: collectionView, rect: CGRect(x: touchPoint.x, y: touchPoint.y, width: 0, height: 0))
         }
     }
 

+ 1 - 1
iOSClient/Share/NCShare.swift

@@ -81,7 +81,7 @@ class NCShare: UIViewController, NCShareNetworkingDelegate, NCSharePagingContent
 
         NotificationCenter.default.addObserver(self, selector: #selector(reloadData), name: NSNotification.Name(rawValue: NCGlobal.shared.notificationCenterReloadDataNCShare), object: nil)
 
-        guard let appDelegate = appDelegate, let metadata = metadata else { return }
+        guard let metadata = metadata else { return }
 
         checkSharedWithYou()
 

+ 1 - 2
iOSClient/Transfers/NCTransfers.swift

@@ -124,8 +124,7 @@ class NCTransfers: NCCollectionViewCommon, NCTransferCellDelegate {
             becomeFirstResponder()
             let startTaskItem = UIMenuItem(title: NSLocalizedString("_force_start_", comment: ""), action: #selector(startTask(_:)))
             UIMenuController.shared.menuItems = [startTaskItem]
-            UIMenuController.shared.setTargetRect(CGRect(x: touchPoint.x, y: touchPoint.y, width: 0, height: 0), in: collectionView)
-            UIMenuController.shared.setMenuVisible(true, animated: true)
+            UIMenuController.shared.showMenu(from: collectionView, rect: CGRect(x: touchPoint.x, y: touchPoint.y, width: 0, height: 0))
         }
     }
 

+ 2 - 2
iOSClient/Viewer/NCViewerMedia/NCPlayer/NCSubtitle/NCSubtitlePlayer.swift

@@ -250,7 +250,7 @@ extension NCPlayer {
     private func adjustLabelBottom(label: UILabel) {
         var bottomConstant: CGFloat = bottomConstantPortrait
 
-        switch UIApplication.shared.statusBarOrientation {
+        switch UIApplication.shared.windows.first?.windowScene?.interfaceOrientation {
         case .portrait:
             bottomConstant = bottomConstantLandscape
         case .landscapeLeft, .landscapeRight, .portraitUpsideDown:
@@ -319,7 +319,7 @@ extension NCPlayer {
 
         var bottomConstant: CGFloat = bottomConstantPortrait
 
-        switch UIApplication.shared.statusBarOrientation {
+        switch UIApplication.shared.windows.first?.windowScene?.interfaceOrientation {
         case .portrait, .portraitUpsideDown:
             bottomConstant = bottomConstantLandscape
         case .landscapeLeft, .landscapeRight: