mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Refactoring [skip ci]
This commit is contained in:
@@ -13,7 +13,6 @@ import AppBundle
|
||||
import LegacyMediaPickerUI
|
||||
import AVFoundation
|
||||
import UndoUI
|
||||
import Postbox
|
||||
|
||||
private struct NotificationSoundSelectionArguments {
|
||||
let account: Account
|
||||
@@ -516,20 +515,20 @@ public func presentCustomNotificationSoundFilePicker(context: AccountContext, co
|
||||
let fileName = url.lastPathComponent
|
||||
|
||||
var maybeUrl: URL?
|
||||
let tempFile = TempBox.shared.tempFile(fileName: "file.mp3")
|
||||
let tempFile = EngineTempBox.shared.tempFile(fileName: "file.mp3")
|
||||
do {
|
||||
try FileManager.default.copyItem(at: url, to: URL(fileURLWithPath: tempFile.path))
|
||||
maybeUrl = URL(fileURLWithPath: tempFile.path)
|
||||
} catch let e {
|
||||
Logger.shared.log("NotificationSoundSelection", "copy file error \(e)")
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
souceUrl.stopAccessingSecurityScopedResource()
|
||||
return
|
||||
}
|
||||
|
||||
guard let url = maybeUrl else {
|
||||
Logger.shared.log("NotificationSoundSelection", "temp url is nil")
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
souceUrl.stopAccessingSecurityScopedResource()
|
||||
return
|
||||
}
|
||||
@@ -544,7 +543,7 @@ public func presentCustomNotificationSoundFilePicker(context: AccountContext, co
|
||||
presentUndo(.info(title: presentationData.strings.Notifications_UploadError_TooLarge_Title, text: presentationData.strings.Notifications_UploadError_TooLarge_Text(dataSizeString(Int64(settings.maxSize), formatting: DataSizeStringFormatting(presentationData: presentationData))).string, timeout: nil))
|
||||
|
||||
souceUrl.stopAccessingSecurityScopedResource()
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -572,7 +571,7 @@ public func presentCustomNotificationSoundFilePicker(context: AccountContext, co
|
||||
Logger.shared.log("NotificationSoundSelection", "track is nil")
|
||||
|
||||
url.stopAccessingSecurityScopedResource()
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
|
||||
return
|
||||
}
|
||||
@@ -583,12 +582,12 @@ public func presentCustomNotificationSoundFilePicker(context: AccountContext, co
|
||||
Logger.shared.log("NotificationSoundSelection", "duration is zero")
|
||||
|
||||
souceUrl.stopAccessingSecurityScopedResource()
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
TempBox.shared.dispose(tempFile)
|
||||
EngineTempBox.shared.dispose(tempFile)
|
||||
|
||||
Queue.mainQueue().async {
|
||||
if duration > Double(settings.maxDuration) {
|
||||
|
||||
Reference in New Issue
Block a user