marinofaggiana 4 жил өмнө
parent
commit
b14bdc4b22

+ 0 - 4
Nextcloud.xcodeproj/project.pbxproj

@@ -244,7 +244,6 @@
 		F78B9685234F785300F54315 /* NCSelectDestination.m in Sources */ = {isa = PBXBuildFile; fileRef = F78B9682234F785300F54315 /* NCSelectDestination.m */; };
 		F78B9686234F785300F54315 /* NCSelectDestination.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F78B9684234F785300F54315 /* NCSelectDestination.storyboard */; };
 		F78BFEE11D31126B00E513CF /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F78BFEDE1D31126B00E513CF /* MainInterface.storyboard */; };
-		F78E7065219F096B006F23E4 /* NCAvatar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78E7064219F096B006F23E4 /* NCAvatar.swift */; };
 		F78F74342163757000C2ADAD /* NCTrash.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F78F74332163757000C2ADAD /* NCTrash.storyboard */; };
 		F78F74362163781100C2ADAD /* NCTrash.swift in Sources */ = {isa = PBXBuildFile; fileRef = F78F74352163781100C2ADAD /* NCTrash.swift */; };
 		F790110E21415BF600D7B136 /* NCViewerRichdocument.swift in Sources */ = {isa = PBXBuildFile; fileRef = F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */; };
@@ -610,7 +609,6 @@
 		F78D6F461F0B7CB9002F9619 /* es-MX */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "es-MX"; path = "es-MX.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F78D6F4D1F0B7CE4002F9619 /* nb-NO */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "nb-NO"; path = "nb-NO.lproj/Localizable.strings"; sourceTree = "<group>"; };
 		F78D6F541F0B7D47002F9619 /* pl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = pl; path = pl.lproj/Localizable.strings; sourceTree = "<group>"; };
-		F78E7064219F096B006F23E4 /* NCAvatar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCAvatar.swift; sourceTree = "<group>"; };
 		F78F74332163757000C2ADAD /* NCTrash.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = NCTrash.storyboard; sourceTree = "<group>"; };
 		F78F74352163781100C2ADAD /* NCTrash.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCTrash.swift; sourceTree = "<group>"; };
 		F790110D21415BF600D7B136 /* NCViewerRichdocument.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichdocument.swift; sourceTree = "<group>"; };
@@ -1273,7 +1271,6 @@
 				F7053E3C1C639DF500741EA5 /* CCUtility.h */,
 				F7053E3D1C639DF500741EA5 /* CCUtility.m */,
 				F733598025C1C188002ABA72 /* NCAskAuthorization.swift */,
-				F78E7064219F096B006F23E4 /* NCAvatar.swift */,
 				F765608E23BF813500765969 /* NCContentPresenter.swift */,
 				F702F30725EE5D47008F8E80 /* NCPopupViewController.swift */,
 				F70968A324212C4E00ED60E5 /* NCLivePhoto.swift */,
@@ -2039,7 +2036,6 @@
 				F78ACD4221903CE00088454D /* NCListCell.swift in Sources */,
 				F76D3CF12428B40E005DFA87 /* NCViewerPDFSearch.swift in Sources */,
 				F73F537F1E929C8500F8678D /* NCMore.swift in Sources */,
-				F78E7065219F096B006F23E4 /* NCAvatar.swift in Sources */,
 				F702F2CF25EE5B5C008F8E80 /* NCGlobal.swift in Sources */,
 				F72CD63A25C19EBF00F46F9A /* NCAutoUpload.swift in Sources */,
 				F7DFB7F0219C5B8000680748 /* NCCreateFormUploadAssets.swift in Sources */,

+ 2 - 3
iOSClient/Account Request/NCAccountRequest.swift

@@ -209,9 +209,8 @@ extension NCAccountRequest: UITableViewDataSource {
         
             let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getStringUser(account.user, urlBase: account.urlBase)) + "-" + account.user + ".png"
             
