소스 검색

User status

marinofaggiana 3 년 전
부모
커밋
afe0f25a5e

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -308,6 +308,7 @@
 		F7DFAA8A22E22EF100FC4527 /* NCShareLinkMenuView.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */; };
 		F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */; };
 		F7DFB7F4219C5CA800680748 /* NCCreateFormUploadScanDocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */; };
+		F7E0CDCF265CE8610044854E /* NCUserStatus.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */; };
 		F7E4D9C422ED929B003675FD /* NCShareComments.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E4D9C322ED929B003675FD /* NCShareComments.swift */; };
 		F7ED547C25EEA65400956C55 /* QRCodeReader in Frameworks */ = {isa = PBXBuildFile; productRef = F7ED547B25EEA65400956C55 /* QRCodeReader */; };
 		F7EDE4CC262D7B6F00414FE6 /* NCEmptyDataSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7239870253D86B600257F49 /* NCEmptyDataSet.swift */; };
@@ -729,6 +730,7 @@
 		F7DFAA8922E22EF100FC4527 /* NCShareLinkMenuView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkMenuView.xib; sourceTree = "<group>"; };
 		F7DFB7EF219C5B8000680748 /* NCCreateFormUploadAssets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadAssets.swift; sourceTree = "<group>"; };
 		F7DFB7F3219C5CA800680748 /* NCCreateFormUploadScanDocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCreateFormUploadScanDocument.swift; sourceTree = "<group>"; };
+		F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCUserStatus.storyboard; sourceTree = "<group>"; };
 		F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F7E4D9C322ED929B003675FD /* NCShareComments.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareComments.swift; sourceTree = "<group>"; };
 		F7E856182351D7BE009A3330 /* SwiftyXMLParser.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyXMLParser.framework; path = Carthage/Build/iOS/SwiftyXMLParser.framework; sourceTree = "<group>"; };
@@ -1436,6 +1438,7 @@
 			isa = PBXGroup;
 			children = (
 				F7EFC0CC256BF8DD00461AAD /* NCUserStatus.swift */,
+				F7E0CDCE265CE8610044854E /* NCUserStatus.storyboard */,
 			);
 			path = UserStatus;
 			sourceTree = "<group>";
@@ -1915,6 +1918,7 @@
 				F74C0437253F1CDC009762AB /* NCShares.storyboard in Resources */,
 				F7B8B83025681C3400967775 /* GoogleService-Info.plist in Resources */,
 				F7381EE5218218C9000B1560 /* NCOffline.storyboard in Resources */,
+				F7E0CDCF265CE8610044854E /* NCUserStatus.storyboard in Resources */,
 				F76D3CF32428B94E005DFA87 /* NCViewerPDFSearchCell.xib in Resources */,
 				F769453E22E9E97E000A798A /* NCShareUserMenuView.xib in Resources */,
 				F7CA212E25F1333300826ABB /* NCAccountRequest.storyboard in Resources */,

+ 6 - 4
iOSClient/Settings/CCManageAccount.m

@@ -125,7 +125,7 @@
             [section addFormRow:row];
         }
         
-#if TARGET_OS_SIMULATOR
+//#if TARGET_OS_SIMULATOR
         // Set user status
         if (@available(iOS 13.0, *)) {
             BOOL userStatus = [[NCManageDatabase shared] getCapabilitiesServerBoolWithAccount:activeAccount.account elements:NCElementsJSON.shared.capabilitiesUserStatusEnabled exists:false];
@@ -141,7 +141,7 @@
                 [section addFormRow:row];
             }
         }
-#endif
+//#endif
     }
     
     // Section : USER INFORMATION -------------------------------------------
@@ -480,8 +480,10 @@
     [self deselectFormRow:sender];
     
     if (@available(iOS 13.0, *)) {
-        UIViewController *userStatusViewController = [[NCUserStatusViewController new] makeUserStatusUI];
-        [self presentViewController:userStatusViewController animated:YES completion:nil];
+        
+        NCUserStatus *navigationController = [[UIStoryboard storyboardWithName:@"NCUserStatus" bundle:nil] instantiateInitialViewController];
+        
+        [self presentViewController:navigationController animated:YES completion:nil];
     }
 }
 

+ 3 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -205,6 +205,9 @@
 /* User status */
 "_invisible_description_"   = "Appear offline";
 
