浏览代码

status user

marinofaggiana 4 年之前
父节点
当前提交
c59e8a2705
共有 2 个文件被更改,包括 17 次插入8 次删除
  1. 3 2
      iOSClient/Share/NCShare.swift
  2. 14 6
      iOSClient/Utility/NCUtility.swift

+ 3 - 2
iOSClient/Share/NCShare.swift

@@ -296,8 +296,9 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
             guard let cell = cell as? NCShareUserDropDownCell else { return }
             let sharee = sharees[index]
             cell.imageItem.image = NCShareCommon.sharedInstance.getImageShareType(shareType: sharee.shareType)
-            cell.imageStatus.image = NCUtility.shared.getImageStausUserIcon(sharee.userIcon)
-            cell.status.text = sharee.userIcon + " " + sharee.userMessage
+            let status = NCUtility.shared.getUserStatus(userIcon: sharee.userIcon, userStatus: sharee.userStatus, userMessage: sharee.userMessage)
+            cell.imageStatus.image = status.onlineStatus
+            cell.status.text = status.statusMessage
             if cell.status.text?.count ?? 0 > 0 {
                 cell.centerTitle.constant = -5
             } else {

+ 14 - 6
iOSClient/Utility/NCUtility.swift

@@ -591,14 +591,22 @@ class NCUtility: NSObject {
         return String(intFileId)
     }
     
-    func getImageStausUserIcon(_ userIcon: String) -> UIImage? {
+    func getUserStatus(userIcon: String, userStatus: String, userMessage: String) -> (onlineStatus: UIImage?, statusMessage: String) {
         
-        if userIcon == "" { return nil }
-        else if userIcon.lowercased() == "away" {
-            return CCGraphics.changeThemingColorImage(UIImage.init(named: "away"), width: 100, height: 100, color: UIColor(red: 233.0/255.0, green: 166.0/255.0, blue: 75.0/255.0, alpha: 1.0))
-        } else {
-            return userIcon.textToImage(size: 100)
+        // Printing description of sharee.userIcon: "🏡"
+        // Printing description of sharee.userMessage: "Working remotely"
+        // Printing description of sharee.userStatus: "away"
+        
+        var onlineStatus: UIImage?
+        var statusMessage: String = ""
+        
+        if userStatus.lowercased() == "away" {
+            onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "away"), width: 100, height: 100, color: UIColor(red: 233.0/255.0, green: 166.0/255.0, blue: 75.0/255.0, alpha: 1.0))
         }
+        
+        statusMessage = userIcon + " " + userMessage
+        
+        return(onlineStatus, statusMessage)
     }
 }