Browse Source

New bottom sheet for create view

Signed-off-by: Philippe Weidmann <philweidmann@me.com>
Philippe Weidmann 5 years ago
parent
commit
9afebfe9ec

+ 1 - 0
Cartfile

@@ -17,6 +17,7 @@ github "WenchaoD/FSCalendar" "2.8.0"
 github "AssistoLab/DropDown" "v2.3.13"
 github "krzyzanowskim/OpenSSL" "1.0.218"
 github "huri000/SwiftEntryKit" "1.2.3"
+github "scenee/FloatingPanel"
 
 github "https://github.com/marinofaggiana/FastScroll" "master"
 github "https://github.com/marinofaggiana/AFNetworking" "master"

+ 1 - 0
Cartfile.resolved

@@ -20,6 +20,7 @@ github "marinofaggiana/FastScroll" "81967c2309d29bc2c330d422da612160a30bade8"
 github "nextcloud/ios-communication-library" "v0.4"
 github "realm/realm-cocoa" "v4.1.1"
 github "rechsteiner/Parchment" "v1.7.0"
+github "scenee/FloatingPanel" "v1.7.1"
 github "tilltue/TLPhotoPicker" "2.0.7"
 github "weichsel/ZIPFoundation" "0.9.10"
 github "yahoojapan/SwiftyXMLParser" "5.1.0"

+ 25 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -7,6 +7,10 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		371B5A2E23D0B04500FAFAE9 /* MainMenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371B5A2D23D0B04500FAFAE9 /* MainMenuTableViewController.swift */; };
+		371B5A3123D0B71B00FAFAE9 /* MainMenuManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 371B5A3023D0B71A00FAFAE9 /* MainMenuManager.swift */; };
+		371B5A3323D0BD5500FAFAE9 /* FloatingPanel.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 371B5A3223D0BD5500FAFAE9 /* FloatingPanel.framework */; };
+		37ECC83B23D0C7410082EFA2 /* MenuAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 37ECC83A23D0C7400082EFA2 /* MenuAction.swift */; };
 		F700222C1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; };
 		F700222D1EC479840080073F /* Custom.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F700222B1EC479840080073F /* Custom.xcassets */; };
 		F70022B31EC4C9100080073F /* OCActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = F70022671EC4C9100080073F /* OCActivity.m */; };
@@ -660,6 +664,10 @@
 		08EA97451E6554FC004C83FA /* FirebaseCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseCore.framework; sourceTree = "<group>"; };
 		08EA97461E6554FC004C83FA /* FirebaseInstanceID.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FirebaseInstanceID.framework; sourceTree = "<group>"; };
 		08EA97471E6554FC004C83FA /* GoogleToolboxForMac.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = GoogleToolboxForMac.framework; sourceTree = "<group>"; };
+		371B5A2D23D0B04500FAFAE9 /* MainMenuTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuTableViewController.swift; sourceTree = "<group>"; };
+		371B5A3023D0B71A00FAFAE9 /* MainMenuManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuManager.swift; sourceTree = "<group>"; };
+		371B5A3223D0BD5500FAFAE9 /* FloatingPanel.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FloatingPanel.framework; path = Carthage/Build/iOS/FloatingPanel.framework; sourceTree = "<group>"; };
+		37ECC83A23D0C7400082EFA2 /* MenuAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuAction.swift; sourceTree = "<group>"; };
 		F700222B1EC479840080073F /* Custom.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Custom.xcassets; sourceTree = "<group>"; };
 		F70022661EC4C9100080073F /* OCActivity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OCActivity.h; sourceTree = "<group>"; };
 		F70022671EC4C9100080073F /* OCActivity.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OCActivity.m; sourceTree = "<group>"; };
@@ -1484,6 +1492,7 @@
 				F7D4B68A2295663D000C2C86 /* FIRAnalyticsConnector.framework in Frameworks */,
 				F700510322DF6897003A3356 /* Parchment.framework in Frameworks */,
 				F7D4B6882295663D000C2C86 /* GoogleUtilities.framework in Frameworks */,
