marinofaggiana 5 yıl önce
ebeveyn
işleme
2140a2e2f2

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -152,6 +152,7 @@
 		F73B4F141F470D9100BBEE4B /* nsUTF8Prober.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73B4EE71F470D9100BBEE4B /* nsUTF8Prober.cpp */; };
 		F73B4F151F470D9100BBEE4B /* symbols.cmake in Resources */ = {isa = PBXBuildFile; fileRef = F73B4EEA1F470D9100BBEE4B /* symbols.cmake */; };
 		F73B4F171F470D9100BBEE4B /* uchardet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F73B4EEC1F470D9100BBEE4B /* uchardet.cpp */; };
+		F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */; };
 		F73CC0691E813DFF006E3047 /* BKPasscodeDummyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC0591E813DFF006E3047 /* BKPasscodeDummyViewController.m */; };
 		F73CC06A1E813DFF006E3047 /* BKPasscodeDummyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC0591E813DFF006E3047 /* BKPasscodeDummyViewController.m */; };
 		F73CC06C1E813DFF006E3047 /* BKPasscodeField.m in Sources */ = {isa = PBXBuildFile; fileRef = F73CC05B1E813DFF006E3047 /* BKPasscodeField.m */; };
@@ -832,6 +833,7 @@
 		F73B4EEA1F470D9100BBEE4B /* symbols.cmake */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = symbols.cmake; sourceTree = "<group>"; };
 		F73B4EEC1F470D9100BBEE4B /* uchardet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = uchardet.cpp; sourceTree = "<group>"; };
 		F73B4EED1F470D9100BBEE4B /* uchardet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uchardet.h; sourceTree = "<group>"; };
+		F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NCShareHeaderView.xib; sourceTree = "<group>"; };
 		F73CB5771ED46807005F2A5A /* NCBridgeSwift.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NCBridgeSwift.h; sourceTree = "<group>"; };
 		F73CC0581E813DFF006E3047 /* BKPasscodeDummyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BKPasscodeDummyViewController.h; sourceTree = "<group>"; };
 		F73CC0591E813DFF006E3047 /* BKPasscodeDummyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BKPasscodeDummyViewController.m; sourceTree = "<group>"; };
@@ -1760,6 +1762,7 @@
 				F7CD0FF91C8DDA7D006520C5 /* CCSharePermissionOC.h */,
 				F7CD0FFA1C8DDA7D006520C5 /* CCSharePermissionOC.m */,
 				F700510022DF63AC003A3356 /* NCShare.storyboard */,
+				F73CB3B122E072A000AD728E /* NCShareHeaderView.xib */,
 				F700510422DF6A89003A3356 /* NCShare.swift */,
 				F78316861C0CB3CA00C43975 /* CCShareUserOC.h */,
 				F78316871C0CB3CA00C43975 /* CCShareUserOC.m */,
@@ -3371,6 +3374,7 @@
 				F78ACD56219047E90088454D /* NCSectionHeader.xib in Resources */,
 				F7D423491F0596AC009C9782 /* Reader-Mark-Y@3x.png in Resources */,
 				F7D423421F0596AC009C9782 /* Reader-Export@2x.png in Resources */,
+				F73CB3B222E072A000AD728E /* NCShareHeaderView.xib in Resources */,
 				F7F54CE91E5B14C700E19C62 /* ImageSelectedOff@2x.png in Resources */,
 				F77B0F8A1D118A16002130FE /* CCCellMain.xib in Resources */,
 				F78ACD58219048040088454D /* NCSectionHeaderMenu.xib in Resources */,

+ 1 - 0
iOSClient/Brand/NCBrand.swift

