Update Ghostgram features

This commit is contained in:
ichmagmaus 812
2026-03-07 18:15:32 +01:00
parent 1a3303b059
commit 24a7ec39d9
902 changed files with 148302 additions and 62355 deletions
@@ -21,6 +21,17 @@ import ComponentFlow
import ComponentDisplayAdapters
import LocalMediaResources
import AppBundle
import SGSimpleSettings
private func sgChatTranslationAvailable(isPremium: Bool, peer: EnginePeer?) -> Bool {
if isPremium || SGSimpleSettings.shared.translationBackendEnum != .default {
return true
}
if case let .channel(channel)? = peer, channel.flags.contains(.autoTranslateEnabled) {
return true
}
return false
}
final class ChatTranslationPanelNode: ASDisplayNode {
private let context: AccountContext
@@ -179,7 +190,7 @@ final class ChatTranslationPanelNode: ASDisplayNode {
let closeButtonSize = self.closeButton.measure(CGSize(width: 100.0, height: 100.0))
self.closeButton.frame = CGRect(origin: CGPoint(x: width - contentRightInset - closeButtonSize.width, y: floorToScreenPixels((panelHeight - closeButtonSize.height) / 2.0)), size: closeButtonSize)
if info.isPremium {
if sgChatTranslationAvailable(isPremium: info.isPremium, peer: info.peer) {
self.moreButton.isHidden = false
self.closeButton.isHidden = true
} else {
@@ -212,11 +223,7 @@ final class ChatTranslationPanelNode: ASDisplayNode {
return
}
let isPremium = info.isPremium
var translationAvailable = isPremium
if case let .channel(channel) = info.peer, channel.flags.contains(.autoTranslateEnabled) {
translationAvailable = true
}
let translationAvailable = sgChatTranslationAvailable(isPremium: isPremium, peer: info.peer)
if translationAvailable {
self.close()
@@ -231,11 +238,7 @@ final class ChatTranslationPanelNode: ASDisplayNode {
}
let isPremium = info.isPremium
var translationAvailable = isPremium
if case let .channel(channel) = info.peer, channel.flags.contains(.autoTranslateEnabled) {
translationAvailable = true
}
let translationAvailable = sgChatTranslationAvailable(isPremium: isPremium, peer: info.peer)
if translationAvailable {
self.toggle()