Browse Source

user status

marinofaggiana 4 years ago
parent
commit
c23d6f76b6

+ 0 - 0
iOSClient/Images.xcassets/away.imageset/Contents.json → iOSClient/Images.xcassets/userStatusAway.imageset/Contents.json


+ 0 - 0
iOSClient/Images.xcassets/away.imageset/away.pdf → iOSClient/Images.xcassets/userStatusAway.imageset/away.pdf


+ 15 - 0
iOSClient/Images.xcassets/userStatusDnd.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "filename" : "userStatusDnd.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

BIN
iOSClient/Images.xcassets/userStatusDnd.imageset/userStatusDnd.pdf


+ 15 - 0
iOSClient/Images.xcassets/userStatusOffline.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "filename" : "offline.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

BIN
iOSClient/Images.xcassets/userStatusOffline.imageset/offline.pdf


+ 15 - 0
iOSClient/Images.xcassets/userStatusOnline.imageset/Contents.json

@@ -0,0 +1,15 @@
+{
+  "images" : [
+    {
+      "filename" : "online.pdf",
+      "idiom" : "universal"
+    }
+  ],
+  "info" : {
+    "author" : "xcode",
+    "version" : 1
+  },
+  "properties" : {
+    "preserves-vector-representation" : true
+  }
+}

BIN
iOSClient/Images.xcassets/userStatusOnline.imageset/online.pdf


+ 11 - 6
iOSClient/Utility/NCUtility.swift

@@ -593,18 +593,23 @@ class NCUtility: NSObject {
     
     func getUserStatus(userIcon: String, userStatus: String, userMessage: String) -> (onlineStatus: UIImage?, statusMessage: String) {
         
-        // 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() == "online" {
+            onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "userStatusOnline"), width: 100, height: 100, color: UIColor(red: 103.0/255.0, green: 176.0/255.0, blue: 134.0/255.0, alpha: 1.0))
+        }
         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))
+            onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "userStatusAway"), width: 100, height: 100, color: UIColor(red: 233.0/255.0, green: 166.0/255.0, blue: 75.0/255.0, alpha: 1.0))
+        }
+        if userStatus.lowercased() == "dnd" {
+            onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "userStatusDnd"), width: 100, height: 100, color: .red)
+        }
+        if userStatus.lowercased() == "offline" {
+            onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "userStatusOffline"), width: 100, height: 100, color: .black)
         }
         
-        statusMessage = userIcon + " " + userMessage
+        statusMessage = (userIcon + " " + userMessage).trimmingCharacters(in: .whitespaces)
         
         return(onlineStatus, statusMessage)
     }