-            if let userImage = UIImage(contentsOfFile: fileNamePath) {
-                avatarImage?.avatar(roundness: 2, borderWidth: 1, borderColor: NCBrandColor.shared.avatarBorder, backgroundColor: .clear)
-                avatarImage?.image = userImage
+            if let image = UIImage(contentsOfFile: fileNamePath) {
+                avatarImage?.image = NCUtility.shared.createAvatar(image: image, size: 40)
             }
                     
             if account.alias != "" {

+ 1 - 1
iOSClient/Activity/NCActivity.storyboard

@@ -33,7 +33,7 @@
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
-                                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LQ8-cO-794" userLabel="avatar" customClass="NCAvatar" customModule="Nextcloud" customModuleProvider="target">
+                                                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LQ8-cO-794" userLabel="avatar">
                                                     <rect key="frame" x="50" y="0.0" width="30" height="30"/>
                                                     <constraints>
                                                         <constraint firstAttribute="width" constant="30" id="OKz-e8-DzD"/>

+ 2 - 2
iOSClient/Activity/NCActivity.swift

@@ -225,13 +225,13 @@ extension NCActivity: UITableViewDataSource {
                 let fileNameLocalPath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase)) + "-" + activity.user + ".png"
                 if FileManager.default.fileExists(atPath: fileNameLocalPath) {
                     if let image = UIImage(contentsOfFile: fileNameLocalPath) {
-                        cell.avatar.image = image
+                        cell.avatar.image = NCUtility.shared.createAvatar(image: image, size: 30) 
                     }
                 } else {
                     DispatchQueue.global().async {
                         NCCommunication.shared.downloadAvatar(userId: activity.user, fileNameLocalPath: fileNameLocalPath, size: NCGlobal.shared.avatarSize) { (account, data, errorCode, errorMessage) in
                             if errorCode == 0 && account == self.appDelegate.account && UIImage(data: data!) != nil {
-                                cell.avatar.image = UIImage(data: data!)
+                                cell.avatar.image = NCUtility.shared.createAvatar(image: UIImage(data: data!)!, size: 30)
                             }
                         }
                     }

+ 3 - 4
iOSClient/More/NCMore.swift

@@ -329,13 +329,12 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
             
             let fileNamePath = String(CCUtility.getDirectoryUserData()) + "/" + String(CCUtility.getStringUser(appDelegate.user, urlBase: appDelegate.urlBase)) + "-" + appDelegate.user + ".png"
             
-            if let themingAvatarFile = UIImage.init(contentsOfFile: fileNamePath) {
-                cell.avatar?.image = themingAvatarFile
+            if let image = UIImage.init(contentsOfFile: fileNamePath) {
+                cell.avatar?.image = NCUtility.shared.createAvatar(image: image, size: 50)
             } else {
                 cell.avatar?.image = UIImage.init(named: "moreAvatar")
             }
-            cell.avatar?.layer.masksToBounds = true
-            cell.avatar?.layer.cornerRadius = cell.avatar.frame.size.width / 2
+           
             if let account = tabAccount {
                 if account.alias == "" {
                     cell.displayName?.text = account.displayName

+ 0 - 66
iOSClient/Utility/NCAvatar.swift

@@ -1,66 +0,0 @@
-//
-//  NCAvatar.swift
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 16/11/2018.
-//  Copyright (c) 2018 Marino Faggiana. All rights reserved.
-//
-//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
-//
-//  This program is free software: you can redistribute it and/or modify
-//  it under the terms of the GNU General Public License as published by
-//  the Free Software Foundation, either version 3 of the License, or
-//  (at your option) any later version.
-//
-//  This program is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-//  GNU General Public License for more details.
-//
-//  You should have received a copy of the GNU General Public License
-//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-//
-
-
-import Foundation
-
-@IBDesignable class NCAvatar: UIImageView {
-    
-    @IBInspectable var roundness: CGFloat = 2 {
-        didSet{
-            layoutSubviews()
-        }
-    }
-    
-    @IBInspectable var borderWidth: CGFloat = 1 {
-        didSet{
-            layoutSubviews()
-        }
-    }
-    
-    @IBInspectable var borderColor: UIColor = NCBrandColor.shared.avatarBorder {
-        didSet{
-            layoutSubviews()
-        }
-    }
-    
-    @IBInspectable var background: UIColor = UIColor.clear {
-        didSet{
-            layoutSubviews()
-        }
-    }
-    
-    required init?(coder aDecoder: NSCoder) {
-        super.init(coder: aDecoder)
-    }
-    
-    override init(frame: CGRect) {
-        super.init(frame: frame)
-    }
-    
-    override func layoutSubviews() {
-        super.layoutSubviews()
-                
-        self.avatar(roundness: roundness, borderWidth: borderWidth, borderColor: borderColor, backgroundColor: background)
-    }
-}