Various fixes

This commit is contained in:
Ilya Laktyushin 2022-06-11 11:49:36 +04:00
parent 6d68d52542
commit a4c6e96b66
9 changed files with 121 additions and 63 deletions

View File

@ -7564,6 +7564,15 @@ Sorry for the inconvenience.";
"OldChannels.TooManyCommunitiesText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one or upgrade to **Telegram Premium** to double the limit to **%@** groups and channels."; "OldChannels.TooManyCommunitiesText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one or upgrade to **Telegram Premium** to double the limit to **%@** groups and channels.";
"OldChannels.TooManyCommunitiesNoPremiumText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one. We are working to let you increase this limit in the future."; "OldChannels.TooManyCommunitiesNoPremiumText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one. We are working to let you increase this limit in the future.";
"OldChannels.TooManyCommunitiesFinalText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one."; "OldChannels.TooManyCommunitiesFinalText" = "You are a member of **%@** groups and channels. Please leave some before joining a new one.";
"OldChannels.TooManyCommunitiesCreateText" = "You are a member of **%@** groups and channels. Please leave some before creating a new one or upgrade to **Telegram Premium** to double the limit to **%@** groups and channels.";
"OldChannels.TooManyCommunitiesCreateNoPremiumText" = "You are a member of **%@** groups and channels. Please leave some before creating a new one. We are working to let you increase this limit in the future.";
"OldChannels.TooManyCommunitiesCreateFinalText" = "You are a member of **%@** groups and channels. Please leave some before creating a new one.";
"OldChannels.TooManyCommunitiesUpgradeText" = "You are a member of **%@** groups and channels. For technical reasons, you need to leave some first before changing this setting in your groups or upgrade to **Telegram Premium** to double the limit to **%@** groups and channels.";
"OldChannels.TooManyCommunitiesUpgradeNoPremiumText" = "You are a member of **%@** groups and channels. For technical reasons, you need to leave some first before changing this setting in your groups. We are working to let you increase this limit in the future.";
"OldChannels.TooManyCommunitiesUpgradeFinalText" = "You are a member of **%@** groups and channels. For technical reasons, you need to leave some first before changing this setting in your groups.";
"OldChannels.LeaveCommunities_1" = "Leave %@ Community"; "OldChannels.LeaveCommunities_1" = "Leave %@ Community";
"OldChannels.LeaveCommunities_any" = "Leave %@ Communities"; "OldChannels.LeaveCommunities_any" = "Leave %@ Communities";
@ -7714,3 +7723,5 @@ Sorry for the inconvenience.";
"Premium.Purchase.ErrorCantMakePayments" = "In-app purchases are not allowed on this device."; "Premium.Purchase.ErrorCantMakePayments" = "In-app purchases are not allowed on this device.";
"Settings.Premium" = "Telegram Premium"; "Settings.Premium" = "Telegram Premium";
"Settings.AddAnotherAccount.PremiumHelp" = "You can add up to four accounts with different phone numbers.";

View File

