소스 검색

fix other share related lint warnings

cyberta 5 년 전
부모
커밋
531f25ca25
2개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 2
      DcShare/Helper/ShareAttachment.swift
  2. 0 2
      deltachat-ios/Helper/Utils.swift

+ 10 - 2
DcShare/Helper/ShareAttachment.swift

@@ -94,6 +94,9 @@ class ShareAttachment {
                     self.delegate?.onThumbnailChanged()
                 }
             }
+            if error != nil {
+                self.dcContext.logger?.error(error?.localizedDescription ?? "Could not load share item as image")
+            }
         }
     }
 
@@ -107,10 +110,12 @@ class ShareAttachment {
                     self.imageThumbnail = DcUtils.generateThumbnailFromVideo(url: url)?.scaleDownImage(toMax: self.thumbnailSize)
                     self.delegate?.onThumbnailChanged()
                 }
-
             default:
                 self.dcContext.logger?.debug("Unexpected data: \(type(of: data))")
             }
+            if error != nil {
+                self.dcContext.logger?.error(error?.localizedDescription ?? "Could not load share item as video")
+            }
         }
     }
 
@@ -134,6 +139,9 @@ class ShareAttachment {
             default:
                 self.dcContext.logger?.debug("Unexpected data: \(type(of: data))")
             }
+            if error != nil {
+                self.dcContext.logger?.error(error?.localizedDescription ?? "Could not load share item.")
+            }
         }
     }
 
@@ -153,7 +161,7 @@ class ShareAttachment {
                                                        scale: scale,
                                                        representationTypes: .all)
             let generator = QLThumbnailGenerator.shared
-            generator.generateRepresentations(for: request) { (thumbnail, type, error) in
+            generator.generateRepresentations(for: request) { (thumbnail, _, error) in
                 DispatchQueue.main.async {
                     if thumbnail == nil || error != nil {
                         self.dcContext.logger?.warning(error?.localizedDescription ?? "Could not create thumbnail.")

+ 0 - 2
deltachat-ios/Helper/Utils.swift

@@ -57,8 +57,6 @@ struct Utils {
         return url.absoluteString.hasSuffix("wav")
     }
 
-   
-
     static func getDeviceLanguage() -> String? {
         // some device languages have suffixes (like en-aus etc.) so we want to cut suffixes off
         guard let lang = Locale.preferredLanguages.first?.split(separator: "-").first else {