marinofaggiana 5 gadi atpakaļ
vecāks
revīzija
745ebe4d10

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -548,6 +548,7 @@
 		F7E0E1DE22327DBA006B0911 /* NCAudioRecorderViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0E1DD22327DBA006B0911 /* NCAudioRecorderViewController.storyboard */; };
 		F7E4D9C422ED929B003675FD /* NCShareComments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareComments.swift */; };
 		F7E9C41B20F4CA870040CF18 /* CCTransfers.m in Sources */ = {isa = PBXBuildFile; fileRef = F7E9C41820F4CA870040CF18 /* CCTransfers.m */; };
+		F7F4B1D823C74B3E00D82A6E /* NCMainChangeHeightWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7F4B1D723C74B3E00D82A6E /* NCMainChangeHeightWebView.swift */; };
 		F7F54CE51E5B14C700E19C62 /* ImageError.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CAF1E5B14C700E19C62 /* ImageError.png */; };
 		F7F54CE61E5B14C700E19C62 /* ImageError@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CB01E5B14C700E19C62 /* ImageError@2x.png */; };
 		F7F54CE71E5B14C700E19C62 /* ImageError@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = F7F54CB11E5B14C700E19C62 /* ImageError@3x.png */; };
@@ -1345,6 +1346,7 @@
 		F7E9C41520F4CA870040CF18 /* CCTransfers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCTransfers.h; sourceTree = "<group>"; };
 		F7E9C41820F4CA870040CF18 /* CCTransfers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCTransfers.m; sourceTree = "<group>"; };
 		F7F0617A1BAACDD300846525 /* CryptoCloud.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoCloud.pch; sourceTree = "<group>"; };
+		F7F4B1D723C74B3E00D82A6E /* NCMainChangeHeightWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMainChangeHeightWebView.swift; sourceTree = "<group>"; };
 		F7F54CAF1E5B14C700E19C62 /* ImageError.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ImageError.png; sourceTree = "<group>"; };
 		F7F54CB01E5B14C700E19C62 /* ImageError@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ImageError@2x.png"; sourceTree = "<group>"; };
 		F7F54CB11E5B14C700E19C62 /* ImageError@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ImageError@3x.png"; sourceTree = "<group>"; };
@@ -1590,6 +1592,7 @@
 				F792A77B1BC7C45400C9388E /* CCSplit.h */,
 				F792A77C1BC7C45400C9388E /* CCSplit.m */,
 				F7D6650620FF341600BFBA9E /* NCMainCommon.swift */,
+				F7F4B1D723C74B3E00D82A6E /* NCMainChangeHeightWebView.swift */,
 				F73F537E1E929C8500F8678D /* CCMore.swift */,
 				F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */,
 			);
@@ -3652,6 +3655,7 @@
 				F7D4238C1F0596C6009C9782 /* UIXToolbarView.m in Sources */,
 				F7233CEE23A24F990011D898 /* NCViewerNextcloudText.swift in Sources */,
 				F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */,
+				F7F4B1D823C74B3E00D82A6E /* NCMainChangeHeightWebView.swift in Sources */,
 				F726EEEC1FED1C820030B9C8 /* NCEndToEndInitialize.swift in Sources */,
 				F79A65C62191D95E00FF6DCC /* NCSelect.swift in Sources */,
 				F7E0E1DC22327885006B0911 /* NCAudioRecorderViewController.swift in Sources */,

+ 15 - 0
iOSClient/Images.xcassets/dragHorizontal.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "filename" : "dragHorizontal.pdf"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

+ 55 - 0
iOSClient/Images.xcassets/dragHorizontal.imageset/dragHorizontal.pdf

@@ -0,0 +1,55 @@
+%PDF-1.4
+%Óëéá
+1 0 obj
+<</Creator (Mozilla/5.0 \(Macintosh; Intel Mac OS X 10_15_2\) AppleWebKit/537.36 \(KHTML, like Gecko\) BoxySVG/3.33.1 Chrome/73.0.3683.121 Electron/5.0.13 Safari/537.36)
+/Producer (Skia/PDF m73)
+/CreationDate (D:20200109144732+00'00')
+/ModDate (D:20200109144732+00'00')>>
+endobj
+3 0 obj
+<</ca 1
+/BM /Normal>>
+endobj
+4 0 obj
+<</Filter /FlateDecode
+/Length 109>> stream
+xœÓ32¶ ÔÕCâ)$çrr�d�
 DQ*W¸–BPÜÔDÏÐ,ÀzQy@�úîÆ
