marinofaggiana 4 năm trước cách đây
mục cha
commit
813aaa1065

+ 4 - 18
Nextcloud.xcodeproj/project.pbxproj

@@ -296,9 +296,7 @@
 		F7CB689A2541676B0050EC94 /* NCMore.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB68992541676B0050EC94 /* NCMore.storyboard */; };
 		F7CB68A0254169530050EC94 /* NCSettings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CB689F254169530050EC94 /* NCSettings.storyboard */; };
 		F7CBC31C24F78E79004D3812 /* NCSortMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7CBC31B24F78E79004D3812 /* NCSortMenu.swift */; };
-		F7D0F33826413A0F0097D4A3 /* lana.jpg in Resources */ = {isa = PBXBuildFile; fileRef = F7D0F33726413A0F0097D4A3 /* lana.jpg */; };
-		F7D0F33A26413C170097D4A3 /* NCFillBackgroundView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7D0F33926413C170097D4A3 /* NCFillBackgroundView.xib */; };
-		F7D0F33B26413C170097D4A3 /* NCFillBackgroundView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7D0F33926413C170097D4A3 /* NCFillBackgroundView.xib */; };
+		F7D0F33E264144FC0097D4A3 /* Background.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7D0F33D264144FC0097D4A3 /* Background.xcassets */; };
 		F7D1612023CF19E30039EBBF /* NCViewerRichWorkspace.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */; };
 		F7D2C773246470CA008513AE /* XLForm.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F7D2C772246470CA008513AE /* XLForm.framework */; };
 		F7D57C8626317BDA00DE301D /* NCAccountRequest.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7CA212C25F1333200826ABB /* NCAccountRequest.storyboard */; };
@@ -678,8 +676,7 @@
 		F7CC04E61F5AD50D00378CEF /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/Localizable.strings; sourceTree = "<group>"; };
 		F7CE8AFA1DC1F8D8009CAE48 /* Nextcloud.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Nextcloud.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		F7CE8AFB1DC1F8D8009CAE48 /* Share.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = Share.appex; sourceTree = BUILT_PRODUCTS_DIR; };
-		F7D0F33726413A0F0097D4A3 /* lana.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = lana.jpg; sourceTree = "<group>"; };
-		F7D0F33926413C170097D4A3 /* NCFillBackgroundView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCFillBackgroundView.xib; sourceTree = "<group>"; };
+		F7D0F33D264144FC0097D4A3 /* Background.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Background.xcassets; sourceTree = "<group>"; };
 		F7D154271E2392A300202FD9 /* Nextcloud-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Nextcloud-Bridging-Header.h"; sourceTree = "<group>"; };
 		F7D1611F23CF19E30039EBBF /* NCViewerRichWorkspace.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCViewerRichWorkspace.storyboard; sourceTree = "<group>"; };
 		F7D2C772246470CA008513AE /* XLForm.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XLForm.framework; path = Carthage/Build/iOS/XLForm.framework; sourceTree = "<group>"; };
@@ -934,7 +931,6 @@
 			isa = PBXGroup;
 			children = (
 				F7239870253D86B600257F49 /* NCEmptyDataSet.swift */,
-				F7D0F33926413C170097D4A3 /* NCFillBackgroundView.xib */,
 				F7239876253D86D300257F49 /* NCEmptyView.xib */,
 			);
 			path = EmptyView;
@@ -1300,6 +1296,7 @@
 				F7C742D31E7BD36600D9C973 /* Supporting Files */,
 				F710E80C1EF95C9C00DC2427 /* Intro */,
 				F700222B1EC479840080073F /* Custom.xcassets */,
+				F7D0F33D264144FC0097D4A3 /* Background.xcassets */,
 				F7B8B82F25681C3400967775 /* GoogleService-Info.plist */,
 				F7362A1E220C853A005101B5 /* LaunchScreen.storyboard */,
 				F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */,
@@ -1362,14 +1359,6 @@
 			path = More;
 			sourceTree = "<group>";
 		};