@ -276,6 +276,23 @@ private final class ChatListFilterPresetListItemNode: ItemListRevealOptionsItemN
transition = .immediate transition = .immediate
} }
if let reorderControlSizeAndApply = reorderControlSizeAndApply {
if strongSelf.reorderControlNode == nil {
let reorderControlNode = reorderControlSizeAndApply.1(layout.contentSize.height, false, .immediate)
strongSelf.reorderControlNode = reorderControlNode
strongSelf.controlsContainer.addSubnode(reorderControlNode)
reorderControlNode.alpha = 0.0
transition.updateAlpha(node: reorderControlNode, alpha: 1.0)
}
let reorderControlFrame = CGRect(origin: CGPoint(x: params.width + revealOffset - params.rightInset - reorderControlSizeAndApply.0, y: 0.0), size: CGSize(width: reorderControlSizeAndApply.0, height: layout.contentSize.height))
strongSelf.reorderControlNode?.frame = reorderControlFrame
} else if let reorderControlNode = strongSelf.reorderControlNode {
strongSelf.reorderControlNode = nil
transition.updateAlpha(node: reorderControlNode, alpha: 0.0, completion: { [weak reorderControlNode] _ in
reorderControlNode?.removeFromSupernode()
})
}
if let editableControlSizeAndApply = editableControlSizeAndApply { if let editableControlSizeAndApply = editableControlSizeAndApply {
let editableControlFrame = CGRect(origin: CGPoint(x: params.leftInset + revealOffset, y: 0.0), size: CGSize(width: editableControlSizeAndApply.0, height: layout.contentSize.height)) let editableControlFrame = CGRect(origin: CGPoint(x: params.leftInset + revealOffset, y: 0.0), size: CGSize(width: editableControlSizeAndApply.0, height: layout.contentSize.height))
if strongSelf.editableControlNode == nil { if strongSelf.editableControlNode == nil {
@ -306,24 +323,7 @@ private final class ChatListFilterPresetListItemNode: ItemListRevealOptionsItemN
}) })
} }
strongSelf.editableControlNode?.isHidden = !item.canBeDeleted strongSelf.editableControlNode?.isHidden = !item.canBeDeleted
if let reorderControlSizeAndApply = reorderControlSizeAndApply {
if strongSelf.reorderControlNode == nil {
let reorderControlNode = reorderControlSizeAndApply.1(layout.contentSize.height, false, .immediate)
strongSelf.reorderControlNode = reorderControlNode
strongSelf.addSubnode(reorderControlNode)
reorderControlNode.alpha = 0.0
transition.updateAlpha(node: reorderControlNode, alpha: 1.0)
}
let reorderControlFrame = CGRect(origin: CGPoint(x: params.width + revealOffset - params.rightInset - reorderControlSizeAndApply.0, y: 0.0), size: CGSize(width: reorderControlSizeAndApply.0, height: layout.contentSize.height))
strongSelf.reorderControlNode?.frame = reorderControlFrame
} else if let reorderControlNode = strongSelf.reorderControlNode {
strongSelf.reorderControlNode = nil
transition.updateAlpha(node: reorderControlNode, alpha: 0.0, completion: { [weak reorderControlNode] _ in
reorderControlNode?.removeFromSupernode()
})
}
let _ = titleApply() let _ = titleApply()
let _ = labelApply() let _ = labelApply()

View File

