mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 01:22:41 +00:00
no message
This commit is contained in:
parent
ba53cb714d
commit
e2fc5ace75
@ -315,26 +315,26 @@ private func autodownloadMediaCategoryControllerEntries(presentationData: Presen
|
||||
size = settings.peers.contacts.videoMessage.sizeLimit
|
||||
}
|
||||
|
||||
entries.append(.cellularHeader(presentationData.theme, "CELLULAR"))
|
||||
entries.append(.cellularContacts(presentationData.theme, "Contacts", cellular.contacts))
|
||||
entries.append(.cellularOtherPrivate(presentationData.theme, "Other Private", cellular.otherPrivate))
|
||||
entries.append(.cellularGroups(presentationData.theme, "Groups", cellular.groups))
|
||||
entries.append(.cellularChannels(presentationData.theme, "Channels", cellular.channels))
|
||||
entries.append(.cellularHeader(presentationData.theme, presentationData.strings.AutoDownloadSettings_Cellular))
|
||||
entries.append(.cellularContacts(presentationData.theme, presentationData.strings.AutoDownloadSettings_Contacts, cellular.contacts))
|
||||
entries.append(.cellularOtherPrivate(presentationData.theme, presentationData.strings.AutoDownloadSettings_PrivateChats, cellular.otherPrivate))
|
||||
entries.append(.cellularGroups(presentationData.theme, presentationData.strings.AutoDownloadSettings_GroupChats, cellular.groups))
|
||||
entries.append(.cellularChannels(presentationData.theme, presentationData.strings.AutoDownloadSettings_Channels, cellular.channels))
|
||||
|
||||
entries.append(.wifiHeader(presentationData.theme, "WI-FI"))
|
||||
entries.append(.wifiContacts(presentationData.theme, "Contacts", wifi.contacts))
|
||||
entries.append(.wifiOtherPrivate(presentationData.theme, "Other Private", wifi.otherPrivate))
|
||||
entries.append(.wifiGroups(presentationData.theme, "Groups", wifi.groups))
|
||||
entries.append(.wifiChannels(presentationData.theme, "Channels", wifi.channels))
|
||||
entries.append(.wifiHeader(presentationData.theme, presentationData.strings.AutoDownloadSettings_WiFi))
|
||||
entries.append(.wifiContacts(presentationData.theme, presentationData.strings.AutoDownloadSettings_Contacts, wifi.contacts))
|
||||
entries.append(.wifiOtherPrivate(presentationData.theme, presentationData.strings.AutoDownloadSettings_PrivateChats, wifi.otherPrivate))
|
||||
entries.append(.wifiGroups(presentationData.theme, presentationData.strings.AutoDownloadSettings_GroupChats, wifi.groups))
|
||||
entries.append(.wifiChannels(presentationData.theme, presentationData.strings.AutoDownloadSettings_Channels, wifi.channels))
|
||||
|
||||
switch category {
|
||||
case .file, .video:
|
||||
entries.append(.sizeHeader(presentationData.theme, "LIMIT BY SIZE"))
|
||||
entries.append(.sizeHeader(presentationData.theme, presentationData.strings.AutoDownloadSettings_LimitBySize))
|
||||
let text: String
|
||||
if size == Int32.max {
|
||||
text = "unlimited"
|
||||
text = presentationData.strings.AutoDownloadSettings_Unlimited
|
||||
} else {
|
||||
text = "up to \(dataSizeString(Int(size)))"
|
||||
text = presentationData.strings.AutoDownloadSettings_UpTo(dataSizeString(Int(size))).0
|
||||
}
|
||||
entries.append(.sizeItem(presentationData.theme, text, size))
|
||||
default:
|
||||
@ -553,15 +553,15 @@ func autodownloadMediaCategoryController(account: Account, category: AutomaticDo
|
||||
let title: String
|
||||
switch category {
|
||||
case .photo:
|
||||
title = "Photos"
|
||||
title = presentationData.strings.AutoDownloadSettings_PhotosTitle
|
||||
case .video:
|
||||
title = "Videos"
|
||||
title = presentationData.strings.AutoDownloadSettings_VideosTitle
|
||||
case .file:
|
||||
title = "Files"
|
||||
title = presentationData.strings.AutoDownloadSettings_DocumentsTitle
|
||||
case .voiceMessage:
|
||||
title = "Voice Messages"
|
||||
title = presentationData.strings.AutoDownloadSettings_VoiceMessagesTitle
|
||||
case .videoMessage:
|
||||
title = "Video Messages"
|
||||
title = presentationData.strings.AutoDownloadSettings_VideoMessagesTitle
|
||||
}
|
||||
|
||||
let controllerState = ItemListControllerState(theme: presentationData.theme, title: .text(title), leftNavigationButton: nil, rightNavigationButton: nil, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: false)
|
||||
|
||||
@ -171,10 +171,10 @@ private func seekCallback(userData: UnsafeMutableRawPointer?, offset: Int64, whe
|
||||
context.requestedCompleteFetch = false
|
||||
} else {
|
||||
if streamable {
|
||||
context.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, range: context.readingOffset ..< resourceSize, statsCategory: statsCategory).start())
|
||||
context.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, range: context.readingOffset ..< resourceSize, statsCategory: statsCategory, preferBackgroundReferenceRevalidation: streamable).start())
|
||||
} else if !context.requestedCompleteFetch && context.fetchAutomatically {
|
||||
context.requestedCompleteFetch = true
|
||||
context.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, statsCategory: statsCategory).start())
|
||||
context.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, statsCategory: statsCategory, preferBackgroundReferenceRevalidation: streamable).start())
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -235,10 +235,10 @@ final class FFMpegMediaFrameSourceContext: NSObject {
|
||||
let resourceSize: Int = resourceReference.resource.size ?? Int(Int32.max - 1)
|
||||
|
||||
if streamable {
|
||||
self.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, range: 0 ..< resourceSize, statsCategory: self.statsCategory ?? .generic).start())
|
||||
self.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, range: 0 ..< resourceSize, statsCategory: self.statsCategory ?? .generic, preferBackgroundReferenceRevalidation: streamable).start())
|
||||
} else if !self.requestedCompleteFetch && self.fetchAutomatically {
|
||||
self.requestedCompleteFetch = true
|
||||
self.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, statsCategory: self.statsCategory ?? .generic).start())
|
||||
self.fetchedDataDisposable.set(fetchedMediaResource(postbox: postbox, reference: resourceReference, statsCategory: self.statsCategory ?? .generic, preferBackgroundReferenceRevalidation: streamable).start())
|
||||
}
|
||||
|
||||
var avFormatContextRef = avformat_alloc_context()
|
||||
|
||||
@ -38,6 +38,11 @@ enum ItemListPeerItemAliasHandling {
|
||||
case threatSelfAsSaved
|
||||
}
|
||||
|
||||
enum ItemListPeerItemNameColor {
|
||||
case primary
|
||||
case secret
|
||||
}
|
||||
|
||||
enum ItemListPeerItemRevealOptionType {
|
||||
case neutral
|
||||
case warning
|
||||
@ -60,6 +65,7 @@ final class ItemListPeerItem: ListViewItem, ItemListItem {
|
||||
let account: Account
|
||||
let peer: Peer
|
||||
let aliasHandling: ItemListPeerItemAliasHandling
|
||||
let nameColor: ItemListPeerItemNameColor
|
||||
let presence: PeerPresence?
|
||||
let text: ItemListPeerItemText
|
||||
let label: ItemListPeerItemLabel
|
||||
@ -73,12 +79,13 @@ final class ItemListPeerItem: ListViewItem, ItemListItem {
|
||||
let removePeer: (PeerId) -> Void
|
||||
let toggleUpdated: ((Bool) -> Void)?
|
||||
|
||||
init(theme: PresentationTheme, strings: PresentationStrings, account: Account, peer: Peer, aliasHandling: ItemListPeerItemAliasHandling = .standard, presence: PeerPresence?, text: ItemListPeerItemText, label: ItemListPeerItemLabel, editing: ItemListPeerItemEditing, revealOptions: ItemListPeerItemRevealOptions? = nil, switchValue: ItemListPeerItemSwitch?, enabled: Bool, sectionId: ItemListSectionId, action: (() -> Void)?, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, removePeer: @escaping (PeerId) -> Void, toggleUpdated: ((Bool) -> Void)? = nil) {
|
||||
init(theme: PresentationTheme, strings: PresentationStrings, account: Account, peer: Peer, aliasHandling: ItemListPeerItemAliasHandling = .standard, nameColor: ItemListPeerItemNameColor = .primary, presence: PeerPresence?, text: ItemListPeerItemText, label: ItemListPeerItemLabel, editing: ItemListPeerItemEditing, revealOptions: ItemListPeerItemRevealOptions? = nil, switchValue: ItemListPeerItemSwitch?, enabled: Bool, sectionId: ItemListSectionId, action: (() -> Void)?, setPeerIdWithRevealedOptions: @escaping (PeerId?, PeerId?) -> Void, removePeer: @escaping (PeerId) -> Void, toggleUpdated: ((Bool) -> Void)? = nil) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.account = account
|
||||
self.peer = peer
|
||||
self.aliasHandling = aliasHandling
|
||||
self.nameColor = nameColor
|
||||
self.presence = presence
|
||||
self.text = text
|
||||
self.label = label
|
||||
@ -304,26 +311,34 @@ class ItemListPeerItemNode: ItemListRevealOptionsItemNode {
|
||||
currentCheckNode = nil
|
||||
}
|
||||
|
||||
let titleColor: UIColor
|
||||
switch item.nameColor {
|
||||
case .primary:
|
||||
titleColor = item.theme.list.itemPrimaryTextColor
|
||||
case .secret:
|
||||
titleColor = item.theme.chatList.secretTitleColor
|
||||
}
|
||||
|
||||
if item.peer.id == item.account.peerId, case .threatSelfAsSaved = item.aliasHandling {
|
||||
titleAttributedString = NSAttributedString(string: item.strings.DialogList_SavedMessages, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
titleAttributedString = NSAttributedString(string: item.strings.DialogList_SavedMessages, font: titleBoldFont, textColor: titleColor)
|
||||
} else if let user = item.peer as? TelegramUser {
|
||||
if let firstName = user.firstName, let lastName = user.lastName, !firstName.isEmpty, !lastName.isEmpty {
|
||||
let string = NSMutableAttributedString()
|
||||
string.append(NSAttributedString(string: firstName, font: titleFont, textColor: item.theme.list.itemPrimaryTextColor))
|
||||
string.append(NSAttributedString(string: " ", font: titleFont, textColor: item.theme.list.itemPrimaryTextColor))
|
||||
string.append(NSAttributedString(string: lastName, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor))
|
||||
string.append(NSAttributedString(string: firstName, font: titleFont, textColor: titleColor))
|
||||
string.append(NSAttributedString(string: " ", font: titleFont, textColor: titleColor))
|
||||
string.append(NSAttributedString(string: lastName, font: titleBoldFont, textColor: titleColor))
|
||||
titleAttributedString = string
|
||||
} else if let firstName = user.firstName, !firstName.isEmpty {
|
||||
titleAttributedString = NSAttributedString(string: firstName, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
titleAttributedString = NSAttributedString(string: firstName, font: titleBoldFont, textColor: titleColor)
|
||||
} else if let lastName = user.lastName, !lastName.isEmpty {
|
||||
titleAttributedString = NSAttributedString(string: lastName, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
titleAttributedString = NSAttributedString(string: lastName, font: titleBoldFont, textColor: titleColor)
|
||||
} else {
|
||||
titleAttributedString = NSAttributedString(string: "Deleted User", font: titleBoldFont, textColor: item.theme.list.itemDisabledTextColor)
|
||||
titleAttributedString = NSAttributedString(string: item.strings.User_DeletedAccount, font: titleBoldFont, textColor: titleColor)
|
||||
}
|
||||
} else if let group = item.peer as? TelegramGroup {
|
||||
titleAttributedString = NSAttributedString(string: group.title, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
titleAttributedString = NSAttributedString(string: group.title, font: titleBoldFont, textColor: titleColor)
|
||||
} else if let channel = item.peer as? TelegramChannel {
|
||||
titleAttributedString = NSAttributedString(string: channel.title, font: titleBoldFont, textColor: item.theme.list.itemPrimaryTextColor)
|
||||
titleAttributedString = NSAttributedString(string: channel.title, font: titleBoldFont, textColor: titleColor)
|
||||
}
|
||||
|
||||
switch item.text {
|
||||
|
||||
@ -2614,7 +2614,7 @@ final class SecureIdDocumentFormControllerNode: FormControllerNode<SecureIdDocum
|
||||
strongSelf.presentAssetPicker(target, replaceDocumentId: document.id)
|
||||
}
|
||||
}),
|
||||
ActionSheetButtonItem(title: strings.Common_Delete, action: { [weak self] in
|
||||
ActionSheetButtonItem(title: strings.Common_Delete, color: .destructive, action: { [weak self] in
|
||||
dismissAction()
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
||||
@ -107,7 +107,7 @@ final class SinglePhoneInputNode: ASDisplayNode, UITextFieldDelegate {
|
||||
|
||||
let numberField = TextFieldNode()
|
||||
numberField.textField.font = Font.regular(self.fontSize)
|
||||
numberField.textField.keyboardType = .numberPad
|
||||
numberField.textField.keyboardType = .phonePad
|
||||
numberField.textField.text = self.numberFieldText
|
||||
|
||||
self.addSubnode(numberField)
|
||||
|
||||
@ -33,7 +33,7 @@ private enum StorageUsageEntry: ItemListNodeEntry {
|
||||
case clearAll(PresentationTheme, String, String, Bool)
|
||||
|
||||
case peersHeader(PresentationTheme, String)
|
||||
case peer(Int32, PresentationTheme, PresentationStrings, Peer, String)
|
||||
case peer(Int32, PresentationTheme, PresentationStrings, Peer, Peer?, String)
|
||||
|
||||
var section: ItemListSectionId {
|
||||
switch self {
|
||||
@ -58,7 +58,7 @@ private enum StorageUsageEntry: ItemListNodeEntry {
|
||||
return 3
|
||||
case .peersHeader:
|
||||
return 4
|
||||
case let .peer(index, _, _, _, _):
|
||||
case let .peer(index, _, _, _, _, _):
|
||||
return 5 + index
|
||||
}
|
||||
}
|
||||
@ -95,8 +95,8 @@ private enum StorageUsageEntry: ItemListNodeEntry {
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .peer(lhsIndex, lhsTheme, lhsStrings, lhsPeer, lhsValue):
|
||||
if case let .peer(rhsIndex, rhsTheme, rhsStrings, rhsPeer, rhsValue) = rhs {
|
||||
case let .peer(lhsIndex, lhsTheme, lhsStrings, lhsPeer, lhsChatPeer, lhsValue):
|
||||
if case let .peer(rhsIndex, rhsTheme, rhsStrings, rhsPeer, rhsChatPeer, rhsValue) = rhs {
|
||||
if lhsIndex != rhsIndex {
|
||||
return false
|
||||
}
|
||||
@ -109,6 +109,9 @@ private enum StorageUsageEntry: ItemListNodeEntry {
|
||||
if !arePeersEqual(lhsPeer, rhsPeer) {
|
||||
return false
|
||||
}
|
||||
if !arePeersEqual(lhsChatPeer, rhsChatPeer) {
|
||||
return false
|
||||
}
|
||||
if lhsValue != rhsValue {
|
||||
return false
|
||||
}
|
||||
@ -139,9 +142,10 @@ private enum StorageUsageEntry: ItemListNodeEntry {
|
||||
return ItemListDisclosureItem(theme: theme, icon: nil, title: text, kind: enabled ? .generic : .disabled, label: value, sectionId: self.section, style: .blocks, disclosureStyle: .arrow, action: {
|
||||
arguments.openClearAll()
|
||||
})
|
||||
case let .peer(_, theme, strings, peer, value):
|
||||
return ItemListPeerItem(theme: theme, strings: strings, account: arguments.account, peer: peer, aliasHandling: .threatSelfAsSaved, presence: nil, text: .none, label: .disclosure(value), editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, sectionId: self.section, action: {
|
||||
arguments.openPeerMedia(peer.id)
|
||||
case let .peer(_, theme, strings, peer, chatPeer, value):
|
||||
return ItemListPeerItem(theme: theme, strings: strings, account: arguments.account, peer: peer, aliasHandling: .threatSelfAsSaved, nameColor: chatPeer == nil ? .primary : .secret, presence: nil, text: .none, label: .disclosure(value), editing: ItemListPeerItemEditing(editable: false, editing: false, revealed: false), switchValue: nil, enabled: true, sectionId: self.section, action: {
|
||||
let resolvedPeer = chatPeer ?? peer
|
||||
arguments.openPeerMedia(resolvedPeer.id)
|
||||
}, setPeerIdWithRevealedOptions: { previousId, id in
|
||||
|
||||
}, removePeer: { _ in
|
||||
@ -193,7 +197,13 @@ private func storageUsageControllerEntries(presentationData: PresentationData, c
|
||||
addedHeader = true
|
||||
entries.append(.peersHeader(presentationData.theme, presentationData.strings.Cache_ByPeerHeader))
|
||||
}
|
||||
entries.append(.peer(index, presentationData.theme, presentationData.strings, peer, dataSizeString(Int(size))))
|
||||
var mainPeer = peer
|
||||
var chatPeer: Peer?
|
||||
if let associatedPeerId = peer.associatedPeerId, let associatedPeer = stats.peers[associatedPeerId] {
|
||||
chatPeer = mainPeer
|
||||
mainPeer = associatedPeer
|
||||
}
|
||||
entries.append(.peer(index, presentationData.theme, presentationData.strings, mainPeer, chatPeer, dataSizeString(Int(size))))
|
||||
index += 1
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user