mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-28 19:05:49 +00:00
UI improvements
This commit is contained in:
parent
98c0b7234c
commit
274aa510b1
@ -433,7 +433,7 @@ public final class EngineMessageReactionListContext {
|
||||
self.reaction = reaction
|
||||
|
||||
let initialState = EngineMessageReactionListContext.State(message: message, readStats: readStats, reaction: reaction)
|
||||
self.state = InternalState(hasOutgoingReaction: initialState.hasOutgoingReaction, totalCount: initialState.totalCount, items: initialState.items, canLoadMore: true, nextOffset: nil)
|
||||
self.state = InternalState(hasOutgoingReaction: initialState.hasOutgoingReaction, totalCount: initialState.totalCount, items: initialState.items, canLoadMore: initialState.canLoadMore, nextOffset: nil)
|
||||
|
||||
if initialState.canLoadMore {
|
||||
self.loadMore()
|
||||
|
||||
@ -512,14 +512,16 @@ private final class SendInviteLinkScreenComponent: Component {
|
||||
if self.selectedItems.isEmpty {
|
||||
controller.dismiss()
|
||||
} else if let link = component.link {
|
||||
let selectedPeers = component.peers.filter { self.selectedItems.contains($0.id) }
|
||||
|
||||
let _ = enqueueMessagesToMultiplePeers(account: component.context.account, peerIds: Array(self.selectedItems), threadIds: [:], messages: [.message(text: link, attributes: [], inlineStickers: [:], mediaReference: nil, replyToMessageId: nil, localGroupingKey: nil, correlationId: nil, bubbleUpEmojiOrStickersets: [])]).start()
|
||||
let text: String
|
||||
if component.peers.count == 1 {
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_Chat_One(component.peers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: "")).string
|
||||
} else if component.peers.count == 2 {
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_TwoChats_One(component.peers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: ""), component.peers[1].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: "")).string
|
||||
if selectedPeers.count == 1 {
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_Chat_One(selectedPeers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: "")).string
|
||||
} else if selectedPeers.count == 2 {
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_TwoChats_One(selectedPeers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: ""), selectedPeers[1].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: "")).string
|
||||
} else {
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_ManyChats_One(component.peers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: ""), "\(component.peers.count - 1)").string
|
||||
text = environment.strings.Conversation_ShareLinkTooltip_ManyChats_One(selectedPeers[0].displayTitle(strings: environment.strings, displayOrder: .firstLast).replacingOccurrences(of: "*", with: ""), "\(selectedPeers.count - 1)").string
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
@ -2258,7 +2258,7 @@ final class StorageUsageScreenComponent: Component {
|
||||
}
|
||||
|
||||
let presentationData = component.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.ClearCache_Success("\(dataSizeString(size, formatting: DataSizeStringFormatting(presentationData: presentationData)))", stringForDeviceType()).string), elevatedLayout: false, action: { _ in return false }), in: .window(.root))
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .succeed(text: presentationData.strings.ClearCache_Success("\(dataSizeString(size, formatting: DataSizeStringFormatting(presentationData: presentationData)))", stringForDeviceType()).string), elevatedLayout: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
|
||||
private func reloadStats(firstTime: Bool, completion: @escaping () -> Void) {
|
||||
|
||||
@ -637,6 +637,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
if hadUpdates {
|
||||
self.activeAccountsValue!.accounts.sort(by: { $0.2 < $1.2 })
|
||||
self.activeAccountsPromise.set(.single(self.activeAccountsValue!))
|
||||
|
||||
self.performAccountSettingsImportIfNecessary()
|
||||
}
|
||||
|
||||
if self.activeAccountsValue!.primary == nil && self.activeAccountsValue!.currentAuth == nil {
|
||||
@ -897,6 +899,37 @@ public final class SharedAccountContextImpl: SharedAccountContext {
|
||||
self.callStateDisposable?.dispose()
|
||||
}
|
||||
|
||||
private var didPerformAccountSettingsImport = false
|
||||
private func performAccountSettingsImportIfNecessary() {
|
||||
if self.didPerformAccountSettingsImport {
|
||||
return
|
||||
}
|
||||
if let _ = UserDefaults.standard.value(forKey: "didPerformAccountSettingsImport") {
|
||||
self.didPerformAccountSettingsImport = true
|
||||
return
|
||||
}
|
||||
UserDefaults.standard.set(true as NSNumber, forKey: "didPerformAccountSettingsImport")
|
||||
UserDefaults.standard.synchronize()
|
||||
|
||||
if let primary = self.activeAccountsValue?.primary {
|
||||
let _ = (primary.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: primary.account.peerId))
|
||||
|> deliverOnMainQueue).start(next: { [weak self] peer in
|
||||
guard let self, case let .user(user) = peer else {
|
||||
return
|
||||
}
|
||||
if user.isPremium {
|
||||
let _ = updateMediaDownloadSettingsInteractively(accountManager: self.accountManager, { settings in
|
||||
var settings = settings
|
||||
settings.energyUsageSettings.loopEmoji = true
|
||||
return settings
|
||||
}).start()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
self.didPerformAccountSettingsImport = true
|
||||
}
|
||||
|
||||
private func updateAccountBackupData(account: Account) -> Signal<Never, NoError> {
|
||||
return accountBackupData(postbox: account.postbox)
|
||||
|> mapToSignal { backupData -> Signal<Never, NoError> in
|
||||
|
||||
@ -270,18 +270,24 @@ public struct EnergyUsageSettings: Codable, Equatable {
|
||||
case autodownloadInBackground
|
||||
}
|
||||
|
||||
public static var `default`: EnergyUsageSettings {
|
||||
public static let `default`: EnergyUsageSettings = {
|
||||
var length: Int = 4
|
||||
var cpuCount: UInt32 = 0
|
||||
sysctlbyname("hw.ncpu", &cpuCount, &length, nil, 0)
|
||||
|
||||
let isCapable = cpuCount >= 4
|
||||
|
||||
return EnergyUsageSettings(
|
||||
activationThreshold: 15,
|
||||
autoplayVideo: true,
|
||||
autoplayGif: true,
|
||||
loopStickers: true,
|
||||
loopEmoji: true,
|
||||
fullTranslucency: true,
|
||||
loopEmoji: isCapable ? false : true,
|
||||
fullTranslucency: isCapable ? false : true,
|
||||
extendBackgroundWork: true,
|
||||
autodownloadInBackground: true
|
||||
)
|
||||
}
|
||||
}()
|
||||
|
||||
public static var powerSavingDefault: EnergyUsageSettings {
|
||||
return EnergyUsageSettings(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user