+éÅ\F†
+††
+¹\Æ *HYI  ”‚hcˆc°CS¨¨)\6‡+ƒ+�+™-#3
+endstream
+endobj
+2 0 obj
+<</Type /Page
+/Resources <</ProcSets [/PDF /Text /ImageB /ImageC /ImageI]
+/ExtGState <</G3 3 0 R>>>>
+/MediaBox [0 0 312 312]
+/Contents 4 0 R
+/StructParents 0
+/Parent 5 0 R>>
+endobj
+5 0 obj
+<</Type /Pages
+/Count 1
+/Kids [2 0 R]>>
+endobj
+6 0 obj
+<</Type /Catalog
+/Pages 5 0 R>>
+endobj
+xref
+0 7
+0000000000 65535 f 
+0000000015 00000 n 
+0000000518 00000 n 
+0000000302 00000 n 
+0000000339 00000 n 
+0000000707 00000 n 
+0000000762 00000 n 
+trailer
+<</Size 7
+/Root 6 0 R
+/Info 1 0 R>>
+startxref
+809
+%%EOF

+ 6 - 0
iOSClient/Main/CCMain.h

@@ -43,10 +43,16 @@
 #import <MGSwipeTableCell/MGSwipeTableCell.h>
 
 @class tableMetadata;
+@class NCMainChangeHeightWebView;
 
 @interface CCMain : UIViewController <UITableViewDataSource, UITableViewDelegate, UIActionSheetDelegate, UIGestureRecognizerDelegate, UIViewControllerPreviewingDelegate, BKPasscodeViewControllerDelegate, UISplitViewControllerDelegate, UIPopoverControllerDelegate, UIDocumentMenuDelegate, UIDocumentPickerDelegate, UISearchResultsUpdating, UISearchControllerDelegate, UISearchBarDelegate, UIScrollViewDelegate, DZNEmptyDataSetSource, DZNEmptyDataSetDelegate>
 
 @property (nonatomic, weak) IBOutlet UITableView *tableView;
+@property (nonatomic, weak) IBOutlet NSLayoutConstraint *viewSectionWebViewHeight;
+@property (nonatomic, weak) IBOutlet UIView *viewSectionWebView;
+@property (nonatomic, weak) IBOutlet WKWebView *webView;
+@property (nonatomic, weak) IBOutlet NCMainChangeHeightWebView *mainChangeHeightWebView;
+
 @property (nonatomic, strong) tableMetadata *metadata;
 @property (nonatomic, strong) tableMetadata *metadataForPushDetail;
 @property (nonatomic, strong) NSString *selectorForPushDetail;

+ 14 - 0
iOSClient/Main/CCMain.m

@@ -281,6 +281,9 @@
     // createImagesThemingColor
     [[NCMainCommon sharedInstance] createImagesThemingColor];
     
+    // viewSectionWebView
+    self.viewSectionWebView.backgroundColor = NCBrandColor.sharedInstance.brand;
+    
     // Refresh control
     refreshControl.tintColor = NCBrandColor.sharedInstance.brandText;
     refreshControl.backgroundColor = NCBrandColor.sharedInstance.brand;
@@ -346,6 +349,17 @@
         // Setting Theming
         [appDelegate settingThemingColorBrand];
         
