Browse Source

Build 10

Signed-off-by: marinofaggiana <ios@nextcloud.com>
marinofaggiana 2 years ago
parent
commit
462c7af8e5
2 changed files with 17 additions and 26 deletions
  1. 2 2
      Nextcloud.xcodeproj/project.pbxproj
  2. 15 24
      iOSClient/Networking/NCOperationQueue.swift

+ 2 - 2
Nextcloud.xcodeproj/project.pbxproj

@@ -2995,7 +2995,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 9;
+				CURRENT_PROJECT_VERSION = 10;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -3058,7 +3058,7 @@
 				CLANG_WARN_UNREACHABLE_CODE = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 9;
+				CURRENT_PROJECT_VERSION = 10;
 				DEVELOPMENT_TEAM = 6JLRKY9ZV7;
 				ENABLE_BITCODE = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;

+ 15 - 24
iOSClient/Networking/NCOperationQueue.swift

@@ -437,17 +437,15 @@ class NCOperationDownloadThumbnail: ConcurrentOperation {
                 etag: etagResource,
                 queue: NCCommunicationCommon.shared.backgroundQueue) { _, _, imageIcon, _, etag, errorCode, _ in
 
-                    if errorCode == 0 && imageIcon != nil {
+                    if errorCode == 0, let imageIcon = imageIcon {
                         NCManageDatabase.shared.setMetadataEtagResource(ocId: self.metadata.ocId, etagResource: etag)
                         DispatchQueue.main.async {
-                            if self.metadata.ocId == self.cell?.fileObjectId {
-                                if let filePreviewImageView = self.cell?.filePreviewImageView {
-                                    UIView.transition(with: filePreviewImageView,
-                                                      duration: 0.75,
-                                                      options: .transitionCrossDissolve,
-                                                      animations: { filePreviewImageView.image = imageIcon! },
-                                                      completion: nil)
-                                }
+                            if self.metadata.ocId == self.cell?.fileObjectId, let filePreviewImageView = self.cell?.filePreviewImageView {
+                                UIView.transition(with: filePreviewImageView,
+                                                  duration: 0.75,
+                                                  options: .transitionCrossDissolve,
+                                                  animations: { filePreviewImageView.image = imageIcon },
+                                                  completion: nil)
                             } else {
                                 if self.view is UICollectionView {
                                     (self.view as? UICollectionView)?.reloadData()
@@ -494,20 +492,16 @@ class NCOperationDownloadAvatar: ConcurrentOperation {
             NCCommunication.shared.downloadAvatar(user: user, fileNameLocalPath: fileNameLocalPath, sizeImage: NCGlobal.shared.avatarSize, avatarSizeRounded: NCGlobal.shared.avatarSizeRounded, etag: self.etag, queue: NCCommunicationCommon.shared.backgroundQueue) { _, imageAvatar, _, etag, errorCode, _ in
 
                 if errorCode == 0, let imageAvatar = imageAvatar, let etag = etag {
-
                     NCManageDatabase.shared.addAvatar(fileName: self.fileName, etag: etag)
-
                     DispatchQueue.main.async {
-                        if self.user == self.cell.fileUser {
-                            if let avatarImageView = self.cellImageView {
-                                UIView.transition(with: avatarImageView, duration: 0.75, options: .transitionCrossDissolve) {
-                                    avatarImageView.image = imageAvatar
-                                } completion: { _ in
-                                    if self.view is UICollectionView {
-                                        (self.view as? UICollectionView)?.reloadData()
-                                    } else if self.view is UITableView {
-                                        (self.view as? UITableView)?.reloadData()
-                                    }
+                        if self.user == self.cell.fileUser, let avatarImageView = self.cellImageView {
+                            UIView.transition(with: avatarImageView, duration: 0.75, options: .transitionCrossDissolve) {
+                                avatarImageView.image = imageAvatar
+                            } completion: { _ in
+                                if self.view is UICollectionView {
+                                    (self.view as? UICollectionView)?.reloadData()
+                                } else if self.view is UITableView {
+                                    (self.view as? UITableView)?.reloadData()
                                 }
                             }
                         } else {
@@ -518,12 +512,9 @@ class NCOperationDownloadAvatar: ConcurrentOperation {
                             }
                         }
                     }
-
                 } else if errorCode == NCGlobal.shared.errorNotModified {
-
                     NCManageDatabase.shared.setAvatarLoaded(fileName: self.fileName)
                 }
-
                 self.finish()
             }
         }