+				371B5A3323D0BD5500FAFAE9 /* FloatingPanel.framework in Frameworks */,
 				F70F2BA5225F2D8900EBB73E /* ZIPFoundation.framework in Frameworks */,
 				F7D4B6972295666E000C2C86 /* GoogleAPIClientForREST.framework in Frameworks */,
 			);
@@ -1492,6 +1501,16 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		371B5A2F23D0B04B00FAFAE9 /* MainMenu */ = {
+			isa = PBXGroup;
+			children = (
+				371B5A2D23D0B04500FAFAE9 /* MainMenuTableViewController.swift */,
+				371B5A3023D0B71A00FAFAE9 /* MainMenuManager.swift */,
+				37ECC83A23D0C7400082EFA2 /* MenuAction.swift */,
+			);
+			path = MainMenu;
+			sourceTree = "<group>";
+		};
 		F70022561EC4C9100080073F /* OCCommunicationLib */ = {
 			isa = PBXGroup;
 			children = (
@@ -1586,6 +1605,7 @@
 				F78ACD3E21903BA20088454D /* Cell */,
 				F7DFB7E9219C5A0500680748 /* Create cloud */,
 				F78ACD4D219043E70088454D /* Layout */,
+				371B5A2F23D0B04B00FAFAE9 /* MainMenu */,
 				F78ACD50219046AC0088454D /* Section */,
 				F7D0E65E1BC5042E008D989A /* CCDetail.h */,
 				F7D0E65F1BC5042E008D989A /* CCDetail.m */,
@@ -2838,6 +2858,7 @@
 		F7FC7D541DC1F93700BB2C6A /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				371B5A3223D0BD5500FAFAE9 /* FloatingPanel.framework */,
 				F765608A23BF80A400765969 /* SwiftEntryKit.framework */,
 				F765608623BF806C00765969 /* QuickLayout.framework */,
 				F716FE7723795E5000FABE50 /* NCCommunication.framework */,
@@ -3301,6 +3322,7 @@
 				"$(SRCROOT)/Carthage/Build/iOS/SwiftyJSON.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/QuickLayout.framework",
 				"$(SRCROOT)/Carthage/Build/iOS/SwiftEntryKit.framework",
+				"$(SRCROOT)/Carthage/Build/iOS/FloatingPanel.framework",
 			);
 			outputPaths = (
 			);
@@ -3485,7 +3507,9 @@
 				F754EECA21772B6100BB1CDF /* DropUpMenu.swift in Sources */,
 				F77B0E041D118A16002130FE /* UIImage+animatedGIF.m in Sources */,
 				F7D423881F0596C6009C9782 /* ReaderThumbView.m in Sources */,
+				37ECC83B23D0C7410082EFA2 /* MenuAction.swift in Sources */,
 				F73B4EFE1F470D9100BBEE4B /* LangHungarianModel.cpp in Sources */,
+				371B5A3123D0B71B00FAFAE9 /* MainMenuManager.swift in Sources */,
 				F7D4238A1F0596C6009C9782 /* ThumbsMainToolbar.m in Sources */,
 				F769454022E9F077000A798A /* NCSharePaging.swift in Sources */,
 				F760F79921F21F61006B1A73 /* CropViewController.swift in Sources */,
@@ -3509,6 +3533,7 @@
 				F762CB0C1EACB66200B38484 /* XLFormSectionDescriptor.m in Sources */,
 				F760F79421F21F61006B1A73 /* ResizeControl.swift in Sources */,
 				F7DFB7F2219C5C0000680748 /* NCCreateFormUploadFileText.swift in Sources */,
+				371B5A2E23D0B04500FAFAE9 /* MainMenuTableViewController.swift in Sources */,
 				F762CB861EACB81000B38484 /* RECommonFunctions.m in Sources */,
 				F76C6F8E21943C8C0063591B /* NCActionSheetHeader.swift in Sources */,
 				F760F79121F21F61006B1A73 /* EmojiCollectionViewCell.swift in Sources */,

+ 2 - 1
iOSClient/AppDelegate.m

@@ -872,7 +872,8 @@ PKPushRegistry *pushRegistry;
     tableDirectory *tableDirectory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", self.activeAccount, self.activeMain.serverUrl]];
     
     if ([tableDirectory.permissions containsString:@"CK"]) {
-        (void)[[NCCreateMenuAdd alloc] initWithViewController:self.window.rootViewController view:[(UIButton *)sender superview]];
+        [[MainMenuManager sharedInstance] showMenuInViewController:self.window.rootViewController];
+        //(void)[[NCCreateMenuAdd alloc] initWithViewController:self.window.rootViewController view:[(UIButton *)sender superview]];
     } else {
         [[NCContentPresenter shared] messageNotification:@"_warning_" description:@"_no_permission_add_file_" delay:k_dismissAfterSecond type:messageTypeInfo errorCode:0];
     }

+ 54 - 3
iOSClient/Main/Main.storyboard

@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4IE-mo-rkp">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="4IE-mo-rkp">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment version="4352" identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -162,7 +162,7 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <imageView userInteractionEnabled="NO" tag="999" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" preservesSuperviewLayoutMargins="YES" image="logo" translatesAutoresizingMaskIntoConstraints="NO" id="zlU-MP-ZVs">
-                                <rect key="frame" x="95.5" y="369.5" width="223" height="157.5"/>
+                                <rect key="frame" x="-16" y="290.5" width="446" height="315"/>
                             </imageView>
                         </subviews>
                         <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -237,6 +237,57 @@
             </objects>
             <point key="canvasLocation" x="5857" y="327"/>
         </scene>
+        <!--Main Menu Table View Controller-->
+        <scene sceneID="dK1-c7-3On">
+            <objects>
+                <tableViewController storyboardIdentifier="MainMenuTableViewController" id="vca-n7-IIz" customClass="MainMenuTableViewController" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                    <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="60" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="NK9-kS-MOD">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+                        <prototypes>
+                            <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="menuActionCell" rowHeight="60" id="EQz-WZ-NOm">
+                                <rect key="frame" x="0.0" y="28" width="414" height="60"/>
+                                <autoresizingMask key="autoresizingMask"/>
+                                <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="EQz-WZ-NOm" id="MXz-fX-a54">
+                                    <rect key="frame" x="0.0" y="0.0" width="414" height="60"/>
+                                    <autoresizingMask key="autoresizingMask"/>
+                                    <subviews>
+                                        <imageView clipsSubviews="YES" userInteractionEnabled="NO" tag="1" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Zd5-qC-6Ie">
+                                            <rect key="frame" x="8" y="14" width="32" height="32"/>
+                                            <constraints>
+                                                <constraint firstAttribute="height" constant="32" id="AYg-rj-RAh"/>
+                                                <constraint firstAttribute="width" constant="32" id="TcB-NO-Ncg"/>
+                                            </constraints>
+                                        </imageView>
+                                        <label opaque="NO" userInteractionEnabled="NO" tag="2" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J4O-BZ-xXZ">
+                                            <rect key="frame" x="56" y="19.5" width="330" height="21"/>
+                                            <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                            <nil key="textColor"/>
+                                            <nil key="highlightedColor"/>
+                                        </label>
+                                    </subviews>
+                                    <constraints>
+                                        <constraint firstItem="Zd5-qC-6Ie" firstAttribute="leading" secondItem="MXz-fX-a54" secondAttribute="leading" constant="8" id="HNF-b3-0lw"/>
+                                        <constraint firstItem="J4O-BZ-xXZ" firstAttribute="centerY" secondItem="MXz-fX-a54" secondAttribute="centerY" id="OnH-41-zTd"/>
+                                        <constraint firstAttribute="trailingMargin" secondItem="J4O-BZ-xXZ" secondAttribute="trailing" constant="8" id="iY7-5r-hah"/>
+                                        <constraint firstItem="J4O-BZ-xXZ" firstAttribute="leading" secondItem="Zd5-qC-6Ie" secondAttribute="trailing" constant="16" id="nqb-ga-0n3"/>
+                                        <constraint firstItem="Zd5-qC-6Ie" firstAttribute="centerY" secondItem="MXz-fX-a54" secondAttribute="centerY" id="vQ3-Yx-pNG"/>
+                                    </constraints>
+                                </tableViewCellContentView>
+                            </tableViewCell>
+                        </prototypes>
+                        <sections/>
+                        <connections>
+                            <outlet property="dataSource" destination="vca-n7-IIz" id="oDQ-s9-30j"/>
+                            <outlet property="delegate" destination="vca-n7-IIz" id="1ab-Sp-XUo"/>
+                        </connections>
+                    </tableView>
+                </tableViewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="BsJ-MF-U6v" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="6836" y="297"/>
+        </scene>
         <!--Favorites-->
         <scene sceneID="33n-4d-goO">
             <objects>

+ 37 - 0
iOSClient/Main/MainMenu/MainMenuManager.swift

@@ -0,0 +1,37 @@
+//
+//  MainMenuManager.swift
+//  Nextcloud
+//
+//  Created by Philippe Weidmann on 16.01.20.
+//  Copyright © 2020 TWS. All rights reserved.
+//
+
+import FloatingPanel
+
+@objc class MainMenuManager: NSObject {
+    
+    
+    @objc public static let sharedInstance = MainMenuManager()
+    
+    private override init(){
+    
+    }
+    
+    @objc public func showMenuIn(viewController: UIViewController){
+        let mainMenuViewController = UIStoryboard.init(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "MainMenuTableViewController") as! MainMenuTableViewController
+        
+        let fpc = FloatingPanelController()
+        fpc.surfaceView.grabberHandle.isHidden = true
+        fpc.delegate = mainMenuViewController
+        fpc.set(contentViewController: mainMenuViewController)
+        fpc.track(scrollView: mainMenuViewController.tableView)
+        fpc.isRemovalInteractionEnabled = true
+        if #available(iOS 11, *) {
+            fpc.surfaceView.cornerRadius = 16
+        } else {
+            fpc.surfaceView.cornerRadius = 0
+        }
+
+        viewController.present(fpc, animated: true, completion: nil)
+    }
+}