+        // Nextcloud 18
+        tableCapabilities *capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:appDelegate.activeAccount];
+        if (capabilities.versionMajor >= k_nextcloud_version_18_0) {
+            self.viewSectionWebViewHeight.constant = CCUtility.getViewSectionWebViewHeight;
+            [self.mainChangeHeightWebView setHidden:false];
+        } else {
+            [CCUtility setViewSectionWebViewHeight:10];
+            self.viewSectionWebViewHeight.constant = 10;
+            [self.mainChangeHeightWebView setHidden:true];
+        }
+        
         // Detail
         // If AVPlayer in play -> Stop
         if (appDelegate.player != nil && appDelegate.player.rate != 0) {

+ 57 - 4
iOSClient/Main/Main.storyboard

@@ -2,7 +2,7 @@
 <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">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
-        <deployment identifier="iOS"/>
+        <deployment version="4352" identifier="iOS"/>
         <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -424,26 +424,78 @@
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="dC6-NQ-0Td">
-                                <rect key="frame" x="0.0" y="88" width="414" height="725"/>
+                                <rect key="frame" x="0.0" y="188" width="414" height="625"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <connections>
                                     <outlet property="dataSource" destination="Qyv-Eo-LeA" id="8v3-Et-JVZ"/>
                                     <outlet property="delegate" destination="Qyv-Eo-LeA" id="CeL-Eu-Cur"/>
                                 </connections>
                             </tableView>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xus-GQ-KT4">
+                                <rect key="frame" x="0.0" y="88" width="414" height="100"/>
+                                <subviews>
+                                    <wkWebView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5wM-L2-281">
+                                        <rect key="frame" x="1" y="0.0" width="412" height="90"/>
+                                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <wkWebViewConfiguration key="configuration">
+                                            <audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
+                                            <wkPreferences key="preferences"/>
+                                        </wkWebViewConfiguration>
+                                    </wkWebView>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ucy-1e-ZKf" customClass="NCMainChangeHeightWebView" customModule="Nextcloud" customModuleProvider="target">
+                                        <rect key="frame" x="0.0" y="90" width="414" height="10"/>
+                                        <subviews>
+                                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="dragHorizontal" translatesAutoresizingMaskIntoConstraints="NO" id="6qg-mV-HhN">
+                                                <rect key="frame" x="202" y="0.0" width="10" height="10"/>
+                                                <constraints>
+                                                    <constraint firstAttribute="width" constant="10" id="ohA-ud-f6c"/>
+                                                    <constraint firstAttribute="height" constant="10" id="sYM-Wo-ZA4"/>
+                                                </constraints>
+                                            </imageView>
+                                        </subviews>
+                                        <color key="backgroundColor" systemColor="systemGreenColor" red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="10" id="5nD-75-8Rl"/>
+                                            <constraint firstItem="6qg-mV-HhN" firstAttribute="centerY" secondItem="ucy-1e-ZKf" secondAttribute="centerY" id="bwH-hl-4Vr"/>
+                                            <constraint firstItem="6qg-mV-HhN" firstAttribute="centerX" secondItem="ucy-1e-ZKf" secondAttribute="centerX" id="y0w-r2-6fH"/>
+                                        </constraints>
+                                        <connections>
+                                            <outlet property="imageDrag" destination="6qg-mV-HhN" id="lpB-Ca-jAF"/>
+                                        </connections>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstAttribute="bottom" secondItem="5wM-L2-281" secondAttribute="bottom" constant="10" id="0ZU-GR-hru"/>
+                                    <constraint firstAttribute="height" constant="100" id="H0o-EG-cxN"/>
+                                    <constraint firstItem="5wM-L2-281" firstAttribute="leading" secondItem="xus-GQ-KT4" secondAttribute="leading" constant="1" id="K5c-Ur-4ht"/>
+                                    <constraint firstAttribute="trailing" secondItem="ucy-1e-ZKf" secondAttribute="trailing" id="R7Q-XH-Xan"/>
+                                    <constraint firstItem="ucy-1e-ZKf" firstAttribute="top" secondItem="5wM-L2-281" secondAttribute="bottom" id="Y8u-eZ-VOP"/>
+                                    <constraint firstItem="5wM-L2-281" firstAttribute="top" secondItem="xus-GQ-KT4" secondAttribute="top" id="ZcF-yZ-qQS"/>
+                                    <constraint firstItem="ucy-1e-ZKf" firstAttribute="leading" secondItem="xus-GQ-KT4" secondAttribute="leading" id="kUK-qj-2fI"/>
+                                    <constraint firstAttribute="trailing" secondItem="5wM-L2-281" secondAttribute="trailing" constant="1" id="o3c-EB-zVd"/>
+                                </constraints>
+                            </view>
                         </subviews>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
+                            <constraint firstItem="xus-GQ-KT4" firstAttribute="top" secondItem="Sqy-z1-MI5" secondAttribute="top" id="58V-Ab-HzA"/>
+                            <constraint firstItem="Sqy-z1-MI5" firstAttribute="trailing" secondItem="xus-GQ-KT4" secondAttribute="trailing" id="A0T-28-XOE"/>
                             <constraint firstItem="dC6-NQ-0Td" firstAttribute="leading" secondItem="Sqy-z1-MI5" secondAttribute="leading" id="AAp-Xf-P1c"/>
                             <constraint firstItem="Sqy-z1-MI5" firstAttribute="trailing" secondItem="dC6-NQ-0Td" secondAttribute="trailing" id="DBL-Bo-AUz"/>
-                            <constraint firstItem="dC6-NQ-0Td" firstAttribute="top" secondItem="Sqy-z1-MI5" secondAttribute="top" id="Y4F-vb-WVb"/>
+                            <constraint firstItem="xus-GQ-KT4" firstAttribute="leading" secondItem="Sqy-z1-MI5" secondAttribute="leading" id="YFb-tE-vb3"/>
                             <constraint firstItem="Sqy-z1-MI5" firstAttribute="bottom" secondItem="dC6-NQ-0Td" secondAttribute="bottom" id="d6p-eB-e8X"/>
+                            <constraint firstItem="dC6-NQ-0Td" firstAttribute="top" secondItem="xus-GQ-KT4" secondAttribute="bottom" id="rRF-Uk-ejG"/>
                         </constraints>
                         <viewLayoutGuide key="safeArea" id="Sqy-z1-MI5"/>
                     </view>
                     <navigationItem key="navigationItem" id="2BC-Vb-dXh"/>
                     <connections>
+                        <outlet property="mainChangeHeightWebView" destination="ucy-1e-ZKf" id="PbN-bX-rQa"/>
                         <outlet property="tableView" destination="dC6-NQ-0Td" id="hew-Gn-bWh"/>
+                        <outlet property="viewSectionWebView" destination="xus-GQ-KT4" id="TMC-zb-IA9"/>
+                        <outlet property="viewSectionWebViewHeight" destination="H0o-EG-cxN" id="M8o-g3-Agn"/>
+                        <outlet property="webView" destination="5wM-L2-281" id="7dJ-Fc-Ltm"/>
                         <segue destination="mtc-lf-PRo" kind="showDetail" identifier="segueDetail" id="2Qm-A6-CfB"/>
                     </connections>
                 </viewController>
@@ -622,10 +674,11 @@
     <resources>
         <image name="avatar" width="25" height="25"/>
         <image name="disclosureIndicator" width="26" height="28"/>
+        <image name="dragHorizontal" width="312" height="312"/>
         <image name="logo" width="223" height="157.5"/>
         <image name="tabBarPlus" width="80" height="80"/>
     </resources>
     <inferredMetricsTieBreakers>
-        <segue reference="W5b-lw-8O1"/>
+        <segue reference="2Qm-A6-CfB"/>
     </inferredMetricsTieBreakers>
 </document>

+ 58 - 0
iOSClient/Main/NCMainChangeHeightWebView.swift

@@ -0,0 +1,58 @@
+//
+//  NCMainChangeHeightWebView.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 09/01/2020.
+//  Copyright © 2020 TWS. All rights reserved.
+//
+
+import Foundation
+
+class NCMainChangeHeightWebView: UIView {
+
+    let appDelegate = UIApplication.shared.delegate as! AppDelegate
+    var startPosition: CGPoint?
+    var originalHeight: CGFloat = 0
+    let minHeight: CGFloat = 10
+    let maxHeight: CGFloat = UIScreen.main.bounds.size.height/3
+    
+    @IBOutlet weak var imageDrag: UIImageView!
+
+    required init?(coder: NSCoder) {
+        super.init(coder: coder)
+        
+        self.backgroundColor = NCBrandColor.sharedInstance.brand
+        NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
+    }
+    
+    @objc func changeTheming() {
+        self.backgroundColor = NCBrandColor.sharedInstance.brand
+        imageDrag.image = CCGraphics.changeThemingColorImage(UIImage(named: "dragHorizontal"), width: 20, height: 10, color: NCBrandColor.sharedInstance.brandText)
+    }
+    
+    override func  touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
+        let touch = touches.first
+        startPosition = touch?.location(in: self)
+        originalHeight = self.frame.height
+    }
+    
+    override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
+        let touch = touches.first
+        let endPosition = touch?.location(in: self)
+        let difference = endPosition!.y - startPosition!.y
+        let currentviewSectionWebViewHeight = appDelegate.activeMain.viewSectionWebViewHeight.constant
+        let differenceSectionWebViewHeight = currentviewSectionWebViewHeight + difference
+        
+        if differenceSectionWebViewHeight <= minHeight {
+            appDelegate.activeMain.viewSectionWebViewHeight.constant = minHeight
+        }
+        else if differenceSectionWebViewHeight >= maxHeight {
+            appDelegate.activeMain.viewSectionWebViewHeight.constant = maxHeight
+        }
+        else {
+            appDelegate.activeMain.viewSectionWebViewHeight.constant = differenceSectionWebViewHeight
+        }
+    }
+
+    
+}

