Various improvements

This commit is contained in:
Ilya Laktyushin 2025-09-22 18:56:39 +04:00
parent d63b0ce392
commit 400a67e240
11 changed files with 88 additions and 54 deletions

View file

@ -15070,7 +15070,7 @@ Error: %8$@";
"SuggestBirthdate.Accept.Title" = "Date of Birth";
"SuggestBirthdate.Accept.HideYear" = "Hide the Year";
"SuggestBirthdate.Accept.Action" = "Add to My Profile";
"SuggestBirthdate.Accept.Added" = "Date of birth added.";
"SuggestBirthdate.Accept.Added" = "Date of birth added. You can change it in **Settings**.";
"Notification.SuggestBirthdate" = "Suggested Date of Birth";
@ -15085,7 +15085,9 @@ Error: %8$@";
"PeerInfo.Notes" = "notes";
"PeerInfo.NotesInfo" = "only visible to you";
"PeerInfo.AddNotesPlaceholder" = "Add Notes";
"PeerInfo.AddNotesInfo" = "Notes are only visible to you.";
"UserInfo.NoteActionCopy" = "Copy Note";
"UserInfo.NoteActionEdit" = "Edit Note";
"UserInfo.ToastNoteCopied" = "Note copied to clipboard.";
"PeerInfo.NoteActionCopy" = "Copy Note";
"PeerInfo.NoteActionEdit" = "Edit Note";
"PeerInfo.ToastNoteCopied" = "Note copied to clipboard.";

View file

@ -924,10 +924,15 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
}
if let initialCall {
var messageLifetime: Int32 = 10
if let data = accountContext.currentAppConfiguration.with({ $0 }).data, let value = data["group_call_message_ttl"] as? Double {
messageLifetime = Int32(value)
}
self.messagesContext = accountContext.engine.messages.groupCallMessages(
callId: initialCall.description.id,
reference: .id(id: initialCall.description.id, accessHash: initialCall.description.accessHash),
e2eContext: self.e2eContext
e2eContext: self.e2eContext,
messageLifetime: messageLifetime
)
self.messagesStatePromise.set(self.messagesContext!.state)
}

View file

@ -3442,6 +3442,12 @@ final class VideoChatScreenComponent: Component {
nextInputMode = .emoji
}
var characterLimit: Int = 128
if let data = call.accountContext.currentAppConfiguration.with({ $0 }).data, let value = data["group_call_message_length_limit"] as? Double {
characterLimit = Int(value)
}
//TODO:localize
self.inputPanel.parentState = state
inputPanelSize = self.inputPanel.update(
transition: transition,
@ -3453,7 +3459,7 @@ final class VideoChatScreenComponent: Component {
style: .glass,
placeholder: .plain("Message"),
sendPaidMessageStars: nil,
maxLength: 128,
maxLength: characterLimit,
queryTypes: [.mention, .hashtag],
alwaysDarkWhenHasText: false,
useGrayBackground: false,

View file

@ -3442,7 +3442,7 @@ public final class GroupCallMessagesContext {
}
private final class Impl {
private let defaultMessageLifetime: Int32 = 10
private let messageLifetime: Int32
let queue: Queue
let account: Account
@ -3464,12 +3464,13 @@ public final class GroupCallMessagesContext {
private var messageLifeTimer: SwiftSignalKit.Timer?
init(queue: Queue, account: Account, callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?) {
init(queue: Queue, account: Account, callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?, messageLifetime: Int32) {
self.queue = queue
self.account = account
self.callId = callId
self.reference = reference
self.e2eContext = e2eContext
self.messageLifetime = messageLifetime
self.state = State(messages: [])
self.stateValue.set(self.state)
@ -3535,7 +3536,7 @@ public final class GroupCallMessagesContext {
text: text,
entities: messageTextEntitiesFromApiEntities(entities),
date: currentTime,
lifetime: self.defaultMessageLifetime
lifetime: self.messageLifetime
))
}
}
@ -3554,7 +3555,7 @@ public final class GroupCallMessagesContext {
text: addedMessage.text,
entities: addedMessage.entities,
date: currentTime,
lifetime: self.defaultMessageLifetime
lifetime: self.messageLifetime
))
}
}
@ -3615,7 +3616,7 @@ public final class GroupCallMessagesContext {
text: text,
entities: entities,
date: currentTime,
lifetime: self.defaultMessageLifetime
lifetime: self.messageLifetime
))
self.state = state
@ -3657,11 +3658,11 @@ public final class GroupCallMessagesContext {
}
}
init(account: Account, callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?) {
init(account: Account, callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?, messageLifetime: Int32) {
let queue = Queue(name: "GroupCallMessagesContext")
self.queue = queue
self.impl = QueueLocalObject(queue: queue, generate: {
return Impl(queue: queue, account: account, callId: callId, reference: reference, e2eContext: e2eContext)
return Impl(queue: queue, account: account, callId: callId, reference: reference, e2eContext: e2eContext, messageLifetime: messageLifetime)
})
}

View file

@ -1632,8 +1632,8 @@ public extension TelegramEngine {
return _internal_refreshGlobalPostSearchState(account: self.account)
}
public func groupCallMessages(callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?) -> GroupCallMessagesContext {
return GroupCallMessagesContext(account: self.account, callId: callId, reference: reference, e2eContext: e2eContext)
public func groupCallMessages(callId: Int64, reference: InternalGroupCallReference, e2eContext: ConferenceCallE2EContext?, messageLifetime: Int32) -> GroupCallMessagesContext {
return GroupCallMessagesContext(account: self.account, callId: callId, reference: reference, e2eContext: e2eContext, messageLifetime: messageLifetime)
}
}
}