@@ -50,6 +50,7 @@ class NCBrandColor: NSObject {
     @objc public let optionItem:            UIColor = UIColor(red: 178.0/255.0, green: 178.0/255.0, blue: 178.0/255.0, alpha: 1.0)
     @objc public let graySoft:              UIColor = UIColor(red: 162.0/255.0, green: 162.0/255.0, blue: 162.0/255.0, alpha: 0.5)
     @objc public let yellowFavorite:        UIColor = UIColor(red: 248.0/255.0, green: 205.0/255.0, blue: 70.0/255.0, alpha: 1.0)
+    @objc public let textInfo:              UIColor = UIColor(red: 153.0/255.0, green: 153.0/255.0, blue: 153.0/255.0, alpha: 1.0)
 
     override init() {
         self.brand = self.customer

+ 39 - 28
iOSClient/Share/NCShare.swift

@@ -35,19 +35,7 @@ class NCShare: UIViewController {
     override func viewDidLoad() {
         super.viewDidLoad()
         
-        // load preview
-        if FileManager.default.fileExists(atPath: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView)) {
-            pagingViewController.image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView))
-        } else {
-            if metadata!.iconName.count > 0 {
-                pagingViewController.image = UIImage.init(named: metadata!.iconName)
-            } else if metadata!.directory {
-                let image = UIImage.init(named: "folder")!
-                pagingViewController.image = CCGraphics.changeThemingColorImage(image, width: image.size.width*2, height: image.size.height*2, color: NCBrandColor.sharedInstance.brandElement)
-            } else {
-                pagingViewController.image = UIImage.init(named: "file")
-            }
-        }
+        pagingViewController.metadata = metadata
         
         // Navigation Controller
         var image = CCGraphics.changeThemingColorImage(UIImage(named: "exit")!, width: 40, height: 40, color: UIColor.gray)
@@ -128,35 +116,29 @@ extension NCShare: PagingViewControllerDataSource {
 class NCShareHeaderViewController: PagingViewController<PagingIndexItem> {
     
     public var image: UIImage?
-   
+    public var metadata: tableMetadata?
+
     override func loadView() {
-        view = NCShareHeader(
+        view = NCSharePagingView(
             options: options,
             collectionView: collectionView,
             pageView: pageViewController.view,
-            image: image
+            metadata: metadata
         )
     }
 }
 
-class NCShareHeader: PagingView {
+class NCSharePagingView: PagingView {
     
     static let HeaderHeight: CGFloat = 200
-    var image: UIImage?
+    var metadata: tableMetadata?
     
     var headerHeightConstraint: NSLayoutConstraint?
     
-    private lazy var headerView: UIImageView = {
-        let view = UIImageView(image: self.image!)
-        view.contentMode = .scaleAspectFit
-        view.clipsToBounds = true
-        return view
-    }()
-    
-    public init(options: Parchment.PagingOptions, collectionView: UICollectionView, pageView: UIView, image: UIImage?) {
+    public init(options: Parchment.PagingOptions, collectionView: UICollectionView, pageView: UIView, metadata: tableMetadata?) {
         super.init(options: options, collectionView: collectionView, pageView: pageView)
         
-        self.image = image
+        self.metadata = metadata
     }
     
     required init?(coder: NSCoder) {
@@ -165,6 +147,27 @@ class NCShareHeader: PagingView {
     
     override func setupConstraints() {
         
+        let headerView = Bundle.main.loadNibNamed("NCShareHeaderView", owner: self, options: nil)?.first as! NCShareHeaderView
+        
+        if FileManager.default.fileExists(atPath: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView)) {
+            headerView.imageView.image = UIImage.init(contentsOfFile: CCUtility.getDirectoryProviderStorageIconFileID(metadata!.fileID, fileNameView: metadata!.fileNameView))
+        } else {
+            if metadata!.iconName.count > 0 {
+                headerView.imageView.image = UIImage.init(named: metadata!.iconName)
+            } else if metadata!.directory {
+                let image = UIImage.init(named: "folder")!
+                headerView.imageView.image = CCGraphics.changeThemingColorImage(image, width: image.size.width*2, height: image.size.height*2, color: NCBrandColor.sharedInstance.brandElement)
+            } else {
+                headerView.imageView.image = UIImage.init(named: "file")
+            }
+        }
+        headerView.fileName.text = metadata?.fileNameView
+        if metadata!.favorite {
+            headerView.favorite.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 40, height: 40, color: NCBrandColor.sharedInstance.yellowFavorite), for: .normal)
+        } else {
+            headerView.favorite.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "favorite"), width: 40, height: 40, color: NCBrandColor.sharedInstance.textInfo), for: .normal)
+        }
+        headerView.info.text = CCUtility.transformedSize(metadata!.size) + ", " + CCUtility.dateDiff(metadata!.date as Date)
         addSubview(headerView)
         
         pageView.translatesAutoresizingMaskIntoConstraints = false
@@ -172,7 +175,7 @@ class NCShareHeader: PagingView {
         headerView.translatesAutoresizingMaskIntoConstraints = false
         
         headerHeightConstraint = headerView.heightAnchor.constraint(
-            equalToConstant: NCShareHeader.HeaderHeight
+            equalToConstant: NCSharePagingView.HeaderHeight
         )
         headerHeightConstraint?.isActive = true
         
@@ -193,3 +196,11 @@ class NCShareHeader: PagingView {
         ])
     }
 }
+
+class NCShareHeaderView: UIView {
+
+    @IBOutlet weak var imageView: UIImageView!
+    @IBOutlet weak var fileName: UILabel!
+    @IBOutlet weak var info: UILabel!
+    @IBOutlet weak var favorite: UIButton!
+}

+ 75 - 0
iOSClient/Share/NCShareHeaderView.xib

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina3_5" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
+        <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="NCShareHeaderView" customModule="Nextcloud" customModuleProvider="target">
+            <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+            <subviews>
+                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="79H-PA-1m2">
+                    <rect key="frame" x="0.0" y="0.0" width="320" height="430"/>
+                </imageView>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="n1G-pn-D8s">
+                    <rect key="frame" x="15" y="440" width="290" height="18"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="15"/>
+                    <nil key="textColor"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOQ-tC-40T">
+                    <rect key="frame" x="40" y="463" width="265" height="15"/>
+                    <fontDescription key="fontDescription" type="system" pointSize="12"/>
+                    <color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
+                    <nil key="highlightedColor"/>
+                </label>
+                <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="EaW-fI-EmD">
+                    <rect key="frame" x="15" y="462" width="15" height="15"/>
+                    <constraints>
+                        <constraint firstAttribute="height" constant="15" id="Rli-bh-8fJ"/>
+                        <constraint firstAttribute="width" constant="15" id="cU5-4t-7Qf"/>
+                    </constraints>
+                    <state key="normal" image="favorite"/>
+                </button>
+            </subviews>
+            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <constraints>
+                <constraint firstAttribute="trailing" secondItem="79H-PA-1m2" secondAttribute="trailing" id="7ui-gc-9Vz"/>
+                <constraint firstItem="EaW-fI-EmD" firstAttribute="top" secondItem="n1G-pn-D8s" secondAttribute="bottom" constant="4" id="8Jc-BA-mYt"/>
+                <constraint firstItem="79H-PA-1m2" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="Fvr-k0-AHg"/>
+                <constraint firstItem="bOQ-tC-40T" firstAttribute="top" secondItem="n1G-pn-D8s" secondAttribute="bottom" constant="5" id="IRS-qU-ubd"/>
+                <constraint firstAttribute="trailing" secondItem="bOQ-tC-40T" secondAttribute="trailing" constant="15" id="LAA-Eb-HZj"/>
+                <constraint firstItem="n1G-pn-D8s" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="cpD-9L-mBy"/>
+                <constraint firstItem="n1G-pn-D8s" firstAttribute="top" secondItem="79H-PA-1m2" secondAttribute="bottom" constant="10" id="fd0-A4-x6m"/>
+                <constraint firstAttribute="trailing" secondItem="n1G-pn-D8s" secondAttribute="trailing" constant="15" id="g7A-jG-74Q"/>
+                <constraint firstItem="79H-PA-1m2" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="k8q-dk-ofe"/>
+                <constraint firstAttribute="bottom" secondItem="79H-PA-1m2" secondAttribute="bottom" constant="50" id="mBw-xB-bkR"/>
+                <constraint firstItem="EaW-fI-EmD" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="15" id="oRc-nv-VzO"/>
+                <constraint firstItem="bOQ-tC-40T" firstAttribute="leading" secondItem="EaW-fI-EmD" secondAttribute="trailing" constant="10" id="uf6-8A-fN4"/>
+            </constraints>
+            <connections>
+                <outlet property="favorite" destination="EaW-fI-EmD" id="dv5-Qo-tPx"/>
+                <outlet property="fileName" destination="n1G-pn-D8s" id="mUh-zi-1bo"/>
+                <outlet property="imageView" destination="79H-PA-1m2" id="t6m-wr-OQ5"/>
+                <outlet property="info" destination="bOQ-tC-40T" id="N7R-YH-Xek"/>
+            </connections>
+            <point key="canvasLocation" x="-9.375" y="293.75"/>
+        </view>
+        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="UoN-dd-uRc">
+            <rect key="frame" x="0.0" y="0.0" width="46" height="30"/>
+            <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+            <state key="normal" title="Button"/>
+            <point key="canvasLocation" x="1322" y="380"/>
+        </button>
+    </objects>
+    <resources>
+        <image name="favorite" width="300" height="300"/>
+    </resources>
+</document>