瀏覽代碼

Set User Status

marinofaggiana 4 年之前
父節點
當前提交
2eb3126ecf
共有 2 個文件被更改,包括 24 次插入1 次删除
  1. 23 0
      iOSClient/Settings/CCManageAccount.m
  2. 1 1
      iOSClient/Utility/NCUtility.swift

+ 23 - 0
iOSClient/Settings/CCManageAccount.m

@@ -114,6 +114,20 @@
         row.action.formSelector = @selector(deleteAccount:);
         if (accounts.count == 0) row.disabled = @YES;
         [section addFormRow:row];
+        
+        // Set user status
+        BOOL userStatus = [[NCManageDatabase sharedInstance] getCapabilitiesServerBoolWithAccount:accountActive.account elements:NCElementsJSON.shared.capabilitiesUserStatusEnabled exists:false];        
+        if (userStatus) {
+            row = [XLFormRowDescriptor formRowDescriptorWithTag:@"setUserStatus" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_set_user_status_", nil)];
+            row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.sharedInstance.backgroundCell;
+            [row.cellConfig setObject:NCBrandColor.sharedInstance.textView forKey:@"textLabel.textColor"];
+            [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
+            [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"userStatusAway"] width:50 height:50 color: NCBrandColor.sharedInstance.icon] forKey:@"imageView.image"];
+            [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
+            row.action.formSelector = @selector(setUserStatus:);
+            if (accounts.count == 0) row.disabled = @YES;
+            [section addFormRow:row];
+        }
     }
     
     // Section : USER INFORMATION -------------------------------------------
@@ -402,6 +416,15 @@
     [self presentViewController:alertController animated:YES completion:nil];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark === Set User Status  ===
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)setUserStatus:(XLFormRowDescriptor *)sender
+{
+    [self deselectFormRow:sender];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark === Change Default Account ===
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Utility/NCUtility.swift

@@ -605,7 +605,7 @@ class NCUtility: NSObject {
         if userStatus?.lowercased() == "dnd" {
             onlineStatus = UIImage.init(named: "userStatusDnd")?.resizeImageUsingVImage(size: CGSize(width: 100, height: 100))
         }
-        if userStatus?.lowercased() == "offline" ||  userStatus?.lowercased() == "invisible"  {
+        if userStatus?.lowercased() == "offline" || userStatus?.lowercased() == "invisible"  {
             onlineStatus = CCGraphics.changeThemingColorImage(UIImage.init(named: "userStatusOffline"), width: 100, height: 100, color: .black)
         }