-		F7D0F33626413A0F0097D4A3 /* fillBackground */ = {
-			isa = PBXGroup;
-			children = (
-				F7D0F33726413A0F0097D4A3 /* lana.jpg */,
-			);
-			path = fillBackground;
-			sourceTree = "<group>";
-		};
 		F7DFB7E9219C5A0500680748 /* Create cloud */ = {
 			isa = PBXGroup;
 			children = (
@@ -1437,7 +1426,6 @@
 			children = (
 				F702F2CC25EE5B4F008F8E80 /* AppDelegate.swift */,
 				F702F2CE25EE5B5C008F8E80 /* NCGlobal.swift */,
-				F7D0F33626413A0F0097D4A3 /* fillBackground */,
 				F70211F31BAC56E9003FC03E /* Main */,
 				F7C1CDD91E6DFC6F005D92BE /* Brand */,
 				F7F67BB81A24D27800EE80DA /* Images.xcassets */,
@@ -1822,7 +1810,6 @@
 				F714803B262EBE3900693E51 /* MainInterface.storyboard in Resources */,
 				F7148054262ED51000693E51 /* NCListCell.xib in Resources */,
 				F7D57C8626317BDA00DE301D /* NCAccountRequest.storyboard in Resources */,
-				F7D0F33B26413C170097D4A3 /* NCFillBackgroundView.xib in Resources */,
 				F7145A1A1D12E3B700CAFEEC /* Images.xcassets in Resources */,
 				F7148063262ED66200693E51 /* NCEmptyView.xib in Resources */,
 				F7145A231D12E3B700CAFEEC /* Localizable.strings in Resources */,
@@ -1855,7 +1842,6 @@
 				F700222C1EC479840080073F /* Custom.xcassets in Resources */,
 				F702F2F125EE5CDB008F8E80 /* NCLogin.storyboard in Resources */,
 				F723985C253C95CE00257F49 /* NCViewerRichdocument.storyboard in Resources */,
-				F7D0F33826413A0F0097D4A3 /* lana.jpg in Resources */,
 				F758B45A212C564000515F55 /* Scan.storyboard in Resources */,
 				F70D87CF25EE6E58008CBBBD /* NCRenameFile.storyboard in Resources */,
 				F765F73225237E3F00391DBE /* NCRecent.storyboard in Resources */,
@@ -1867,6 +1853,7 @@
 				F702F2E725EE5C86008F8E80 /* NCAudioRecorderViewController.storyboard in Resources */,
 				F7632FBF21832F8700721B71 /* NCTrashSectionHeaderMenu.xib in Resources */,
 				3704EB2A23D5A58400455C5B /* NCMenu.storyboard in Resources */,
+				F7D0F33E264144FC0097D4A3 /* Background.xcassets in Resources */,
 				F7F1E54C2492369A00E42386 /* NCMediaCommandView.xib in Resources */,
 				F710E8111EF95C9C00DC2427 /* ImagesIntro.xcassets in Resources */,
 				F76032A0252F0F8E0015A421 /* NCTransferCell.xib in Resources */,
@@ -1879,7 +1866,6 @@
 				F749C10E23C4A5340027D966 /* NCIntroCollectionViewCell.xib in Resources */,
 				F717402D24F699A5000C87D5 /* NCFavorite.storyboard in Resources */,
 				F723B3DD22FC6D1D00301EFE /* NCShareCommentsCell.xib in Resources */,
-				F7D0F33A26413C170097D4A3 /* NCFillBackgroundView.xib in Resources */,
 				F78ACD4B21903F850088454D /* NCTrashListCell.xib in Resources */,
 				F7725A61251F33BB00D125E0 /* NCFiles.storyboard in Resources */,
 				F700510122DF63AC003A3356 /* NCShare.storyboard in Resources */,

+ 6 - 0
iOSClient/Brand/Background.xcassets/Contents.json

@@ -0,0 +1,6 @@
+{
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

+ 12 - 0
iOSClient/Brand/Background.xcassets/lana.imageset/Contents.json

@@ -0,0 +1,12 @@
+{
+  "images" : [
+    {
+      "filename" : "lana.jpg",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  }
+}

BIN
iOSClient/Brand/Background.xcassets/lana.imageset/lana.jpg


+ 54 - 34
iOSClient/EmptyView/NCEmptyDataSet.swift

@@ -5,39 +5,69 @@
 //  Created by Marino Faggiana on 19/10/2020.
 //  Copyright © 2020 Marino Faggiana. All rights reserved.
 //
+//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
 
 import UIKit
 
-@objc public protocol NCEmptyDataSetDelegate {
-    @objc optional func emptyDataSetView(_ view: NCEmptyView)
+public protocol NCEmptyDataSetDelegate {
+    func emptyDataSetView(_ view: NCEmptyView)
+}
+
+// optional func
+public extension NCEmptyDataSetDelegate {
+    func emptyDataSetView(_ view: NCEmptyView) {}
 }
 
 class NCEmptyDataSet: NSObject {
     
-    var emptyView: NCEmptyView?
-    var fillBackgroundView: NCFillBackgroundView?
-    var delegate: NCEmptyDataSetDelegate?
-    var timer: Timer?
-    var numberItemsForSections: Int = 0
+    private var superView: UIView?
+    private var emptyView: NCEmptyView?
+    private var timer: Timer?
+    private var numberItemsForSections: Int = 0
+    private var delegate: NCEmptyDataSetDelegate?
+
+    private var fillBackgroundName: String = ""
+    private var fillBackgroundView = UIImageView()
+
+    public var backgroud: String {
+        get {
+            return fillBackgroundName
+        }
+        set {
+            self.fillBackgroundName = newValue
+            if let image = UIImage(named: newValue) {
+                fillBackgroundView.image = image
+                if superView is UICollectionView {
+                    (superView as! UICollectionView).backgroundView = fillBackgroundView
+                }
+            } else {
+                fillBackgroundView.image = nil
+                if superView is UICollectionView {
+                    (superView as! UICollectionView).backgroundView = nil
+                }
+            }
+        }
+    }
     
     init(view: UIView, offset: CGFloat = 0, delegate: NCEmptyDataSetDelegate?) {
         super.init()
         
-        if let fillBackgroundView = UINib(nibName: "NCFillBackgroundView", bundle: nil).instantiate(withOwner: self, options: nil).first as? NCFillBackgroundView {
-            
-            self.fillBackgroundView = fillBackgroundView
-            
-            fillBackgroundView.isHidden = true
-            fillBackgroundView.translatesAutoresizingMaskIntoConstraints = false
-            
-            view.addSubview(fillBackgroundView)
-            
-            fillBackgroundView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
-            fillBackgroundView.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
-            fillBackgroundView.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
-            fillBackgroundView.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
-        }
-
+        self.superView = view
+        
         if let emptyView = UINib(nibName: "NCEmptyView", bundle: nil).instantiate(withOwner: self, options: nil).first as? NCEmptyView {
         
             self.delegate = delegate
@@ -61,7 +91,7 @@ class NCEmptyDataSet: NSObject {
             emptyView.centerYAnchor.constraint(equalTo: view.centerYAnchor, constant: offset).isActive = true
         }
     }
-    
+        
     func numberOfItemsInSection(_ num: Int, section: Int) {
         
         if section == 0 {
@@ -72,7 +102,7 @@ class NCEmptyDataSet: NSObject {
         
         if let emptyView = emptyView {
             
-            self.delegate?.emptyDataSetView?(emptyView)
+            self.delegate?.emptyDataSetView(emptyView)
             
             if !(timer?.isValid ?? false) && emptyView.isHidden == true {
                 timer = Timer.scheduledTimer(timeInterval: 0.3, target: self, selector: #selector(timerHandler(_:)), userInfo: nil, repeats: false)
@@ -106,13 +136,3 @@ public class NCEmptyView: UIView {
         emptyTitle.textColor = NCBrandColor.shared.label
     }
 }
-
-public class NCFillBackgroundView: UIView {
-    
-    @IBOutlet weak var fillBackground: UIImageView!
-    
-    public override func awakeFromNib() {
-        super.awakeFromNib()
-    }
-}
-

+ 0 - 36
iOSClient/EmptyView/NCFillBackgroundView.xib

@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
-    <device id="retina3_5" orientation="portrait" appearance="light"/>
-    <dependencies>
-        <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
-        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
-        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
-    </dependencies>
-    <objects>
-        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
-        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
-        <view contentMode="scaleToFill" id="iN0-l3-epB" customClass="NCFillBackgroundView" customModule="Nextcloud" customModuleProvider="target">
-            <rect key="frame" x="0.0" y="0.0" width="350" height="250"/>
-            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-            <subviews>
-                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="W3d-Us-kU4">
-                    <rect key="frame" x="0.0" y="0.0" width="350" height="250"/>
-                </imageView>
-            </subviews>
-            <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/>
-            <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
-            <constraints>
-                <constraint firstItem="W3d-Us-kU4" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" id="KPL-eZ-i2o"/>
-                <constraint firstItem="vUN-kp-3ea" firstAttribute="trailing" secondItem="W3d-Us-kU4" secondAttribute="trailing" id="O1w-go-B0B"/>
-                <constraint firstItem="W3d-Us-kU4" firstAttribute="top" secondItem="vUN-kp-3ea" secondAttribute="top" id="S5y-Bc-aC0"/>
-                <constraint firstItem="vUN-kp-3ea" firstAttribute="bottom" secondItem="W3d-Us-kU4" secondAttribute="bottom" id="jD8-kg-UhO"/>
-            </constraints>
-            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
-            <connections>
-                <outlet property="fillBackground" destination="W3d-Us-kU4" id="FM2-Cz-lqR"/>
-            </connections>
-            <point key="canvasLocation" x="-146.25" y="32.5"/>
-        </view>
-    </objects>
-</document>

+ 3 - 0
iOSClient/Select/NCSelect.swift

@@ -178,6 +178,9 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
             serverUrl = NCUtilityFileSystem.shared.getHomeServer(urlBase: activeAccount.urlBase, account: activeAccount.account)
         }
                 
+        // TEST
+        emptyDataSet?.backgroud = "lana"
+        
         // get auto upload folder
         autoUploadFileName = NCManageDatabase.shared.getAccountAutoUploadFileName()
         autoUploadDirectory = NCManageDatabase.shared.getAccountAutoUploadDirectory(urlBase: activeAccount.urlBase, account: activeAccount.account)