Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/ios.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarinofaggiana <marino@marinofaggiana.com>2019-07-26 16:48:05 +0300
committermarinofaggiana <marino@marinofaggiana.com>2019-07-26 16:48:05 +0300
commit5fd89600e2172f5148d8dac9ec7809c07c755d6a (patch)
treeb7c335d465c6b602172d440cea08b47a8f6a8a68
parenta05a92eaf267abba49c2e175b483e7e1d63271e1 (diff)
new view share
-rw-r--r--iOSClient/Nextcloud-Bridging-Header.h1
-rw-r--r--iOSClient/Share/CCShare.storyboard225
-rw-r--r--iOSClient/Share/CCShareInfoCMOC.h39
-rw-r--r--iOSClient/Share/CCShareInfoCMOC.m190
-rw-r--r--iOSClient/Share/CCShareOC.h62
-rw-r--r--iOSClient/Share/CCShareOC.m716
-rw-r--r--iOSClient/Share/CCSharePermissionOC.h41
-rw-r--r--iOSClient/Share/CCSharePermissionOC.m205
-rw-r--r--iOSClient/Share/CCShareUserOC.h50
-rw-r--r--iOSClient/Share/CCShareUserOC.m268
-rw-r--r--iOSClient/Share/NCShare.storyboard19
-rw-r--r--iOSClient/Share/NCShare.swift39
-rw-r--r--iOSClient/Share/NCShareLinkMenuView.swift2
-rw-r--r--iOSClient/Share/NCShareNetworking.swift15
-rw-r--r--iOSClient/Share/NCShareUserMenuView.swift2
15 files changed, 50 insertions, 1824 deletions
diff --git a/iOSClient/Nextcloud-Bridging-Header.h b/iOSClient/Nextcloud-Bridging-Header.h
index b3293bcd1..b4484b697 100644
--- a/iOSClient/Nextcloud-Bridging-Header.h
+++ b/iOSClient/Nextcloud-Bridging-Header.h
@@ -21,6 +21,7 @@
#import "OCNotifications.h"
#import "OCConstants.h"
#import "OCNotificationsAction.h"
+#import "OCShareUser.h"
#import "UtilsFramework.h"
#import "NCNetworkingEndToEnd.h"
#import "NCRichDocumentTemplate.h"
diff --git a/iOSClient/Share/CCShare.storyboard b/iOSClient/Share/CCShare.storyboard
deleted file mode 100644
index 6724352eb..000000000
--- a/iOSClient/Share/CCShare.storyboard
+++ /dev/null
@@ -1,225 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
- <device id="retina4_7" 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>
- <scenes>
- <!--Share ownCloud-->
- <scene sceneID="8Af-7G-uzd">
- <objects>
- <viewController storyboardIdentifier="CCShareOC" id="FgK-eH-DI1" userLabel="Share ownCloud" customClass="CCShareOC" sceneMemberID="viewController">
- <layoutGuides>
- <viewControllerLayoutGuide type="top" id="ypH-iM-3do"/>
- <viewControllerLayoutGuide type="bottom" id="g3i-ij-OJy"/>
- </layoutGuides>
- <view key="view" contentMode="scaleToFill" id="e6B-CP-Y0Y">
- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="ejc-ux-EAE">
- <rect key="frame" x="0.0" y="78" width="375" height="589"/>
- <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- </tableView>
- <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="g7r-0n-C6A" userLabel="File Image View">
- <rect key="frame" x="16" y="28" width="50" height="50"/>
- <constraints>
- <constraint firstAttribute="width" constant="50" id="aFd-Ss-ph2"/>
- <constraint firstAttribute="height" constant="50" id="fWJ-Sq-Yb3"/>
- </constraints>
- </imageView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0rc-qU-t2v">
- <rect key="frame" x="314" y="29" width="53" height="32"/>
- <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
- <state key="normal" title="Button"/>
- <connections>
- <action selector="endButtonAction:" destination="FgK-eH-DI1" eventType="touchDown" id="Ibi-H5-8Lo"/>
- </connections>
- </button>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qJU-ls-kRT">
- <rect key="frame" x="74" y="57" width="232" height="16"/>
- <constraints>
- <constraint firstAttribute="height" constant="16" id="Vdr-Qz-Db3"/>
- </constraints>
- <fontDescription key="fontDescription" type="system" pointSize="13"/>
- <nil key="textColor"/>
- <nil key="highlightedColor"/>
- </label>
- <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="wordWrap" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5R0-1B-nUL" userLabel="Label Title">
- <rect key="frame" x="74" y="35" width="232" height="16"/>
- <constraints>
- <constraint firstAttribute="height" constant="16" id="I73-FO-nfA"/>
- </constraints>
- <fontDescription key="fontDescription" type="system" pointSize="13"/>
- <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <nil key="highlightedColor"/>
- </label>
- </subviews>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <constraints>
- <constraint firstItem="ejc-ux-EAE" firstAttribute="leading" secondItem="e6B-CP-Y0Y" secondAttribute="leading" id="67Z-Q5-Cgm"/>
- <constraint firstItem="g7r-0n-C6A" firstAttribute="top" secondItem="ypH-iM-3do" secondAttribute="bottom" constant="8" id="7as-6H-my4"/>
- <constraint firstItem="5R0-1B-nUL" firstAttribute="leading" secondItem="e6B-CP-Y0Y" secondAttribute="leadingMargin" constant="58" id="B3Z-eo-tqx"/>
- <constraint firstAttribute="trailingMargin" secondItem="0rc-qU-t2v" secondAttribute="trailing" constant="-8" id="F2h-Gs-1HX"/>
- <constraint firstItem="qJU-ls-kRT" firstAttribute="top" secondItem="5R0-1B-nUL" secondAttribute="bottom" constant="6" id="M0T-ZH-G18"/>
- <constraint firstItem="5R0-1B-nUL" firstAttribute="top" secondItem="g7r-0n-C6A" secondAttribute="bottom" constant="-43" id="Nt2-22-66i"/>
- <constraint firstAttribute="trailing" secondItem="ejc-ux-EAE" secondAttribute="trailing" id="Qmg-GS-aNl"/>
- <constraint firstAttribute="trailing" secondItem="qJU-ls-kRT" secondAttribute="trailing" constant="69" id="SP4-ET-g7O"/>
- <constraint firstAttribute="trailingMargin" secondItem="5R0-1B-nUL" secondAttribute="trailing" constant="53" id="Wf2-P9-9R0"/>
- <constraint firstItem="0rc-qU-t2v" firstAttribute="top" secondItem="ypH-iM-3do" secondAttribute="bottom" constant="9" id="ZUu-Ur-vra"/>
- <constraint firstItem="ejc-ux-EAE" firstAttribute="top" secondItem="ypH-iM-3do" secondAttribute="bottom" constant="58" id="e5l-5V-Ic6"/>
- <constraint firstItem="g3i-ij-OJy" firstAttribute="top" secondItem="ejc-ux-EAE" secondAttribute="bottom" id="g0g-ki-s02"/>
- <constraint firstItem="qJU-ls-kRT" firstAttribute="leading" secondItem="g7r-0n-C6A" secondAttribute="trailing" constant="8" id="gTe-TJ-zdC"/>
- <constraint firstAttribute="leadingMargin" secondItem="g7r-0n-C6A" secondAttribute="leading" id="pUq-DL-LqB"/>
- </constraints>
- </view>
- <connections>
- <outlet property="endButton" destination="0rc-qU-t2v" id="9is-oc-P0a"/>
- <outlet property="fileImageView" destination="g7r-0n-C6A" id="Tc2-yQ-RmV"/>
- <outlet property="labelSharedWithYouBy" destination="qJU-ls-kRT" id="QGo-K6-7IE"/>
- <outlet property="labelTitle" destination="5R0-1B-nUL" id="2We-Yk-se8"/>
- <outlet property="tableView" destination="ejc-ux-EAE" id="Z3m-ev-PLR"/>
- </connections>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="Zxn-bc-fzJ" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="512.79999999999995" y="613.94302848575717"/>
- </scene>
- <!--ShareUser ownCloud-->
- <scene sceneID="NIA-LD-rfC">
- <objects>
- <viewController storyboardIdentifier="CCShareUserOC" id="uGP-Rl-nGJ" userLabel="ShareUser ownCloud" customClass="CCShareUserOC" sceneMemberID="viewController">
- <layoutGuides>
- <viewControllerLayoutGuide type="top" id="ZiR-UH-h8a"/>
- <viewControllerLayoutGuide type="bottom" id="Iv5-it-wkO"/>
- </layoutGuides>
- <view key="view" contentMode="scaleToFill" id="Jiu-JY-UWo">
- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="Gm7-74-eSh">
- <rect key="frame" x="0.0" y="45" width="375" height="622"/>
- <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- </tableView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tz1-hm-QBT">
- <rect key="frame" x="314" y="20" width="53" height="32"/>
- <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
- <state key="normal" title="Button"/>
- <connections>
- <action selector="endButtonAction:" destination="uGP-Rl-nGJ" eventType="touchDown" id="Uxd-Sd-jCh"/>
- </connections>
- </button>
- </subviews>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <constraints>
- <constraint firstItem="Gm7-74-eSh" firstAttribute="top" secondItem="ZiR-UH-h8a" secondAttribute="bottom" constant="25" id="9fi-43-f40"/>
- <constraint firstItem="Gm7-74-eSh" firstAttribute="leading" secondItem="Jiu-JY-UWo" secondAttribute="leading" id="GP9-0g-84R"/>
- <constraint firstItem="tz1-hm-QBT" firstAttribute="top" secondItem="ZiR-UH-h8a" secondAttribute="bottom" id="aGS-9O-wzn"/>
- <constraint firstItem="Iv5-it-wkO" firstAttribute="top" secondItem="Gm7-74-eSh" secondAttribute="bottom" id="fhG-d5-kpd"/>
- <constraint firstAttribute="trailing" secondItem="Gm7-74-eSh" secondAttribute="trailing" id="kUP-di-82P"/>
- <constraint firstAttribute="trailingMargin" secondItem="tz1-hm-QBT" secondAttribute="trailing" constant="-8" id="rBB-in-TrC"/>
- </constraints>
- </view>
- <connections>
- <outlet property="endButton" destination="tz1-hm-QBT" id="1Em-nb-5p1"/>
- <outlet property="tableView" destination="Gm7-74-eSh" id="GZF-vb-bC1"/>
- </connections>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="BYc-9w-DfS" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="1309.5999999999999" y="613.94302848575717"/>
- </scene>
- <!--SharePermission ownCloud-->
- <scene sceneID="RFG-Po-tNO">
- <objects>
- <viewController storyboardIdentifier="CCSharePermissionOC" id="6IJ-Tt-iX8" userLabel="SharePermission ownCloud" customClass="CCSharePermissionOC" sceneMemberID="viewController">
- <layoutGuides>
- <viewControllerLayoutGuide type="top" id="eqs-fE-Yye"/>
- <viewControllerLayoutGuide type="bottom" id="YLL-Ma-4iJ"/>
- </layoutGuides>
- <view key="view" contentMode="scaleToFill" id="vkr-eQ-OYs">
- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="DRw-C6-XHf">
- <rect key="frame" x="0.0" y="44" width="375" height="623"/>
- <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- </tableView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="UkB-6i-4rS">
- <rect key="frame" x="314" y="20" width="53" height="32"/>
- <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
- <state key="normal" title="Button"/>
- <connections>
- <action selector="endButtonAction:" destination="6IJ-Tt-iX8" eventType="touchDown" id="A3w-y5-pNx"/>
- </connections>
- </button>
- </subviews>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <constraints>
- <constraint firstItem="DRw-C6-XHf" firstAttribute="top" secondItem="eqs-fE-Yye" secondAttribute="bottom" constant="24" id="02t-PL-QWM"/>
- <constraint firstAttribute="trailing" secondItem="DRw-C6-XHf" secondAttribute="trailing" id="Akh-kD-zen"/>
- <constraint firstAttribute="trailingMargin" secondItem="UkB-6i-4rS" secondAttribute="trailing" constant="-8" id="ZYs-Fv-ghX"/>
- <constraint firstItem="DRw-C6-XHf" firstAttribute="leading" secondItem="vkr-eQ-OYs" secondAttribute="leading" id="dPK-kZ-gF6"/>
- <constraint firstItem="UkB-6i-4rS" firstAttribute="top" secondItem="eqs-fE-Yye" secondAttribute="bottom" id="g3N-JQ-Uih"/>
- <constraint firstItem="YLL-Ma-4iJ" firstAttribute="top" secondItem="DRw-C6-XHf" secondAttribute="bottom" id="lw0-cL-Nmj"/>
- </constraints>
- </view>
- <connections>
- <outlet property="endButton" destination="UkB-6i-4rS" id="5lf-Ef-iev"/>
- <outlet property="tableView" destination="DRw-C6-XHf" id="HNp-ew-flf"/>
- </connections>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="a31-QY-djo" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="1949.5999999999999" y="613.94302848575717"/>
- </scene>
- <!--CCShareInfoCMOC ownCloud-->
- <scene sceneID="9He-gi-9NT">
- <objects>
- <viewController storyboardIdentifier="CCShareInfoCMOC" id="rOp-4O-AKn" userLabel="CCShareInfoCMOC ownCloud" customClass="CCShareInfoCMOC" sceneMemberID="viewController">
- <layoutGuides>
- <viewControllerLayoutGuide type="top" id="cJu-FE-egs"/>
- <viewControllerLayoutGuide type="bottom" id="LKN-3A-aUQ"/>
- </layoutGuides>
- <view key="view" contentMode="scaleToFill" id="ThM-gV-z79">
- <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
- <subviews>
- <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="0Tl-U6-oZH">
- <rect key="frame" x="0.0" y="45" width="375" height="622"/>
- <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- </tableView>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="z1J-6F-519">
- <rect key="frame" x="314" y="20" width="53" height="32"/>
- <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/>
- <state key="normal" title="Button"/>
- <connections>
- <action selector="endButtonAction:" destination="rOp-4O-AKn" eventType="touchDown" id="fdb-Pp-Ifg"/>
- </connections>
- </button>
- </subviews>
- <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
- <constraints>
- <constraint firstAttribute="trailingMargin" secondItem="z1J-6F-519" secondAttribute="trailing" constant="-8" id="470-o5-hbr"/>
- <constraint firstItem="z1J-6F-519" firstAttribute="top" secondItem="cJu-FE-egs" secondAttribute="bottom" id="4ax-aH-ys3"/>
- <constraint firstItem="0Tl-U6-oZH" firstAttribute="top" secondItem="cJu-FE-egs" secondAttribute="bottom" constant="25" id="7hl-hq-nP4"/>
- <constraint firstItem="0Tl-U6-oZH" firstAttribute="leading" secondItem="ThM-gV-z79" secondAttribute="leading" id="E6g-O0-jvY"/>
- <constraint firstItem="LKN-3A-aUQ" firstAttribute="top" secondItem="0Tl-U6-oZH" secondAttribute="bottom" id="PTW-nP-5Cr"/>
- <constraint firstAttribute="trailing" secondItem="0Tl-U6-oZH" secondAttribute="trailing" id="kTy-Ip-ZUU"/>
- </constraints>
- </view>
- <connections>
- <outlet property="endButton" destination="z1J-6F-519" id="TTI-ri-5dB"/>
- <outlet property="tableView" destination="0Tl-U6-oZH" id="kgD-bk-e0n"/>
- </connections>
- </viewController>
- <placeholder placeholderIdentifier="IBFirstResponder" id="NFe-CI-5yc" userLabel="First Responder" sceneMemberID="firstResponder"/>
- </objects>
- <point key="canvasLocation" x="2592.8000000000002" y="613.94302848575717"/>
- </scene>
- </scenes>
-</document>
diff --git a/iOSClient/Share/CCShareInfoCMOC.h b/iOSClient/Share/CCShareInfoCMOC.h
deleted file mode 100644
index 3d11d9fc7..000000000
--- a/iOSClient/Share/CCShareInfoCMOC.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//
-// CCShareInfoCMOC.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 07/03/16.
-// Copyright (c) 2017 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/UIKit.h>
-
-#import "XLFormViewController.h"
-#import "UtilsFramework.h"
-
-@class tableMetadata;
-
-@interface CCShareInfoCMOC : XLFormViewController
-
-@property (nonatomic, weak) IBOutlet UIButton *endButton;
-
-@property (nonatomic, strong) tableMetadata *metadata;
-
-- (IBAction)endButtonAction:(id)sender;
-
-@end
diff --git a/iOSClient/Share/CCShareInfoCMOC.m b/iOSClient/Share/CCShareInfoCMOC.m
deleted file mode 100644
index b1d73f5f3..000000000
--- a/iOSClient/Share/CCShareInfoCMOC.m
+++ /dev/null
@@ -1,190 +0,0 @@
-//
-// CCShareInfoCMOC.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 07/03/16.
-// Copyright (c) 2017 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 "CCShareInfoCMOC.h"
-#import "XLFormViewController.h"
-#import "XLForm.h"
-#import "AppDelegate.h"
-#import "CCHud.h"
-#import "NCBridgeSwift.h"
-
-@interface CCShareInfoCMOC ()
-{
- AppDelegate *appDelegate;
- CCHud *_hud;
-}
-@end
-
-/*
-const PERMISSION_CREATE = 4;
-const PERMISSION_READ = 1;
-const PERMISSION_UPDATE = 2;
-const PERMISSION_DELETE = 8;
-const PERMISSION_SHARE = 16;
-const PERMISSION_ALL = 31;
-*/
-
-@implementation CCShareInfoCMOC
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
- self = [super initWithCoder:coder];
- if (self) {
-
- appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- }
- return self;
-}
-
-- (void)initializeForm
-{
- XLFormDescriptor *form ;
- XLFormSectionDescriptor *section;
- XLFormRowDescriptor *row;
-
- form = [XLFormDescriptor formDescriptor];
- form.rowNavigationOptions = XLFormRowNavigationOptionNone;
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_permission_title_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"create" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_create_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"read" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_read_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"change" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_change_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"delete" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_delete_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"share" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_share_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_permission_info_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sharetype" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_type_", nil)];
-
- if ([self.metadata.permissions rangeOfString:k_permission_shared].location != NSNotFound) row.value = NSLocalizedString(@"_type_resource_connect_you_", nil);
- if ([self.metadata.permissions rangeOfString:k_permission_mounted].location != NSNotFound) row.value = NSLocalizedString(@"_type_resource_external_", nil);
-
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- self.form = form;
-
- form.disabled = YES;
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.view.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- [self.endButton setTitle:NSLocalizedString(@"_done_", nil) forState:UIControlStateNormal];
- self.endButton.tintColor = [UIColor blackColor];
-
- self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- _hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
-
- [[OCNetworking sharedManager] getSharePermissionsFileWithAccount:appDelegate.activeAccount fileNamePath:[NSString stringWithFormat:@"%@/%@", _metadata.serverUrl, _metadata.fileName] completion:^(NSString *account, NSString *permissions, NSString *message, NSInteger errorCode) {
-
- [_hud hideHud];
-
- if (errorCode == 0 && [account isEqualToString:appDelegate.activeAccount] && permissions != nil) {
-
- NSInteger iPermissions = [permissions integerValue];
-
- // ------------------------------------------------------------------
-
- XLFormRowDescriptor *rowCreate = [self.form formRowWithTag:@"create"];
- XLFormRowDescriptor *rowRead = [self.form formRowWithTag:@"read"];
- XLFormRowDescriptor *rowChange = [self.form formRowWithTag:@"change"];
- XLFormRowDescriptor *rowDelete = [self.form formRowWithTag:@"delete"];
- XLFormRowDescriptor *rowShare = [self.form formRowWithTag:@"share"];
-
- // ------------------------------------------------------------------
-
- if ([UtilsFramework isPermissionToCanCreate:iPermissions]) rowCreate.value = @1;
- else rowCreate.value = @0;
-
- if ([UtilsFramework isPermissionToRead:iPermissions]) rowRead.value = @1;
- else rowRead.value = @0;
-
- if ([UtilsFramework isPermissionToCanChange:iPermissions]) rowChange.value = @1;
- else rowChange.value = @0;
-
- if ([UtilsFramework isPermissionToCanDelete:iPermissions]) rowDelete.value = @1;
- else rowDelete.value = @0;
-
- if ([UtilsFramework isPermissionToCanShare:iPermissions]) rowShare.value = @1;
- else rowShare.value = @0;
-
- // -----------------------------------------------------------------
-
- [self.tableView reloadData];
-
- } else if (errorCode != 0) {
-
- [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
-
- [self dismissViewControllerAnimated:YES completion:nil];
- } else {
- NSLog(@"[LOG] It has been changed user during networking process, error.");
- }
- }];
-
- [_hud visibleHudTitle:@"" mode:MBProgressHUDModeIndeterminate color:nil];
-
- [self initializeForm];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Button =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)endButtonAction:(id)sender
-{
- [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-@end
diff --git a/iOSClient/Share/CCShareOC.h b/iOSClient/Share/CCShareOC.h
deleted file mode 100644
index 7d99e4eca..000000000
--- a/iOSClient/Share/CCShareOC.h
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// CCShareOC.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 13/11/15.
-// Copyright (c) 2017 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/UIKit.h>
-
-#import "XLFormViewController.h"
-#import "CCShareUserOC.h"
-#import "CCSharePermissionOC.h"
-
-@class tableMetadata;
-
-@protocol CCShareOCDelegate;
-
-@interface CCShareOC : XLFormViewController
-
-@property (nonatomic, weak) id <CCShareOCDelegate> delegate;
-
-@property (nonatomic, weak) IBOutlet UIImageView *fileImageView;
-@property (nonatomic, weak) IBOutlet UILabel *labelTitle;
-@property (nonatomic, weak) IBOutlet UILabel *labelSharedWithYouBy;
-@property (nonatomic, weak) IBOutlet UIButton *endButton;
-
-@property (nonatomic, strong) NSString *serverUrl;
-@property (nonatomic, strong) NSString *shareLink;
-@property (nonatomic, strong) NSString *shareUserAndGroup;
-@property (nonatomic, strong) tableMetadata *metadata;
-
-@property (nonatomic, strong) OCSharedDto *itemShareLink;
-@property (nonatomic, strong) NSArray *itemsUserAndGroupLink;
-@property (nonatomic, strong) NSMutableArray *itemsShareWith;
-@property (nonatomic, weak) CCShareUserOC *shareUserOC;
-@property (nonatomic, weak) CCSharePermissionOC *sharePermissionOC;
-
-- (IBAction)endButtonAction:(id)sender;
-
-@end
-
-@protocol CCShareOCDelegate
-
-- (void)readShareServer;
-
-@end
diff --git a/iOSClient/Share/CCShareOC.m b/iOSClient/Share/CCShareOC.m
deleted file mode 100644
index d4f1bc0e4..000000000
--- a/iOSClient/Share/CCShareOC.m
+++ /dev/null
@@ -1,716 +0,0 @@
-//
-// CCShareOC.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 13/11/15.
-// Copyright (c) 2017 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 "CCShareOC.h"
-#import "AppDelegate.h"
-#import "NCBridgeSwift.h"
-
-@interface CCShareOC ()
-{
- AppDelegate *appDelegate;
- tableCapabilities *capabilities;
-}
-@end
-
-@implementation CCShareOC
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
- self = [super initWithCoder:coder];
- if (self) {
-
- appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- self.itemsShareWith = [NSMutableArray new];
-
- [self initializeForm];
- }
- return self;
-}
-
-- (void)initializeForm
-{
- XLFormDescriptor *form ;
- XLFormSectionDescriptor *section;
- XLFormRowDescriptor *row;
-
- form = [XLFormDescriptor formDescriptor];
- form.rowNavigationOptions = XLFormRowNavigationOptionNone;
-
- // Share Link
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_link_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"shareLinkSwitch" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_share_link_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"shareLinkPermission" rowType:XLFormRowDescriptorTypePicker];
- row.height = 70;
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"password" rowType:XLFormRowDescriptorTypePassword title:NSLocalizedString(@"_password_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [section addFormRow:row];
-
- capabilities = [[NCManageDatabase sharedInstance] getCapabilitesWithAccount:appDelegate.activeAccount];
- if (capabilities != nil && capabilities.versionMajor >= k_nextcloud_version_15_0) {
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"hideDownload" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_share_link_hide_download_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [section addFormRow:row];
- }
-
- // Expiration date
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"expirationDate" rowType:XLFormRowDescriptorTypeDate title:NSLocalizedString(@"_date_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- row.value = [self tomorrow];
- [row.cellConfigAtConfigure setObject:[self tomorrow] forKey:@"minimumDate"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"expirationDateSwitch" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_share_expirationdate_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [section addFormRow:row];
-
- // Send Link To
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sendLinkTo" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_share_link_button_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
- row.action.formSelector = @selector(sendLinkTo:);
- [section addFormRow:row];
-
- // Sharee
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_title_", nil)];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_add_sharee_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"findUser" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_add_sharee_", nil)];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
- row.action.formSelector = @selector(shareUserButton:);
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSectionWithTitle:@"" sectionOptions:XLFormSectionOptionCanDelete];
- [form addFormSection:section];
-
- self.form = form;
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.view.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- XLFormRowDescriptor *rowShareLinkPermission = [self.form formRowWithTag:@"shareLinkPermission"];
- if (self.metadata.directory) {
- rowShareLinkPermission.selectorOptions = @[NSLocalizedString(@"_share_link_readonly_", nil), NSLocalizedString(@"_share_link_upload_modify_", nil), NSLocalizedString(@"_share_link_upload_", nil)];
- } else {
- rowShareLinkPermission.selectorOptions = @[NSLocalizedString(@"_share_link_readonly_", nil), NSLocalizedString(@"_share_link_modify_", nil)];
- }
-
- [self.endButton setTitle:NSLocalizedString(@"_done_", nil) forState:UIControlStateNormal];
- self.endButton.tintColor = [UIColor blackColor];
-
- if ([[NSFileManager defaultManager] fileExistsAtPath:[CCUtility getDirectoryProviderStorageIconFileID:self.metadata.fileID fileNameView:self.metadata.fileNameView]]) {
-
- self.fileImageView.image = [UIImage imageWithContentsOfFile:[CCUtility getDirectoryProviderStorageIconFileID:self.metadata.fileID fileNameView:self.metadata.fileNameView]];
-
- } else {
-
- if (self.metadata.directory)
- self.fileImageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
- else
- self.fileImageView.image = [UIImage imageNamed:self.metadata.iconName];
-
- }
-
- self.labelTitle.text = self.metadata.fileNameView;
- self.labelTitle.textColor = [UIColor blackColor];
-
- self.tableView.tableHeaderView = ({UIView *line = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.tableView.frame.size.width, 0.1 / UIScreen.mainScreen.scale)];
- line.backgroundColor = self.tableView.separatorColor;
- line;
- });
-
- self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
- [super viewWillAppear:animated];
-}
-
-- (void)viewDidAppear:(BOOL)animated
-{
- [super viewDidAppear:animated];
-
- [self reloadDatasource];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Networking =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)share:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl password:(NSString *)password permission:(NSInteger)permission hideDownload:(BOOL)hideDownload
-{
- NSString *fileName = [CCUtility returnFileNamePathFromFileName:metadata.fileName serverUrl:serverUrl activeUrl:appDelegate.activeUrl];
-
- [[OCNetworking sharedManager] shareWithAccount:appDelegate.activeAccount fileName:fileName password:password permission:permission hideDownload:hideDownload completion:^(NSString *account, NSString *message, NSInteger errorCode) {
-
- if (errorCode != 0) {
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
-
- [self reloadDatasource];
- }];
-}
-
-- (void)unShare:(NSString *)share metadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl
-{
- [[OCNetworking sharedManager] unshareAccount:appDelegate.activeAccount shareID:[share integerValue] completion:^(NSString *account, NSString *message, NSInteger errorCode) {
-
- if (errorCode != 0) {
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
-
- [self reloadDatasource];
- }];
-}
-
-- (void)updateShare:(NSString *)share metadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl password:(NSString *)password expirationTime:(NSString *)expirationTime permission:(NSInteger)permission hideDownload:(BOOL)hideDownload
-{
- [[OCNetworking sharedManager] shareUpdateAccount:appDelegate.activeAccount shareID:[share integerValue] password:password permission:permission expirationTime:expirationTime hideDownload:hideDownload completion:^(NSString *account, NSString *message, NSInteger errorCode) {
-
- if (errorCode != 0) {
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
-
- [self reloadDatasource];
- }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Reload Data =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)reloadDatasource
-{
- // bugfix
- if (!self.serverUrl || !self.metadata) {
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
- [self.delegate readShareServer];
- [self dismissViewControllerAnimated:YES completion:nil];
- });
-
- return;
- }
-
- XLFormRowDescriptor *rowShareLinkSwitch = [self.form formRowWithTag:@"shareLinkSwitch"];
- XLFormRowDescriptor *rowShareLinkPermission = [self.form formRowWithTag:@"shareLinkPermission"];
- XLFormRowDescriptor *rowPassword = [self.form formRowWithTag:@"password"];
- XLFormRowDescriptor *rowHideDownload = [self.form formRowWithTag:@"hideDownload"];
- XLFormRowDescriptor *rowExpirationDate = [self.form formRowWithTag:@"expirationDate"];
- XLFormRowDescriptor *rowExpirationDateSwitch = [self.form formRowWithTag:@"expirationDateSwitch"];
- XLFormRowDescriptor *rowSendLinkTo = [self.form formRowWithTag:@"sendLinkTo"];
- XLFormRowDescriptor *rowFindUser = [self.form formRowWithTag:@"findUser"];
-
- NSString *path = [CCUtility returnFileNamePathFromFileName:self.metadata.fileName serverUrl:self.serverUrl activeUrl:appDelegate.activeUrl];
-
- [[OCNetworking sharedManager] readShareWithAccount:appDelegate.activeAccount path:path completion:^(NSString *account, NSArray *items, NSString *message, NSInteger errorCode) {
-
- if (errorCode == 0) {
-
- [appDelegate.sharesID removeAllObjects];
-
- for (OCSharedDto *item in items) {
- [appDelegate.sharesID setObject:item forKey:[@(item.idRemoteShared) stringValue]];
- }
-
- NSArray *result = [[NCManageDatabase sharedInstance] updateShare:appDelegate.sharesID activeUrl:appDelegate.activeUrl account:appDelegate.activeAccount];
- if (result) {
- appDelegate.sharesLink = result[0];
- appDelegate.sharesUserAndGroup = result[1];
- }
-
- self.shareLink = [appDelegate.sharesLink objectForKey:[self.serverUrl stringByAppendingString:self.metadata.fileName]];
- self.shareUserAndGroup = [appDelegate.sharesUserAndGroup objectForKey:[self.serverUrl stringByAppendingString:self.metadata.fileName]];
-
- self.itemShareLink = [appDelegate.sharesID objectForKey:self.shareLink];
- if ([self.shareUserAndGroup length] > 0) self.itemsUserAndGroupLink = [self.shareUserAndGroup componentsSeparatedByString:@","];
- else self.itemsUserAndGroupLink = nil;
-
- } else {
-
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
-
- self.form.delegate = nil;
-
- // Share Link
- if ([self.shareLink length] > 0) {
-
- [rowShareLinkSwitch setValue:@1];
-
- rowShareLinkPermission.disabled = @NO;
- rowPassword.disabled = @NO;
- rowHideDownload.disabled = @NO;
- rowExpirationDate.disabled = @NO;
- rowExpirationDateSwitch.disabled = @NO;
-
- rowSendLinkTo.disabled = @NO;
-
- } else {
-
- [rowShareLinkSwitch setValue:@0];
-
- rowShareLinkPermission.disabled = @YES;
- rowPassword.disabled = @YES;
- rowHideDownload.disabled = @YES;
- rowExpirationDate.disabled = @YES;
- rowExpirationDateSwitch.disabled = @YES;
-
- rowSendLinkTo.disabled = @YES;
- }
-
- // Permission
-
- if (self.itemShareLink.permissions > 0 && self.itemShareLink.shareType == shareTypeLink) {
- switch (self.itemShareLink.permissions) {
- case 1:
- rowShareLinkPermission.value = NSLocalizedString(@"_share_link_readonly_", nil);
- break;
- case 3:
- rowShareLinkPermission.value = NSLocalizedString(@"_share_link_modify_", nil);
- break;
- case 4:
- rowShareLinkPermission.value = NSLocalizedString(@"_share_link_upload_", nil);
- break;
- case 15:
- rowShareLinkPermission.value = NSLocalizedString(@"_share_link_upload_modify_", nil);
- break;
- default:
- break;
- }
- } else {
- rowShareLinkPermission.value = NSLocalizedString(@"_share_link_readonly_", nil);
- }
-
- // Password
- if ([[self.itemShareLink shareWith] length] > 0 && self.itemShareLink.shareType == shareTypeLink)
- rowPassword.value = [self.itemShareLink shareWith];
- else
- rowPassword.value = @"";
-
- // Hide Download
- if (self.itemShareLink.hideDownload) rowHideDownload.value = @1;
- else rowHideDownload.value = @0;
-
- // Expiration Date
- if (self.itemShareLink.expirationDate) {
-
- rowExpirationDateSwitch.value = @1;
- NSDate *expireDate;
-
- if (self.itemShareLink.expirationDate) expireDate = [NSDate dateWithTimeIntervalSince1970: self.itemShareLink.expirationDate];
- else expireDate = [self tomorrow];
-
- rowExpirationDate.value = expireDate;
-
- } else {
-
- rowExpirationDateSwitch.value = @0;
- rowExpirationDate.value = [self tomorrow];
- }
-
- // User & Group
- XLFormSectionDescriptor *section = [self.form formSectionAtIndex:4];
- [section.formRows removeAllObjects];
- [self.itemsShareWith removeAllObjects];
-
- if ([self.itemsUserAndGroupLink count] > 0) {
-
- for (NSString *idRemoteShared in self.itemsUserAndGroupLink) {
-
- OCSharedDto *item = [appDelegate.sharesID objectForKey:idRemoteShared];
-
- XLFormRowDescriptor *row = [XLFormRowDescriptor formRowDescriptorWithTag:idRemoteShared rowType:XLFormRowDescriptorTypeButton];
-
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"textLabel.textColor"];
- row.action.formSelector = @selector(sharePermissionButton:);
-
- if (item.shareType == shareTypeGroup) row.title = [item.shareWithDisplayName stringByAppendingString:NSLocalizedString(@"_user_is_group_", nil)];
- else row.title = item.shareWithDisplayName;
-
- //If the initiator or the recipient is not the current user, show the list of sharees without any options to edit it.
- if (![item.uidOwner isEqualToString:appDelegate.activeUserID] && ![item.uidFileOwner isEqualToString:appDelegate.activeUserID]) {
- row.disabled = @YES;
- }
-
- [section addFormRow:row];
-
- // add users
- [self.itemsShareWith addObject:item];
-
- // shared with you by
- if (![item.uidFileOwner isEqualToString:appDelegate.activeUserID]) {
- self.labelSharedWithYouBy.text = [NSString stringWithFormat:@"%@ %@", NSLocalizedString(@"_shared_with_you_by_", nil), item.displayNameFileOwner];
- }
- }
-
- section.footerTitle = NSLocalizedString(@"_user_sharee_footer_", nil);
-
- } else {
-
- section.footerTitle = @"";
- }
-
- // canShare
- BOOL canShare = [self.metadata.permissions containsString:k_permission_can_share];
- if (! canShare) {
-
- rowShareLinkSwitch.disabled = @YES;
- rowShareLinkPermission.disabled = @YES;
- rowPassword.disabled = @YES;
- rowHideDownload.disabled = @YES;
- rowExpirationDate.disabled = @YES;
- rowExpirationDateSwitch.disabled = @YES;
- rowSendLinkTo.disabled = @YES;
- rowFindUser.disabled = @YES;
-
- XLFormSectionDescriptor *section = [self.form formSectionAtIndex:4];
- [section.formRows removeAllObjects];
- }
-
- self.form.disabled = NO;
-
- [self.tableView reloadData];
-
- self.form.delegate = self;
- }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Change Value & Button =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)sendLinkTo:(XLFormRowDescriptor *)sender
-{
- [self deselectFormRow:sender];
-
- NSString *sharedLink = self.itemShareLink.token;
- NSString *url;
-
- if ([sharedLink hasPrefix:@"http://"] || [sharedLink hasPrefix:@"https://"]) {
-
- url = sharedLink;
-
- } else if (self.itemShareLink.url) {
-
- url = self.itemShareLink.url;
-
- } else {
-
- url = [NSString stringWithFormat:@"%@/%@%@", appDelegate.activeUrl, k_share_link_middle_part_url_after_version_8, sharedLink];
-
- }
-
- NSArray *activityItems = @[[NSString stringWithFormat:@""], [NSURL URLWithString:url]];
- NSArray *applicationActivities = nil;
-
- UIActivityViewController *activityController = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
-
- activityController.popoverPresentationController.sourceView = self.view;
- NSIndexPath *indexPath = [self.form indexPathOfFormRow:sender];
- CGRect cellRect = [self.tableView rectForRowAtIndexPath:indexPath];
- activityController.popoverPresentationController.sourceRect = CGRectOffset(cellRect, -self.tableView.contentOffset.x, -self.tableView.contentOffset.y);
-
- [self presentViewController:activityController animated:YES completion:nil];
-}
-
-- (void)shareUserButton:(XLFormRowDescriptor *)rowDescriptor
-{
- [self deselectFormRow:rowDescriptor];
-
- self.shareUserOC = [[UIStoryboard storyboardWithName:@"CCShare" bundle:nil] instantiateViewControllerWithIdentifier:@"CCShareUserOC"];
- self.shareUserOC.metadata = self.metadata;
- self.shareUserOC.serverUrl = self.serverUrl;
- self.shareUserOC.itemsShareWith = self.itemsShareWith;
- self.shareUserOC.isDirectory = self.metadata.directory;
-
- [self.shareUserOC setModalPresentationStyle:UIModalPresentationFormSheet];
- [self presentViewController:self.shareUserOC animated:YES completion:NULL];
-}
-
-- (void)sharePermissionButton:(XLFormRowDescriptor *)rowDescriptor
-{
- [self deselectFormRow:rowDescriptor];
-
- self.sharePermissionOC = [[UIStoryboard storyboardWithName:@"CCShare" bundle:nil] instantiateViewControllerWithIdentifier:@"CCSharePermissionOC"];
- self.sharePermissionOC.idRemoteShared = rowDescriptor.tag;
- self.sharePermissionOC.metadata = self.metadata;
- self.sharePermissionOC.serverUrl = self.serverUrl;
-
- [self.sharePermissionOC setModalPresentationStyle:UIModalPresentationFormSheet];
- [self presentViewController:self.sharePermissionOC animated:YES completion:NULL];
-}
-
-- (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
-{
- [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
-
- //OCSharedDto *shareDto = [appDelegate.sharesID objectForKey:self.shareLink];
-
- if ([rowDescriptor.tag isEqualToString:@"shareLinkSwitch"]) {
-
- if ([[rowDescriptor.value valueData] boolValue] == YES) {
-
- if (capabilities.isFilesSharingPublicPasswordEnforced == YES) {
-
- __weak __typeof(UIAlertController) *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_enforce_password_protection_",nil) message:nil preferredStyle:UIAlertControllerStyleAlert];
- [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField) {
- textField.secureTextEntry = true;
- [textField addTarget:self action:@selector(minCharTextFieldDidChange:) forControlEvents:UIControlEventEditingChanged];
- }];
- UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_",nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
- [self reloadDatasource];
- }];
- UIAlertAction *okAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"_ok_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
- NSString *password = alertController.textFields.firstObject.text;
- XLFormRowDescriptor *rowPassword = [self.form formRowWithTag:@"password"];
- rowPassword.value = password;
- [self share:self.metadata serverUrl:self.serverUrl password:password permission:1 hideDownload:false];
- [self disableForm];
- }];
-
- okAction.enabled = NO;
-
- [alertController addAction:cancelAction];
- [alertController addAction:okAction];
-
- [self presentViewController:alertController animated:YES completion:nil];
-
- } else {
-
- [self share:self.metadata serverUrl:self.serverUrl password:@"" permission:1 hideDownload:false];
- [self disableForm];
- }
-
- } else {
-
- // unshare
- [self unShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl];
- [self disableForm];
- }
- }
-
- if ([rowDescriptor.tag isEqualToString:@"shareLinkPermission"]) {
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:nil permission:[self getShareLinkPermission:newValue] hideDownload:false];
- [self disableForm];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"hideDownload"]) {
-
- BOOL hideDownload = [newValue boolValue];
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:nil permission:0 hideDownload:hideDownload];
- [self disableForm];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"expirationDateSwitch"]) {
-
- // remove expiration date
- if ([[rowDescriptor.value valueData] boolValue] == NO) {
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:@"" permission:0 hideDownload:false];
- [self disableForm];
-
- } else {
-
- // new date
- XLFormRowDescriptor *rowExpirationDate = [self.form formRowWithTag:@"expirationDate"];
- NSString *expirationDate = [self convertDateInServerFormat:rowExpirationDate.value];
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:expirationDate permission:0 hideDownload:false];
- [self disableForm];
- }
- }
-}
-
-- (void)formRowHasBeenRemoved:(XLFormRowDescriptor *)formRow atIndexPath:(NSIndexPath *)indexPath
-{
- long long idRemoteShared = [formRow.tag longLongValue];
-
- if ([formRow.rowType isEqualToString:@"button"] && idRemoteShared > 0) {
-
- [self unShare:formRow.tag metadata:self.metadata serverUrl:self.serverUrl];
- [self disableForm];
- }
-}
-
-- (void)beginEditing:(XLFormRowDescriptor *)rowDescriptor
-{
- [super beginEditing:rowDescriptor];
-
- if ([rowDescriptor.tag isEqualToString:@"expirationDate"]) {
-
- self.endButton.enabled = NO;
- }
-}
-
-- (void)endEditing:(XLFormRowDescriptor *)rowDescriptor
-{
- [super endEditing:rowDescriptor];
-
- //OCSharedDto *shareDto = [appDelegate.sharesID objectForKey:self.shareLink];
-
- if ([rowDescriptor.tag isEqualToString:@"expirationDate"]) {
-
- NSDate *old = [NSDate dateWithTimeIntervalSince1970: self.itemShareLink.expirationDate];
- NSDate *new = rowDescriptor.value;
-
- if ([old compare:new] != NSOrderedSame) {
-
- NSString *expirationDate = [self convertDateInServerFormat:rowDescriptor.value];
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:expirationDate permission:0 hideDownload:false];
- [self disableForm];
- }
-
- self.endButton.enabled = YES;
- }
-
- if ([rowDescriptor.tag isEqualToString:@"password"]) {
-
- NSString *password = rowDescriptor.value;
-
- // Public Password Enforced Test
- if (capabilities.isFilesSharingPublicPasswordEnforced == YES && password == nil) {
-
- [appDelegate messageNotification:@"_share_link_" description:@"_password_obligatory_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:k_CCErrorInternalError];
-
- [self reloadDatasource];
-
- } else {
-
- // if the password is not changed or is 0 lenght
- if ([[self.itemShareLink shareWith] isEqualToString:password]) {
-
- [self reloadDatasource];
-
- } else {
-
- if (password == nil)
- password = @"";
-
- if (self.shareLink) {
-
- [self updateShare:self.shareLink metadata:self.metadata serverUrl:self.serverUrl password:password expirationTime:nil permission:0 hideDownload:false];
- [self disableForm];
- }
- }
- }
- }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Button =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)endButtonAction:(id)sender
-{
- [self.tableView endEditing:YES];
-
- [[NCMainCommon sharedInstance] reloadDatasourceWithServerUrl:self.metadata.serverUrl fileID:self.metadata.fileID action:k_action_MOD];
-
- [self.delegate readShareServer];
-
- [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Utility =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)minCharTextFieldDidChange:(UITextField *)sender
-{
- UIAlertController *alertController = (UIAlertController *)self.presentedViewController;
-
- if (alertController) {
- UITextField *password = alertController.textFields.firstObject;
- UIAlertAction *okAction = alertController.actions.lastObject;
- okAction.enabled = password.text.length >= 8;
- }
-}
-
--(void)disableForm
-{
- self.form.disabled = YES;
- [self.tableView endEditing:YES];
- [self.tableView reloadData];
-}
-
-- (NSString *)convertDateInServerFormat:(NSDate *)date {
-
- NSDateFormatter *dateFormatter = [NSDateFormatter new];
-
- [dateFormatter setDateFormat:@"YYYY-MM-dd"];
-
- return [dateFormatter stringFromDate:date];
-}
-
--(NSDate *)tomorrow
-{
- NSDate *now = [NSDate date];
- int daysToAdd = 1;
- return [now dateByAddingTimeInterval:60*60*24*daysToAdd];
-}
-
-- (NSInteger)getShareLinkPermission:(NSString *)value
-{
- if ([value isEqualToString:NSLocalizedString(@"_share_link_readonly_", nil)]) {
- return 1;
- } else if ([value isEqualToString:NSLocalizedString(@"_share_link_modify_", nil)]) {
- return 3;
- } else if ([value isEqualToString:NSLocalizedString(@"_share_link_upload_", nil)]) {
- return 4;
- } else if ([value isEqualToString:NSLocalizedString(@"_share_link_upload_modify_", nil)]) {
- return 15;
- } else {
- return 1;
- }
-}
-
-@end
diff --git a/iOSClient/Share/CCSharePermissionOC.h b/iOSClient/Share/CCSharePermissionOC.h
deleted file mode 100644
index 73cafd0ee..000000000
--- a/iOSClient/Share/CCSharePermissionOC.h
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// CCSharePermissionOC.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 07/03/16.
-// Copyright (c) 2017 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/UIKit.h>
-
-#import "XLFormViewController.h"
-#import "OCShareUser.h"
-#import "UtilsFramework.h"
-
-@class tableMetadata;
-
-@interface CCSharePermissionOC : XLFormViewController
-
-@property (nonatomic, weak) IBOutlet UIButton *endButton;
-@property (nonatomic, strong) NSString *idRemoteShared;
-@property (nonatomic, strong) tableMetadata *metadata;
-@property (nonatomic, strong) NSString *serverUrl;
-
-- (IBAction)endButtonAction:(id)sender;
-
-@end
diff --git a/iOSClient/Share/CCSharePermissionOC.m b/iOSClient/Share/CCSharePermissionOC.m
deleted file mode 100644
index 1615b9ee9..000000000
--- a/iOSClient/Share/CCSharePermissionOC.m
+++ /dev/null
@@ -1,205 +0,0 @@
-//
-// CCSharePermissionOC.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 07/03/16.
-// Copyright (c) 2017 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 "CCSharePermissionOC.h"
-#import "AppDelegate.h"
-#import "NCBridgeSwift.h"
-
-@interface CCSharePermissionOC ()
-{
- AppDelegate *appDelegate;
- OCSharedDto *shareDto;
-}
-@end
-
-@implementation CCSharePermissionOC
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
- self = [super initWithCoder:coder];
- if (self) {
-
- appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
- }
- return self;
-}
-
-- (void)initializeForm
-{
- XLFormDescriptor *form ;
- XLFormSectionDescriptor *section;
- XLFormRowDescriptor *row;
-
- form = [XLFormDescriptor formDescriptor];
- form.rowNavigationOptions = XLFormRowNavigationOptionNone;
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_permission_title_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"edit" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_edit_", nil)];
- if ([UtilsFramework isAnyPermissionToEdit:shareDto.permissions]) row.value = @1;
- else row.value = @0;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- if (shareDto.isDirectory) {
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"create" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_create_", nil)];
- row.hidden = [NSString stringWithFormat:@"$%@==0", @"edit"];
- if ([UtilsFramework isPermissionToCanCreate:shareDto.permissions]) row.value = @1;
- else row.value = @0;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"change" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_change_", nil)];
- row.hidden = [NSString stringWithFormat:@"$%@==0", @"edit"];
- if ([UtilsFramework isPermissionToCanChange:shareDto.permissions]) row.value = @1;
- else row.value = @0;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"delete" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_delete_", nil)];
- row.hidden = [NSString stringWithFormat:@"$%@==0", @"edit"];
- if ([UtilsFramework isPermissionToCanDelete:shareDto.permissions]) row.value = @1;
- else row.value = @0;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
- }
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"share" rowType:XLFormRowDescriptorTypeBooleanCheck title:NSLocalizedString(@"_share_permission_share_", nil)];
- if ([UtilsFramework isPermissionToCanShare:shareDto.permissions]) row.value = @1;
- else row.value = @0;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"tintColor"];
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_permission_info_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sharepath" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_path_", nil)];
- row.value = self.metadata.fileNameView;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sharetype" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_type_", nil)];
- if (shareDto.shareType == shareTypeUser) row.value = NSLocalizedString(@"_share_permission_typeuser_", nil);
- if (shareDto.shareType == shareTypeGroup) row.value = NSLocalizedString(@"_share_permission_typegroup_", nil);
- if (shareDto.shareType == shareTypeLink) row.value = NSLocalizedString(@"_share_permission_typepubliclink_", nil);
- if (shareDto.shareType == shareTypeRemote) row.value = NSLocalizedString(@"_share_permission_typefederated_", nil);
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"shareowner" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_owner_", nil)];
- row.value = shareDto.displayNameOwner;
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sharedate" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_date_", nil)];
- NSDate *date = [NSDate dateWithTimeIntervalSince1970:shareDto.sharedDate];
- row.value = [NSDateFormatter localizedStringFromDate:date dateStyle:NSDateFormatterShortStyle timeStyle:NSDateFormatterShortStyle];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"sharemail" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_share_permission_email_", nil)];
- if (shareDto.mailSend == 0) row.value = NSLocalizedString(@"_no_", nil);
- if (shareDto.mailSend == 1) row.value = NSLocalizedString(@"_yes_", nil);
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
- [section addFormRow:row];
-
- self.form = form;
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.view.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- [self.endButton setTitle:NSLocalizedString(@"_done_", nil) forState:UIControlStateNormal];
- self.endButton.tintColor = [UIColor blackColor];
-
- self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- shareDto = [appDelegate.sharesID objectForKey:self.idRemoteShared];
-
- [self initializeForm];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Networking =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)updateShare:(NSString *)share metadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl password:(NSString *)password expirationTime:(NSString *)expirationTime permission:(NSInteger)permission hideDownload:(BOOL)hideDownload
-{
- [[OCNetworking sharedManager] shareUpdateAccount:appDelegate.activeAccount shareID:[share integerValue] password:password permission:permission expirationTime:expirationTime hideDownload:hideDownload completion:^(NSString *account, NSString *message, NSInteger errorCode) {
-
- if (errorCode != 0) {
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
-
- [self dismissViewControllerAnimated:YES completion:nil];
- }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Button =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)endButtonAction:(id)sender
-{
- NSInteger permission;
-
- XLFormRowDescriptor *rowEdit = [self.form formRowWithTag:@"edit"];
- XLFormRowDescriptor *rowCreate = [self.form formRowWithTag:@"create"];
- XLFormRowDescriptor *rowChange = [self.form formRowWithTag:@"change"];
- XLFormRowDescriptor *rowDelete = [self.form formRowWithTag:@"delete"];
- XLFormRowDescriptor *rowShare = [self.form formRowWithTag:@"share"];
-
- if ([rowEdit.value boolValue] == 0)
- permission = [UtilsFramework getPermissionsValueByCanEdit:NO andCanCreate:NO andCanChange:NO andCanDelete:NO andCanShare:[rowShare.value boolValue] andIsFolder:shareDto.isDirectory];
- else
- permission = [UtilsFramework getPermissionsValueByCanEdit:[rowEdit.value boolValue] andCanCreate:[rowCreate.value boolValue] andCanChange:[rowChange.value boolValue] andCanDelete:[rowDelete.value boolValue] andCanShare:[rowShare.value boolValue] andIsFolder:shareDto.isDirectory];
-
- if (permission != shareDto.permissions) {
- [self updateShare:self.idRemoteShared metadata:self.metadata serverUrl:self.serverUrl password:nil expirationTime:nil permission:permission hideDownload:false];
- } else {
- [self dismissViewControllerAnimated:YES completion:nil];
- }
-}
-
-@end
diff --git a/iOSClient/Share/CCShareUserOC.h b/iOSClient/Share/CCShareUserOC.h
deleted file mode 100644
index 5f770c50d..000000000
--- a/iOSClient/Share/CCShareUserOC.h
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// CCShareUserOC.h
-// Nextcloud
-//
-// Created by Marino Faggiana on 30/11/15.
-// Copyright (c) 2017 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/UIKit.h>
-
-#import "XLFormViewController.h"
-#import "OCShareUser.h"
-#import "OCConstants.h"
-
-@class tableMetadata;
-
-@interface CCShareUserOC : XLFormViewController
-
-@property (nonatomic, weak) IBOutlet UIButton *endButton;
-
-@property (nonatomic, strong) NSMutableArray *selectedItems;
-@property (nonatomic, strong) NSArray *itemsShareWith;
-@property (nonatomic, strong) NSMutableArray *users;
-@property (nonatomic, strong) NSString *directUser;
-@property (nonatomic, strong) tableMetadata *metadata;
-@property (nonatomic, strong) NSString *serverUrl;
-
-@property BOOL isDirectory;
-@property NSInteger shareType;
-
-- (IBAction)endButtonAction:(id)sender;
-
-- (void)reloadUserAndGroup:(NSArray *)items;
-
-@end
diff --git a/iOSClient/Share/CCShareUserOC.m b/iOSClient/Share/CCShareUserOC.m
deleted file mode 100644
index e3c125a3b..000000000
--- a/iOSClient/Share/CCShareUserOC.m
+++ /dev/null
@@ -1,268 +0,0 @@
-//
-// CCShareUserOC.m
-// Nextcloud
-//
-// Created by Marino Faggiana on 30/11/15.
-// Copyright (c) 2017 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 "CCShareUserOC.h"
-#import "AppDelegate.h"
-#import "NCBridgeSwift.h"
-
-@interface CCShareUserOC ()
-{
- AppDelegate *appDelegate;
-}
-@end
-
-@implementation CCShareUserOC
-
-- (instancetype)initWithCoder:(NSCoder *)coder
-{
- self = [super initWithCoder:coder];
- if (self) {
-
- appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-
- self.directUser = @"";
-
- [self initializeForm];
- }
- return self;
-}
-
-- (void)initializeForm
-{
- XLFormDescriptor *form ;
- XLFormSectionDescriptor *section;
- XLFormRowDescriptor *row;
-
- form = [XLFormDescriptor formDescriptor];
- form.rowNavigationOptions = XLFormRowNavigationOptionNone;
- form.assignFirstResponderOnShow = NO;
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_find_sharee_title_", nil)];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_find_sharee_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"findUser" rowType:XLFormRowDescriptorTypeAccount];
- [row.cellConfigAtConfigure setObject:NSLocalizedString(@"_find_sharee_", nil) forKey:@"textField.placeholder"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textField.font"];
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_direct_sharee_title_", nil)];
- [form addFormSection:section];
- section.footerTitle = NSLocalizedString(@"_direct_sharee_footer_", nil);
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"directUser" rowType:XLFormRowDescriptorTypeAccount];
- [row.cellConfigAtConfigure setObject:NSLocalizedString(@"_direct_sharee_", nil) forKey:@"textField.placeholder"];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textField.font"];
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_share_type_title_", nil)];
- [form addFormSection:section];
-
- row = [XLFormRowDescriptor formRowDescriptorWithTag:@"shareType" rowType:XLFormRowDescriptorTypePicker];
- row.selectorOptions = @[NSLocalizedString(@"_share_type_user_", nil), NSLocalizedString(@"_share_type_group_", nil), NSLocalizedString(@"_share_type_remote_", nil)];
- row.value = NSLocalizedString(@"_share_type_user_", nil);
- self.shareType = shareTypeUser;
- row.height = 100;
- [section addFormRow:row];
-
- section = [XLFormSectionDescriptor formSection];
- [form addFormSection:section];
-
- self.form = form;
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-
- self.selectedItems = [[NSMutableArray alloc] init];
-
- self.view.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-
- [self.endButton setTitle:NSLocalizedString(@"_done_", nil) forState:UIControlStateNormal];
- self.endButton.tintColor = [UIColor blackColor];
-
- self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Networking =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)shareUserAndGroup:(NSString *)user shareeType:(NSInteger)shareeType permission:(NSInteger)permission metadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl
-{
- NSString *fileName = [CCUtility returnFileNamePathFromFileName:metadata.fileName serverUrl:serverUrl activeUrl:appDelegate.activeUrl];
-
- [[OCNetworking sharedManager] shareUserGroupWithAccount:appDelegate.activeAccount userOrGroup:user fileName:fileName permission:permission shareeType:shareeType completion:^(NSString *account, NSString *message, NSInteger errorCode) {
-
- if (errorCode != 0) {
- [appDelegate messageNotification:@"_share_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
- }];
-}
-
-- (void)getUserAndGroup:(NSString *)find
-{
- [[OCNetworking sharedManager] getUserGroupWithAccount:appDelegate.activeAccount searchString:find completion:^(NSString *account, NSArray *item, NSString *message, NSInteger errorCode) {
-
- if (errorCode == 0) {
- [self reloadUserAndGroup:item];
- } else {
- [appDelegate messageNotification:@"_error_" description:message visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:errorCode];
- }
- }];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Button =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (IBAction)endButtonAction:(id)sender
-{
- NSInteger permission;
-
- if (self.isDirectory) permission = k_max_folder_share_permission;
- else permission = k_max_file_share_permission;
-
- // start share of select users
- for (NSString *num in self.selectedItems) {
-
- // fix #166 Crashlytics
- if (self.users.count > 0 && [num integerValue] < self.users.count) {
-
- OCShareUser *item = [self.users objectAtIndex:[num integerValue]];
- [self shareUserAndGroup:item.name shareeType:item.shareeType permission:permission metadata:self.metadata serverUrl:self.serverUrl];
- }
- }
-
- // add manual user
- if ([self.directUser isEqual:[NSNull null]] == NO && [self.directUser length] > 0 && [self.directUser isEqualToString:appDelegate.activeUser] == NO) {
- [self shareUserAndGroup:self.directUser shareeType:self.shareType permission:permission metadata:self.metadata serverUrl:self.serverUrl];
- }
-
- [self dismissViewControllerAnimated:YES completion:nil];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Change Value =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
-{
- [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
-
- if ([rowDescriptor.rowType isEqualToString:XLFormRowDescriptorTypeBooleanCheck]) {
-
- if ([newValue boolValue] == YES)
- [self.selectedItems addObject:rowDescriptor.tag];
- if ([newValue boolValue] == NO)
- [self.selectedItems removeObject:rowDescriptor.tag];
- }
-
- if ([rowDescriptor.tag isEqualToString:@"directUser"]) {
-
- self.directUser = newValue;
- }
-
- if ([rowDescriptor.tag isEqualToString:@"shareType"]){
-
- if ([newValue isEqualToString:NSLocalizedString(@"_share_type_user_", nil)])
- self.shareType = shareTypeUser;
- if ([newValue isEqualToString:NSLocalizedString(@"_share_type_group_", nil)])
- self.shareType = shareTypeGroup;
- if ([newValue isEqualToString:NSLocalizedString(@"_share_type_remote_", nil)])
- self.shareType = shareTypeRemote;
- }
-}
-
-- (void)endEditing:(XLFormRowDescriptor *)rowDescriptor
-{
- [super endEditing:rowDescriptor];
-
- if ([rowDescriptor.tag isEqualToString:@"findUser"]) {
-
- rowDescriptor.value = [rowDescriptor.value stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
-
- if ([rowDescriptor.value length] > 1)
- [self getUserAndGroup:rowDescriptor.value];
- }
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Delegate =====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)reloadUserAndGroup:(NSArray *)items
-{
- self.users = [[NSMutableArray alloc] initWithArray:items];
-
- self.form.delegate = nil;
-
- // remove the select users and i
- for (OCShareUser *user in items) {
-
- for (OCSharedDto *item in self.itemsShareWith)
- if ([item.shareWith isEqualToString:user.name] && ((item.shareType == shareTypeGroup && user.shareeType == 1) || (item.shareType != shareTypeGroup && user.shareeType == 0)))
- [self.users removeObject:user];
-
- if ([self.itemsShareWith containsObject:user.name] || [user.name isEqualToString:appDelegate.activeUser])
- [self.users removeObject:user];
- }
-
- XLFormSectionDescriptor *section = [self.form formSectionAtIndex:1];
- [section.formRows removeAllObjects];
-
- for (OCShareUser *item in self.users) {
-
- NSInteger num = [self.users indexOfObject:item];
-
- NSString *title;
-
- if (item.shareeType == 1) {
- if (item.displayName)
- title = [item.displayName stringByAppendingString:NSLocalizedString(@"_user_is_group_", nil)];
- else
- title = [item.name stringByAppendingString:NSLocalizedString(@"_user_is_group_", nil)];
- } else {
- if (item.displayName)
- title = item.displayName;
- else
- title = item.name;
- }
-
- XLFormRowDescriptor *row = [XLFormRowDescriptor formRowDescriptorWithTag:[@(num) stringValue] rowType:XLFormRowDescriptorTypeBooleanCheck title:title];
- [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
- [row.cellConfig setObject:[NCBrandColor sharedInstance].brandElement forKey:@"self.tintColor"];
-
- [section addFormRow:row];
- }
-
- [self.tableView reloadData];
-
- self.form.delegate = self;
-}
-
-@end
diff --git a/iOSClient/Share/NCShare.storyboard b/iOSClient/Share/NCShare.storyboard
index 46bb8b1c2..20203df84 100644
--- a/iOSClient/Share/NCShare.storyboard
+++ b/iOSClient/Share/NCShare.storyboard
@@ -71,22 +71,17 @@
<rect key="frame" x="5" y="244" width="404" height="608"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" clearButtonMode="always" translatesAutoresizingMaskIntoConstraints="NO" id="iSO-mc-0TB">
- <rect key="frame" x="5" y="20" width="354" height="30"/>
+ <rect key="frame" x="5" y="20" width="389" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="0aG-z9-fcy"/>
</constraints>
<nil key="textColor"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<textInputTraits key="textInputTraits"/>
+ <connections>
+ <action selector="searchFieldDidEndOnExitWithTextField:" destination="bgO-Rz-2M1" eventType="editingDidEndOnExit" id="xH6-YR-5W9"/>
+ </connections>
</textField>
- <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f5j-bG-pbj">
- <rect key="frame" x="369" y="20" width="30" height="30"/>
- <constraints>
- <constraint firstAttribute="height" constant="30" id="Ikg-Fn-Sfc"/>
- <constraint firstAttribute="width" constant="30" id="rfv-yn-tpm"/>
- </constraints>
- <state key="normal" image="arrowRight"/>
- </button>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="c94-b9-Sim">
<rect key="frame" x="0.0" y="118" width="404" height="490"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
@@ -129,17 +124,15 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
- <constraint firstItem="f5j-bG-pbj" firstAttribute="centerY" secondItem="iSO-mc-0TB" secondAttribute="centerY" id="8Aa-Tz-QVA"/>
<constraint firstAttribute="trailing" secondItem="c94-b9-Sim" secondAttribute="trailing" id="BtN-cJ-TTc"/>
<constraint firstItem="c94-b9-Sim" firstAttribute="top" secondItem="iSO-mc-0TB" secondAttribute="bottom" constant="68" id="Co6-l6-HiT"/>
- <constraint firstItem="f5j-bG-pbj" firstAttribute="leading" secondItem="iSO-mc-0TB" secondAttribute="trailing" constant="10" id="GBQ-j9-3mM"/>
<constraint firstItem="SQW-aQ-ydN" firstAttribute="centerY" secondItem="8Cj-cK-AKZ" secondAttribute="centerY" id="LtS-8d-L7a"/>
<constraint firstItem="Qek-aQ-NjE" firstAttribute="centerY" secondItem="8Cj-cK-AKZ" secondAttribute="centerY" id="NYZ-hc-SBk"/>
<constraint firstItem="SQW-aQ-ydN" firstAttribute="leading" secondItem="8Cj-cK-AKZ" secondAttribute="trailing" constant="8" id="Oby-Ea-MaC"/>
<constraint firstItem="cLd-wD-cSC" firstAttribute="leading" secondItem="SQW-aQ-ydN" secondAttribute="trailing" constant="10" id="PFh-qU-yXY"/>
<constraint firstAttribute="bottom" secondItem="c94-b9-Sim" secondAttribute="bottom" id="Svm-RV-vnl"/>
+ <constraint firstAttribute="trailing" secondItem="iSO-mc-0TB" secondAttribute="trailing" constant="10" id="Vhu-GP-EJN"/>
<constraint firstItem="8Cj-cK-AKZ" firstAttribute="leading" secondItem="X2m-IC-J1u" secondAttribute="leading" constant="5" id="WlZ-CY-x4s"/>
- <constraint firstAttribute="trailing" secondItem="f5j-bG-pbj" secondAttribute="trailing" constant="5" id="Yb4-KO-nwi"/>
<constraint firstItem="Qek-aQ-NjE" firstAttribute="leading" secondItem="cLd-wD-cSC" secondAttribute="trailing" constant="30" id="bSw-vM-d12"/>
<constraint firstItem="iSO-mc-0TB" firstAttribute="leading" secondItem="X2m-IC-J1u" secondAttribute="leading" constant="5" id="d8E-WM-YfC"/>
<constraint firstItem="iSO-mc-0TB" firstAttribute="top" secondItem="X2m-IC-J1u" secondAttribute="top" constant="20" id="jPM-Uo-0lS"/>
@@ -162,7 +155,6 @@
<connections>
<outlet property="buttonCopy" destination="cLd-wD-cSC" id="Sib-oL-uQx"/>
<outlet property="buttonMenu" destination="Qek-aQ-NjE" id="xfp-a1-YDn"/>
- <outlet property="returnSearchButton" destination="f5j-bG-pbj" id="Frk-T3-NV9"/>
<outlet property="searchField" destination="iSO-mc-0TB" id="1vY-Js-dGQ"/>
<outlet property="shareLinkImage" destination="8Cj-cK-AKZ" id="dIZ-nv-gyf"/>
<outlet property="shareLinkLabel" destination="SQW-aQ-ydN" id="nBK-WJ-oKy"/>
@@ -176,7 +168,6 @@
</scene>
</scenes>
<resources>
- <image name="arrowRight" width="329" height="329"/>
<image name="shareCopy" width="329" height="329"/>
<image name="shareMenu" width="329" height="329"/>
</resources>
diff --git a/iOSClient/Share/NCShare.swift b/iOSClient/Share/NCShare.swift
index 0557f9af1..8a68e73d1 100644
--- a/iOSClient/Share/NCShare.swift
+++ b/iOSClient/Share/NCShare.swift
@@ -28,7 +28,6 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
@IBOutlet weak var viewContainerConstraint: NSLayoutConstraint!
@IBOutlet weak var searchField: UITextField!
- @IBOutlet weak var returnSearchButton: UIButton!
@IBOutlet weak var shareLinkImage: UIImageView!
@IBOutlet weak var shareLinkLabel: UILabel!
@IBOutlet weak var buttonCopy: UIButton!
@@ -50,7 +49,6 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
searchField.placeholder = NSLocalizedString("_shareLinksearch_placeholder_", comment: "")
- returnSearchButton.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "arrowRight"), width: 100, height: 100, color: UIColor.gray), for: .normal)
shareLinkLabel.text = NSLocalizedString("_share_link_", comment: "")
shareLinkImage.image = NCShareCommon.sharedInstance.createLinkAvatar()
buttonCopy.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "shareCopy"), width: 100, height: 100, color: UIColor.gray), for: .normal)
@@ -77,6 +75,28 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
shareUserMenuView = nil
}
+ @objc func reloadData() {
+ let shares = NCManageDatabase.sharedInstance.getTableShares(metadata: metadata!)
+ if shares.firstShareLink == nil {
+ buttonMenu.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "shareAdd"), width: 100, height: 100, color: UIColor.gray), for: .normal)
+ buttonCopy.isHidden = true
+ } else {
+ buttonMenu.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "shareMenu"), width: 100, height: 100, color: UIColor.gray), for: .normal)
+ buttonCopy.isHidden = false
+ }
+ tableView.reloadData()
+ }
+
+ // MARK: - IBAction
+
+ @IBAction func searchFieldDidEndOnExit(textField: UITextField) {
+
+ guard let searchString = textField.text else { return }
+
+ let networking = NCShareNetworking.init(account: metadata!.account, activeUrl: appDelegate.activeUrl, view: self.view, delegate: self)
+ networking.getUserAndGroup(searchString: searchString)
+ }
+
@IBAction func touchUpInsideButtonCopy(_ sender: Any) {
let shares = NCManageDatabase.sharedInstance.getTableShares(metadata: metadata!)
tapCopy(with: shares.firstShareLink, sender: sender)
@@ -133,19 +153,8 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
}
}
- @objc func reloadData() {
- let shares = NCManageDatabase.sharedInstance.getTableShares(metadata: metadata!)
- if shares.firstShareLink == nil {
- buttonMenu.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "shareAdd"), width: 100, height: 100, color: UIColor.gray), for: .normal)
- buttonCopy.isHidden = true
- } else {
- buttonMenu.setImage(CCGraphics.changeThemingColorImage(UIImage.init(named: "shareMenu"), width: 100, height: 100, color: UIColor.gray), for: .normal)
- buttonCopy.isHidden = false
- }
- tableView.reloadData()
- }
+ /// MARK: - NCShareNetworkingDelegate
- // NCShareNetworkingDelegate
func readShareCompleted(errorCode: Int) {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "reloadDataNCShare"), object: nil, userInfo: nil)
}
@@ -157,6 +166,8 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
func unShareCompleted() { }
func updateShareWithError(idRemoteShared: Int) { }
+
+ func getUserAndGroup(items: [OCShareUser]?) { }
}
// MARK: - UITableViewDelegate
diff --git a/iOSClient/Share/NCShareLinkMenuView.swift b/iOSClient/Share/NCShareLinkMenuView.swift
index 041bdf24d..ce83208d1 100644
--- a/iOSClient/Share/NCShareLinkMenuView.swift
+++ b/iOSClient/Share/NCShareLinkMenuView.swift
@@ -266,6 +266,8 @@ class NCShareLinkMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
reloadData(idRemoteShared: idRemoteShared)
}
+ func getUserAndGroup(items: [OCShareUser]?) { }
+
// MARK: - Delegate calendar
func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {
diff --git a/iOSClient/Share/NCShareNetworking.swift b/iOSClient/Share/NCShareNetworking.swift
index 5e8168937..37cfd35f2 100644
--- a/iOSClient/Share/NCShareNetworking.swift
+++ b/iOSClient/Share/NCShareNetworking.swift
@@ -101,6 +101,20 @@ class NCShareNetworking: NSObject {
}
})
}
+
+ func getUserAndGroup(searchString: String) {
+ NCUtility.sharedInstance.startActivityIndicator(view: view, bottom: 0)
+ OCNetworking.sharedManager()?.getUserGroup(withAccount: account, search: searchString, completion: { (account, items, message, errorCode) in
+ NCUtility.sharedInstance.stopActivityIndicator()
+ if errorCode == 0 {
+ let itemsOCShareUser = items as! [OCShareUser]
+ self.delegate?.getUserAndGroup(items: itemsOCShareUser)
+ } else {
+ self.appDelegate.messageNotification("_share_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
+ self.delegate?.getUserAndGroup(items: nil)
+ }
+ })
+ }
}
protocol NCShareNetworkingDelegate {
@@ -108,4 +122,5 @@ protocol NCShareNetworkingDelegate {
func shareCompleted(errorCode: Int)
func unShareCompleted()
func updateShareWithError(idRemoteShared: Int)
+ func getUserAndGroup(items: [OCShareUser]?)
}
diff --git a/iOSClient/Share/NCShareUserMenuView.swift b/iOSClient/Share/NCShareUserMenuView.swift
index 683a68199..1a36f2b25 100644
--- a/iOSClient/Share/NCShareUserMenuView.swift
+++ b/iOSClient/Share/NCShareUserMenuView.swift
@@ -202,6 +202,8 @@ class NCShareUserMenuView: UIView, UIGestureRecognizerDelegate, NCShareNetworkin
reloadData(idRemoteShared: idRemoteShared)
}
+ func getUserAndGroup(items: [OCShareUser]?) { }
+
// MARK: - Delegate calendar
func calendar(_ calendar: FSCalendar, didSelect date: Date, at monthPosition: FSCalendarMonthPosition) {