View file

@ -99,11 +99,8 @@ func _internal_updateBirthday(account: Account, birthday: TelegramBirthday?) ->
return account.postbox.transaction { transaction -> Void in
if case .boolTrue = result {
transaction.updatePeerCachedData(peerIds: Set([account.peerId]), update: { _, current in
if let current = current as? CachedUserData {
return current.withUpdatedBirthday(birthday)
} else {
return current
}
let current = current as? CachedUserData ?? CachedUserData()
return current.withUpdatedBirthday(birthday)
})
}
}

View file

@ -70,7 +70,7 @@ final class PeerInfoScreenNoteListItemNode: PeerInfoScreenItemNode {
}
var resetText: NSAttributedString?
if self.item == nil {
if self.item?.initialValue != item.initialValue {
resetText = item.initialValue
}
@ -97,7 +97,7 @@ final class PeerInfoScreenNoteListItemNode: PeerInfoScreenItemNode {
self.textField.parentState = self.state
let textFieldSize = self.textField.update(
transition: .immediate,
component: AnyComponent(TextFieldComponent(context: context, theme: presentationData.theme, strings: presentationData.strings, externalState: self.textFieldExternalState, fontSize: 17.0, textColor: presentationData.theme.list.itemPrimaryTextColor, accentColor: presentationData.theme.list.itemAccentColor, insets: UIEdgeInsets(top: 9.0, left: 8.0, bottom: 10.0, right: 8.0), hideKeyboard: false, customInputView: nil, placeholder: NSAttributedString(string: "Add notes", font: Font.regular(17.0), textColor: presentationData.theme.list.itemPlaceholderTextColor), resetText: resetText, isOneLineWhenUnfocused: false, characterLimit: characterLimit, formatMenuAvailability: .available([.bold, .italic, .underline, .strikethrough, .spoiler]), lockedFormatAction: {}, present: { c in }, paste: { _ in })),
component: AnyComponent(TextFieldComponent(context: context, theme: presentationData.theme, strings: presentationData.strings, externalState: self.textFieldExternalState, fontSize: 17.0, textColor: presentationData.theme.list.itemPrimaryTextColor, accentColor: presentationData.theme.list.itemAccentColor, insets: UIEdgeInsets(top: 9.0, left: 8.0, bottom: 10.0, right: 8.0), hideKeyboard: false, customInputView: nil, placeholder: NSAttributedString(string: presentationData.strings.PeerInfo_AddNotesPlaceholder, font: Font.regular(17.0), textColor: presentationData.theme.list.itemPlaceholderTextColor), resetText: resetText, isOneLineWhenUnfocused: false, characterLimit: characterLimit, formatMenuAvailability: .available([.bold, .italic, .underline, .strikethrough, .spoiler]), lockedFormatAction: {}, present: { c in }, paste: { _ in })),
environment: {},
containerSize: CGSize(width: width - sideInset * 2.0, height: .greatestFiniteMagnitude)
)

View file

@ -1064,7 +1064,8 @@ func peerInfoScreenData(
chatLocationContextHolder: Atomic<ChatLocationContextHolder?>,
sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?,
privacySettings: Signal<AccountPrivacySettings?, NoError>,
forceHasGifts: Bool
forceHasGifts: Bool,
switchToUpgradableGifts: Bool
) -> Signal<PeerInfoScreenData, NoError> {
return peerInfoScreenInputData(context: context, peerId: peerId, isSettings: isSettings)
|> mapToSignal { inputData -> Signal<PeerInfoScreenData, NoError> in
@ -1140,6 +1141,10 @@ func peerInfoScreenData(
if isMyProfile || userPeerId != context.account.peerId {
profileGiftsContext = existingProfileGiftsContext ?? ProfileGiftsContext(account: context.account, peerId: userPeerId)
profileGiftsCollectionsContext = existingProfileGiftsCollectionsContext ?? ProfileGiftsCollectionsContext(account: context.account, peerId: userPeerId, allGiftsContext: profileGiftsContext)
if switchToUpgradableGifts {
profileGiftsContext?.updateFilter([.displayed, .hidden, .limitedUpgradable])
}
} else {
profileGiftsContext = nil
profileGiftsCollectionsContext = nil

View file

@ -2181,7 +2181,6 @@ private func editingItems(data: PeerInfoScreenData?, boostStatus: ChannelBoostSt
let compactName = EnginePeer(user).compactDisplayTitle
if let cachedData = data.cachedData as? CachedUserData {
//TODO:localize
items[.peerNote]!.append(PeerInfoScreenNoteListItem(
id: ItemNote,
initialValue: chatInputStateStringWithAppliedEntities(cachedData.note?.text ?? "", entities: cachedData.note?.entities ?? []),
@ -2193,7 +2192,7 @@ private func editingItems(data: PeerInfoScreenData?, boostStatus: ChannelBoostSt
}
))
items[.peerNote]!.append(PeerInfoScreenCommentItem(id: ItemNoteInfo, text: "Notes are only visible to you."))
items[.peerNote]!.append(PeerInfoScreenCommentItem(id: ItemNoteInfo, text: presentationData.strings.PeerInfo_AddNotesInfo))
if let _ = cachedData.sendPaidMessageStars {
@ -2973,7 +2972,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
private let chatLocation: ChatLocation
private let chatLocationContextHolder: Atomic<ChatLocationContextHolder?>
private let switchToStoryFolder: Int64?
private let switchToGiftCollection: Int64?
private let switchToGiftsTarget: PeerInfoSwitchToGiftsTarget?
private let sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?
let isSettings: Bool
@ -3100,7 +3099,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
private var didSetReady = false
init(controller: PeerInfoScreenImpl, context: AccountContext, peerId: PeerId, avatarInitiallyExpanded: Bool, isOpenedFromChat: Bool, nearbyPeerDistance: Int32?, reactionSourceMessageId: MessageId?, callMessages: [Message], isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, requestsContext: PeerInvitationImportersContext?, profileGiftsContext: ProfileGiftsContext?, starsContext: StarsContext?, tonContext: StarsContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, switchToStoryFolder: Int64?, switchToGiftCollection: Int64?, initialPaneKey: PeerInfoPaneKey?, sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?) {
init(controller: PeerInfoScreenImpl, context: AccountContext, peerId: PeerId, avatarInitiallyExpanded: Bool, isOpenedFromChat: Bool, nearbyPeerDistance: Int32?, reactionSourceMessageId: MessageId?, callMessages: [Message], isSettings: Bool, isMyProfile: Bool, hintGroupInCommon: PeerId?, requestsContext: PeerInvitationImportersContext?, profileGiftsContext: ProfileGiftsContext?, starsContext: StarsContext?, tonContext: StarsContext?, chatLocation: ChatLocation, chatLocationContextHolder: Atomic<ChatLocationContextHolder?>, switchToGiftsTarget: PeerInfoSwitchToGiftsTarget?, switchToStoryFolder: Int64?, initialPaneKey: PeerInfoPaneKey?, sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?) {
self.controller = controller
self.context = context
self.peerId = peerId
@ -3117,7 +3116,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
self.isMediaOnly = context.account.peerId == peerId && !isSettings && !isMyProfile
self.initialExpandPanes = initialPaneKey != nil
self.switchToStoryFolder = switchToStoryFolder
self.switchToGiftCollection = switchToGiftCollection
self.switchToGiftsTarget = switchToGiftsTarget
self.sharedMediaFromForumTopic = sharedMediaFromForumTopic
self.scrollNode = ASScrollNode()
@ -3131,6 +3130,15 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
forumTopicThreadId = message.threadId
}
self.headerNode = PeerInfoHeaderNode(context: context, controller: controller, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, isMediaOnly: self.isMediaOnly, isSettings: isSettings, isMyProfile: isMyProfile, forumTopicThreadId: forumTopicThreadId, chatLocation: self.chatLocation)
var switchToGiftCollection: Int64?
switch switchToGiftsTarget {
case let .collection(id):
switchToGiftCollection = id
default:
break
}
self.paneContainerNode = PeerInfoPaneContainerNode(context: context, updatedPresentationData: controller.updatedPresentationData, peerId: peerId, chatLocation: chatLocation, sharedMediaFromForumTopic: sharedMediaFromForumTopic, chatLocationContextHolder: chatLocationContextHolder, isMediaOnly: self.isMediaOnly, initialPaneKey: initialPaneKey, initialStoryFolderId: switchToStoryFolder, initialGiftCollectionId: switchToGiftCollection)
super.init()
@ -4940,7 +4948,12 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
self.privacySettings.set(.single(nil))
}
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, existingProfileGiftsContext: profileGiftsContext, existingProfileGiftsCollectionsContext: nil, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, sharedMediaFromForumTopic: self.sharedMediaFromForumTopic, privacySettings: self.privacySettings.get(), forceHasGifts: initialPaneKey == .gifts)
var switchToUpgradableGifts = false
if let switchToGiftsTarget, case .upgradable = switchToGiftsTarget {
switchToUpgradableGifts = true
}
screenData = peerInfoScreenData(context: context, peerId: peerId, strings: self.presentationData.strings, dateTimeFormat: self.presentationData.dateTimeFormat, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: hintGroupInCommon, existingRequestsContext: requestsContext, existingProfileGiftsContext: profileGiftsContext, existingProfileGiftsCollectionsContext: nil, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, sharedMediaFromForumTopic: self.sharedMediaFromForumTopic, privacySettings: self.privacySettings.get(), forceHasGifts: initialPaneKey == .gifts, switchToUpgradableGifts: switchToUpgradableGifts)
var previousTimestamp: Double?
self.headerNode.displayPremiumIntro = { [weak self] sourceView, peerStatus, emojiStatusFileAndPack, white in
@ -8268,12 +8281,12 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
UIPasteboard.general.string = noteText
let toastText = self.presentationData.strings.UserInfo_ToastNoteCopied
let toastText = self.presentationData.strings.PeerInfo_ToastNoteCopied
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .copy(text: toastText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .current)
}
var items: [ContextMenuItem] = []
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.UserInfo_NoteActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_NoteActionEdit, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Edit"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in
c?.dismiss {
guard let self else {
return
@ -8293,7 +8306,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
})))
let copyText = self.presentationData.strings.UserInfo_NoteActionCopy
let copyText = self.presentationData.strings.PeerInfo_NoteActionCopy
items.append(.action(ContextMenuActionItem(text: copyText, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Copy"), color: theme.contextMenu.primaryColor) }, action: { c, _ in
c?.dismiss {
copyAction()
@ -13398,6 +13411,12 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
}
public enum PeerInfoSwitchToGiftsTarget {
case generic
case upgradable
case collection(Int64)
}
public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortcutResponder {
let context: AccountContext
fileprivate let updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?
@ -13415,10 +13434,9 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
fileprivate let starsContext: StarsContext?
fileprivate let tonContext: StarsContext?
private let switchToRecommendedChannels: Bool
private let switchToGifts: Bool
private let switchToGiftsTarget: PeerInfoSwitchToGiftsTarget?
private let switchToGroupsInCommon: Bool
private let switchToStoryFolder: Int64?
private let switchToGiftCollection: Int64?
private let sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?
let chatLocation: ChatLocation
private let chatLocationContextHolder = Atomic<ChatLocationContextHolder?>(value: nil)
@ -13493,10 +13511,9 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
forumTopicThread: ChatReplyThreadMessage? = nil,
sharedMediaFromForumTopic: (EnginePeer.Id, Int64)? = nil,
switchToRecommendedChannels: Bool = false,
switchToGifts: Bool = false,
switchToGiftsTarget: PeerInfoSwitchToGiftsTarget? = nil,
switchToGroupsInCommon: Bool = false,
switchToStoryFolder: Int64? = nil,
switchToGiftCollection: Int64? = nil
) {
self.context = context
self.updatedPresentationData = updatedPresentationData
@ -13512,10 +13529,9 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
self.requestsContext = requestsContext
self.profileGiftsContext = profileGiftsContext
self.switchToRecommendedChannels = switchToRecommendedChannels
self.switchToGifts = switchToGifts
self.switchToGiftsTarget = switchToGiftsTarget
self.switchToGroupsInCommon = switchToGroupsInCommon
self.switchToStoryFolder = switchToStoryFolder
self.switchToGiftCollection = switchToGiftCollection
self.sharedMediaFromForumTopic = sharedMediaFromForumTopic
if let forumTopicThread = forumTopicThread {
@ -13889,16 +13905,14 @@ public final class PeerInfoScreenImpl: ViewController, PeerInfoScreen, KeyShortc
var initialPaneKey: PeerInfoPaneKey?
if self.switchToRecommendedChannels {
initialPaneKey = .similarChannels
} else if self.switchToGifts {
} else if let _ = self.switchToGiftsTarget {
initialPaneKey = .gifts
} else if self.switchToGroupsInCommon {
initialPaneKey = .groupsInCommon
} else if self.switchToStoryFolder != nil {
initialPaneKey = .stories
} else if self .switchToGiftCollection != nil {
initialPaneKey = .gifts
}
self.displayNode = PeerInfoScreenNode(controller: self, context: self.context, peerId: self.peerId, avatarInitiallyExpanded: self.avatarInitiallyExpanded, isOpenedFromChat: self.isOpenedFromChat, nearbyPeerDistance: self.nearbyPeerDistance, reactionSourceMessageId: self.reactionSourceMessageId, callMessages: self.callMessages, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: self.hintGroupInCommon, requestsContext: self.requestsContext, profileGiftsContext: self.profileGiftsContext, starsContext: self.starsContext, tonContext: self.tonContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, switchToStoryFolder: self.switchToStoryFolder, switchToGiftCollection: self.switchToGiftCollection, initialPaneKey: initialPaneKey, sharedMediaFromForumTopic: self.sharedMediaFromForumTopic)
self.displayNode = PeerInfoScreenNode(controller: self, context: self.context, peerId: self.peerId, avatarInitiallyExpanded: self.avatarInitiallyExpanded, isOpenedFromChat: self.isOpenedFromChat, nearbyPeerDistance: self.nearbyPeerDistance, reactionSourceMessageId: self.reactionSourceMessageId, callMessages: self.callMessages, isSettings: self.isSettings, isMyProfile: self.isMyProfile, hintGroupInCommon: self.hintGroupInCommon, requestsContext: self.requestsContext, profileGiftsContext: self.profileGiftsContext, starsContext: self.starsContext, tonContext: self.tonContext, chatLocation: self.chatLocation, chatLocationContextHolder: self.chatLocationContextHolder, switchToGiftsTarget: self.switchToGiftsTarget, switchToStoryFolder: self.switchToStoryFolder, initialPaneKey: initialPaneKey, sharedMediaFromForumTopic: self.sharedMediaFromForumTopic)
self.controllerNode.accountsAndPeers.set(self.accountsAndPeers.get() |> map { $0.1 })
self.controllerNode.activeSessionsContextAndCount.set(self.activeSessionsContextAndCount.get())
self.cachedDataPromise.set(self.controllerNode.cachedDataPromise.get())

View file

@ -1253,7 +1253,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
let _ = self.context.engine.accountData.updateBirthday(birthday: value).startStandalone()
self.present(UndoOverlayController(presentationData: self.presentationData, content: .actionSucceeded(title: nil, text: self.presentationData.strings.SuggestBirthdate_Accept_Added, cancel: nil, destructive: false), elevatedLayout: false, action: { _ in
self.present(UndoOverlayController(presentationData: self.presentationData, content: .universal(animation: "anim_gift", scale: 0.058, colors: ["__allcolors__": UIColor.white], title: nil, text: self.presentationData.strings.SuggestBirthdate_Accept_Added, customUndoText: nil, timeout: 5.0), elevatedLayout: false, action: { _ in
return true
}), in: .current)
})

View file

@ -3970,7 +3970,7 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
} else if let _ = peer as? TelegramChannel {
var forumTopicThread: ChatReplyThreadMessage?
var switchToRecommendedChannels = false
var switchToGifts = false
var switchToGiftsTarget: PeerInfoSwitchToGiftsTarget?
var switchToGroupsInCommon = false
var switchToStoryFolder: Int64?
switch mode {
@ -3978,8 +3978,10 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
forumTopicThread = thread
case .recommendedChannels:
switchToRecommendedChannels = true
case .gifts, .upgradableGifts:
switchToGifts = true
case .gifts:
switchToGiftsTarget = .generic
case .upgradableGifts:
switchToGiftsTarget = .upgradable
case .groupsInCommon:
switchToGroupsInCommon = true
case let .storyAlbum(id):
@ -3987,7 +3989,7 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
default:
break
}
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nil, reactionSourceMessageId: nil, callMessages: [], forumTopicThread: forumTopicThread, switchToRecommendedChannels: switchToRecommendedChannels, switchToGifts: switchToGifts, switchToGroupsInCommon: switchToGroupsInCommon, switchToStoryFolder: switchToStoryFolder)
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nil, reactionSourceMessageId: nil, callMessages: [], forumTopicThread: forumTopicThread, switchToRecommendedChannels: switchToRecommendedChannels, switchToGiftsTarget: switchToGiftsTarget, switchToGroupsInCommon: switchToGroupsInCommon, switchToStoryFolder: switchToStoryFolder)
} else if peer is TelegramUser {
var nearbyPeerDistance: Int32?
var reactionSourceMessageId: MessageId?
@ -3996,10 +3998,9 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
var forumTopicThread: ChatReplyThreadMessage?
var sharedMediaFromForumTopic: (EnginePeer.Id, Int64)?
var isMyProfile = false
var switchToGifts = false
var switchToGiftsTarget: PeerInfoSwitchToGiftsTarget?
var switchToGroupsInCommon = false
var switchToStoryFolder: Int64?
var switchToGiftCollection: Int64?
switch mode {
case let .nearbyPeer(distance):
@ -4016,11 +4017,14 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
forumTopicThread = thread
case .myProfile:
isMyProfile = true
case .gifts, .upgradableGifts:
switchToGifts = true
case .gifts:
switchToGiftsTarget = .generic
case .upgradableGifts:
isMyProfile = true
switchToGiftsTarget = .upgradable
case .myProfileGifts:
isMyProfile = true
switchToGifts = true
switchToGiftsTarget = .generic
case .groupsInCommon:
switchToGroupsInCommon = true
case let .monoforum(peerId):
@ -4031,14 +4035,14 @@ private func peerInfoControllerImpl(context: AccountContext, updatedPresentation
isMyProfile = true
}
case let .giftCollection(id):
switchToGiftCollection = id
switchToGiftsTarget = .collection(id)
if peer.id == context.account.peerId {
isMyProfile = true
}
default:
break
}
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nearbyPeerDistance, reactionSourceMessageId: reactionSourceMessageId, callMessages: callMessages, isMyProfile: isMyProfile, hintGroupInCommon: hintGroupInCommon, forumTopicThread: forumTopicThread, sharedMediaFromForumTopic: sharedMediaFromForumTopic, switchToGifts: switchToGifts, switchToGroupsInCommon: switchToGroupsInCommon, switchToStoryFolder: switchToStoryFolder, switchToGiftCollection: switchToGiftCollection)
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nearbyPeerDistance, reactionSourceMessageId: reactionSourceMessageId, callMessages: callMessages, isMyProfile: isMyProfile, hintGroupInCommon: hintGroupInCommon, forumTopicThread: forumTopicThread, sharedMediaFromForumTopic: sharedMediaFromForumTopic, switchToGiftsTarget: switchToGiftsTarget, switchToGroupsInCommon: switchToGroupsInCommon, switchToStoryFolder: switchToStoryFolder)
} else if peer is TelegramSecretChat {
return PeerInfoScreenImpl(context: context, updatedPresentationData: updatedPresentationData, peerId: peer.id, avatarInitiallyExpanded: avatarInitiallyExpanded, isOpenedFromChat: isOpenedFromChat, nearbyPeerDistance: nil, reactionSourceMessageId: nil, callMessages: [])
}