marinofaggiana il y a 3 ans
Parent
commit
bb0d3594bc

+ 3 - 5
Share/NCShareExtension.swift

@@ -241,18 +241,16 @@ class NCShareExtension: UIViewController, NCListCellDelegate, NCEmptyDataSetDele
         // PROFILE BUTTON
                 
         var image = NCUtility.shared.loadImage(named: "person.crop.circle")
-        let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getUserUrlBase(activeAccount.user, urlBase: activeAccount.urlBase)) + "-" + activeAccount.user + ".png"
+        let fileName = String(CCUtility.getUserUrlBase(activeAccount.user, urlBase: activeAccount.urlBase)) + "-" + activeAccount.user + ".png"
+        let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
         if let userImage = UIImage(contentsOfFile: fileNamePath) {
             image = userImage
         }
-            
-        image = NCUtility.shared.createAvatar(image: image, size: 30)
-            
+
         let profileButton = UIButton(type: .custom)
         profileButton.setImage(image, for: .normal)
             
         if serverUrl == NCUtilityFileSystem.shared.getHomeServer(account: activeAccount.account) {
-             
 
             var title = "  "
             if activeAccount?.alias == "" {

+ 6 - 5
iOSClient/Main/Account Request/NCAccountRequest.swift

@@ -235,13 +235,14 @@ extension NCAccountRequest: UITableViewDataSource {
         } else {
         
             let account = accounts[indexPath.row]
-
-            avatarImage?.image = NCUtility.shared.loadImage(named: "person.crop.circle")
-        
-            let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getUserUrlBase(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"
+            
+            let fileName = String(CCUtility.getUserUrlBase(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"
+            let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
             
             if let image = UIImage(contentsOfFile: fileNamePath) {
-                avatarImage?.image = NCUtility.shared.createAvatar(image: image, size: 40)
+                avatarImage?.image = image
+            } else {
+                avatarImage?.image = NCUtility.shared.loadImage(named: "person.crop.circle")
             }
                     
             if account.alias != "" {

+ 3 - 2
iOSClient/Menu/NCLoginWeb+Menu.swift

@@ -37,10 +37,11 @@ extension NCLoginWeb {
         for account in accounts {
             
             let title = account.user + " " + (URL(string: account.urlBase)?.host ?? "")
-            let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getUserUrlBase(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"
+            let fileName = String(CCUtility.getUserUrlBase(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"
+            let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
 
             if let image = UIImage(contentsOfFile: fileNamePath) {
-                avatar = NCUtility.shared.createAvatar(image: image, size: 50)
+                avatar = image
             }
             
             actions.append(

+ 1 - 1
iOSClient/More/NCMore.swift

@@ -326,7 +326,7 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
             let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getUserUrlBase(appDelegate.user, urlBase: appDelegate.urlBase)) + "-" + appDelegate.user + ".png"
             
             if let image = UIImage.init(contentsOfFile: fileNamePath) {
-                cell.avatar?.image = NCUtility.shared.createAvatar(image: image, size: 50)
+                cell.avatar?.image = image
             } else {
                 cell.avatar?.image = UIImage.init(named: "avatar")?.imageColor(NCBrandColor.shared.gray)
             }

+ 1 - 1
iOSClient/NCGlobal.swift

@@ -93,7 +93,7 @@ class NCGlobal: NSObject {
     // Avatar & Preview size
     //
     let avatarSize: Int                             = 128 * Int(UIScreen.main.scale)
-    let sizeRoundedAvatar: Int                      = 30
+    let sizeRoundedAvatar: Int                      = 50
     let sizePreview: Int                            = 1024
     let sizeIcon: Int                               = 512
     

+ 1 - 1
iOSClient/Networking/NCOperationQueue.swift

@@ -175,7 +175,7 @@ import NCCommunication
                 
         cell.fileAvatarImageView?.image = placeholder
         if let image = UIImage(contentsOfFile: fileNameLocalPath) {
-            cell.fileAvatarImageView?.image = NCUtility.shared.createAvatar(image: image, size: 30)
+            cell.fileAvatarImageView?.image = image
         }
         
         downloadAvatarQueue.addOperation(NCOperationDownloadAvatar.init(user: user, fileName: fileName, fileNameLocalPath: fileNameLocalPath, cell: cell, view: view))

+ 1 - 1
iOSClient/Settings/CCManageAccount.m

@@ -59,7 +59,7 @@
         NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@-%@.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];
+            avatar = avatar;
         } else {
             avatar = [[UIImage imageNamed:@"avatar"] imageWithColor:NCBrandColor.shared.gray size:40];
         }

+ 4 - 8
iOSClient/Share/NCShare.swift

@@ -105,13 +105,11 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
                 
                 NCCommunication.shared.downloadAvatar(user: metadata!.ownerId, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, sizeRoundedAvatar: NCGlobal.shared.sizeRoundedAvatar, etag: etag) { (account, data, etag, errorCode, errorMessage) in
                     
-                    if errorCode == 0, let etag = etag, let data = data, var image = UIImage.init(data: data) {
-                        image = NCUtility.shared.createAvatar(image: image, size: 30)
+                    if errorCode == 0, let etag = etag, let data = data, let image = UIImage.init(data: data) {
                         (UIApplication.shared.delegate as! AppDelegate).avatars[self.metadata!.ownerId] = image
                         NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
                         self.sharedWithYouByImage.image = image
-                    } else if errorCode == NCGlobal.shared.errorNotModified, var image = UIImage(contentsOfFile: fileNameLocalPath) {
-                        image = NCUtility.shared.createAvatar(image: image, size: 30)
+                    } else if errorCode == NCGlobal.shared.errorNotModified, let image = UIImage(contentsOfFile: fileNameLocalPath) {
                         (UIApplication.shared.delegate as! AppDelegate).avatars[self.metadata!.ownerId] = image
                         self.sharedWithYouByImage.image = image
                     }
@@ -350,13 +348,11 @@ class NCShare: UIViewController, UIGestureRecognizerDelegate, NCShareLinkCellDel
 
                 NCCommunication.shared.downloadAvatar(user: sharee.shareWith, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, sizeRoundedAvatar: NCGlobal.shared.sizeRoundedAvatar, etag: etag) { (account, data, etag, errorCode, errorMessage) in
                     
-                    if errorCode == 0, let etag = etag, let data = data, var image = UIImage.init(data: data) {
-                        image = NCUtility.shared.createAvatar(image: image, size: 30)
+                    if errorCode == 0, let etag = etag, let data = data, let image = UIImage.init(data: data) {
                         self.appDelegate.avatars[sharee.shareWith] = image
                         NCManageDatabase.shared.addAvatar(fileName: fileName, etag: etag)
                         cell.imageItem.image = image
-                    } else if errorCode == NCGlobal.shared.errorNotModified, var image = UIImage(contentsOfFile: fileNameLocalPath) {
-                        image = NCUtility.shared.createAvatar(image: image, size: 30)
+                    } else if errorCode == NCGlobal.shared.errorNotModified, let image = UIImage(contentsOfFile: fileNameLocalPath) {
                         self.appDelegate.avatars[sharee.shareWith] = image
                         cell.imageItem.image = image
                     }

+ 6 - 6
iOSClient/Share/NCShareComments.swift

@@ -71,12 +71,12 @@ class NCShareComments: UIViewController, NCShareCommentsCellDelegate {
         }
         labelUser.textColor = NCBrandColor.shared.label
         
-        imageItem.image = UIImage(named: "avatar")
-        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getUserUrlBase(appDelegate.user, urlBase: appDelegate.urlBase)) + "-" + appDelegate.user + ".png"
-        if FileManager.default.fileExists(atPath: fileNameLocalPath) {
-            if let image = UIImage(contentsOfFile: fileNameLocalPath) {
-                imageItem.image = NCUtility.shared.createAvatar(image: image, size: 40)
-            }
+        let fileName = String(CCUtility.getUserUrlBase(appDelegate.user, urlBase: appDelegate.urlBase)) + "-" + appDelegate.user + ".png"
+        let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + fileName
+        if let image = UIImage(contentsOfFile: fileNameLocalPath) {
+            imageItem.image = image
+        } else {
+            imageItem.image = UIImage(named: "avatar")
         }
         
         // Mark comment ad read