Bladeren bron

Use `loadUserImageFor` in `CCManageAccount`

Signed-off-by: Henrik Storch <henrik.storch@nextcloud.com>
Henrik Storch 3 jaren geleden
bovenliggende
commit
403aa09165
2 gewijzigde bestanden met toevoegingen van 3 en 8 verwijderingen
  1. 2 7
      iOSClient/Settings/CCManageAccount.m
  2. 1 1
      iOSClient/Utility/NCUtility.swift

+ 2 - 7
iOSClient/Settings/CCManageAccount.m

@@ -56,13 +56,8 @@
         row = [XLFormRowDescriptor formRowDescriptorWithTag:account.account rowType:XLFormRowDescriptorTypeBooleanCheck title:title];
         
         // Avatar
-        NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@-%@-original.png", [CCUtility getDirectoryUserData], [CCUtility getUserUrlBase:account.user urlBase:account.urlBase], account.user];
-        UIImage *avatar = [UIImage imageWithContentsOfFile:fileNamePath];
-        if (avatar) {
-            avatar = [NCUtility.shared createAvatarWithImage:avatar size:40];
-        } else {
-            avatar = [[UIImage imageNamed:@"avatar"] imageWithColor:NCBrandColor.shared.gray size:40];
-        }
+        NSString* userUrlBase = [CCUtility getUserUrlBase:account.user urlBase:account.urlBase];
+        UIImage *avatar = [NCUtility.shared loadUserImageFor:account.user displayName:account.displayName userUrlBase:userUrlBase original:YES];
         
         row.cellConfigAtConfigure[@"backgroundColor"] = NCBrandColor.shared.secondarySystemGroupedBackground;
         [row.cellConfig setObject:[UIFont systemFontOfSize:13.0] forKey:@"textLabel.font"];

+ 1 - 1
iOSClient/Utility/NCUtility.swift

@@ -496,7 +496,7 @@ class NCUtility: NSObject {
         return  UIImage(named: "file")!.image(color: color, size: size)
     }
     
-    func loadUserImage(for user: String, displayName: String?, userUrlBase: String, original: Bool = false) -> UIImage {
+    @objc func loadUserImage(for user: String, displayName: String?, userUrlBase: String, original: Bool = false) -> UIImage {
 
         //@marino: I'm not even sure the original is needed.. seems to work just fine with the 'normal' one
         let fileName = userUrlBase + "-" + user + (original ? "-original.png" : ".png")