From a7788b5ecf309ce2a3450d4f483609543812e3b7 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 20 Apr 2022 19:10:32 +0400 Subject: [PATCH] Fix fetch --- .../NotificationService/Sources/NotificationService.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Telegram/NotificationService/Sources/NotificationService.swift b/Telegram/NotificationService/Sources/NotificationService.swift index 94437a779e..53c6c2bb39 100644 --- a/Telegram/NotificationService/Sources/NotificationService.swift +++ b/Telegram/NotificationService/Sources/NotificationService.swift @@ -1110,7 +1110,8 @@ private final class NotificationServiceHandler { fetchResource = downloadNotificationSound.resource as? TelegramMultipartFetchableResource if let resource = fetchResource { - if let _ = strongSelf.stateManager?.postbox.mediaBox.completedResourcePath(resource) { + if let path = strongSelf.stateManager?.postbox.mediaBox.completedResourcePath(resource), let data = try? Data(contentsOf: URL(fileURLWithPath: path)) { + fetchNotificationSoundSignal = .single(data) } else { let intervals: Signal<[(Range, MediaBoxFetchPriority)], NoError> = .single([(0 ..< Int(Int32.max), MediaBoxFetchPriority.maximum)]) fetchNotificationSoundSignal = Signal { subscriber in @@ -1172,7 +1173,7 @@ private final class NotificationServiceHandler { if let notificationSoundData = notificationSoundData { Logger.shared.log("NotificationService \(episode)", "Did fetch notificationSoundData") - if let (_, filePath, fileName) = downloadNotificationSound { + if let (_, filePath, _) = downloadNotificationSound { let _ = try? notificationSoundData.write(to: URL(fileURLWithPath: filePath)) } }