diff --git a/TelegramUI/ChatListArchiveInfoItem.swift b/TelegramUI/ChatListArchiveInfoItem.swift index 44cd8725f2..9a5a963b35 100644 --- a/TelegramUI/ChatListArchiveInfoItem.swift +++ b/TelegramUI/ChatListArchiveInfoItem.swift @@ -222,7 +222,7 @@ class ChatListArchiveInfoItemNode: ListViewItemNode, UIScrollViewDelegate { if themeUpdated { strongSelf.pageControlNode.dotColor = item.theme.chatList.unreadBadgeActiveBackgroundColor - strongSelf.pageControlNode.inactiveDotColor = item.theme.chatList.unreadBadgeInactiveBackgroundColor + strongSelf.pageControlNode.inactiveDotColor = item.theme.list.pageIndicatorInactiveColor } let resetOffset = !strongSelf.scrollNode.frame.width.isEqual(to: baseWidth) diff --git a/TelegramUI/ChatListController.swift b/TelegramUI/ChatListController.swift index 0c8af56431..da1cafcc6a 100644 --- a/TelegramUI/ChatListController.swift +++ b/TelegramUI/ChatListController.swift @@ -109,11 +109,18 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBar.style.style - if case .root = groupId { + let title: String + if case .root = self.groupId { + title = self.presentationData.strings.DialogList_Title self.navigationBar?.item = nil + } else { + title = self.presentationData.strings.ChatList_ArchivedChatsTitle + } - self.titleView.title = NetworkStatusTitle(text: self.presentationData.strings.DialogList_Title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false) - self.navigationItem.titleView = self.titleView + self.titleView.title = NetworkStatusTitle(text: title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false) + self.navigationItem.titleView = self.titleView + + if case .root = groupId { self.tabBarItem.title = self.presentationData.strings.DialogList_Title let icon: UIImage? @@ -133,17 +140,18 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie let rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationComposeIcon(self.presentationData.theme), style: .plain, target: self, action: #selector(self.composePressed)) rightBarButtonItem.accessibilityLabel = "Compose" self.navigationItem.rightBarButtonItem = rightBarButtonItem + let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) + backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back + self.navigationItem.backBarButtonItem = backBarButtonItem } else { - self.navigationItem.title = self.presentationData.strings.ChatList_ArchivedChatsTitle let rightBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Edit, style: .plain, target: self, action: #selector(self.editPressed)) rightBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Edit self.navigationItem.rightBarButtonItem = rightBarButtonItem + let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) + backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back + self.navigationItem.backBarButtonItem = backBarButtonItem } - let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) - backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back - self.navigationItem.backBarButtonItem = backBarButtonItem - self.scrollToTop = { [weak self] in if let strongSelf = self { if let searchContentNode = strongSelf.searchContentNode { @@ -201,15 +209,23 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie if !self.hideNetworkActivityStatus { self.titleDisposable = combineLatest(queue: .mainQueue(), context.account.networkState, hasProxy, passcode, self.chatListDisplayNode.chatListNode.state).start(next: { [weak self] networkState, proxy, passcode, state in if let strongSelf = self { + let defaultTitle: String + if case .root = strongSelf.groupId { + defaultTitle = strongSelf.presentationData.strings.DialogList_Title + } else { + defaultTitle = strongSelf.presentationData.strings.ChatList_ArchivedChatsTitle + } if state.editing { if case .root = strongSelf.groupId { strongSelf.navigationItem.rightBarButtonItem = nil } - let title = !state.selectedPeerIds.isEmpty ? strongSelf.presentationData.strings.ChatList_SelectedChats(Int32(state.selectedPeerIds.count)) : strongSelf.presentationData.strings.DialogList_Title + let title = !state.selectedPeerIds.isEmpty ? strongSelf.presentationData.strings.ChatList_SelectedChats(Int32(state.selectedPeerIds.count)) : defaultTitle strongSelf.titleView.title = NetworkStatusTitle(text: title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false) } else { + var isRoot = false if case .root = strongSelf.groupId { + isRoot = true let rightBarButtonItem = UIBarButtonItem(image: PresentationResourcesRootController.navigationComposeIcon(strongSelf.presentationData.theme), style: .plain, target: strongSelf, action: #selector(strongSelf.composePressed)) rightBarButtonItem.accessibilityLabel = "Compose" strongSelf.navigationItem.rightBarButtonItem = rightBarButtonItem @@ -220,7 +236,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie var checkProxy = false switch networkState { case .waitingForNetwork: - strongSelf.titleView.title = NetworkStatusTitle(text: strongSelf.presentationData.strings.State_WaitingForNetwork, activity: true, hasProxy: false, connectsViaProxy: connectsViaProxy, isPasscodeSet: isPasscodeSet, isManuallyLocked: isManuallyLocked) + strongSelf.titleView.title = NetworkStatusTitle(text: strongSelf.presentationData.strings.State_WaitingForNetwork, activity: true, hasProxy: false, connectsViaProxy: connectsViaProxy, isPasscodeSet: isRoot && isPasscodeSet, isManuallyLocked: isRoot && isManuallyLocked) case let .connecting(proxy): var text = strongSelf.presentationData.strings.State_Connecting if let layout = strongSelf.validLayout, proxy != nil && layout.metrics.widthClass != .regular && layout.size.width > 320.0 { @@ -229,13 +245,13 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie if let proxy = proxy, proxy.hasConnectionIssues { checkProxy = true } - strongSelf.titleView.title = NetworkStatusTitle(text: text, activity: true, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isPasscodeSet, isManuallyLocked: isManuallyLocked) + strongSelf.titleView.title = NetworkStatusTitle(text: text, activity: true, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isRoot && isPasscodeSet, isManuallyLocked: isRoot && isManuallyLocked) case .updating: - strongSelf.titleView.title = NetworkStatusTitle(text: strongSelf.presentationData.strings.State_Updating, activity: true, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isPasscodeSet, isManuallyLocked: isManuallyLocked) + strongSelf.titleView.title = NetworkStatusTitle(text: strongSelf.presentationData.strings.State_Updating, activity: true, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isRoot && isPasscodeSet, isManuallyLocked: isRoot && isManuallyLocked) case .online: - strongSelf.titleView.title = NetworkStatusTitle(text: strongSelf.presentationData.strings.DialogList_Title, activity: false, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isPasscodeSet, isManuallyLocked: isManuallyLocked) + strongSelf.titleView.title = NetworkStatusTitle(text: defaultTitle, activity: false, hasProxy: hasProxy, connectsViaProxy: connectsViaProxy, isPasscodeSet: isRoot && isPasscodeSet, isManuallyLocked: isRoot && isManuallyLocked) } - if checkProxy { + if case .root = groupId, checkProxy { if strongSelf.proxyUnavailableTooltipController == nil && !strongSelf.didShowProxyUnavailableTooltipController && strongSelf.isNodeLoaded && strongSelf.displayNode.view.window != nil { strongSelf.didShowProxyUnavailableTooltipController = true let tooltipController = TooltipController(content: .text(strongSelf.presentationData.strings.Proxy_TooltipUnavailable), timeout: 60.0, dismissByTapOutside: true) @@ -340,11 +356,16 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie } private func updateThemeAndStrings() { - self.tabBarItem.title = self.presentationData.strings.DialogList_Title - - let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) - backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back - self.navigationItem.backBarButtonItem = backBarButtonItem + if case .root = self.groupId { + self.tabBarItem.title = self.presentationData.strings.DialogList_Title + let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) + backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back + self.navigationItem.backBarButtonItem = backBarButtonItem + } else { + let backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.DialogList_Title, style: .plain, target: nil, action: nil) + backBarButtonItem.accessibilityLabel = self.presentationData.strings.Common_Back + self.navigationItem.backBarButtonItem = backBarButtonItem + } self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.DialogList_SearchLabel) var editing = false @@ -432,7 +453,7 @@ public class ChatListController: TelegramController, KeyShortcutResponder, UIVie }) if value { - strongSelf.present(UndoOverlayController(context: strongSelf.context, content: .hidArchive(title: strongSelf.presentationData.strings.ChatList_UndoArchiveHiddenTitle, text: strongSelf.presentationData.strings.ChatList_UndoArchiveHiddenText, undo: true), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] shouldCommit in + strongSelf.present(UndoOverlayController(context: strongSelf.context, content: .hidArchive(title: strongSelf.presentationData.strings.ChatList_UndoArchiveHiddenTitle, text: strongSelf.presentationData.strings.ChatList_UndoArchiveHiddenText, undo: false), elevatedLayout: false, animateInAsReplacement: true, action: { [weak self] shouldCommit in guard let strongSelf = self else { return } diff --git a/TelegramUI/DefaultDarkAccentPresentationTheme.swift b/TelegramUI/DefaultDarkAccentPresentationTheme.swift index 88c91720d8..3db3cbe86b 100644 --- a/TelegramUI/DefaultDarkAccentPresentationTheme.swift +++ b/TelegramUI/DefaultDarkAccentPresentationTheme.swift @@ -110,7 +110,8 @@ private let list = PresentationThemeList( controlColor: UIColor(rgb: 0x4d4d4d) ), mediaPlaceholderColor: UIColor(rgb: 0x1e2c3a), - scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3) + scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3), + pageIndicatorInactiveColor: UIColor(rgb: 0xDBF5FF, alpha: 0.4) ) private let chatList = PresentationThemeChatList( diff --git a/TelegramUI/DefaultDarkPresentationTheme.swift b/TelegramUI/DefaultDarkPresentationTheme.swift index e0a593b2c7..bca2e41201 100644 --- a/TelegramUI/DefaultDarkPresentationTheme.swift +++ b/TelegramUI/DefaultDarkPresentationTheme.swift @@ -110,7 +110,8 @@ private let list = PresentationThemeList( controlColor: UIColor(rgb: 0x4d4d4d) ), mediaPlaceholderColor: UIColor(rgb: 0x1c1c1d), - scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3) + scrollIndicatorColor: UIColor(white: 1.0, alpha: 0.3), + pageIndicatorInactiveColor: UIColor(white: 1.0, alpha: 0.3) ) private let chatList = PresentationThemeChatList( diff --git a/TelegramUI/DefaultPresentationTheme.swift b/TelegramUI/DefaultPresentationTheme.swift index a9eee62352..ba034ac9d8 100644 --- a/TelegramUI/DefaultPresentationTheme.swift +++ b/TelegramUI/DefaultPresentationTheme.swift @@ -110,7 +110,8 @@ private func makeDefaultPresentationTheme(accentColor: UIColor, serviceBackgroun controlColor: UIColor(rgb: 0x96979d) ), mediaPlaceholderColor: UIColor(rgb: 0xe4e4e4), - scrollIndicatorColor: UIColor(white: 0.0, alpha: 0.3) + scrollIndicatorColor: UIColor(white: 0.0, alpha: 0.3), + pageIndicatorInactiveColor: UIColor(rgb: 0xe3e3e7) ) let chatList = PresentationThemeChatList( diff --git a/TelegramUI/PresentationTheme.swift b/TelegramUI/PresentationTheme.swift index 7246e83020..686a96d882 100644 --- a/TelegramUI/PresentationTheme.swift +++ b/TelegramUI/PresentationTheme.swift @@ -315,8 +315,9 @@ public final class PresentationThemeList { public let freeInputField: PresentationInputFieldTheme public let mediaPlaceholderColor: UIColor public let scrollIndicatorColor: UIColor + public let pageIndicatorInactiveColor: UIColor - public init(blocksBackgroundColor: UIColor, plainBackgroundColor: UIColor, itemPrimaryTextColor: UIColor, itemSecondaryTextColor: UIColor, itemDisabledTextColor: UIColor, itemAccentColor: UIColor, itemHighlightedColor: UIColor, itemDestructiveColor: UIColor, itemPlaceholderTextColor: UIColor, itemBlocksBackgroundColor: UIColor, itemHighlightedBackgroundColor: UIColor, itemBlocksSeparatorColor: UIColor, itemPlainSeparatorColor: UIColor, disclosureArrowColor: UIColor, sectionHeaderTextColor: UIColor, freeTextColor: UIColor, freeTextErrorColor: UIColor, freeTextSuccessColor: UIColor, freeMonoIcon: UIColor, itemSwitchColors: PresentationThemeSwitch, itemDisclosureActions: PresentationThemeItemDisclosureActions, itemCheckColors: PresentationThemeCheck, controlSecondaryColor: UIColor, freeInputField: PresentationInputFieldTheme, mediaPlaceholderColor: UIColor, scrollIndicatorColor: UIColor) { + public init(blocksBackgroundColor: UIColor, plainBackgroundColor: UIColor, itemPrimaryTextColor: UIColor, itemSecondaryTextColor: UIColor, itemDisabledTextColor: UIColor, itemAccentColor: UIColor, itemHighlightedColor: UIColor, itemDestructiveColor: UIColor, itemPlaceholderTextColor: UIColor, itemBlocksBackgroundColor: UIColor, itemHighlightedBackgroundColor: UIColor, itemBlocksSeparatorColor: UIColor, itemPlainSeparatorColor: UIColor, disclosureArrowColor: UIColor, sectionHeaderTextColor: UIColor, freeTextColor: UIColor, freeTextErrorColor: UIColor, freeTextSuccessColor: UIColor, freeMonoIcon: UIColor, itemSwitchColors: PresentationThemeSwitch, itemDisclosureActions: PresentationThemeItemDisclosureActions, itemCheckColors: PresentationThemeCheck, controlSecondaryColor: UIColor, freeInputField: PresentationInputFieldTheme, mediaPlaceholderColor: UIColor, scrollIndicatorColor: UIColor, pageIndicatorInactiveColor: UIColor) { self.blocksBackgroundColor = blocksBackgroundColor self.plainBackgroundColor = plainBackgroundColor self.itemPrimaryTextColor = itemPrimaryTextColor @@ -343,6 +344,7 @@ public final class PresentationThemeList { self.freeInputField = freeInputField self.mediaPlaceholderColor = mediaPlaceholderColor self.scrollIndicatorColor = scrollIndicatorColor + self.pageIndicatorInactiveColor = pageIndicatorInactiveColor } } diff --git a/TelegramUI/SharedAccountContext.swift b/TelegramUI/SharedAccountContext.swift index b376a7cedc..787c7a197c 100644 --- a/TelegramUI/SharedAccountContext.swift +++ b/TelegramUI/SharedAccountContext.swift @@ -279,6 +279,8 @@ public final class SharedAccountContext { } })) + let startTime = CFAbsoluteTimeGetCurrent() + let differenceDisposable = MetaDisposable() let _ = (accountManager.accountRecords() |> map { view -> (AccountRecordId?, [AccountRecordId: AccountAttributes], (AccountRecordId, Bool)?) in @@ -393,6 +395,9 @@ public final class SharedAccountContext { differenceDisposable.set((combineLatest(queue: .mainQueue(), mappedAddedAccounts, addedAuthSignal) |> deliverOnMainQueue).start(next: { mappedAddedAccounts, authAccount in + let endTime = CFAbsoluteTimeGetCurrent() + print("SharedAccountManager: accounts processed in \(endTime - startTime)") + var addedAccounts: [(AccountRecordId, Account?, Int32)] = [] switch mappedAddedAccounts { case let .upgrading(progress):