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
-1
View File
@@ -31,7 +31,6 @@ swift_library(
"//submodules/Components/BundleIconComponent:BundleIconComponent",
"//submodules/UndoUI:UndoUI",
"//submodules/ActivityIndicator:ActivityIndicator",
"//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
"//submodules/ShimmerEffect:ShimmerEffect",
],
visibility = [
@@ -270,47 +270,55 @@ public func chatTranslationState(context: AccountContext, peerId: EnginePeer.Id,
var count = 0
for message in messages {
if message.effectivelyIncoming(context.account.peerId), message.text.count >= 10 {
var text = String(message.text.prefix(256))
if var entities = message.textEntitiesAttribute?.entities.filter({ entity in
switch entity.type {
case .Pre, .Code, .Url, .Email, .Mention, .Hashtag, .BotCommand:
return true
default:
return false
if let summaryAttribute = message.attributes.first(where: { $0 is SummarizationMessageAttribute }) as? SummarizationMessageAttribute, !summaryAttribute.fromLang.isEmpty {
let fromLang = normalizeTranslationLanguage(summaryAttribute.fromLang)
if supportedTranslationLanguages.contains(fromLang) {
fromLangs[fromLang] = (fromLangs[fromLang] ?? 0) + message.text.count
count += 1
}
}) {
entities = entities.sorted(by: { $0.range.lowerBound > $1.range.lowerBound })
var ranges: [Range<String.Index>] = []
for entity in entities {
if entity.range.lowerBound > text.count || entity.range.upperBound > text.count {
continue
} else {
var text = String(message.text.prefix(256))
if var entities = message.textEntitiesAttribute?.entities.filter({ entity in
switch entity.type {
case .Pre, .Code, .Url, .Email, .Mention, .Hashtag, .BotCommand:
return true
default:
return false
}
ranges.append(text.index(text.startIndex, offsetBy: entity.range.lowerBound) ..< text.index(text.startIndex, offsetBy: entity.range.upperBound))
}
for range in ranges {
if range.upperBound < text.endIndex {
text.removeSubrange(range)
}) {
entities = entities.sorted(by: { $0.range.lowerBound > $1.range.lowerBound })
var ranges: [Range<String.Index>] = []
for entity in entities {
if entity.range.lowerBound > text.count || entity.range.upperBound > text.count {
continue
}
ranges.append(text.index(text.startIndex, offsetBy: entity.range.lowerBound) ..< text.index(text.startIndex, offsetBy: entity.range.upperBound))
}
for range in ranges {
if range.upperBound < text.endIndex {
text.removeSubrange(range)
}
}
}
}
if message.text.count < 10 {
continue
}
languageRecognizer.processString(text)
let hypotheses = languageRecognizer.languageHypotheses(withMaximum: 4)
languageRecognizer.reset()
let filteredLanguages = hypotheses.filter { supportedTranslationLanguages.contains(normalizeTranslationLanguage($0.key.rawValue)) }.sorted(by: { $0.value > $1.value })
if let language = filteredLanguages.first {
let fromLang = normalizeTranslationLanguage(language.key.rawValue)
if loggingEnabled && !["en", "ru"].contains(fromLang) && !dontTranslateLanguages.contains(fromLang) {
Logger.shared.log("ChatTranslation", "\(text)")
Logger.shared.log("ChatTranslation", "Recognized as: \(fromLang), other hypotheses: \(hypotheses.map { $0.key.rawValue }.joined(separator: ",")) ")
if message.text.count < 10 {
continue
}
languageRecognizer.processString(text)
let hypotheses = languageRecognizer.languageHypotheses(withMaximum: 4)
languageRecognizer.reset()
let filteredLanguages = hypotheses.filter { supportedTranslationLanguages.contains(normalizeTranslationLanguage($0.key.rawValue)) }.sorted(by: { $0.value > $1.value })
if let language = filteredLanguages.first {
let fromLang = normalizeTranslationLanguage(language.key.rawValue)
if loggingEnabled && !["en", "ru"].contains(fromLang) && !dontTranslateLanguages.contains(fromLang) {
Logger.shared.log("ChatTranslation", "\(text)")
Logger.shared.log("ChatTranslation", "Recognized as: \(fromLang), other hypotheses: \(hypotheses.map { $0.key.rawValue }.joined(separator: ",")) ")
}
fromLangs[fromLang] = (fromLangs[fromLang] ?? 0) + message.text.count
count += 1
}
fromLangs[fromLang] = (fromLangs[fromLang] ?? 0) + message.text.count
count += 1
}
}
if count >= 16 {
@@ -7,7 +7,6 @@ import TelegramPresentationData
import ItemListUI
import PresentationDataUtils
import ActivityIndicator
import ChatListSearchItemNode
import ShimmerEffect
public struct LocalizationListItemEditing: Equatable {
@@ -185,7 +184,7 @@ class LocalizationListItemNode: ItemListRevealOptionsItemNode {
self.activateArea = AccessibilityAreaNode()
super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
super.init(layerBacked: false, rotated: false, seeThrough: false)
self.addSubnode(self.containerNode)
@@ -314,7 +313,7 @@ class LocalizationListItemNode: ItemListRevealOptionsItemNode {
if strongSelf.maskNode.supernode == nil {
strongSelf.addSubnode(strongSelf.maskNode)
}
let hasCorners = itemListHasRoundedBlockLayout(params)
let hasCorners = itemListHasRoundedBlockLayout(params) && !item.alwaysPlain
var hasTopCorners = false
var hasBottomCorners = false
switch neighbors.top {