@ -294,7 +294,7 @@ private final class ItemNode: ASDisplayNode {
if let deleteButtonNode = self.deleteButtonNode { if let deleteButtonNode = self.deleteButtonNode {
if let theme = self.theme { if let theme = self.theme {
let deleteButtonSize = deleteButtonNode.update(theme: theme) let deleteButtonSize = deleteButtonNode.update(theme: theme)
deleteButtonNode.frame = CGRect(origin: CGPoint(x: -deleteButtonSize.width, y: 5.0), size: deleteButtonSize) deleteButtonNode.frame = CGRect(origin: CGPoint(x: -deleteButtonSize.width + 3.0, y: 5.0), size: deleteButtonSize)
} }
} }
@ -788,7 +788,7 @@ final class ChatListFilterTabContainerNode: ASDisplayNode {
selectionFraction = 0.0 selectionFraction = 0.0
} }
itemNode.updateText(strings: presentationData.strings, title: filter.title(strings: presentationData.strings), shortTitle: filter.shortTitle(strings: presentationData.strings), unreadCount: unreadCount, unreadHasUnmuted: unreadHasUnmuted, isNoFilter: isNoFilter, selectionFraction: selectionFraction, isEditing: isEditing, isReordering: isReordering, canReorderAllChats: canReorderAllChats, isDisabled: isDisabled, presentationData: presentationData, transition: itemNodeTransition) itemNode.updateText(strings: presentationData.strings, title: filter.title(strings: presentationData.strings), shortTitle: i == 0 ? filter.shortTitle(strings: presentationData.strings) : filter.title(strings: presentationData.strings), unreadCount: unreadCount, unreadHasUnmuted: unreadHasUnmuted, isNoFilter: isNoFilter, selectionFraction: selectionFraction, isEditing: isEditing, isReordering: isReordering, canReorderAllChats: canReorderAllChats, isDisabled: isDisabled, presentationData: presentationData, transition: itemNodeTransition)
} }
var removeKeys: [ChatListFilterTabEntryId] = [] var removeKeys: [ChatListFilterTabEntryId] = []
for (id, _) in self.itemNodes { for (id, _) in self.itemNodes {

View File

@ -932,7 +932,7 @@ public class ContactsPeerItemNode: ItemListRevealOptionsItemNode {
iconNode.isLayerBacked = true iconNode.isLayerBacked = true
iconNode.displaysAsynchronously = false iconNode.displaysAsynchronously = false
iconNode.displayWithoutProcessing = true iconNode.displayWithoutProcessing = true
strongSelf.containerNode.addSubnode(iconNode) strongSelf.offsetContainerNode.addSubnode(iconNode)
strongSelf.credibilityIconNode = iconNode strongSelf.credibilityIconNode = iconNode
} }
iconNode.image = currentCredibilityIconImage iconNode.image = currentCredibilityIconImage

View File

@ -191,12 +191,33 @@ private func oldChannelsEntries(presentationData: PresentationData, state: OldCh
let count = max(limit, Int32(peers?.count ?? 0)) let count = max(limit, Int32(peers?.count ?? 0))
var text: String? var text: String?
if count >= premiumLimit { if count >= premiumLimit {
text = presentationData.strings.OldChannels_TooManyCommunitiesFinalText("\(premiumLimit)").string switch intent {
case .create:
text = presentationData.strings.OldChannels_TooManyCommunitiesCreateFinalText("\(premiumLimit)").string
case .upgrade:
text = presentationData.strings.OldChannels_TooManyCommunitiesUpgradeFinalText("\(premiumLimit)").string
case .join:
text = presentationData.strings.OldChannels_TooManyCommunitiesFinalText("\(premiumLimit)").string
}
} else if count >= limit { } else if count >= limit {
if isPremiumDisabled { if isPremiumDisabled {
text = presentationData.strings.OldChannels_TooManyCommunitiesNoPremiumText("\(count)").string switch intent {
case .create:
text = presentationData.strings.OldChannels_TooManyCommunitiesCreateNoPremiumText("\(premiumLimit)").string
case .upgrade:
text = presentationData.strings.OldChannels_TooManyCommunitiesUpgradeNoPremiumText("\(premiumLimit)").string
case .join:
text = presentationData.strings.OldChannels_TooManyCommunitiesNoPremiumText("\(count)").string
}
} else { } else {
text = presentationData.strings.OldChannels_TooManyCommunitiesText("\(count)", "\(premiumLimit)").string switch intent {
case .create:
text = presentationData.strings.OldChannels_TooManyCommunitiesCreateText("\(count)", "\(premiumLimit)").string
case .upgrade:
text = presentationData.strings.OldChannels_TooManyCommunitiesUpgradeText("\(count)", "\(premiumLimit)").string
case .join:
text = presentationData.strings.OldChannels_TooManyCommunitiesText("\(count)", "\(premiumLimit)").string
}
} }
} }

View File

@ -1161,7 +1161,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
}) })
let termsString: MultilineTextComponent.TextContent let termsString: MultilineTextComponent.TextContent
// if context.component.isPremium == true {
if let promoConfiguration = context.state.promoConfiguration { if let promoConfiguration = context.state.promoConfiguration {
let attributedString = stringWithAppliedEntities(promoConfiguration.status, entities: promoConfiguration.statusEntities, baseColor: termsTextColor, linkColor: environment.theme.list.itemAccentColor, baseFont: termsFont, linkFont: termsFont, boldFont: boldTermsFont, italicFont: italicTermsFont, boldItalicFont: boldItalicTermsFont, fixedFont: monospaceTermsFont, blockQuoteFont: termsFont) let attributedString = stringWithAppliedEntities(promoConfiguration.status, entities: promoConfiguration.statusEntities, baseColor: termsTextColor, linkColor: environment.theme.list.itemAccentColor, baseFont: termsFont, linkFont: termsFont, boldFont: boldTermsFont, italicFont: italicTermsFont, boldItalicFont: boldItalicTermsFont, fixedFont: monospaceTermsFont, blockQuoteFont: termsFont)
termsString = .plain(attributedString) termsString = .plain(attributedString)
@ -1390,6 +1389,13 @@ private final class PremiumIntroScreenComponent: CombinedComponent {
return return
} }
guard !self.context.account.testingEnvironment else {
let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
let alertController = textAlertController(context: self.context, title: nil, text: "Telegram Premium purchase is not available in the test environment.", actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
self.present(alertController)
return
}
addAppLogEvent(postbox: self.context.account.postbox, type: "premium.promo_screen_accept") addAppLogEvent(postbox: self.context.account.postbox, type: "premium.promo_screen_accept")
self.inProgress = true self.inProgress = true

View File

@ -3602,7 +3602,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
return true return true
} }
self.chatTitleView = ChatTitleView(account: self.context.account, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder) self.chatTitleView = ChatTitleView(context: self.context, theme: self.presentationData.theme, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, nameDisplayOrder: self.presentationData.nameDisplayOrder)
self.navigationItem.titleView = self.chatTitleView self.navigationItem.titleView = self.chatTitleView
self.chatTitleView?.pressed = { [weak self] in self.chatTitleView?.pressed = { [weak self] in
if let strongSelf = self { if let strongSelf = self {

View File

@ -16,6 +16,7 @@ import LocalizedPeerData
import PhoneNumberFormat import PhoneNumberFormat
import ChatTitleActivityNode import ChatTitleActivityNode
import AnimatedCountLabelNode import AnimatedCountLabelNode
import AccountContext
private let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers]) private let titleFont = Font.with(size: 17.0, design: .regular, weight: .semibold, traits: [.monospacedNumbers])
private let subtitleFont = Font.regular(13.0) private let subtitleFont = Font.regular(13.0)
@ -46,7 +47,7 @@ private enum ChatTitleCredibilityIcon {
} }
final class ChatTitleView: UIView, NavigationBarTitleView { final class ChatTitleView: UIView, NavigationBarTitleView {
private let account: Account private let context: AccountContext
private var theme: PresentationTheme private var theme: PresentationTheme
private var hasEmbeddedTitleContent: Bool = false private var hasEmbeddedTitleContent: Bool = false
@ -122,7 +123,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
segments = [.text(0, NSAttributedString(string: typeText, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] segments = [.text(0, NSAttributedString(string: typeText, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
isEnabled = false isEnabled = false
} else if isScheduledMessages { } else if isScheduledMessages {
if peerView.peerId == self.account.peerId { if peerView.peerId == self.context.account.peerId {
segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_RemindersTitle, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_RemindersTitle, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
} else { } else {
segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_Title, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] segments = [.text(0, NSAttributedString(string: self.strings.ScheduledMessages_Title, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
@ -130,7 +131,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
isEnabled = false isEnabled = false
} else { } else {
if let peer = peerViewMainPeer(peerView) { if let peer = peerViewMainPeer(peerView) {
if peerView.peerId == self.account.peerId { if peerView.peerId == self.context.account.peerId {
segments = [.text(0, NSAttributedString(string: self.strings.Conversation_SavedMessages, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] segments = [.text(0, NSAttributedString(string: self.strings.Conversation_SavedMessages, font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
} else { } else {
if !peerView.peerIsContact, let user = peer as? TelegramUser, !user.flags.contains(.isSupport), user.botInfo == nil, let phone = user.phone, !phone.isEmpty { if !peerView.peerIsContact, let user = peer as? TelegramUser, !user.flags.contains(.isSupport), user.botInfo == nil, let phone = user.phone, !phone.isEmpty {
@ -139,14 +140,15 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
segments = [.text(0, NSAttributedString(string: EnginePeer(peer).displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder), font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))] segments = [.text(0, NSAttributedString(string: EnginePeer(peer).displayTitle(strings: self.strings, displayOrder: self.nameDisplayOrder), font: titleFont, textColor: titleTheme.rootController.navigationBar.primaryTextColor))]
} }
} }
if peer.id != self.account.peerId { if peer.id != self.context.account.peerId {
let premiumConfiguration = PremiumConfiguration.with(appConfiguration: self.context.currentAppConfiguration.with { $0 })
if peer.isFake { if peer.isFake {
titleCredibilityIcon = .fake titleCredibilityIcon = .fake
} else if peer.isScam { } else if peer.isScam {
titleCredibilityIcon = .scam titleCredibilityIcon = .scam
} else if peer.isVerified { } else if peer.isVerified {
titleCredibilityIcon = .verified titleCredibilityIcon = .verified
} else if peer.isPremium { } else if peer.isPremium && !premiumConfiguration.isPremiumDisabled {
titleCredibilityIcon = .premium titleCredibilityIcon = .premium
} }
} }
@ -303,7 +305,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
switch titleContent { switch titleContent {
case let .peer(peerView, _, isScheduledMessages): case let .peer(peerView, _, isScheduledMessages):
if let peer = peerViewMainPeer(peerView) { if let peer = peerViewMainPeer(peerView) {
if peer.id == self.account.peerId || isScheduledMessages || peer.id.isReplies { if peer.id == self.context.account.peerId || isScheduledMessages || peer.id.isReplies {
inputActivitiesAllowed = false inputActivitiesAllowed = false
} }
} }
@ -405,7 +407,7 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
case let .peer(peerView, onlineMemberCount, isScheduledMessages): case let .peer(peerView, onlineMemberCount, isScheduledMessages):
if let peer = peerViewMainPeer(peerView) { if let peer = peerViewMainPeer(peerView) {
let servicePeer = isServicePeer(peer) let servicePeer = isServicePeer(peer)
if peer.id == self.account.peerId || isScheduledMessages || peer.id.isReplies { if peer.id == self.context.account.peerId || isScheduledMessages || peer.id.isReplies {
let string = NSAttributedString(string: "", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor) let string = NSAttributedString(string: "", font: subtitleFont, textColor: titleTheme.rootController.navigationBar.secondaryTextColor)
state = .info(string, .generic) state = .info(string, .generic)
} else if let user = peer as? TelegramUser { } else if let user = peer as? TelegramUser {
@ -541,13 +543,13 @@ final class ChatTitleView: UIView, NavigationBarTitleView {
} }
} }
init(account: Account, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder) { init(context: AccountContext, theme: PresentationTheme, strings: PresentationStrings, dateTimeFormat: PresentationDateTimeFormat, nameDisplayOrder: PresentationPersonNameOrder) {
self.account = account self.context = context
self.theme = theme self.theme = theme
self.strings = strings self.strings = strings
self.dateTimeFormat = dateTimeFormat self.dateTimeFormat = dateTimeFormat
self.nameDisplayOrder = nameDisplayOrder self.nameDisplayOrder = nameDisplayOrder
self.contentContainer = ASDisplayNode() self.contentContainer = ASDisplayNode()
self.titleNode = ImmediateAnimatedCountLabelNode() self.titleNode = ImmediateAnimatedCountLabelNode()

View File

@ -842,7 +842,23 @@ private func settingsEditingItems(data: PeerInfoScreenData?, state: PeerInfoStat
items[.account]!.append(PeerInfoScreenActionItem(id: ItemAddAccount, text: presentationData.strings.Settings_AddAnotherAccount, alignment: .center, action: { items[.account]!.append(PeerInfoScreenActionItem(id: ItemAddAccount, text: presentationData.strings.Settings_AddAnotherAccount, alignment: .center, action: {
interaction.openSettings(.addAccount) interaction.openSettings(.addAccount)
})) }))
items[.account]!.append(PeerInfoScreenCommentItem(id: ItemAddAccountHelp, text: presentationData.strings.Settings_AddAnotherAccount_Help))
var hasPremiumAccounts = false
if data.peer?.isPremium == true && !context.account.testingEnvironment {
hasPremiumAccounts = true
}
if let settings = data.globalSettings {
for (accountContext, peer, _) in settings.accountsAndPeers {
if !accountContext.account.testingEnvironment {
if peer.isPremium {
hasPremiumAccounts = true
break
}
}
}
}
items[.account]!.append(PeerInfoScreenCommentItem(id: ItemAddAccountHelp, text: hasPremiumAccounts ? presentationData.strings.Settings_AddAnotherAccount_PremiumHelp : presentationData.strings.Settings_AddAnotherAccount_Help))
items[.logout]!.append(PeerInfoScreenActionItem(id: ItemLogout, text: presentationData.strings.Settings_Logout, color: .destructive, alignment: .center, action: { items[.logout]!.append(PeerInfoScreenActionItem(id: ItemLogout, text: presentationData.strings.Settings_Logout, color: .destructive, alignment: .center, action: {
interaction.openSettings(.logout) interaction.openSettings(.logout)
@ -6275,36 +6291,38 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate
case .username: case .username:
push(usernameSetupController(context: self.context)) push(usernameSetupController(context: self.context))
case .addAccount: case .addAccount:
var maximumAvailableAccounts: Int = 3 if let data = self.data {
if self.data?.peer?.isPremium == true && !self.context.account.testingEnvironment { var maximumAvailableAccounts: Int = 3
maximumAvailableAccounts = 4 if data.peer?.isPremium == true && !self.context.account.testingEnvironment {
} maximumAvailableAccounts = 4
var count: Int = 1 }
if let settings = self.data?.globalSettings { var count: Int = 1
for (accountContext, peer, _) in settings.accountsAndPeers { if let settings = data.globalSettings {
if !accountContext.account.testingEnvironment { for (accountContext, peer, _) in settings.accountsAndPeers {
if peer.isPremium { if !accountContext.account.testingEnvironment {
maximumAvailableAccounts = 4 if peer.isPremium {
maximumAvailableAccounts = 4
}
count += 1
} }
count += 1
} }
} }
} if count >= maximumAvailableAccounts {
if count >= maximumAvailableAccounts { let context = self.context
let context = self.context var replaceImpl: ((ViewController) -> Void)?
var replaceImpl: ((ViewController) -> Void)? let controller = PremiumLimitScreen(context: context, subject: .accounts, count: Int32(count), action: {
let controller = PremiumLimitScreen(context: context, subject: .accounts, count: Int32(count), action: { let controller = PremiumIntroScreen(context: context, source: .accounts)
let controller = PremiumIntroScreen(context: context, source: .accounts) replaceImpl?(controller)
replaceImpl?(controller) })
}) replaceImpl = { [weak controller] c in
replaceImpl = { [weak controller] c in controller?.replace(with: c)
controller?.replace(with: c) }
if let navigationController = context.sharedContext.mainWindow?.viewController as? NavigationController {
navigationController.pushViewController(controller)
}
} else {
self.context.sharedContext.beginNewAuth(testingEnvironment: self.context.account.testingEnvironment)
} }
if let navigationController = context.sharedContext.mainWindow?.viewController as? NavigationController {
navigationController.pushViewController(controller)
}
} else {
self.context.sharedContext.beginNewAuth(testingEnvironment: self.context.account.testingEnvironment)
} }
case .logout: case .logout:
if let user = self.data?.peer as? TelegramUser, let phoneNumber = user.phone { if let user = self.data?.peer as? TelegramUser, let phoneNumber = user.phone {