mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Version 11.9
This commit is contained in:
@@ -685,7 +685,8 @@ extension ChatControllerImpl {
|
||||
if counterAndTimestamp.0 >= 3 {
|
||||
maybeSuggestPremium = true
|
||||
}
|
||||
if (isPremium || maybeSuggestPremium) && !isHidden {
|
||||
// MARK: Swiftgram
|
||||
if (isPremium || maybeSuggestPremium || true) && !isHidden {
|
||||
return chatTranslationState(context: context, peerId: peerId)
|
||||
|> map { translationState -> ChatPresentationTranslationState? in
|
||||
if let translationState, !translationState.fromLang.isEmpty && (translationState.fromLang != baseLanguageCode || translationState.isEnabled) {
|
||||
@@ -706,6 +707,22 @@ extension ChatControllerImpl {
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// MARK: Swiftgram
|
||||
self.chatLanguagePredictionDisposable = (
|
||||
chatTranslationState(context: context, peerId: peerId, forcePredict: true)
|
||||
|> map { translationState -> ChatPresentationTranslationState? in
|
||||
if let translationState, !translationState.fromLang.isEmpty {
|
||||
return ChatPresentationTranslationState(isEnabled: translationState.isEnabled, fromLang: translationState.fromLang, toLang: translationState.toLang ?? baseLanguageCode)
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged).startStrict(next: { [weak self] translationState in
|
||||
if let strongSelf = self, let translationState = translationState, strongSelf.predictedChatLanguage == nil {
|
||||
strongSelf.predictedChatLanguage = translationState.fromLang
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
let premiumGiftOptions: Signal<[CachedPremiumGiftOption], NoError> = .single([])
|
||||
@@ -2175,12 +2192,24 @@ extension ChatControllerImpl {
|
||||
}
|
||||
}))
|
||||
}
|
||||
}, forwardSelectedMessages: { [weak self] in
|
||||
}, forwardSelectedMessages: { [weak self] mode in
|
||||
if let strongSelf = self {
|
||||
strongSelf.commitPurposefulAction()
|
||||
if let forwardMessageIdsSet = strongSelf.presentationInterfaceState.interfaceState.selectionState?.selectedIds {
|
||||
let forwardMessageIds = Array(forwardMessageIdsSet).sorted()
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
// MARK: Swiftgram
|
||||
if let mode = mode {
|
||||
switch (mode) {
|
||||
case "toCloud":
|
||||
strongSelf.forwardMessagesToCloud(messageIds: forwardMessageIds, removeNames: false, openCloud: false, resetCurrent: true)
|
||||
case "hideNames":
|
||||
strongSelf.forwardMessages(forceHideNames: true, messageIds: forwardMessageIds, options: ChatInterfaceForwardOptionsState(hideNames: true, hideCaptions: false, unhideNamesOnCaptionChange: false))
|
||||
default:
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
}
|
||||
} else {
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, forwardCurrentForwardMessages: { [weak self] in
|
||||
@@ -2190,7 +2219,7 @@ extension ChatControllerImpl {
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds, options: strongSelf.presentationInterfaceState.interfaceState.forwardOptionsState, resetCurrent: true)
|
||||
}
|
||||
}
|
||||
}, forwardMessages: { [weak self] messages in
|
||||
}, forwardMessages: { [weak self] messages, mode in
|
||||
if let strongSelf = self, !messages.isEmpty {
|
||||
guard !strongSelf.presentAccountFrozenInfoIfNeeded(delay: true) else {
|
||||
return
|
||||
@@ -2198,7 +2227,22 @@ extension ChatControllerImpl {
|
||||
|
||||
strongSelf.commitPurposefulAction()
|
||||
let forwardMessageIds = messages.map { $0.id }.sorted()
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
// MARK: Swiftgram
|
||||
if let mode = mode {
|
||||
switch (mode) {
|
||||
case "forwardMessagesToCloudWithNoNamesAndOpen":
|
||||
strongSelf.forwardMessagesToCloud(messageIds: forwardMessageIds, removeNames: true, openCloud: true)
|
||||
case "forwardMessagesToCloud":
|
||||
strongSelf.forwardMessagesToCloud(messageIds: forwardMessageIds, removeNames: false, openCloud: false)
|
||||
case "forwardMessagesWithNoNames":
|
||||
strongSelf.forwardMessages(forceHideNames: true, messageIds: forwardMessageIds, options: ChatInterfaceForwardOptionsState(hideNames: true, hideCaptions: false, unhideNamesOnCaptionChange: false))
|
||||
default:
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
}
|
||||
} else {
|
||||
strongSelf.forwardMessages(messageIds: forwardMessageIds)
|
||||
}
|
||||
|
||||
}
|
||||
}, updateForwardOptionsState: { [weak self] f in
|
||||
if let strongSelf = self {
|
||||
@@ -5076,4 +5120,4 @@ extension ChatControllerImpl {
|
||||
|
||||
self.displayNodeDidLoad()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user