Merge branches 'master' and 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2021-01-28 20:37:57 +03:00
commit 04f8d29c01
8 changed files with 31 additions and 18 deletions

View File

@ -5931,22 +5931,22 @@ Sorry for the inconvenience.";
"CallList.DeleteAllForEveryone" = "Delete for me and Others"; "CallList.DeleteAllForEveryone" = "Delete for me and Others";
"Conversation.ImportProgress" = "Importing Messages... %@%"; "Conversation.ImportProgress" = "Importing Messages... %@%";
"Conversation.AudioRateTooltipSpeedUp" = "The audio will now play 2 times faster."; "Conversation.AudioRateTooltipSpeedUp" = "Audio will play two times faster.";
"Conversation.AudioRateTooltipNormal" = "The audio will now play at normal speed."; "Conversation.AudioRateTooltipNormal" = "Audio will play at normal speed.";
"ChatImport.Title" = "Select Chat"; "ChatImport.Title" = "Select Chat";
"ChatImport.SelectionErrorNotAdmin" = "You need to be an admin of the group to import messages into it."; "ChatImport.SelectionErrorNotAdmin" = "You must to be an admin in the group to import messages to it.";
"ChatImport.SelectionErrorGroupGeneric" = "You can't import history into this group."; "ChatImport.SelectionErrorGroupGeneric" = "Sorry, you can't import history to this group.";
"ChatImport.SelectionConfirmationGroupWithTitle" = "Are you sure you want to import messages from **%1$@** into **%2$@**?"; "ChatImport.SelectionConfirmationGroupWithTitle" = "Do you want to import messages from **%1$@** into **%2$@**?";
"ChatImport.SelectionConfirmationGroupWithoutTitle" = "Are you sure you want to import messages into **%@**?"; "ChatImport.SelectionConfirmationGroupWithoutTitle" = "Do you want to import messages into **%@**?";
"ChatImport.SelectionConfirmationAlertTitle" = "Import Messages"; "ChatImport.SelectionConfirmationAlertTitle" = "Import Messages";
"ChatImport.SelectionConfirmationAlertImportAction" = "Import"; "ChatImport.SelectionConfirmationAlertImportAction" = "Import";
"ChatImport.CreateGroupAlertTitle" = "Create Group and Import Messages"; "ChatImport.CreateGroupAlertTitle" = "Create Group and Import Messages";
"ChatImport.CreateGroupAlertText" = "Are you sure you want to create the group **%@** and import messages from another messaging app?"; "ChatImport.CreateGroupAlertText" = "Do you want to create the group **%@** and import messages from another messaging app?";
"ChatImport.CreateGroupAlertImportAction" = "Create and Import"; "ChatImport.CreateGroupAlertImportAction" = "Create and Import";
"ChatImport.UserErrorNotMutual" = "You can only import messages into private chats with users who added you as a contact."; "ChatImport.UserErrorNotMutual" = "You can only import messages into private chats with users who are mutual contacts.";
"ChatImport.SelectionConfirmationUserWithTitle" = "Import messages from **%1$@** into the chat with **%2$@**?"; "ChatImport.SelectionConfirmationUserWithTitle" = "Do you want to import messages from **%1$@** into the chat with **%2$@**?";
"ChatImport.SelectionConfirmationUserWithoutTitle" = "Import messages into the chat with **%@?**"; "ChatImport.SelectionConfirmationUserWithoutTitle" = "Do you want to import messages into the chat with **%@?**";
"PeerSelection.ImportIntoNewGroup" = "Import to a New Group"; "PeerSelection.ImportIntoNewGroup" = "Import to a New Group";
"Message.ImportedDateFormat" = "%1$@, %2$@ Imported %3$@"; "Message.ImportedDateFormat" = "%1$@, %2$@ Imported %3$@";
@ -5954,10 +5954,10 @@ Sorry for the inconvenience.";
"ChatImportActivity.Title" = "Importing Chat"; "ChatImportActivity.Title" = "Importing Chat";
"ChatImportActivity.OpenApp" = "Open Telegram"; "ChatImportActivity.OpenApp" = "Open Telegram";
"ChatImportActivity.Retry" = "Retry"; "ChatImportActivity.Retry" = "Retry";
"ChatImportActivity.InProgress" = "Please keep this window open\nduring the import."; "ChatImportActivity.InProgress" = "Please keep this window open\nuntil the import is completed.";
"ChatImportActivity.ErrorNotAdmin" = "You need to be an admin."; "ChatImportActivity.ErrorNotAdmin" = "You need to be an admin in the group to import messages.";
"ChatImportActivity.ErrorInvalidChatType" = "You can't import this history in this type of chat."; "ChatImportActivity.ErrorInvalidChatType" = "Wrong type of chat for the messages you are trying to import.";
"ChatImportActivity.ErrorUserBlocked" = "This user is blocked."; "ChatImportActivity.ErrorUserBlocked" = "Unable to import messages due to privacy settings.";
"ChatImportActivity.ErrorGeneric" = "An error occurred."; "ChatImportActivity.ErrorGeneric" = "An error occurred.";
"ChatImportActivity.Success" = "Chat imported\nsuccessfully."; "ChatImportActivity.Success" = "Chat imported\nsuccessfully.";

