Pre-release improvements

This commit is contained in:
Ali
2022-04-01 17:25:59 +04:00
parent eb9ff7beda
commit e93bc2efab
18 changed files with 363 additions and 187 deletions

View File

@@ -183,7 +183,7 @@ private enum NotificationSoundSelectionEntry: ItemListNodeEntry {
return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section)
case let .uploadSound(text):
let icon = PresentationResourcesItemList.uploadToneIcon(presentationData.theme)
return ItemListCheckboxItem(presentationData: presentationData, icon: icon, iconSize: nil, iconPlacement: .check, title: text, style: .left, checked: false, zeroSeparatorInsets: false, sectionId: self.section, action: {
return ItemListCheckboxItem(presentationData: presentationData, icon: icon, iconSize: nil, iconPlacement: .check, title: text, style: .left, textColor: .accent, checked: false, zeroSeparatorInsets: false, sectionId: self.section, action: {
arguments.upload()
})
case let .cloudInfo(text):
@@ -479,6 +479,20 @@ public func presentCustomNotificationSoundFilePicker(context: AccountContext, co
return
}
do {
let resources = try url.resourceValues(forKeys:[.fileSizeKey])
if let size = resources.fileSize {
if Int32(size) > settings.maxSize {
//TODO:localize
presentUndo(.info(title: "Audio is too large", text: "The file is over \(dataSizeString(Int64(settings.maxSize), formatting: DataSizeStringFormatting(presentationData: presentationData)))."))
return
}
}
} catch {
print("Error: \(error)")
return
}
let coordinator = NSFileCoordinator(filePresenter: nil)
var error: NSError?
coordinator.coordinate(readingItemAt: url, options: .forUploading, error: &error, byAccessor: { url in