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
@@ -46,9 +46,30 @@ public extension ToolbarTheme {
}
public extension NavigationBarTheme {
convenience init(rootControllerTheme: PresentationTheme, enableBackgroundBlur: Bool = true, hideBackground: Bool = false, hideBadge: Bool = false, hideSeparator: Bool = false) {
convenience init(rootControllerTheme: PresentationTheme, enableBackgroundBlur: Bool = true, hideBackground: Bool = false, hideBadge: Bool = false, hideSeparator: Bool = false, edgeEffectColor: UIColor? = nil, style: NavigationBar.Style = .legacy) {
let theme = rootControllerTheme.rootController.navigationBar
self.init(buttonColor: theme.buttonColor, disabledButtonColor: theme.disabledButtonColor, primaryTextColor: theme.primaryTextColor, backgroundColor: hideBackground ? .clear : theme.blurredBackgroundColor, opaqueBackgroundColor: hideBackground ? .clear : theme.opaqueBackgroundColor, enableBackgroundBlur: enableBackgroundBlur, separatorColor: hideBackground || hideSeparator ? .clear : theme.separatorColor, badgeBackgroundColor: hideBadge ? .clear : theme.badgeBackgroundColor, badgeStrokeColor: hideBadge ? .clear : theme.badgeStrokeColor, badgeTextColor: hideBadge ? .clear : theme.badgeTextColor)
let buttonColor: UIColor
let disabledButtonColor: UIColor
let badgeBackgroundColor: UIColor
let badgeTextColor: UIColor
var edgeEffectColor = edgeEffectColor
if case .glass = style {
buttonColor = rootControllerTheme.chat.inputPanel.panelControlColor
disabledButtonColor = buttonColor.withMultipliedAlpha(0.5)
badgeBackgroundColor = rootControllerTheme.chat.inputPanel.panelControlColor
badgeTextColor = rootControllerTheme.overallDarkAppearance ? .black : rootControllerTheme.list.itemCheckColors.foregroundColor
if edgeEffectColor == nil {
edgeEffectColor = rootControllerTheme.list.plainBackgroundColor
}
} else {
buttonColor = theme.buttonColor
disabledButtonColor = theme.disabledButtonColor
badgeBackgroundColor = theme.badgeBackgroundColor
badgeTextColor = theme.badgeTextColor
}
self.init(overallDarkAppearance: rootControllerTheme.overallDarkAppearance, buttonColor: buttonColor, disabledButtonColor: disabledButtonColor, primaryTextColor: theme.primaryTextColor, backgroundColor: hideBackground ? .clear : theme.blurredBackgroundColor, opaqueBackgroundColor: hideBackground ? .clear : theme.opaqueBackgroundColor, enableBackgroundBlur: enableBackgroundBlur, separatorColor: hideBackground || hideSeparator ? .clear : theme.separatorColor, badgeBackgroundColor: hideBadge ? .clear : badgeBackgroundColor, badgeStrokeColor: .clear, badgeTextColor: hideBadge ? .clear : badgeTextColor, edgeEffectColor: edgeEffectColor, style: style)
}
}
@@ -59,16 +80,16 @@ public extension NavigationBarStrings {
}
public extension NavigationBarPresentationData {
convenience init(presentationData: PresentationData) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
convenience init(presentationData: PresentationData, style: NavigationBar.Style = .legacy) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, style: style), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
}
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideBackground, hideBadge: hideBadge, hideSeparator: hideSeparator), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
convenience init(presentationData: PresentationData, hideBackground: Bool, hideBadge: Bool, hideSeparator: Bool = false, style: NavigationBar.Style = .legacy) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationData.theme, hideBackground: hideBackground, hideBadge: hideBadge, hideSeparator: hideSeparator, edgeEffectColor: hideBackground ? .clear : nil, style: style), strings: NavigationBarStrings(presentationStrings: presentationData.strings))
}
convenience init(presentationTheme: PresentationTheme, presentationStrings: PresentationStrings) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationTheme), strings: NavigationBarStrings(presentationStrings: presentationStrings))
convenience init(presentationTheme: PresentationTheme, presentationStrings: PresentationStrings, style: NavigationBar.Style = .legacy) {
self.init(theme: NavigationBarTheme(rootControllerTheme: presentationTheme, style: style), strings: NavigationBarStrings(presentationStrings: presentationStrings))
}
}
@@ -371,7 +371,7 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
let navigationSearchBar = PresentationThemeNavigationSearchBar(
backgroundColor: UIColor(rgb: 0x1c1c1d),
accentColor: UIColor(rgb: 0xffffff),
inputFillColor: UIColor(rgb: 0x0f0f0f),
inputFillColor: UIColor(white: 1.0, alpha: 0.1),
inputTextColor: UIColor(rgb: 0xffffff),
inputPlaceholderTextColor: UIColor(rgb: 0x8f8f8f),
inputIconColor: UIColor(rgb: 0x8f8f8f),
@@ -504,8 +504,8 @@ public func makeDefaultDarkPresentationTheme(extendingThemeReference: Presentati
pinnedBadgeColor: UIColor(rgb: 0x767677),
pinnedSearchBarColor: UIColor(rgb: 0x272728),
regularSearchBarColor: UIColor(rgb: 0x272728),
sectionHeaderFillColor: UIColor(rgb: 0x1c1c1d),
sectionHeaderTextColor: UIColor(rgb: 0xffffff),
sectionHeaderFillColor: .black,
sectionHeaderTextColor: UIColor(rgb: 0x8d8e93),
verifiedIconFillColor: UIColor(rgb: 0xffffff),
verifiedIconForegroundColor: UIColor(rgb: 0x000000),
secretIconColor: UIColor(rgb: 0x00b12c),
@@ -145,7 +145,7 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme
navigationSearchBar: rootController.navigationSearchBar.withUpdated(
backgroundColor: mainBackgroundColor,
accentColor: accentColor,
inputFillColor: mainInputColor,
inputFillColor: UIColor(white: 1.0, alpha: 0.1),
inputPlaceholderTextColor: mainSecondaryColor,
inputIconColor: mainSecondaryColor,
inputClearButtonColor: mainSecondaryColor,
@@ -429,7 +429,7 @@ public func customizeDefaultDarkTintedPresentationTheme(theme: PresentationTheme
panelBackgroundColor: mainBackgroundColor?.withAlphaComponent(0.9),
panelSeparatorColor: mainSeparatorColor,
panelControlAccentColor: accentColor,
panelControlColor: mainSecondaryTextColor?.withAlphaComponent(0.5),
panelControlColor: UIColor(rgb: 0xffffff),
inputBackgroundColor: inputBackgroundColor,
inputStrokeColor: accentColor?.withMultiplied(hue: 1.038, saturation: 0.463, brightness: 0.26),
inputPlaceholderColor: mainSecondaryTextColor?.withAlphaComponent(0.4),
@@ -581,7 +581,7 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres
let navigationSearchBar = PresentationThemeNavigationSearchBar(
backgroundColor: mainBackgroundColor,
accentColor: accentColor,
inputFillColor: mainInputColor,
inputFillColor: UIColor(white: 1.0, alpha: 0.1),
inputTextColor: UIColor(rgb: 0xffffff),
inputPlaceholderTextColor: mainSecondaryColor,
inputIconColor: mainSecondaryColor,
@@ -714,7 +714,7 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres
pinnedBadgeColor: mainSecondaryTextColor.withAlphaComponent(0.5),
pinnedSearchBarColor: accentColor.withMultiplied(hue: 1.029, saturation: 0.609, brightness: 0.12),
regularSearchBarColor: accentColor.withMultiplied(hue: 1.029, saturation: 0.609, brightness: 0.12),
sectionHeaderFillColor: mainBackgroundColor,
sectionHeaderFillColor: .black,
sectionHeaderTextColor: mainSecondaryTextColor.withAlphaComponent(0.5),
verifiedIconFillColor: accentColor,
verifiedIconForegroundColor: .white,
@@ -874,7 +874,7 @@ public func makeDefaultDarkTintedPresentationTheme(extendingThemeReference: Pres
panelBackgroundColorNoWallpaper: accentColor.withMultiplied(hue: 1.024, saturation: 0.573, brightness: 0.18),
panelSeparatorColor: mainSeparatorColor,
panelControlAccentColor: accentColor,
panelControlColor: mainSecondaryTextColor.withAlphaComponent(0.5),
panelControlColor: UIColor(rgb: 0xffffff),
panelControlDisabledColor: UIColor(rgb: 0x90979F, alpha: 0.5),
panelControlDestructiveColor: UIColor(rgb: 0xff6767),
inputBackgroundColor: inputBackgroundColor,
@@ -565,8 +565,8 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
pinnedBadgeColor: UIColor(rgb: 0xb6b6bb),
pinnedSearchBarColor: UIColor(rgb: 0xe5e5e5),
regularSearchBarColor: UIColor(rgb: 0xe9e9e9),
sectionHeaderFillColor: UIColor(rgb: 0xf7f7f7),
sectionHeaderTextColor: UIColor(rgb: 0x8e8e93),
sectionHeaderFillColor: .white,
sectionHeaderTextColor: UIColor(rgb: 0x6d6d72),
verifiedIconFillColor: defaultDayAccentColor,
verifiedIconForegroundColor: UIColor(rgb: 0xffffff),
secretIconColor: UIColor(rgb: 0x00b12c),
@@ -946,7 +946,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
panelControlColor: UIColor(rgb: 0x000000, alpha: 1.0),
panelControlDisabledColor: UIColor(rgb: 0x727b87, alpha: 0.5),
panelControlDestructiveColor: UIColor(rgb: 0xff3b30),
inputBackgroundColor: UIColor(rgb: 0xffffff),
inputBackgroundColor: UIColor(white: 1.0, alpha: 0.8),
inputStrokeColor: UIColor(rgb: 0x000000, alpha: 0.1),
inputPlaceholderColor: UIColor(rgb: 0x000000, alpha: 0.4),
inputTextColor: UIColor(rgb: 0x000000),
@@ -1032,7 +1032,7 @@ public func makeDefaultDayPresentationTheme(extendingThemeReference: Presentatio
primaryTextColor: UIColor(rgb: 0x000000),
secondaryTextColor: UIColor(rgb: 0x8e8e93),
controlAccentColor: defaultDayAccentColor,
inputBackgroundColor: UIColor(rgb: 0xe9e9e9),
inputBackgroundColor: UIColor(white: 1.0, alpha: 0.6),
inputHollowBackgroundColor: UIColor(rgb: 0xffffff),
inputBorderColor: UIColor(rgb: 0xe4e4e6),
inputPlaceholderColor: UIColor(rgb: 0x8e8d92),
@@ -175,6 +175,11 @@ public final class PrincipalThemeEssentialGraphics {
public let outgoingDateAndStatusStarsIcon: UIImage
public let mediaStarsIcon: UIImage
public let freeStarsIcon: UIImage
public let incomingDateAndStatusTonIcon: UIImage
public let outgoingDateAndStatusTonIcon: UIImage
public let mediaTonIcon: UIImage
public let freeTonIcon: UIImage
public let incomingDateAndStatusPinnedIcon: UIImage
public let outgoingDateAndStatusPinnedIcon: UIImage
@@ -369,6 +374,12 @@ public final class PrincipalThemeEssentialGraphics {
self.outgoingDateAndStatusStarsIcon = generateTintedImage(image: starsImage, color: theme.message.outgoing.secondaryTextColor)!
self.mediaStarsIcon = generateTintedImage(image: starsImage, color: .white)!
self.freeStarsIcon = generateTintedImage(image: starsImage, color: serviceColor.primaryText)!
let tonImage = generateScaledImage(image: UIImage(bundleImageName: "Ads/TonMedium"), size: CGSize(width: 12.0, height: 12.0), opaque: false)!
self.incomingDateAndStatusTonIcon = generateTintedImage(image: tonImage, color: theme.message.incoming.secondaryTextColor)!
self.outgoingDateAndStatusTonIcon = generateTintedImage(image: tonImage, color: theme.message.outgoing.secondaryTextColor)!
self.mediaTonIcon = generateTintedImage(image: tonImage, color: .white)!
self.freeTonIcon = generateTintedImage(image: tonImage, color: serviceColor.primaryText)!
let pinnedImage = UIImage(bundleImageName: "Chat/Message/Pinned")!
self.incomingDateAndStatusPinnedIcon = generateTintedImage(image: pinnedImage, color: theme.message.incoming.secondaryTextColor)!
@@ -497,6 +508,12 @@ public final class PrincipalThemeEssentialGraphics {
self.mediaStarsIcon = generateTintedImage(image: starsImage, color: .white)!
self.freeStarsIcon = generateTintedImage(image: starsImage, color: serviceColor.primaryText)!
let tonImage = generateScaledImage(image: UIImage(bundleImageName: "Ads/TonMedium"), size: CGSize(width: 12.0, height: 12.0), opaque: false)!
self.incomingDateAndStatusTonIcon = generateTintedImage(image: tonImage, color: theme.message.incoming.secondaryTextColor)!
self.outgoingDateAndStatusTonIcon = generateTintedImage(image: tonImage, color: theme.message.outgoing.secondaryTextColor)!
self.mediaTonIcon = generateTintedImage(image: tonImage, color: .white)!
self.freeTonIcon = generateTintedImage(image: tonImage, color: serviceColor.primaryText)!
let pinnedImage = UIImage(bundleImageName: "Chat/Message/Pinned")!
self.incomingDateAndStatusPinnedIcon = generateTintedImage(image: pinnedImage, color: theme.message.incoming.secondaryTextColor)!
self.outgoingDateAndStatusPinnedIcon = generateTintedImage(image: pinnedImage, color: theme.message.outgoing.secondaryTextColor)!
@@ -308,6 +308,8 @@ public enum PresentationResourceKey: Int32 {
case chatFreeShareButtonIcon
case chatFreeCloseButtonIcon
case chatFreeMoreButtonIcon
case chatFreeExpandButtonIcon
case chatFreeCollapseButtonIcon
case chatKeyboardActionButtonMessageIcon
case chatKeyboardActionButtonLinkIcon
@@ -1174,6 +1174,18 @@ public struct PresentationResourcesChat {
})
}
public static func chatFreeExpandButtonIcon(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> UIImage? {
return theme.image(PresentationResourceKey.chatFreeExpandButtonIcon.rawValue, { _ in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/ExpandIcon"), color: bubbleVariableColor(variableColor: theme.chat.message.shareButtonForegroundColor, wallpaper: wallpaper))
})
}
public static func chatFreeCollapseButtonIcon(_ theme: PresentationTheme, wallpaper: TelegramWallpaper) -> UIImage? {
return theme.image(PresentationResourceKey.chatFreeCollapseButtonIcon.rawValue, { _ in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/CollapseIcon"), color: bubbleVariableColor(variableColor: theme.chat.message.shareButtonForegroundColor, wallpaper: wallpaper))
})
}
public static func chatKeyboardActionButtonMessageIconImage(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.chatKeyboardActionButtonMessageIcon.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Message/BotMessage"), color: theme.chat.inputButtonPanel.buttonTextColor)
@@ -70,7 +70,7 @@ public struct PresentationResourcesRootController {
public static func navigationCompactSearchIcon(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.navigationCompactSearchIcon.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/SearchIcon"), color: theme.rootController.navigationBar.accentTextColor)
return generateTintedImage(image: UIImage(bundleImageName: "Chat List/SearchIcon"), color: theme.chat.inputPanel.panelControlColor)
})
}
@@ -82,7 +82,7 @@ public struct PresentationResourcesRootController {
public static func navigationCompactTagsSearchIcon(_ theme: PresentationTheme) -> UIImage? {
return theme.image(PresentationResourceKey.navigationCompactTagsSearchIcon.rawValue, { theme in
return generateTintedImage(image: UIImage(bundleImageName: "Chat/NavigationSearchTagsIcon"), color: theme.rootController.navigationBar.accentTextColor)
return generateTintedImage(image: UIImage(bundleImageName: "Chat/NavigationSearchTagsIcon"), color: theme.chat.inputPanel.panelControlColor)
})
}