View File

@ -229,7 +229,12 @@ private final class ImportManager {
let uploadedEntrySignal: Signal<Float, ImportError> = unpackedFile let uploadedEntrySignal: Signal<Float, ImportError> = unpackedFile
|> mapToSignal { tempFile -> Signal<Float, ImportError> in |> mapToSignal { tempFile -> Signal<Float, ImportError> in
return ChatHistoryImport.uploadMedia(account: account, session: session, file: tempFile, fileName: entry.0.path, mimeType: entry.1, type: entry.2) let pathExtension = (entry.1 as NSString).pathExtension
var mimeType = "application/octet-stream"
if !pathExtension.isEmpty, let value = TGMimeTypeMap.mimeType(forExtension: pathExtension) {
mimeType = value
}
return ChatHistoryImport.uploadMedia(account: account, session: session, file: tempFile, fileName: entry.0.path, mimeType: mimeType, type: entry.2)
|> mapError { error -> ImportError in |> mapError { error -> ImportError in
switch error { switch error {
case .chatAdminRequired: case .chatAdminRequired:

View File

@ -491,7 +491,9 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
var authorNameText: String? var authorNameText: String?
if let author = message.effectiveAuthor { if let forwardInfo = message.forwardInfo, forwardInfo.flags.contains(.isImported), let authorSignature = forwardInfo.authorSignature {
authorNameText = authorSignature
} else if let author = message.effectiveAuthor {
authorNameText = author.displayTitle(strings: self.strings, displayOrder: self.nameOrder) authorNameText = author.displayTitle(strings: self.strings, displayOrder: self.nameOrder)
} else if let peer = message.peers[message.id.peerId] { } else if let peer = message.peers[message.id.peerId] {
authorNameText = peer.displayTitle(strings: self.strings, displayOrder: self.nameOrder) authorNameText = peer.displayTitle(strings: self.strings, displayOrder: self.nameOrder)

View File

@ -131,6 +131,7 @@ private func synchronizeEmojiKeywords(postbox: Postbox, transaction: Transaction
for apiEmojiKeyword in keywords { for apiEmojiKeyword in keywords {
switch apiEmojiKeyword { switch apiEmojiKeyword {
case let .emojiKeyword(keyword, emoticons): case let .emojiKeyword(keyword, emoticons):
let keyword = keyword.replacingOccurrences(of: " ", with: "")
let indexKeys = stringIndexTokens(keyword, transliteration: .none).map { $0.toMemoryBuffer() } let indexKeys = stringIndexTokens(keyword, transliteration: .none).map { $0.toMemoryBuffer() }
let item = EmojiKeywordItem(index: ItemCollectionItemIndex(index: 0, id: 0), collectionId: collectionId.id, keyword: keyword, emoticons: emoticons, indexKeys: indexKeys) let item = EmojiKeywordItem(index: ItemCollectionItemIndex(index: 0, id: 0), collectionId: collectionId.id, keyword: keyword, emoticons: emoticons, indexKeys: indexKeys)
itemsToAppend[keyword] = item itemsToAppend[keyword] = item
@ -200,6 +201,7 @@ private func synchronizeEmojiKeywords(postbox: Postbox, transaction: Transaction
var index: Int32 = 0 var index: Int32 = 0
for apiEmojiKeyword in keywords { for apiEmojiKeyword in keywords {
if case let .emojiKeyword(keyword, emoticons) = apiEmojiKeyword, !emoticons.isEmpty { if case let .emojiKeyword(keyword, emoticons) = apiEmojiKeyword, !emoticons.isEmpty {
let keyword = keyword.replacingOccurrences(of: " ", with: "")
let indexKeys = stringIndexTokens(keyword, transliteration: .none).map { $0.toMemoryBuffer() } let indexKeys = stringIndexTokens(keyword, transliteration: .none).map { $0.toMemoryBuffer() }
let item = EmojiKeywordItem(index: ItemCollectionItemIndex(index: index, id: keywordCollectionItemId(keyword, inputLanguageCode: operation.inputLanguageCode)), collectionId: collectionId.id, keyword: keyword, emoticons: emoticons, indexKeys: indexKeys) let item = EmojiKeywordItem(index: ItemCollectionItemIndex(index: index, id: keywordCollectionItemId(keyword, inputLanguageCode: operation.inputLanguageCode)), collectionId: collectionId.id, keyword: keyword, emoticons: emoticons, indexKeys: indexKeys)
items.append(item) items.append(item)

View File

@ -1251,6 +1251,8 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty { if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame) item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
} else if let forwardInfo = item.content.firstMessage.forwardInfo, forwardInfo.flags.contains(.isImported), forwardInfo.author == nil {
item.controllerInteraction.displayImportedMessageTooltip(avatarNode)
} else { } else {
if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil { if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
if case .member = channel.participationStatus { if case .member = channel.participationStatus {

View File

@ -818,6 +818,8 @@ class ChatMessageStickerItemNode: ChatMessageItemView {
if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty { if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty {
item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame) item.controllerInteraction.displayMessageTooltip(item.content.firstMessage.id, item.presentationData.strings.Conversation_ForwardAuthorHiddenTooltip, self, avatarNode.frame)
} else if let forwardInfo = item.content.firstMessage.forwardInfo, forwardInfo.flags.contains(.isImported), forwardInfo.author == nil {
item.controllerInteraction.displayImportedMessageTooltip(avatarNode)
} else { } else {
if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil { if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil {
if case .member = channel.participationStatus { if case .member = channel.participationStatus {

View File

@ -729,7 +729,7 @@ public class ShareRootControllerImpl {
let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 } let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 }
var attemptSelectionImpl: ((Peer) -> Void)? var attemptSelectionImpl: ((Peer) -> Void)?
let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyPrivateChats, .excludeDisabled, .doNotSearchMessages], hasChatListSelector: false, hasContactSelector: true, hasGlobalSearch: false, title: presentationData.strings.ChatImport_Title, attemptSelection: { peer in let controller = context.sharedContext.makePeerSelectionController(PeerSelectionControllerParams(context: context, filter: [.onlyPrivateChats, .excludeDisabled, .doNotSearchMessages, .excludeSecretChats], hasChatListSelector: false, hasContactSelector: true, hasGlobalSearch: false, title: presentationData.strings.ChatImport_Title, attemptSelection: { peer in
attemptSelectionImpl?(peer) attemptSelectionImpl?(peer)
}, pretendPresentedInModal: true)) }, pretendPresentedInModal: true))

View File

@ -1,5 +1,5 @@
{ {
"app": "7.4", "app": "7.4.1",
"bazel": "3.7.0", "bazel": "3.7.0",
"xcode": "12.3" "xcode": "12.3"
} }