+/* User status */
+"_status_message_"          = "Status message";
+
 "_network_available_"       = "Network available";
 "_network_not_available_"   = "Network unavailable";
 "_file_too_big_"            = "File too large to be encrypted/decrypted";

+ 271 - 0
iOSClient/UserStatus/NCUserStatus.storyboard

@@ -0,0 +1,271 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="QH7-hC-pPW">
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--User Status-->
+        <scene sceneID="s0d-6b-0kx">
+            <objects>
+                <viewController id="Y6W-OH-hqX" customClass="NCUserStatus" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="5EZ-qb-Rvc">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="IUw-Rz-hg5" userLabel="Online View">
+                                <rect key="frame" x="10" y="108" width="180" height="40"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7YL-BS-nbc">
+                                        <rect key="frame" x="0.0" y="0.0" width="180" height="40"/>
+                                        <color key="backgroundColor" systemColor="systemGray6Color"/>
+                                    </button>
+                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="userStatusOnline" translatesAutoresizingMaskIntoConstraints="NO" id="wwP-hA-oHT">
+                                        <rect key="frame" x="5" y="5" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="30" id="Rn5-HY-NFJ"/>
+                                            <constraint firstAttribute="height" constant="30" id="UZm-F9-aS2"/>
+                                        </constraints>
+                                    </imageView>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="online" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4dG-pv-efQ">
+                                        <rect key="frame" x="40" y="9.5" width="120" height="21"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="21" id="hWk-6I-NzN"/>
+                                            <constraint firstAttribute="width" constant="120" id="o5n-VM-Xpa"/>
+                                        </constraints>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstAttribute="width" constant="180" id="35Q-yI-BpG"/>
+                                    <constraint firstItem="7YL-BS-nbc" firstAttribute="top" secondItem="IUw-Rz-hg5" secondAttribute="top" id="5QB-qr-SlK"/>
+                                    <constraint firstItem="wwP-hA-oHT" firstAttribute="leading" secondItem="IUw-Rz-hg5" secondAttribute="leading" constant="5" id="F69-ar-ank"/>
+                                    <constraint firstItem="7YL-BS-nbc" firstAttribute="leading" secondItem="IUw-Rz-hg5" secondAttribute="leading" id="UNt-GH-j8N"/>
+                                    <constraint firstItem="4dG-pv-efQ" firstAttribute="centerY" secondItem="IUw-Rz-hg5" secondAttribute="centerY" id="e0n-c3-1A3"/>
+                                    <constraint firstItem="wwP-hA-oHT" firstAttribute="centerY" secondItem="IUw-Rz-hg5" secondAttribute="centerY" id="eOh-VX-MdR"/>
+                                    <constraint firstAttribute="bottom" secondItem="7YL-BS-nbc" secondAttribute="bottom" id="hOe-88-FRM"/>
+                                    <constraint firstAttribute="trailing" secondItem="7YL-BS-nbc" secondAttribute="trailing" id="ndl-uA-aak"/>
+                                    <constraint firstItem="4dG-pv-efQ" firstAttribute="leading" secondItem="IUw-Rz-hg5" secondAttribute="leading" constant="40" id="ond-hq-EmN"/>
+                                    <constraint firstAttribute="height" constant="40" id="r2C-A5-1RR"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ukn-PZ-9sx" userLabel="Away View">
+                                <rect key="frame" x="224" y="108" width="180" height="40"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iqo-IM-261">
+                                        <rect key="frame" x="0.0" y="0.0" width="180" height="40"/>
+                                        <color key="backgroundColor" systemColor="systemGray6Color"/>
+                                    </button>
+                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="userStatusAway" translatesAutoresizingMaskIntoConstraints="NO" id="4EB-gX-bxj">
+                                        <rect key="frame" x="5" y="5" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="30" id="Bbi-US-LER"/>
+                                            <constraint firstAttribute="height" constant="30" id="UZA-na-DGp"/>
+                                        </constraints>
+                                    </imageView>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="away" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KUE-W1-haU">
+                                        <rect key="frame" x="40" y="9.5" width="120" height="21"/>
+                                        <constraints>
+                                            <constraint firstAttribute="height" constant="21" id="Jbw-5I-U4V"/>
+                                            <constraint firstAttribute="width" constant="120" id="uvN-Fj-2a2"/>
+                                        </constraints>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="KUE-W1-haU" firstAttribute="centerY" secondItem="ukn-PZ-9sx" secondAttribute="centerY" id="7cU-0J-mT1"/>
+                                    <constraint firstItem="KUE-W1-haU" firstAttribute="leading" secondItem="ukn-PZ-9sx" secondAttribute="leading" constant="40" id="7qo-9W-xYH"/>
+                                    <constraint firstItem="4EB-gX-bxj" firstAttribute="centerY" secondItem="ukn-PZ-9sx" secondAttribute="centerY" id="HqP-sm-fJp"/>
+                                    <constraint firstItem="iqo-IM-261" firstAttribute="top" secondItem="ukn-PZ-9sx" secondAttribute="top" id="LsD-PZ-hQ6"/>
+                                    <constraint firstAttribute="bottom" secondItem="iqo-IM-261" secondAttribute="bottom" id="MOY-gj-I7B"/>
+                                    <constraint firstAttribute="width" constant="180" id="P7c-7a-GPz"/>
+                                    <constraint firstItem="4EB-gX-bxj" firstAttribute="leading" secondItem="ukn-PZ-9sx" secondAttribute="leading" constant="5" id="WFQ-2a-0u3"/>
+                                    <constraint firstAttribute="trailing" secondItem="iqo-IM-261" secondAttribute="trailing" id="flk-Z6-CYF"/>
+                                    <constraint firstAttribute="height" constant="40" id="jiB-ym-LwX"/>
+                                    <constraint firstItem="iqo-IM-261" firstAttribute="leading" secondItem="ukn-PZ-9sx" secondAttribute="leading" id="r47-pK-1YC"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="DgJ-Se-BTI" userLabel="dnd View">
+                                <rect key="frame" x="10" y="178" width="180" height="60"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YEP-sj-zkF">
+                                        <rect key="frame" x="0.0" y="0.0" width="180" height="60"/>
+                                        <color key="backgroundColor" systemColor="systemGray6Color"/>
+                                    </button>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="mute all notifications" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nJ9-Ag-jcR">
+                                        <rect key="frame" x="40" y="35" width="140" height="17"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="userStatusDnd" translatesAutoresizingMaskIntoConstraints="NO" id="UAa-AA-kcA">
+                                        <rect key="frame" x="5" y="15" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="30" id="I74-UW-8TL"/>
+                                            <constraint firstAttribute="height" constant="30" id="Z4Z-4k-03G"/>
+                                        </constraints>
+                                    </imageView>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="do not disturb" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MUx-sY-ev7">
+                                        <rect key="frame" x="40" y="8" width="120" height="21"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="120" id="PoJ-2t-hiE"/>
+                                            <constraint firstAttribute="height" constant="21" id="iYk-NL-Rgd"/>
+                                        </constraints>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="60" id="55r-Xe-fsA"/>
+                                    <constraint firstAttribute="trailing" secondItem="YEP-sj-zkF" secondAttribute="trailing" id="6f3-A2-KYC"/>
+                                    <constraint firstItem="nJ9-Ag-jcR" firstAttribute="leading" secondItem="DgJ-Se-BTI" secondAttribute="leading" constant="40" id="BJt-58-RWa"/>
+                                    <constraint firstAttribute="bottom" secondItem="YEP-sj-zkF" secondAttribute="bottom" id="CVn-CC-1k8"/>
+                                    <constraint firstItem="MUx-sY-ev7" firstAttribute="leading" secondItem="DgJ-Se-BTI" secondAttribute="leading" constant="40" id="Cqi-gW-jbJ"/>
+                                    <constraint firstAttribute="width" constant="180" id="JHk-tU-fxT"/>
+                                    <constraint firstAttribute="bottom" secondItem="nJ9-Ag-jcR" secondAttribute="bottom" constant="8" id="Lji-IV-dzt"/>
+                                    <constraint firstAttribute="trailing" secondItem="nJ9-Ag-jcR" secondAttribute="trailing" id="OwE-Ke-uTX"/>
+                                    <constraint firstItem="YEP-sj-zkF" firstAttribute="top" secondItem="DgJ-Se-BTI" secondAttribute="top" id="Wbk-3u-Frc"/>
+                                    <constraint firstItem="UAa-AA-kcA" firstAttribute="leading" secondItem="DgJ-Se-BTI" secondAttribute="leading" constant="5" id="WmK-kB-Fr1"/>
+                                    <constraint firstItem="YEP-sj-zkF" firstAttribute="leading" secondItem="DgJ-Se-BTI" secondAttribute="leading" id="c0R-uA-QDS"/>
+                                    <constraint firstItem="UAa-AA-kcA" firstAttribute="centerY" secondItem="DgJ-Se-BTI" secondAttribute="centerY" id="qgf-Hn-hhk"/>
+                                    <constraint firstItem="MUx-sY-ev7" firstAttribute="top" secondItem="DgJ-Se-BTI" secondAttribute="top" constant="8" id="wCX-Px-QRK"/>
+                                </constraints>
+                            </view>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hed-Bz-0g1" userLabel="Invisible View">
+                                <rect key="frame" x="224" y="178" width="180" height="60"/>
+                                <subviews>
+                                    <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hFm-Mo-Ec3">
+                                        <rect key="frame" x="0.0" y="0.0" width="180" height="60"/>
+                                        <color key="backgroundColor" systemColor="systemGray6Color"/>
+                                    </button>
+                                    <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="userStatusOffline" translatesAutoresizingMaskIntoConstraints="NO" id="Zz1-bN-nfb">
+                                        <rect key="frame" x="5" y="15" width="30" height="30"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="30" id="DXS-dM-QqF"/>
+                                            <constraint firstAttribute="height" constant="30" id="JS4-lq-npY"/>
+                                        </constraints>
+                                    </imageView>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="invisible" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="4KT-ng-OWD">
+                                        <rect key="frame" x="40" y="8" width="120" height="21"/>
+                                        <constraints>
+                                            <constraint firstAttribute="width" constant="120" id="LZx-h3-YOx"/>
+                                            <constraint firstAttribute="height" constant="21" id="fh3-WJ-pgP"/>
+                                        </constraints>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <nil key="textColor"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                    <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="appear offline" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ADw-af-ua9">
+                                        <rect key="frame" x="40" y="35" width="140" height="17"/>
+                                        <fontDescription key="fontDescription" type="system" pointSize="14"/>
+                                        <color key="textColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                        <nil key="highlightedColor"/>
+                                    </label>
+                                </subviews>
+                                <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="Zz1-bN-nfb" firstAttribute="leading" secondItem="Hed-Bz-0g1" secondAttribute="leading" constant="5" id="1j8-nh-4iF"/>
+                                    <constraint firstItem="ADw-af-ua9" firstAttribute="leading" secondItem="Hed-Bz-0g1" secondAttribute="leading" constant="40" id="29w-ON-cUz"/>
+                                    <constraint firstAttribute="trailing" secondItem="hFm-Mo-Ec3" secondAttribute="trailing" id="D0M-5i-YVH"/>
+                                    <constraint firstItem="hFm-Mo-Ec3" firstAttribute="leading" secondItem="Hed-Bz-0g1" secondAttribute="leading" id="JE5-B4-XgM"/>
+                                    <constraint firstItem="Zz1-bN-nfb" firstAttribute="centerY" secondItem="Hed-Bz-0g1" secondAttribute="centerY" id="Olj-mI-W6v"/>
+                                    <constraint firstItem="hFm-Mo-Ec3" firstAttribute="top" secondItem="Hed-Bz-0g1" secondAttribute="top" id="QhQ-zK-hV6"/>
+                                    <constraint firstAttribute="bottom" secondItem="hFm-Mo-Ec3" secondAttribute="bottom" id="Vc1-Y6-TSY"/>
+                                    <constraint firstAttribute="width" constant="180" id="XWG-t0-6Gc"/>
+                                    <constraint firstItem="4KT-ng-OWD" firstAttribute="top" secondItem="Hed-Bz-0g1" secondAttribute="top" constant="8" id="fRx-Dh-1J1"/>
+                                    <constraint firstAttribute="trailing" secondItem="ADw-af-ua9" secondAttribute="trailing" id="jQi-yk-I5r"/>
+                                    <constraint firstItem="4KT-ng-OWD" firstAttribute="leading" secondItem="Hed-Bz-0g1" secondAttribute="leading" constant="40" id="oCV-YR-gcp"/>
+                                    <constraint firstAttribute="bottom" secondItem="ADw-af-ua9" secondAttribute="bottom" constant="8" id="xro-sn-a2U"/>
+                                    <constraint firstAttribute="height" constant="60" id="yiG-Nk-2yg"/>
+                                </constraints>
+                            </view>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="status message" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ldK-hD-vsJ">
+                                <rect key="frame" x="5" y="278" width="404" height="21"/>
+                                <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                        </subviews>
+                        <viewLayoutGuide key="safeArea" id="vDu-zF-Fre"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                        <constraints>
+                            <constraint firstItem="IUw-Rz-hg5" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" constant="20" id="1KK-dw-MTN"/>
+                            <constraint firstItem="IUw-Rz-hg5" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="42H-eC-eCC"/>
+                            <constraint firstItem="DgJ-Se-BTI" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="10" id="8KJ-5Z-Y8J"/>
+                            <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="Hed-Bz-0g1" secondAttribute="trailing" constant="10" id="9LY-Ad-ugS"/>
+                            <constraint firstItem="ldK-hD-vsJ" firstAttribute="top" secondItem="Hed-Bz-0g1" secondAttribute="bottom" constant="40" id="K8i-hZ-ic0"/>
+                            <constraint firstItem="Hed-Bz-0g1" firstAttribute="top" secondItem="ukn-PZ-9sx" secondAttribute="bottom" constant="30" id="LJ2-Qn-qbJ"/>
+                            <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="ukn-PZ-9sx" secondAttribute="trailing" constant="10" id="Sxc-Bi-ERz"/>
+                            <constraint firstItem="DgJ-Se-BTI" firstAttribute="top" secondItem="7YL-BS-nbc" secondAttribute="bottom" constant="30" id="Vqd-ZX-eQb"/>
+                            <constraint firstItem="ldK-hD-vsJ" firstAttribute="leading" secondItem="vDu-zF-Fre" secondAttribute="leading" constant="5" id="XMX-Uc-FkN"/>
+                            <constraint firstItem="ukn-PZ-9sx" firstAttribute="top" secondItem="vDu-zF-Fre" secondAttribute="top" constant="20" id="vBm-Uq-cEs"/>
+                            <constraint firstItem="vDu-zF-Fre" firstAttribute="trailing" secondItem="ldK-hD-vsJ" secondAttribute="trailing" constant="5" id="yZf-48-jHR"/>
+                        </constraints>
+                    </view>
+                    <navigationItem key="navigationItem" id="jEA-I6-e1c"/>
+                    <connections>
+                        <outlet property="awayButton" destination="iqo-IM-261" id="iYQ-Pd-j9h"/>
+                        <outlet property="awayImage" destination="4EB-gX-bxj" id="GCs-RA-aok"/>
+                        <outlet property="awayLabel" destination="KUE-W1-haU" id="ujx-v9-M8H"/>
+                        <outlet property="dndButton" destination="YEP-sj-zkF" id="fox-tB-G8Q"/>
+                        <outlet property="dndDescrLabel" destination="nJ9-Ag-jcR" id="N5X-MQ-TOd"/>
+                        <outlet property="dndImage" destination="UAa-AA-kcA" id="dif-r7-KEv"/>
+                        <outlet property="dndLabel" destination="MUx-sY-ev7" id="6YB-U3-dn7"/>
+                        <outlet property="invisibleButton" destination="hFm-Mo-Ec3" id="Vej-67-miA"/>
+                        <outlet property="invisibleDescrLabel" destination="ADw-af-ua9" id="QZF-F6-GuP"/>
+                        <outlet property="invisibleImage" destination="Zz1-bN-nfb" id="FZR-Ny-qby"/>
+                        <outlet property="invisibleLabel" destination="4KT-ng-OWD" id="uQf-Ce-CSV"/>
+                        <outlet property="onlineButton" destination="7YL-BS-nbc" id="X4i-nV-iqB"/>
+                        <outlet property="onlineImage" destination="wwP-hA-oHT" id="tv9-3Y-ccU"/>
+                        <outlet property="onlineLabel" destination="4dG-pv-efQ" id="9Y2-mc-yZ1"/>
+                        <outlet property="statusMessageLabel" destination="ldK-hD-vsJ" id="edn-hK-cYI"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="Ief-a0-LHa" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="1047.8260869565217" y="137.94642857142856"/>
+        </scene>
+        <!--Navigation Controller-->
+        <scene sceneID="5ev-K0-cSF">
+            <objects>
+                <navigationController automaticallyAdjustsScrollViewInsets="NO" id="QH7-hC-pPW" sceneMemberID="viewController">
+                    <toolbarItems/>
+                    <navigationBar key="navigationBar" contentMode="scaleToFill" id="G9L-7e-agx">
+                        <rect key="frame" x="0.0" y="44" width="414" height="44"/>
+                        <autoresizingMask key="autoresizingMask"/>
+                    </navigationBar>
+                    <nil name="viewControllers"/>
+                    <connections>
+                        <segue destination="Y6W-OH-hqX" kind="relationship" relationship="rootViewController" id="0Jb-eI-ha9"/>
+                    </connections>
+                </navigationController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="exi-Ug-yMV" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="137.68115942028987" y="137.94642857142856"/>
+        </scene>
+    </scenes>
+    <resources>
+        <image name="userStatusAway" width="425" height="425"/>
+        <image name="userStatusDnd" width="425" height="425"/>
+        <image name="userStatusOffline" width="425" height="425"/>
+        <image name="userStatusOnline" width="425" height="425"/>
+        <systemColor name="systemBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
+        <systemColor name="systemGray6Color">
+            <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
+    </resources>
+</document>

