chore: migrate to new version + fixed several critical bugs

- Migrated project to latest Telegram iOS base (v12.3.2+)
- Fixed circular dependency between GhostModeManager and MiscSettingsManager
- Fixed multiple Bazel build configuration errors (select() default conditions)
- Fixed duplicate type definitions in PeerInfoScreen
- Fixed swiftmodule directory resolution in build scripts
- Added Ghostgram Settings tab in main Settings menu with all 5 features
- Cleared sensitive credentials from config.json (template-only now)
- Excluded bazel-cache from version control
This commit is contained in:
ichmagmaus 812
2026-02-23 23:04:32 +01:00
parent 703e291bcb
commit db53826061
1017 changed files with 62337 additions and 40559 deletions
@@ -34,6 +34,8 @@ swift_library(
"//submodules/TelegramUI/Components/Stories/PeerListItemComponent",
"//submodules/ContextUI",
"//submodules/TelegramUI/Components/AlertComponent",
"//submodules/TelegramUI/Components/AlertComponent/AlertTableComponent",
"//submodules/TelegramUI/Components/Gifts/TableComponent",
"//submodules/TelegramUI/Components/PlainButtonComponent",
"//submodules/TelegramUI/Components/ToastComponent",
"//submodules/AvatarNode",
@@ -26,6 +26,9 @@ import ContextUI
import BalancedTextComponent
import AlertComponent
import PremiumCoinComponent
import AlertComponent
import AlertTableComponent
import TableComponent
private func textForTimeout(value: Int32) -> String {
if value < 3600 {
@@ -64,13 +67,16 @@ final class AffiliateProgramSetupScreenComponent: Component {
typealias EnvironmentType = ViewControllerComponentContainer.Environment
let context: AccountContext
let overNavigationContainer: UIView
let initialContent: AffiliateProgramSetupScreen.Content
init(
context: AccountContext,
overNavigationContainer: UIView,
initialContent: AffiliateProgramSetupScreen.Content
) {
self.context = context
self.overNavigationContainer = overNavigationContainer
self.initialContent = initialContent
}
@@ -93,6 +99,7 @@ final class AffiliateProgramSetupScreenComponent: Component {
private let coinIcon = ComponentView<Empty>()
private let title = ComponentView<Empty>()
private let titleContainer: UIView
private let titleTransformContainer: UIView
private var titleNeutralScale: CGFloat = 1.0
private let subtitle = ComponentView<Empty>()
@@ -157,6 +164,8 @@ final class AffiliateProgramSetupScreenComponent: Component {
self.scrollView.contentInsetAdjustmentBehavior = .never
self.scrollView.alwaysBounceVertical = true
self.titleContainer = SparseContainerView()
self.titleTransformContainer = UIView()
self.titleTransformContainer.isUserInteractionEnabled = false
@@ -208,30 +217,50 @@ final class AffiliateProgramSetupScreenComponent: Component {
} else {
durationTitle = environment.strings.AffiliateProgram_DurationLifetime
}
var content: [AnyComponentWithIdentity<AlertComponentEnvironment>] = []
content.append(AnyComponentWithIdentity(
id: "title",
component: AnyComponent(
AlertTitleComponent(title: environment.strings.AffiliateSetup_AlertApply_Title)
)
))
content.append(AnyComponentWithIdentity(
id: "text",
component: AnyComponent(
AlertTextComponent(content: .plain(environment.strings.AffiliateSetup_AlertApply_Text))
)
))
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 })
self.environment?.controller()?.present(tableAlert(
theme: presentationData.theme,
title: environment.strings.AffiliateSetup_AlertApply_Title,
text: environment.strings.AffiliateSetup_AlertApply_Text,
table: TableComponent(theme: environment.theme, items: [
TableComponent.Item(id: 0, title: environment.strings.AffiliateSetup_AlertApply_SectionCommission, component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: commissionTitle, font: Font.regular(17.0), textColor: environment.theme.actionSheet.primaryTextColor))
))),
TableComponent.Item(id: 1, title: environment.strings.AffiliateSetup_AlertApply_SectionDuration, component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: durationTitle, font: Font.regular(17.0), textColor: environment.theme.actionSheet.primaryTextColor))
)))
]),
let tableItems: [TableComponent.Item] = [
TableComponent.Item(id: 0, title: environment.strings.AffiliateSetup_AlertApply_SectionCommission, component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: commissionTitle, font: Font.regular(15.0), textColor: environment.theme.actionSheet.primaryTextColor))
))),
TableComponent.Item(id: 1, title: environment.strings.AffiliateSetup_AlertApply_SectionDuration, component: AnyComponent(MultilineTextComponent(
text: .plain(NSAttributedString(string: durationTitle, font: Font.regular(15.0), textColor: environment.theme.actionSheet.primaryTextColor))
)))
]
content.append(AnyComponentWithIdentity(
id: "table",
component: AnyComponent(
AlertTableComponent(items: tableItems)
)
))
let alertController = AlertScreen(
context: component.context,
content: content,
actions: [
ComponentAlertAction(type: .genericAction, title: environment.strings.Common_Cancel, action: {}),
ComponentAlertAction(type: .defaultAction, title: environment.strings.AffiliateSetup_AlertApply_Action, action: { [weak self] in
.init(title: environment.strings.Common_Cancel),
.init(title: environment.strings.AffiliateSetup_AlertApply_Action, type: .default, action: { [weak self] in
guard let self else {
return
}
self.applyProgram()
})
]
), in: .window(.root))
)
self.environment?.controller()?.present(alertController, in: .window(.root))
}
private func requestApplyEndProgram() {
@@ -239,8 +268,8 @@ final class AffiliateProgramSetupScreenComponent: Component {
return
}
let presentationData = component.context.sharedContext.currentPresentationData.with({ $0 })
self.environment?.controller()?.present(standardTextAlertController(
theme: AlertControllerTheme(presentationData: presentationData),
self.environment?.controller()?.present(textAlertController(
context: component.context,
title: environment.strings.AffiliateSetup_AlertTerminate_Title,
text: environment.strings.AffiliateSetup_AlertTerminate_Text,
actions: [
@@ -337,6 +366,8 @@ final class AffiliateProgramSetupScreenComponent: Component {
transition.setSublayerTransform(view: self.titleTransformContainer, transform: CATransform3DMakeTranslation(0.0, titleY - self.titleTransformContainer.center.y, 0.0))
transition.setSublayerTransform(view: self.titleContainer, transform: CATransform3DMakeTranslation(0.0, -self.scrollView.contentOffset.y, 0.0))
let titleYDistance: CGFloat = titleY - titleCenterY
let titleTransformFraction: CGFloat = 1.0 - max(0.0, min(1.0, titleYDistance / titleTransformDistance))
let titleMinScale: CGFloat = 17.0 / 30.0
@@ -625,6 +656,10 @@ final class AffiliateProgramSetupScreenComponent: Component {
self.component = component
self.state = state
if self.titleContainer.superview == nil {
component.overNavigationContainer.addSubview(self.titleContainer)
}
let topInset: CGFloat = environment.navigationHeight + 90.0
let bottomInset: CGFloat = 8.0
let sideInset: CGFloat = 16.0 + environment.safeInsets.left
@@ -648,7 +683,7 @@ final class AffiliateProgramSetupScreenComponent: Component {
let coinIconFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - coinIconSize.width) * 0.5), y: contentHeight - coinIconSize.height + 30.0), size: coinIconSize)
if let coinIconView = self.coinIcon.view {
if coinIconView.superview == nil {
self.scrollView.addSubview(coinIconView)
self.titleContainer.addSubview(coinIconView)
}
transition.setFrame(view: coinIconView, frame: coinIconFrame)
}
@@ -1158,6 +1193,7 @@ final class AffiliateProgramSetupScreenComponent: Component {
transition: transition,
component: AnyComponent(ButtonComponent(
background: ButtonComponent.Background(
style: .glass,
color: environment.theme.list.itemCheckColors.fillColor,
foreground: environment.theme.list.itemCheckColors.foregroundColor,
pressedColor: environment.theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.8)
@@ -1174,7 +1210,7 @@ final class AffiliateProgramSetupScreenComponent: Component {
}
)),
environment: {},
containerSize: CGSize(width: availableSize.width - bottomPanelButtonInsets.left - bottomPanelButtonInsets.right, height: 50.0)
containerSize: CGSize(width: availableSize.width - bottomPanelButtonInsets.left - bottomPanelButtonInsets.right, height: 52.0)
)
let bottomPanelHeight: CGFloat = bottomPanelButtonInsets.top + bottomPanelButtonSize.height + bottomPanelButtonInsets.bottom + bottomPanelTextSize.height + 8.0 + environment.safeInsets.bottom
@@ -1620,16 +1656,21 @@ public class AffiliateProgramSetupScreen: ViewControllerComponentContainer {
private let context: AccountContext
private var isDismissed: Bool = false
private let overNavigationContainer: UIView
public init(
context: AccountContext,
initialContent: AffiliateProgramSetupScreenInitialData
) {
self.context = context
self.overNavigationContainer = SparseContainerView()
let initialContent = initialContent as! AffiliateProgramSetupScreen.Content
super.init(context: context, component: AffiliateProgramSetupScreenComponent(
context: context,
overNavigationContainer: self.overNavigationContainer,
initialContent: initialContent
), navigationBarAppearance: .default, theme: .default)
@@ -1647,6 +1688,10 @@ public class AffiliateProgramSetupScreen: ViewControllerComponentContainer {
return componentView.attemptNavigation(complete: complete)
}
if let navigationBar = self.navigationBar {
navigationBar.customOverBackgroundContentView.insertSubview(self.overNavigationContainer, at: 0)
}
}
required public init(coder aDecoder: NSCoder) {
@@ -1130,11 +1130,11 @@ private final class JoinAffiliateProgramScreenComponent: Component {
)),
background: AnyComponent(FilledRoundedRectangleComponent(
color: environment.theme.list.itemInputField.backgroundColor,
cornerRadius: .value(8.0),
cornerRadius: .minEdge,
smoothCorners: true
)),
effectAlignment: .center,
minSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 50.0),
minSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 52.0),
contentInsets: UIEdgeInsets(top: 0.0, left: 10.0, bottom: 0.0, right: 10.0),
action: { [weak self] in
guard let self, case let .active(active) = self.currentMode else {
@@ -1148,7 +1148,7 @@ private final class JoinAffiliateProgramScreenComponent: Component {
animateContents: false
)),
environment: {},
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 50.0)
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 52.0)
)
let linkTextFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - linkTextSize.width) * 0.5), y: contentHeight), size: linkTextSize)
if let linkTextView = self.linkText.view {
@@ -1170,6 +1170,7 @@ private final class JoinAffiliateProgramScreenComponent: Component {
actionButtonTitle = environment.strings.AffiliateProgram_ActionCopyLink
}
let buttonSideInset: CGFloat = 30.0
let actionButtonSize = self.actionButton.update(
transition: transition,
component: AnyComponent(ButtonComponent(
@@ -1208,7 +1209,7 @@ private final class JoinAffiliateProgramScreenComponent: Component {
}
)),
environment: {},
containerSize: CGSize(width: availableSize.width - 30.0 * 2.0, height: 52.0)
containerSize: CGSize(width: availableSize.width - buttonSideInset * 2.0, height: 52.0)
)
let bottomTextSize = self.bottomText.update(
@@ -1238,7 +1239,7 @@ private final class JoinAffiliateProgramScreenComponent: Component {
let bottomPanelFrame = CGRect(origin: CGPoint(x: 0.0, y: availableSize.height - bottomPanelHeight), size: CGSize(width: availableSize.width, height: bottomPanelHeight))
transition.setFrame(view: self.bottomPanelContainer, frame: bottomPanelFrame)
let actionButtonFrame = CGRect(origin: CGPoint(x: sideInset, y: 0.0), size: actionButtonSize)
let actionButtonFrame = CGRect(origin: CGPoint(x: buttonSideInset, y: 0.0), size: actionButtonSize)
if let actionButtonView = self.actionButton.view {
if actionButtonView.superview == nil {
self.bottomPanelContainer.addSubview(actionButtonView)