+ 3 - 0
iOSClient/Utility/CCUtility.h

@@ -174,6 +174,9 @@
 + (BOOL)getDarkModeDetect;
 + (void)setDarkModeDetect:(BOOL)disable;
 
++ (NSInteger)getViewSectionWebViewHeight;
++ (void)setViewSectionWebViewHeight:(NSInteger)height;
+
 // ===== Varius =====
 
 + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL;

+ 17 - 0
iOSClient/Utility/CCUtility.m

@@ -692,6 +692,23 @@
     [UICKeyChainStore setString:sDisable forKey:@"darkModeDetect" service:k_serviceShareKeyChain];
 }
 
++ (NSInteger)getViewSectionWebViewHeight
+{
+    NSString *height = [UICKeyChainStore stringForKey:@"viewSectionWebViewHeight" service:k_serviceShareKeyChain];
+    
+    if (height == nil) {
+        return UIScreen.mainScreen.bounds.size.height/4;
+    } else {
+        return [height integerValue];
+    }
+}
+
++ (void)setViewSectionWebViewHeight:(NSInteger)height
+{
+    NSString *heightString = [@(height) stringValue];
+    [UICKeyChainStore setString:heightString forKey:@"viewSectionWebViewHeight" service:k_serviceShareKeyChain];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Various =====
 #pragma --------------------------------------------------------------------------------------------