+ 97 - 25
iOSClient/UserStatus/NCUserStatus.swift

@@ -2,42 +2,113 @@
 //  NCUserStatus.swift
 //  Nextcloud
 //
-//  Created by Marino Faggiana on 23/11/20.
-//  Copyright © 2020 Marino Faggiana. All rights reserved.
+//  Created by Marino Faggiana on 25/05/21.
+//  Copyright © 2021 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 SwiftUI
+import UIKit
 import Foundation
 import NCCommunication
 
-@available(iOS 13.0, *)
-struct NCUserStatus: View {
-    @State var counter = 0
-    var body: some View {
-        VStack {
-            Button("Tap me") {
-                self.counter += 1
-            }
-            if counter > 0 {
-                Text("tapped \(counter) time")
-            }
-        }
+class NCUserStatus: UIViewController {
+    
+    @IBOutlet weak var onlineButton: UIButton!
+    @IBOutlet weak var onlineImage: UIImageView!
+    @IBOutlet weak var onlineLabel: UILabel!
+    
+    @IBOutlet weak var awayButton: UIButton!
+    @IBOutlet weak var awayImage: UIImageView!
+    @IBOutlet weak var awayLabel: UILabel!
+    
+    @IBOutlet weak var dndButton: UIButton!
+    @IBOutlet weak var dndImage: UIImageView!
+    @IBOutlet weak var dndLabel: UILabel!
+    @IBOutlet weak var dndDescrLabel: UILabel!
+
+    @IBOutlet weak var invisibleButton: UIButton!
+    @IBOutlet weak var invisibleImage: UIImageView!
+    @IBOutlet weak var invisibleLabel: UILabel!
+    @IBOutlet weak var invisibleDescrLabel: UILabel!
+    
+    @IBOutlet weak var statusMessageLabel: UILabel!
+
+    
+    // MARK: - View Life Cycle
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+        
+        onlineButton.layer.cornerRadius = 10
+        onlineButton.layer.masksToBounds = true
+        //onlineLabel.layer.borderWidth = 0.5
+        //onlineLabel.layer.borderColor = NCBrandColor.shared.brand.cgColor
+        let onLine = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "online", userMessage: nil)
+        onlineImage.image = onLine.onlineStatus
+        onlineLabel.text = onLine.statusMessage
+        onlineLabel.textColor = NCBrandColor.shared.label
+       
+        
+        awayButton.layer.cornerRadius = 10
+        awayButton.layer.masksToBounds = true
+        //onlineLabel.layer.borderWidth = 0.5
+        //onlineLabel.layer.borderColor = NCBrandColor.shared.brand.cgColor
+        let away = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "away", userMessage: nil)
+        awayImage.image = away.onlineStatus
+        awayLabel.text = away.statusMessage
+        awayLabel.textColor = NCBrandColor.shared.label
+        
+        dndButton.layer.cornerRadius = 10
+        dndButton.layer.masksToBounds = true
+        //onlineLabel.layer.borderWidth = 0.5
+        //onlineLabel.layer.borderColor = NCBrandColor.shared.brand.cgColor
+        let dnd = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "dnd", userMessage: nil)
+        dndImage.image = dnd.onlineStatus
+        dndLabel.text = dnd.statusMessage
+        dndLabel.textColor = NCBrandColor.shared.label
+        dndDescrLabel.text = dnd.descriptionMessage
+        dndDescrLabel.textColor = .darkGray
+        
+        invisibleButton.layer.cornerRadius = 10
+        invisibleButton.layer.masksToBounds = true
+        //onlineLabel.layer.borderWidth = 0.5
+        //onlineLabel.layer.borderColor = NCBrandColor.shared.brand.cgColor
+        let offline = NCUtility.shared.getUserStatus(userIcon: nil, userStatus: "offline", userMessage: nil)
+        invisibleImage.image = offline.onlineStatus
+        invisibleLabel.text = offline.statusMessage
+        invisibleLabel.textColor = NCBrandColor.shared.label
+        invisibleDescrLabel.text = offline.descriptionMessage
+        invisibleDescrLabel.textColor = .darkGray
+        
+        statusMessageLabel.text = NSLocalizedString("_status_message_", comment: "")
+        statusMessageLabel.textColor = NCBrandColor.shared.label
+
     }
 }
 
