Various improvements

This commit is contained in:
Ilya Laktyushin
2024-10-25 19:09:31 +04:00
parent 2fa059477c
commit 3d03fc94c6
23 changed files with 917 additions and 113 deletions

View File

@@ -20,15 +20,18 @@ private final class SheetContent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
let context: AccountContext
let mode: MonetizationIntroScreen.Mode
let openMore: () -> Void
let dismiss: () -> Void
init(
context: AccountContext,
mode: MonetizationIntroScreen.Mode,
openMore: @escaping () -> Void,
dismiss: @escaping () -> Void
) {
self.context = context
self.mode = mode
self.openMore = openMore
self.dismiss = dismiss
}
@@ -37,6 +40,9 @@ private final class SheetContent: CombinedComponent {
if lhs.context !== rhs.context {
return false
}
if lhs.mode != rhs.mode {
return false
}
return true
}
@@ -136,7 +142,7 @@ private final class SheetContent: CombinedComponent {
let title = title.update(
component: BalancedTextComponent(
text: .plain(NSAttributedString(string: strings.Monetization_Intro_Title, font: titleFont, textColor: textColor)),
text: .plain(NSAttributedString(string: component.mode == .bot ? strings.Monetization_Intro_Bot_Title : strings.Monetization_Intro_Title, font: titleFont, textColor: textColor)),
horizontalAlignment: .center,
maximumNumberOfLines: 0,
lineSpacing: 0.1
@@ -157,7 +163,7 @@ private final class SheetContent: CombinedComponent {
component: AnyComponent(ParagraphComponent(
title: strings.Monetization_Intro_Ads_Title,
titleColor: textColor,
text: strings.Monetization_Intro_Ads_Text,
text: component.mode == .bot ? strings.Monetization_Intro_Bot_Ads_Text : strings.Monetization_Intro_Ads_Text,
textColor: secondaryTextColor,
iconName: "Ads/Ads",
iconColor: linkColor
@@ -343,13 +349,16 @@ private final class SheetContainerComponent: CombinedComponent {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
let context: AccountContext
let mode: MonetizationIntroScreen.Mode
let openMore: () -> Void
init(
context: AccountContext,
mode: MonetizationIntroScreen.Mode,
openMore: @escaping () -> Void
) {
self.context = context
self.mode = mode
self.openMore = openMore
}
@@ -357,6 +366,9 @@ private final class SheetContainerComponent: CombinedComponent {
if lhs.context !== rhs.context {
return false
}
if lhs.mode != rhs.mode {
return false
}
return true
}
@@ -375,6 +387,7 @@ private final class SheetContainerComponent: CombinedComponent {
component: SheetComponent<EnvironmentType>(
content: AnyComponent<EnvironmentType>(SheetContent(
context: context.component.context,
mode: context.component.mode,
openMore: context.component.openMore,
dismiss: {
animateOut.invoke(Action { _ in
@@ -444,9 +457,15 @@ private final class SheetContainerComponent: CombinedComponent {
final class MonetizationIntroScreen: ViewControllerComponentContainer {
private let context: AccountContext
private var openMore: (() -> Void)?
enum Mode: Equatable {
case channel
case bot
}
init(
context: AccountContext,
mode: Mode,
openMore: @escaping () -> Void
) {
self.context = context
@@ -456,6 +475,7 @@ final class MonetizationIntroScreen: ViewControllerComponentContainer {
context: context,
component: SheetContainerComponent(
context: context,
mode: mode,
openMore: openMore
),
navigationBarAppearance: .none,