Various improvements

This commit is contained in:
Ilya Laktyushin 2025-06-30 00:09:17 +02:00
parent deed7905b6
commit d3f42e6cb0
9 changed files with 37 additions and 97 deletions

View File

@ -42,7 +42,6 @@ public enum PremiumIntroSource {
case folderTags
case animatedEmoji
case messageEffects
case paidMessages
case todo
case auth(String)
}
@ -82,7 +81,6 @@ public enum PremiumDemoSubject {
case folderTags
case business
case messageEffects
case paidMessages
case todo
case businessLocation

View File

@ -1099,25 +1099,6 @@ private final class DemoSheetContent: CombinedComponent {
)
)
availableItems[.paidMessages] = DemoPagerComponent.Item(
AnyComponentWithIdentity(
id: PremiumDemoScreen.Subject.paidMessages,
component: AnyComponent(
PageComponent(
content: AnyComponent(PhoneDemoComponent(
context: component.context,
position: .top,
videoFile: configuration.videos["paid_messages"],
decoration: .badgeStars
)),
title: strings.Premium_PaidMessages,
text: strings.Premium_PaidMessagesInfo,
textColor: textColor
)
)
)
)
availableItems[.todo] = DemoPagerComponent.Item(
AnyComponentWithIdentity(
id: PremiumDemoScreen.Subject.todo,
@ -1234,8 +1215,6 @@ private final class DemoSheetContent: CombinedComponent {
text = strings.Premium_FolderTagsStandaloneInfo
case .messageEffects:
text = strings.Premium_MessageEffectsInfo
case .paidMessages:
text = strings.Premium_PaidMessagesInfo
case .todo:
text = strings.Premium_TodoInfo
default:
@ -1322,8 +1301,6 @@ private final class DemoSheetContent: CombinedComponent {
case .emojiStatus:
buttonText = strings.Premium_EmojiStatus_Proceed
buttonAnimationName = "premium_unlock"
case .paidMessages:
buttonText = strings.Premium_PaidMessages_Proceed
case .todo:
buttonText = strings.Premium_PaidMessages_Proceed
default:
@ -1515,7 +1492,6 @@ public class PremiumDemoScreen: ViewControllerComponentContainer {
case business
case folderTags
case messageEffects
case paidMessages
case todo
case businessLocation
@ -1575,8 +1551,6 @@ public class PremiumDemoScreen: ViewControllerComponentContainer {
return .folderTags
case .messageEffects:
return .messageEffects
case .paidMessages:
return .paidMessages
case .todo:
return .todo
case .businessLocation:

View File

@ -539,8 +539,6 @@ private final class PremiumGiftScreenContentComponent: CombinedComponent {
demoSubject = .messagePrivacy
case .messageEffects:
demoSubject = .messageEffects
case .paidMessages:
demoSubject = .paidMessages
case .business:
demoSubject = .business
default:

View File

@ -303,12 +303,6 @@ public enum PremiumSource: Equatable {
} else {
return false
}
case .paidMessages:
if case .messageEffects = rhs {
return true
} else {
return false
}
case .todo:
if case .todo = rhs {
return true
@ -368,7 +362,6 @@ public enum PremiumSource: Equatable {
case messageTags
case folderTags
case messageEffects
case paidMessages
case todo
case auth(String)
@ -464,8 +457,6 @@ public enum PremiumSource: Equatable {
return "folder_tags"
case .messageEffects:
return "effects"
case .paidMessages:
return "paid_messages"
case .todo:
return "todo"
case .auth:
@ -498,7 +489,6 @@ public enum PremiumPerk: CaseIterable {
case business
case folderTags
case messageEffects
case paidMessages
case todo
case businessLocation
@ -535,7 +525,7 @@ public enum PremiumPerk: CaseIterable {
.folderTags,
.business,
.messageEffects,
.paidMessages
.todo
]
}
@ -609,8 +599,6 @@ public enum PremiumPerk: CaseIterable {
return "folder_tags"
case .messageEffects:
return "effects"
case .paidMessages:
return "paid_messages"
case .todo:
return "todo"
case .business:
@ -682,8 +670,6 @@ public enum PremiumPerk: CaseIterable {
return strings.Premium_Business
case .messageEffects:
return strings.Premium_MessageEffects
case .paidMessages:
return strings.Premium_PaidMessages
case .todo:
return strings.Premium_Todo
case .businessLocation:
@ -753,8 +739,6 @@ public enum PremiumPerk: CaseIterable {
return strings.Premium_BusinessInfo
case .messageEffects:
return strings.Premium_MessageEffectsInfo
case .paidMessages:
return strings.Premium_PaidMessagesInfo
case .todo:
return strings.Premium_TodoInfo
case .businessLocation:
@ -824,8 +808,6 @@ public enum PremiumPerk: CaseIterable {
return "Premium/Perk/Business"
case .messageEffects:
return "Premium/Perk/MessageEffects"
case .paidMessages:
return "Premium/Perk/PaidMessages"
case .todo:
return "Premium/Perk/Todo"
case .businessLocation:
@ -866,7 +848,6 @@ struct PremiumIntroConfiguration {
.colors,
.wallpapers,
.profileBadge,
.paidMessages,
.messagePrivacy,
.advancedChatManagement,
.noAds,
@ -2171,8 +2152,6 @@ private final class PremiumIntroScreenContentComponent: CombinedComponent {
demoSubject = .messagePrivacy
case .messageEffects:
demoSubject = .messageEffects
case .paidMessages:
demoSubject = .paidMessages
case .todo:
demoSubject = .todo
case .business:

View File

@ -843,24 +843,6 @@ public class PremiumLimitsListScreen: ViewController {
)
)
)
availableItems[.paidMessages] = DemoPagerComponent.Item(
AnyComponentWithIdentity(
id: PremiumDemoScreen.Subject.paidMessages,
component: AnyComponent(
PageComponent(
content: AnyComponent(PhoneDemoComponent(
context: context,
position: .top,
videoFile: videos["paid_messages"],
decoration: .badgeStars
)),
title: strings.Premium_PaidMessages,
text: strings.Premium_PaidMessagesInfo,
textColor: textColor
)
)
)
)
availableItems[.todo] = DemoPagerComponent.Item(
AnyComponentWithIdentity(

View File

@ -363,7 +363,7 @@ public func incomingMessagePrivacyScreen(context: AccountContext, value: GlobalP
openPremiumInfo: {
var replaceImpl: ((ViewController) -> Void)?
let controller = context.sharedContext.makePremiumDemoController(context: context, subject: .messagePrivacy, forceDark: false, action: {
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .paidMessages, forceDark: false, dismissed: nil)
let controller = context.sharedContext.makePremiumIntroController(context: context, source: .messageEffects, forceDark: false, dismissed: nil)
replaceImpl?(controller)
}, dismissed: nil)
replaceImpl = { [weak controller] c in

View File

@ -1165,6 +1165,10 @@ private enum StatsEntry: ItemListNodeEntry {
detailText = "\(fromDateString) \(toDateString)"
}
} else if case .fragment = transaction.peer {
if transaction.flags.contains(.isRefund) {
title = NSAttributedString(string: presentationData.strings.Monetization_Transaction_Refund, font: font, textColor: theme.list.itemPrimaryTextColor)
detailText = stringForMediumCompactDate(timestamp: transaction.date, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat)
} else {
title = NSAttributedString(string: presentationData.strings.Monetization_Transaction_Withdrawal("Fragment").string, font: font, textColor: theme.list.itemPrimaryTextColor)
labelColor = theme.list.itemDestructiveColor
if transaction.flags.contains(.isPending) {
@ -1175,6 +1179,7 @@ private enum StatsEntry: ItemListNodeEntry {
} else {
detailText = stringForMediumCompactDate(timestamp: transaction.date, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat)
}
}
} else if transaction.flags.contains(.isRefund) {
title = NSAttributedString(string: presentationData.strings.Monetization_Transaction_Refund, font: font, textColor: theme.list.itemPrimaryTextColor)
detailText = stringForMediumCompactDate(timestamp: transaction.date, strings: presentationData.strings, dateTimeFormat: presentationData.dateTimeFormat)

View File

@ -145,6 +145,13 @@ private final class SheetContent: CombinedComponent {
explorerUrl = nil
showPeer = true
} else if case .fragment = component.transaction.peer {
if component.transaction.flags.contains(.isRefund) {
labelColor = theme.list.itemDisclosureActions.constructive.fillColor
titleString = strings.Monetization_TransactionInfo_Refund
amountString = tonAmountAttributedString(formatTonAmountText(component.transaction.count.amount.value, dateTimeFormat: dateTimeFormat, showPlus: true), integralFont: integralFont, fractionalFont: fractionalFont, color: labelColor, decimalSeparator: dateTimeFormat.decimalSeparator).mutableCopy() as! NSMutableAttributedString
dateString = stringForFullDate(timestamp: component.transaction.date, strings: strings, dateTimeFormat: dateTimeFormat)
buttonTitle = strings.Common_OK
} else {
labelColor = theme.list.itemDestructiveColor
amountString = tonAmountAttributedString(formatTonAmountText(component.transaction.count.amount.value, dateTimeFormat: dateTimeFormat), integralFont: integralFont, fractionalFont: fractionalFont, color: labelColor, decimalSeparator: dateTimeFormat.decimalSeparator).mutableCopy() as! NSMutableAttributedString
dateString = stringForFullDate(timestamp: component.transaction.date, strings: strings, dateTimeFormat: dateTimeFormat)
@ -160,6 +167,7 @@ private final class SheetContent: CombinedComponent {
titleString = strings.Monetization_TransactionInfo_Withdrawal("Fragment").string
buttonTitle = strings.Monetization_TransactionInfo_ViewInExplorer
}
}
explorerUrl = component.transaction.transactionUrl
} else if component.transaction.flags.contains(.isRefund) {
labelColor = theme.list.itemDisclosureActions.constructive.fillColor

View File

@ -2720,10 +2720,8 @@ public final class SharedAccountContextImpl: SharedAccountContext {
mappedSource = .messageEffects
case .animatedEmoji:
mappedSource = .animatedEmoji
case .paidMessages:
mappedSource = .paidMessages
case .todo:
mappedSource = .paidMessages
mappedSource = .todo
case let .auth(price):
mappedSource = .auth(price)
}
@ -2800,8 +2798,6 @@ public final class SharedAccountContextImpl: SharedAccountContext {
mappedSubject = .folderTags
case .messageEffects:
mappedSubject = .messageEffects
case .paidMessages:
mappedSubject = .paidMessages
case .todo:
mappedSubject = .todo
case .business: