From 1d7c2ec381aec952bdaf1b00d2d6a81faa44e3a1 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sun, 5 Sep 2021 13:52:49 +0400 Subject: [PATCH] Update read list UI --- .../Context Menu/Read.imageset/Contents.json | 12 +++ .../Read.imageset/readchecks_24.pdf | 85 +++++++++++++++++++ .../ChatInterfaceStateContextMenus.swift | 62 +++++++------- .../Sources/SharedAccountContext.swift | 3 +- 4 files changed, 127 insertions(+), 35 deletions(-) create mode 100644 submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/Contents.json create mode 100644 submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/readchecks_24.pdf diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/Contents.json new file mode 100644 index 0000000000..f51c5a300c --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "readchecks_24.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/readchecks_24.pdf b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/readchecks_24.pdf new file mode 100644 index 0000000000..4ace088923 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Chat/Context Menu/Read.imageset/readchecks_24.pdf @@ -0,0 +1,85 @@ +%PDF-1.7 + +1 0 obj + << >> +endobj + +2 0 obj + << /Length 3 0 R >> +stream +/DeviceRGB CS +/DeviceRGB cs +q +1.000000 0.000000 -0.000000 1.000000 1.084961 5.940613 cm +0.000000 0.000000 0.000000 scn +15.402316 10.856923 m +15.652225 11.126056 15.636642 11.546823 15.367509 11.796731 c +15.098376 12.046640 14.677609 12.031056 14.427701 11.761924 c +5.184863 1.808098 l +1.169918 6.492201 l +0.930902 6.771052 0.511087 6.803346 0.232236 6.564330 c +-0.046616 6.325315 -0.078909 5.905500 0.160106 5.626648 c +4.660105 0.376649 l +4.783442 0.232757 4.962314 0.148323 5.151794 0.144557 c +5.341275 0.140790 5.523361 0.218048 5.652318 0.356925 c +15.402316 10.856923 l +h +20.902319 10.856923 m +21.152227 11.126056 21.136642 11.546823 20.867512 11.796731 c +20.598377 12.046639 20.177612 12.031055 19.927704 11.761923 c +10.177705 1.261925 l +9.927795 0.992792 9.943379 0.572026 10.212512 0.322118 c +10.481645 0.072208 10.902411 0.087792 11.152320 0.356925 c +20.902319 10.856923 l +h +f* +n +Q + +endstream +endobj + +3 0 obj + 889 +endobj + +4 0 obj + << /Annots [] + /Type /Page + /MediaBox [ 0.000000 0.000000 24.000000 24.000000 ] + /Resources 1 0 R + /Contents 2 0 R + /Parent 5 0 R + >> +endobj + +5 0 obj + << /Kids [ 4 0 R ] + /Count 1 + /Type /Pages + >> +endobj + +6 0 obj + << /Type /Catalog + /Pages 5 0 R + >> +endobj + +xref +0 7 +0000000000 65535 f +0000000010 00000 n +0000000034 00000 n +0000000979 00000 n +0000001001 00000 n +0000001174 00000 n +0000001248 00000 n +trailer +<< /ID [ (some) (id) ] + /Root 6 0 R + /Size 7 +>> +startxref +1307 +%%EOF \ No newline at end of file diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 9a07fa961d..e584dd7f96 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1053,28 +1053,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState clearCacheAsDelete = true } - - if !isPinnedMessages, !isReplyThreadHead, data.canSelect { - if !selectAll || messages.count == 1 { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelect, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - interfaceInteraction.beginMessageSelection(selectAll ? messages.map { $0.id } : [message.id], { transition in - f(.custom(transition)) - }) - }))) - } - - if messages.count > 1 { - actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelectAll(Int32(messages.count)), icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SelectAll"), color: theme.actionSheet.primaryTextColor) - }, action: { _, f in - interfaceInteraction.beginMessageSelection(messages.map { $0.id }, { transition in - f(.custom(transition)) - }) - }))) - } - } if !isReplyThreadHead, (!data.messageActions.options.intersection([.deleteLocally, .deleteGlobally]).isEmpty || clearCacheAsDelete) { var autoremoveDeadline: Int32? @@ -1102,10 +1080,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } if let autoremoveDeadline = autoremoveDeadline, !isEditing, !isSending { - if !actions.isEmpty { - actions.append(.separator) - } - actions.append(.custom(ChatDeleteMessageContextItem(timestamp: Double(autoremoveDeadline), action: { controller, f in if isEditing { context.account.pendingUpdateMessageManager.cancel(messageId: message.id) @@ -1115,10 +1089,6 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } }), false)) } else if !isUnremovableAction { - if !actions.isEmpty { - actions.append(.separator) - } - actions.append(.action(ContextMenuActionItem(text: title, textColor: .destructive, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: isSending ? "Chat/Context Menu/Clear" : "Chat/Context Menu/Delete"), color: theme.actionSheet.destructiveActionTextColor) }, action: { controller, f in @@ -1132,6 +1102,32 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } } + if !isPinnedMessages, !isReplyThreadHead, data.canSelect { + if !selectAll || messages.count == 1 { + if !actions.isEmpty { + actions.append(.separator) + } + + actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelect, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + interfaceInteraction.beginMessageSelection(selectAll ? messages.map { $0.id } : [message.id], { transition in + f(.custom(transition)) + }) + }))) + } + + if messages.count > 1 { + actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ContextMenuSelectAll(Int32(messages.count)), icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/SelectAll"), color: theme.actionSheet.primaryTextColor) + }, action: { _, f in + interfaceInteraction.beginMessageSelection(messages.map { $0.id }, { transition in + f(.custom(transition)) + }) + }))) + } + } + if let peer = message.peers[message.id.peerId], canViewReadStats(message: message, appConfig: appConfig) { var hasReadReports = false if let channel = peer as? TelegramChannel { @@ -1759,7 +1755,7 @@ private final class ChatReadReportContextItemNode: ASDisplayNode, ContextMenuCus self.buttonNode.accessibilityLabel = presentationData.strings.VoiceChat_StopRecording self.iconNode = ASImageNode() - self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Select"), color: presentationData.theme.actionSheet.primaryTextColor) + self.iconNode.image = generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Read"), color: presentationData.theme.actionSheet.primaryTextColor) self.avatarsNode = AnimatedAvatarSetNode() self.avatarsContext = AnimatedAvatarSetContext() @@ -1887,7 +1883,7 @@ private final class ChatReadReportContextItemNode: ASDisplayNode, ContextMenuCus transition.updateAlpha(node: self.shimmerNode, alpha: self.currentStats == nil ? 1.0 : 0.0) if !iconSize.width.isZero { - transition.updateFrameAdditive(node: self.iconNode, frame: CGRect(origin: CGPoint(x: sideInset - 2.0, y: floor((size.height - iconSize.height) / 2.0)), size: iconSize)) + transition.updateFrameAdditive(node: self.iconNode, frame: CGRect(origin: CGPoint(x: sideInset + 1.0, y: floor((size.height - iconSize.height) / 2.0)), size: iconSize)) } let avatarsContent: AnimatedAvatarSetContext.Content @@ -1903,7 +1899,7 @@ private final class ChatReadReportContextItemNode: ASDisplayNode, ContextMenuCus placeholderAvatarsContent = self.avatarsContext.updatePlaceholder(color: shimmeringForegroundColor, count: 3, animated: false) let avatarsSize = self.avatarsNode.update(context: self.item.context, content: avatarsContent, itemSize: CGSize(width: 24.0, height: 24.0), customSpacing: 10.0, animated: false, synchronousLoad: true) - self.avatarsNode.frame = CGRect(origin: CGPoint(x: size.width - sideInset - 8.0 - avatarsSize.width, y: floor((size.height - avatarsSize.height) / 2.0)), size: avatarsSize) + self.avatarsNode.frame = CGRect(origin: CGPoint(x: size.width - sideInset - 12.0 - avatarsSize.width, y: floor((size.height - avatarsSize.height) / 2.0)), size: avatarsSize) transition.updateAlpha(node: self.avatarsNode, alpha: self.currentStats == nil ? 0.0 : 1.0) let placeholderAvatarsSize = self.placeholderAvatarsNode.update(context: self.item.context, content: placeholderAvatarsContent, itemSize: CGSize(width: 24.0, height: 24.0), customSpacing: 10.0, animated: false, synchronousLoad: true) diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index 46928694bf..a58ea0267c 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -563,8 +563,7 @@ public final class SharedAccountContextImpl: SharedAccountContext { } if self.activeAccountsValue!.primary == nil && self.activeAccountsValue!.currentAuth == nil { - //TODO:change to production after merging - self.beginNewAuth(testingEnvironment: true) + self.beginNewAuth(testingEnvironment: false) } })) })