From b11616a31d4206e996371008e69d0c76a825a6b5 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 27 Jan 2021 18:00:45 +0500 Subject: [PATCH 1/6] Fix mime types --- .../ChatImportUI/Sources/ChatImportActivityScreen.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift b/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift index a5101d6516..8a9edd3735 100644 --- a/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift +++ b/submodules/ChatImportUI/Sources/ChatImportActivityScreen.swift @@ -229,7 +229,12 @@ private final class ImportManager { let uploadedEntrySignal: Signal = unpackedFile |> mapToSignal { tempFile -> Signal 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 switch error { case .chatAdminRequired: From e63330f75478025a63f6fe48841f7b38c8acbf34 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 27 Jan 2021 21:08:20 +0500 Subject: [PATCH 2/6] Chat import fixes --- Telegram/Telegram-iOS/en.lproj/Localizable.strings | 2 +- .../GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift | 4 +++- .../Sources/ChatMessageAnimatedStickerItemNode.swift | 2 ++ .../TelegramUI/Sources/ChatMessageStickerItemNode.swift | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index e8d5885b13..2be2c6b979 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -5936,7 +5936,7 @@ Sorry for the inconvenience."; "ChatImport.Title" = "Select Chat"; "ChatImport.SelectionErrorNotAdmin" = "You need to be an admin of the group to import messages into it."; -"ChatImport.SelectionErrorGroupGeneric" = "You can't import history into this group."; +"ChatImport.SelectionErrorGroupGeneric" = "You can't import history to this group."; "ChatImport.SelectionConfirmationGroupWithTitle" = "Are you sure you want to import messages from **%1$@** into **%2$@**?"; "ChatImport.SelectionConfirmationGroupWithoutTitle" = "Are you sure you want to import messages into **%@**?"; "ChatImport.SelectionConfirmationAlertTitle" = "Import Messages"; diff --git a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift index 8e230946bf..c4bd71e596 100644 --- a/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift +++ b/submodules/GalleryUI/Sources/ChatItemGalleryFooterContentNode.swift @@ -491,7 +491,9 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll 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) } else if let peer = message.peers[message.id.peerId] { authorNameText = peer.displayTitle(strings: self.strings, displayOrder: self.nameOrder) diff --git a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift index bea85e4dc9..e28f137cb9 100644 --- a/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageAnimatedStickerItemNode.swift @@ -1251,6 +1251,8 @@ class ChatMessageAnimatedStickerItemNode: ChatMessageItemView { if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty { 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 { if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil { if case .member = channel.participationStatus { diff --git a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift index 93b49a999e..da2ccb6945 100644 --- a/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageStickerItemNode.swift @@ -818,6 +818,8 @@ class ChatMessageStickerItemNode: ChatMessageItemView { if item.effectiveAuthorId?.namespace == Namespaces.Peer.Empty { 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 { if !item.message.id.peerId.isReplies, let channel = item.content.firstMessage.forwardInfo?.author as? TelegramChannel, channel.username == nil { if case .member = channel.participationStatus { From b0c6118d869b6622ebf8446688cc9298e358f782 Mon Sep 17 00:00:00 2001 From: overtake Date: Wed, 27 Jan 2021 20:44:27 +0400 Subject: [PATCH 3/6] fixed caching emojies --- .../Sources/ManagedSynchronizeEmojiKeywordsOperations.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/submodules/TelegramCore/Sources/ManagedSynchronizeEmojiKeywordsOperations.swift b/submodules/TelegramCore/Sources/ManagedSynchronizeEmojiKeywordsOperations.swift index bbe1a92d9d..3f3266990e 100644 --- a/submodules/TelegramCore/Sources/ManagedSynchronizeEmojiKeywordsOperations.swift +++ b/submodules/TelegramCore/Sources/ManagedSynchronizeEmojiKeywordsOperations.swift @@ -131,6 +131,7 @@ private func synchronizeEmojiKeywords(postbox: Postbox, transaction: Transaction for apiEmojiKeyword in keywords { switch apiEmojiKeyword { case let .emojiKeyword(keyword, emoticons): + let keyword = keyword.replacingOccurrences(of: " ", with: "") 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) itemsToAppend[keyword] = item @@ -200,6 +201,7 @@ private func synchronizeEmojiKeywords(postbox: Postbox, transaction: Transaction var index: Int32 = 0 for apiEmojiKeyword in keywords { 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 item = EmojiKeywordItem(index: ItemCollectionItemIndex(index: index, id: keywordCollectionItemId(keyword, inputLanguageCode: operation.inputLanguageCode)), collectionId: collectionId.id, keyword: keyword, emoticons: emoticons, indexKeys: indexKeys) items.append(item) From fb925d28feab2008e8156294e09f2760a0a97584 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 27 Jan 2021 21:48:28 +0500 Subject: [PATCH 4/6] Filter secret chats --- submodules/TelegramUI/Sources/ShareExtensionContext.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/TelegramUI/Sources/ShareExtensionContext.swift b/submodules/TelegramUI/Sources/ShareExtensionContext.swift index f21a6952ae..72b64e46c4 100644 --- a/submodules/TelegramUI/Sources/ShareExtensionContext.swift +++ b/submodules/TelegramUI/Sources/ShareExtensionContext.swift @@ -729,7 +729,7 @@ public class ShareRootControllerImpl { let presentationData = internalContext.sharedContext.currentPresentationData.with { $0 } 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) }, pretendPresentedInModal: true)) From c11c4b626dfc55b8cc84a57f4ab0d583ff790181 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 27 Jan 2021 23:27:33 +0500 Subject: [PATCH 5/6] Bump version --- versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.json b/versions.json index 21ffadf857..759565ff78 100644 --- a/versions.json +++ b/versions.json @@ -1,5 +1,5 @@ { - "app": "7.4", + "app": "7.4.1", "bazel": "3.7.0", "xcode": "12.3" } From ce9943a9f2f1ce5e6ab013c9a32935b519c0b35d Mon Sep 17 00:00:00 2001 From: Ali <> Date: Thu, 28 Jan 2021 12:51:36 +0500 Subject: [PATCH 6/6] Update localization [skip ci] --- .../Telegram-iOS/en.lproj/Localizable.strings | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 2be2c6b979..aa1a698fd6 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -5931,22 +5931,22 @@ Sorry for the inconvenience."; "CallList.DeleteAllForEveryone" = "Delete for me and Others"; "Conversation.ImportProgress" = "Importing Messages... %@%"; -"Conversation.AudioRateTooltipSpeedUp" = "The audio will now play 2 times faster."; -"Conversation.AudioRateTooltipNormal" = "The audio will now play at normal speed."; +"Conversation.AudioRateTooltipSpeedUp" = "Audio will play two times faster."; +"Conversation.AudioRateTooltipNormal" = "Audio will play at normal speed."; "ChatImport.Title" = "Select Chat"; -"ChatImport.SelectionErrorNotAdmin" = "You need to be an admin of the group to import messages into it."; -"ChatImport.SelectionErrorGroupGeneric" = "You can't import history to this group."; -"ChatImport.SelectionConfirmationGroupWithTitle" = "Are you sure you want to import messages from **%1$@** into **%2$@**?"; -"ChatImport.SelectionConfirmationGroupWithoutTitle" = "Are you sure you want to import messages into **%@**?"; +"ChatImport.SelectionErrorNotAdmin" = "You must to be an admin in the group to import messages to it."; +"ChatImport.SelectionErrorGroupGeneric" = "Sorry, you can't import history to this group."; +"ChatImport.SelectionConfirmationGroupWithTitle" = "Do you want to import messages from **%1$@** into **%2$@**?"; +"ChatImport.SelectionConfirmationGroupWithoutTitle" = "Do you want to import messages into **%@**?"; "ChatImport.SelectionConfirmationAlertTitle" = "Import Messages"; "ChatImport.SelectionConfirmationAlertImportAction" = "Import"; "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.UserErrorNotMutual" = "You can only import messages into private chats with users who added you as a contact."; -"ChatImport.SelectionConfirmationUserWithTitle" = "Import messages from **%1$@** into the chat with **%2$@**?"; -"ChatImport.SelectionConfirmationUserWithoutTitle" = "Import messages into the chat with **%@?**"; +"ChatImport.UserErrorNotMutual" = "You can only import messages into private chats with users who are mutual contacts."; +"ChatImport.SelectionConfirmationUserWithTitle" = "Do you want to import messages from **%1$@** into the chat with **%2$@**?"; +"ChatImport.SelectionConfirmationUserWithoutTitle" = "Do you want to import messages into the chat with **%@?**"; "PeerSelection.ImportIntoNewGroup" = "Import to a New Group"; "Message.ImportedDateFormat" = "%1$@, %2$@ Imported %3$@"; @@ -5954,10 +5954,10 @@ Sorry for the inconvenience."; "ChatImportActivity.Title" = "Importing Chat"; "ChatImportActivity.OpenApp" = "Open Telegram"; "ChatImportActivity.Retry" = "Retry"; -"ChatImportActivity.InProgress" = "Please keep this window open\nduring the import."; -"ChatImportActivity.ErrorNotAdmin" = "You need to be an admin."; -"ChatImportActivity.ErrorInvalidChatType" = "You can't import this history in this type of chat."; -"ChatImportActivity.ErrorUserBlocked" = "This user is blocked."; +"ChatImportActivity.InProgress" = "Please keep this window open\nuntil the import is completed."; +"ChatImportActivity.ErrorNotAdmin" = "You need to be an admin in the group to import messages."; +"ChatImportActivity.ErrorInvalidChatType" = "Wrong type of chat for the messages you are trying to import."; +"ChatImportActivity.ErrorUserBlocked" = "Unable to import messages due to privacy settings."; "ChatImportActivity.ErrorGeneric" = "An error occurred."; "ChatImportActivity.Success" = "Chat imported\nsuccessfully.";