Skip to content

Commit 496c820

Browse files
committed
Update PhotoView.swift
1 parent ecd7910 commit 496c820

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

apple/InlineIOS/Chat/PhotoView.swift

+9-7
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ final class PhotoView: UIView, QLPreviewControllerDataSource, QLPreviewControlle
7373
}
7474

7575
private func setupImage() {
76-
guard let (_, url) = imageUrl() else { return }
76+
guard let (isLocal, url) = imageUrl() else { return }
7777
backgroundColor = .clear
7878
addSubview(imageView)
7979

@@ -135,13 +135,15 @@ final class PhotoView: UIView, QLPreviewControllerDataSource, QLPreviewControlle
135135
if case let .success(response) = result {
136136
// Save to local storage if needed
137137
if var file = fullMessage.file {
138-
Task {
139-
let pathString = response.image.save(file: file)
140-
file.localPath = pathString
141-
try? await AppDatabase.shared.dbWriter.write { db in
142-
try file.save(db)
138+
if !isLocal {
139+
Task {
140+
let pathString = response.image.save(file: file)
141+
file.localPath = pathString
142+
try? await AppDatabase.shared.dbWriter.write { db in
143+
try file.save(db)
144+
}
145+
self.triggerMessageReload()
143146
}
144-
self.triggerMessageReload()
145147
}
146148
}
147149
}

0 commit comments

Comments
 (0)