mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-08 19:13:56 +02:00
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:
+54
-8
@@ -116,6 +116,8 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
private var appliedExpandedBlockIds: Set<Int>?
|
||||
private var displayContentsUnderSpoilers: (value: Bool, location: CGPoint?) = (false, nil)
|
||||
|
||||
private var isSummaryApplied = false
|
||||
|
||||
private final class TextRevealAnimationState {
|
||||
let fromCount: Int
|
||||
let toCount: Int
|
||||
@@ -404,6 +406,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
|
||||
var isSummaryApplied = false
|
||||
var isTranslating = false
|
||||
if let invoice {
|
||||
rawText = invoice.description
|
||||
@@ -417,7 +420,14 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if let updatingMedia = item.attributes.updatingMedia {
|
||||
rawText = updatingMedia.text
|
||||
} else {
|
||||
rawText = item.message.text
|
||||
// MARK: - Ghostgram: Check for local edit first
|
||||
let peerId = item.message.id.peerId.toInt64()
|
||||
let messageId = item.message.id.id
|
||||
if let localEdit = LocalEditManager.shared.getLocalEdit(peerId: peerId, messageId: messageId) {
|
||||
rawText = localEdit
|
||||
} else {
|
||||
rawText = item.message.text
|
||||
}
|
||||
}
|
||||
|
||||
for attribute in item.message.attributes {
|
||||
@@ -441,15 +451,29 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
messageEntities = updatingMedia.entities?.entities ?? []
|
||||
}
|
||||
|
||||
let translateToLanguage = item.associatedData.translateToLanguage
|
||||
var isSummarized = false
|
||||
if item.controllerInteraction.summarizedMessageIds.contains(item.message.id) {
|
||||
isSummarized = true
|
||||
}
|
||||
|
||||
if let subject = item.associatedData.subject, case .messageOptions = subject {
|
||||
} else if let translateToLanguage = item.associatedData.translateToLanguage, !item.message.text.isEmpty && incoming {
|
||||
isTranslating = true
|
||||
for attribute in item.message.attributes {
|
||||
if let attribute = attribute as? TranslationMessageAttribute, !attribute.text.isEmpty, attribute.toLang == translateToLanguage {
|
||||
} else if !item.message.text.isEmpty && incoming {
|
||||
if translateToLanguage != nil || isSummarized {
|
||||
isTranslating = true
|
||||
}
|
||||
if isTranslating {
|
||||
if isSummarized, let attribute = item.message.attributes.first(where: { $0 is SummarizationMessageAttribute }) as? SummarizationMessageAttribute, let summary = attribute.summaryForLang(translateToLanguage) {
|
||||
rawText = summary.text
|
||||
messageEntities = summary.entities
|
||||
isTranslating = false
|
||||
isSummaryApplied = true
|
||||
} else if let attribute = item.message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, !attribute.text.isEmpty, attribute.toLang == translateToLanguage {
|
||||
rawText = attribute.text
|
||||
messageEntities = attribute.entities
|
||||
isTranslating = false
|
||||
break
|
||||
if !isSummarized {
|
||||
isTranslating = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -718,6 +742,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
starsCount: starsCount,
|
||||
isPinned: item.message.tags.contains(.pinned) && (!item.associatedData.isInPinnedListMode || isReplyThread),
|
||||
hasAutoremove: item.message.isSelfExpiring,
|
||||
isDeleted: AntiDeleteManager.shared.isMessageDeleted(peerId: item.message.id.peerId.toInt64(), messageId: item.message.id.id) || AntiDeleteManager.shared.isMessageDeleted(text: item.message.text),
|
||||
canViewReactionList: canViewMessageReactionList(message: item.topMessage),
|
||||
animationCache: item.controllerInteraction.presentationContext.animationCache,
|
||||
animationRenderer: item.controllerInteraction.presentationContext.animationRenderer
|
||||
@@ -789,6 +814,20 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
strongSelf.textNode.textNode.displaysAsynchronously = !item.presentationData.isPreview
|
||||
animation.animator.updateFrame(layer: strongSelf.containerNode.layer, frame: CGRect(origin: CGPoint(), size: boundingSize), completion: nil)
|
||||
|
||||
|
||||
if strongSelf.isSummaryApplied != isSummaryApplied {
|
||||
strongSelf.isSummaryApplied = isSummaryApplied
|
||||
itemApply?.setInvertOffsetDirection()
|
||||
|
||||
if let snapshotView = strongSelf.textNode.textNode.view.snapshotContentTree() {
|
||||
strongSelf.view.addSubview(snapshotView)
|
||||
|
||||
snapshotView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.25, removeOnCompletion: false, completion: { _ in
|
||||
snapshotView.removeFromSuperview()
|
||||
})
|
||||
strongSelf.textNode.textNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25)
|
||||
}
|
||||
}
|
||||
if strongSelf.appliedExpandedBlockIds != nil && strongSelf.appliedExpandedBlockIds != strongSelf.expandedBlockIds {
|
||||
itemApply?.setInvertOffsetDirection()
|
||||
}
|
||||
@@ -1227,7 +1266,14 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if let current = self.shimmeringNode {
|
||||
shimmeringNode = current
|
||||
} else {
|
||||
shimmeringNode = ShimmeringLinkNode(color: item.message.effectivelyIncoming(item.context.account.peerId) ? item.presentationData.theme.theme.chat.message.incoming.secondaryTextColor.withAlphaComponent(0.1) : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor.withAlphaComponent(0.1))
|
||||
let color: UIColor
|
||||
let isIncoming = item.message.effectivelyIncoming(item.context.account.peerId)
|
||||
if item.presentationData.theme.theme.overallDarkAppearance {
|
||||
color = isIncoming ? item.presentationData.theme.theme.chat.message.incoming.primaryTextColor.withAlphaComponent(0.1) : item.presentationData.theme.theme.chat.message.outgoing.primaryTextColor.withAlphaComponent(0.1)
|
||||
} else {
|
||||
color = isIncoming ? item.presentationData.theme.theme.chat.message.incoming.accentTextColor.withAlphaComponent(0.1) : item.presentationData.theme.theme.chat.message.outgoing.secondaryTextColor.withAlphaComponent(0.1)
|
||||
}
|
||||
shimmeringNode = ShimmeringLinkNode(color: color)
|
||||
shimmeringNode.updateRects(rects)
|
||||
shimmeringNode.frame = self.textNode.textNode.frame
|
||||
shimmeringNode.updateLayout(self.textNode.textNode.frame.size)
|
||||
|
||||
Reference in New Issue
Block a user