+ 220 - 0
iOSClient/Main/MainMenu/MainMenuTableViewController.swift

@@ -0,0 +1,220 @@
+//
+//  MainMenuTableViewController.swift
+//  Nextcloud
+//
+//  Created by Philippe Weidmann on 16.01.20.
+//  Copyright © 2020 TWS. All rights reserved.
+//
+
+import UIKit
+import FloatingPanel
+
+class MainMenuTableViewController: UITableViewController{
+    
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var isNextcloudTextAvailable = false
+    var actions = [MenuAction]()
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        if self.appDelegate.reachability.isReachable() && NCBrandBeta.shared.directEditing && NCManageDatabase.sharedInstance.getDirectEditingCreators(account: self.appDelegate.activeAccount) != nil {
+            isNextcloudTextAvailable = true
+        }
+        
+        actions.append(MenuAction(title: NSLocalizedString("_upload_photos_videos_", comment: ""), value: 10, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_photo"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        
+        actions.append(MenuAction(title: NSLocalizedString("_upload_file_", comment: ""), value: 20, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "file"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        
+        if NCBrandOptions.sharedInstance.use_imi_viewer {
+            actions.append(MenuAction(title: NSLocalizedString("_im_create_new_file", tableName: "IMLocalizable", bundle: Bundle.main, value: "", comment: ""), value: 21, icon: CCGraphics.scale(UIImage.init(named: "imagemeter"), to: CGSize(width: 25, height: 25), isAspectRation: true)))
+        }
+        
+        if isNextcloudTextAvailable {
+            actions.append(MenuAction(title: NSLocalizedString("_create_nextcloudtext_document_", comment: ""), value: 31, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        } else {
+            actions.append(MenuAction(title: NSLocalizedString("_upload_file_text_", comment: ""), value: 30, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "file_txt"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+        }
+        
+        #if !targetEnvironment(simulator)
+                if #available(iOS 11.0, *) {
+                    actions.append(MenuAction(title: NSLocalizedString("_scans_document_", comment: ""), value: 40, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "scan"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+                }
+        #endif
+        
+        actions.append(MenuAction(title: NSLocalizedString("_create_voice_memo_", comment: ""), value: 50, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "microphone"), width: 50, height: 50, color: NCBrandColor.sharedInstance.icon)))
+
+        actions.append(MenuAction(title: NSLocalizedString("_create_folder_", comment: ""), value: 60, icon: CCGraphics.changeThemingColorImage(UIImage.init(named: "folder"), width: 50, height: 50, color: NCBrandColor.sharedInstance.brandElement)))
+        
+        if let richdocumentsMimetypes = NCManageDatabase.sharedInstance.getRichdocumentsMimetypes(account: appDelegate.activeAccount) {
+            if richdocumentsMimetypes.count > 0 {
+                actions.append(MenuAction(title: NSLocalizedString("_create_new_document_", comment: ""), value: 70, icon: UIImage.init(named: "create_file_document")!))
+                actions.append(MenuAction(title: NSLocalizedString("_create_new_spreadsheet_", comment: ""), value: 80, icon: UIImage(named: "create_file_xls")!))
+                actions.append(MenuAction(title: NSLocalizedString("_create_new_presentation_", comment: ""), value: 90, icon: UIImage(named: "create_file_ppt")!))
+            }
+        }
+    }
+    
+    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+        let action = actions[indexPath.row]
+        
+        self.dismiss(animated: true, completion: nil)
+        if action.value == 10 {
+            self.appDelegate.activeMain.openAssetsPickerController()
+        }
+        if action.value == 20 { self.appDelegate.activeMain.openImportDocumentPicker() }
+        if action.value == 21 {
+            _ = IMCreate.init(serverUrl: self.appDelegate.activeMain.serverUrl)
+        }
+        if action.value == 30 {
+            let storyboard = UIStoryboard(name: "NCText", bundle: nil)
+            let controller = storyboard.instantiateViewController(withIdentifier: "NCText")
+            controller.modalPresentationStyle = UIModalPresentationStyle.pageSheet
+            self.appDelegate.activeMain.present(controller, animated: true, completion: nil)
+        }
+        if action.value == 31 {
+            guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController() else {
+                return
+            }
+            navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+            
+            let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
+            viewController.typeTemplate = k_nextcloudtext_document
+            viewController.serverUrl = self.appDelegate.activeMain.serverUrl
+            viewController.titleForm = NSLocalizedString("_create_nextcloudtext_document_", comment: "")
+            
+            self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+        }
+        if action.value == 40 {
+            if #available(iOS 11.0, *) {
+                NCCreateScanDocument.sharedInstance.openScannerDocument(viewController: self.appDelegate.activeMain)
+            }
+        }
+        
+        if action.value == 50 { NCMainCommon.sharedInstance.startAudioRecorder() }
+        
+        if action.value == 60 { self.appDelegate.activeMain.createFolder() }
+        
+        if action.value == 70 {
+            guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController() else {
+                return
+            }
+            navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+            
+            let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
+            viewController.typeTemplate = k_richdocument_document
+            viewController.serverUrl = self.appDelegate.activeMain.serverUrl
+            viewController.titleForm = NSLocalizedString("_create_new_document_", comment: "")
+            
+            self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+        }
+        if action.value == 80 {
+            guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController() else {
+                return
+            }
+            navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+            
+            let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
+            viewController.typeTemplate = k_richdocument_spreadsheet
+            viewController.serverUrl = self.appDelegate.activeMain.serverUrl
+            viewController.titleForm = NSLocalizedString("_create_new_spreadsheet_", comment: "")
+            
+            self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+        }
+        if action.value == 90 {
+            guard let navigationController = UIStoryboard(name: "NCCreateFormUploadDocuments", bundle: nil).instantiateInitialViewController() else {
+                return
+            }
+            navigationController.modalPresentationStyle = UIModalPresentationStyle.formSheet
+            
+            let viewController = (navigationController as! UINavigationController).topViewController as! NCCreateFormUploadDocuments
+            viewController.typeTemplate = k_richdocument_presentation
+            viewController.serverUrl = self.appDelegate.activeMain.serverUrl
+            viewController.titleForm = NSLocalizedString("_create_new_presentation_", comment: "")
+            
+            self.appDelegate.window.rootViewController?.present(navigationController, animated: true, completion: nil)
+        }
+                
+    }
+
+    // MARK: - Table view data source
+
+    override func numberOfSections(in tableView: UITableView) -> Int {
+        return 1
+    }
+
+    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+        return actions.count
+    }
+
+    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+        let cell = tableView.dequeueReusableCell(withIdentifier: "menuActionCell", for: indexPath)
+        
+        let action = actions[indexPath.row]
+        let actionIconView = cell.viewWithTag(1) as! UIImageView
+        let actionNameLabel = cell.viewWithTag(2) as! UILabel
+            
+        actionIconView.image = action.icon
+        actionNameLabel.text = action.title
+            
+        return cell
+    }
+
+}
+extension MainMenuTableViewController: FloatingPanelControllerDelegate{
+    
+    func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? {
+        return MainMenuFloatingPanelLayout(height: self.actions.count * 60)
+    }
+    
+    func floatingPanel(_ vc: FloatingPanelController, behaviorFor newCollection: UITraitCollection) -> FloatingPanelBehavior? {
+        return MainMenuFloatingPanelBehavior()
+    }
+
+}
+
+class MainMenuFloatingPanelLayout: FloatingPanelLayout {
+    
+    let height: CGFloat
+    
+    init(height: Int){
+        self.height = CGFloat(height)
+    }
+    
+    var initialPosition: FloatingPanelPosition {
+        return .tip
+    }
+    
+    var supportedPositions: Set<FloatingPanelPosition> {
+        return [.half]
+    }
+    
+    func insetFor(position: FloatingPanelPosition) -> CGFloat? {
+        switch position {
+        case .half: return height
+        case .tip: return height
+        default: return nil
+        }
+    }
+    
+
+    func backdropAlphaFor(position: FloatingPanelPosition) -> CGFloat {
+        return 0.5
+    }
+}
+
+public class MainMenuFloatingPanelBehavior: FloatingPanelBehavior {
+
+    public func addAnimator(_ fpc: FloatingPanelController, to: FloatingPanelPosition) -> UIViewPropertyAnimator {
+        return UIViewPropertyAnimator(duration: 0.1, curve: .easeInOut)
+    }
+
+    public func removeAnimator(_ fpc: FloatingPanelController, from: FloatingPanelPosition) -> UIViewPropertyAnimator {
+        return UIViewPropertyAnimator(duration: 0.1, curve: .easeInOut)
+    }
+
+    public func moveAnimator(_ fpc: FloatingPanelController, from: FloatingPanelPosition, to: FloatingPanelPosition) -> UIViewPropertyAnimator {
+        return UIViewPropertyAnimator(duration: 0.1, curve: .easeInOut)
+    }
+
+}

+ 22 - 0
iOSClient/Main/MainMenu/MenuAction.swift

@@ -0,0 +1,22 @@
+//
+//  MainMenuAction.swift
+//  Nextcloud
+//
+//  Created by Philippe Weidmann on 16.01.20.
+//  Copyright © 2020 TWS. All rights reserved.
+//
+
+import Foundation
+
+class MenuAction {
+    
+    let title: String
+    let icon: UIImage
+    let value: Int
+    
+    init(title: String, value: Int, icon: UIImage) {
+        self.title = title
+        self.icon = icon
+        self.value = value
+    }
+}