mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various improvements
This commit is contained in:
@@ -1698,21 +1698,6 @@ public final class ChatListNode: ListView {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
if let birthdays {
|
||||
let today = Calendar(identifier: .gregorian).component(.day, from: Date())
|
||||
var todayBirthdayPeerIds: [EnginePeer.Id] = []
|
||||
for (peerId, birthday) in birthdays {
|
||||
if birthday.day == today {
|
||||
todayBirthdayPeerIds.append(peerId)
|
||||
}
|
||||
}
|
||||
let peerIds = todayBirthdayPeerIds.sorted { lhs, rhs in
|
||||
return lhs < rhs
|
||||
}
|
||||
Queue.mainQueue().after(0.4) {
|
||||
let _ = ApplicationSpecificNotice.setDismissedBirthdayPremiumGifts(accountManager: self.context.sharedContext.accountManager, values: peerIds.map { $0.toInt64() }).start()
|
||||
}
|
||||
}
|
||||
let controller = self.context.sharedContext.makePremiumGiftController(context: self.context, source: .chatList(birthdays), completion: nil)
|
||||
controller.navigationPresentation = .modal
|
||||
self.push?(controller)
|
||||
@@ -1819,9 +1804,8 @@ public final class ChatListNode: ListView {
|
||||
return true
|
||||
}))
|
||||
case .setupBirthday:
|
||||
//TODO:localize
|
||||
let _ = self.context.engine.notices.dismissServerProvidedSuggestion(suggestion: .setupBirthday).startStandalone()
|
||||
self.present?(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: "You can set your date of birth later in **Settings**.", timeout: 5.0, customUndoText: nil), elevatedLayout: false, action: { _ in
|
||||
self.present?(UndoOverlayController(presentationData: presentationData, content: .info(title: nil, text: presentationData.strings.ChatList_BirthdayInSettingsInfo, timeout: 5.0, customUndoText: nil), elevatedLayout: false, action: { _ in
|
||||
return true
|
||||
}))
|
||||
case let .birthdayPremiumGift(peers, _):
|
||||
|
||||
@@ -225,19 +225,17 @@ class ChatListStorageInfoItemNode: ItemListRevealOptionsItemNode {
|
||||
titleString = parseMarkdownIntoAttributedString(item.strings.ChatList_PremiumXmasGiftTitle, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor), bold: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.accentTextColor), link: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor), linkAttribute: { _ in return nil }))
|
||||
textString = NSAttributedString(string: item.strings.ChatList_PremiumXmasGiftText, font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
|
||||
case .setupBirthday:
|
||||
//TODO:localize
|
||||
titleString = NSAttributedString(string: "Add your birthday! 🎂", font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor)
|
||||
textString = NSAttributedString(string: "Let your contacts know when you're celebrating.", font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
|
||||
titleString = NSAttributedString(string: item.strings.ChatList_AddBirthdayTitle, font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor)
|
||||
textString = NSAttributedString(string: item.strings.ChatList_AddBirthdayText, font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
|
||||
case let .birthdayPremiumGift(peers, _):
|
||||
//TODO:localize
|
||||
let title: String
|
||||
let text: String
|
||||
if peers.count == 1, let peer = peers.first {
|
||||
title = "It's \(peer.compactDisplayTitle)'s **birthday** today! 🎂"
|
||||
text = "Gift them Telegram Premium."
|
||||
title = item.strings.ChatList_BirthdaySingleTitle(peer.compactDisplayTitle).string
|
||||
text = item.strings.ChatList_BirthdaySingleText
|
||||
} else {
|
||||
title = "\(peers.count) contacts have **birthdays** today! 🎂"
|
||||
text = "Gift them Telegram Premium."
|
||||
title = item.strings.ChatList_BirthdayMultipleTitle(Int32(peers.count))
|
||||
text = item.strings.ChatList_BirthdayMultipleText
|
||||
}
|
||||
titleString = parseMarkdownIntoAttributedString(title, attributes: MarkdownAttributes(body: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor), bold: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.accentTextColor), link: MarkdownAttributeSet(font: titleFont, textColor: item.theme.rootController.navigationBar.primaryTextColor), linkAttribute: { _ in return nil }))
|
||||
textString = NSAttributedString(string: text, font: textFont, textColor: item.theme.rootController.navigationBar.secondaryTextColor)
|
||||
|
||||
Reference in New Issue
Block a user