+/*
 @available(iOS 13.0, *)
-struct NCUserStatus_Previews: PreviewProvider {
-    static var previews: some View {
-        Group {
-            NCUserStatus()
-        }
-    }
-}
+
 
 @available(iOS 13.0, *)
 @objc class NCUserStatusViewController: NSObject {
  
-    @objc func makeUserStatusUI() -> UIViewController{
+    @objc func makeUserStatusUI() -> UIViewController
         
         NCCommunication.shared.getUserStatusPredefinedStatuses { (account, userStatuses, errorCode, errorDescription) in
             if errorCode == 0 {
@@ -55,8 +126,9 @@ struct NCUserStatus_Previews: PreviewProvider {
             }
         }
         
-        let userStatus = NCUserStatus()
+        //let userStatus = NCUserStatus()
         //details.shipName = name
-        return UIHostingController(rootView: userStatus)
+        return
     }
 }
+*/

+ 5 - 2
iOSClient/Utility/NCUtility.swift

@@ -331,10 +331,11 @@ class NCUtility: NSObject {
         return String(intFileId)
     }
     
-    func getUserStatus(userIcon: String?, userStatus: String?, userMessage: String?) -> (onlineStatus: UIImage?, statusMessage: String) {
+    func getUserStatus(userIcon: String?, userStatus: String?, userMessage: String?) -> (onlineStatus: UIImage?, statusMessage: String, descriptionMessage: String) {
         
         var onlineStatus: UIImage?
         var statusMessage: String = ""
+        var descriptionMessage: String = ""
         var messageUserDefined: String = ""
         
         if userStatus?.lowercased() == "online" {
@@ -348,10 +349,12 @@ class NCUtility: NSObject {
         if userStatus?.lowercased() == "dnd" {
             onlineStatus = UIImage.init(named: "userStatusDnd")?.resizeImage(size: CGSize(width: 100, height: 100), isAspectRation: false)
             messageUserDefined = NSLocalizedString("_dnd_", comment: "")
+            descriptionMessage = NSLocalizedString("_dnd_description_", comment: "")
         }
         if userStatus?.lowercased() == "offline" || userStatus?.lowercased() == "invisible"  {
             onlineStatus = UIImage.init(named: "userStatusOffline")!.image(color: .black, size: 50) 
             messageUserDefined = NSLocalizedString("_invisible_", comment: "")
+            descriptionMessage = NSLocalizedString("_invisible_description_", comment: "")
         }
         
         if let userIcon = userIcon {
@@ -365,7 +368,7 @@ class NCUtility: NSObject {
             statusMessage = messageUserDefined
         }
                 
-        return(onlineStatus, statusMessage)
+        return(onlineStatus, statusMessage, descriptionMessage)
     }
     
     func imageFromVideo(url: URL, at time: TimeInterval) -> UIImage? {