From b9fb58b312ffde7bf93d1a3c9470ac8541569d19 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 4 Apr 2022 20:06:05 +0400 Subject: [PATCH 1/3] Update menu --- .../ContextControllerActionsStackNode.swift | 22 ++++-- .../Sources/PeerInfo/PeerInfoScreen.swift | 73 ++++++++++--------- 2 files changed, 51 insertions(+), 44 deletions(-) diff --git a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift index 8a59bc8e9a..b30ea3e75f 100644 --- a/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift +++ b/submodules/ContextUI/Sources/ContextControllerActionsStackNode.swift @@ -13,7 +13,8 @@ public protocol ContextControllerActionsStackItemNode: ASDisplayNode { func update( presentationData: PresentationData, constrainedSize: CGSize, - standardWidth: CGFloat, + standardMinWidth: CGFloat, + standardMaxWidth: CGFloat, transition: ContainedViewLayoutTransition ) -> (size: CGSize, apparentHeight: CGFloat) @@ -476,7 +477,8 @@ final class ContextControllerActionsListStackItem: ContextControllerActionsStack func update( presentationData: PresentationData, constrainedSize: CGSize, - standardWidth: CGFloat, + standardMinWidth: CGFloat, + standardMaxWidth: CGFloat, transition: ContainedViewLayoutTransition ) -> (size: CGSize, apparentHeight: CGFloat) { var itemNodeLayouts: [(minSize: CGSize, apply: (_ size: CGSize, _ transition: ContainedViewLayoutTransition) -> Void)] = [] @@ -486,13 +488,13 @@ final class ContextControllerActionsListStackItem: ContextControllerActionsStack let itemNodeLayout = item.node.update( presentationData: presentationData, - constrainedSize: CGSize(width: standardWidth, height: constrainedSize.height) + constrainedSize: CGSize(width: standardMaxWidth, height: constrainedSize.height) ) itemNodeLayouts.append(itemNodeLayout) combinedSize.width = max(combinedSize.width, itemNodeLayout.minSize.width) combinedSize.height += itemNodeLayout.minSize.height } - combinedSize.width = max(combinedSize.width, standardWidth) + combinedSize.width = max(combinedSize.width, standardMinWidth) var nextItemOrigin = CGPoint() for i in 0 ..< self.itemNodes.count { @@ -619,7 +621,8 @@ final class ContextControllerActionsCustomStackItem: ContextControllerActionsSta func update( presentationData: PresentationData, constrainedSize: CGSize, - standardWidth: CGFloat, + standardMinWidth: CGFloat, + standardMaxWidth: CGFloat, transition: ContainedViewLayoutTransition ) -> (size: CGSize, apparentHeight: CGFloat) { let contentLayout = self.contentNode.update( @@ -830,14 +833,16 @@ final class ContextControllerActionsStackNode: ASDisplayNode { func update( presentationData: PresentationData, constrainedSize: CGSize, - standardWidth: CGFloat, + standardMinWidth: CGFloat, + standardMaxWidth: CGFloat, transitionFraction: CGFloat, transition: ContainedViewLayoutTransition ) -> (size: CGSize, apparentHeight: CGFloat) { let (size, apparentHeight) = self.node.update( presentationData: presentationData, constrainedSize: constrainedSize, - standardWidth: standardWidth, + standardMinWidth: standardMinWidth, + standardMaxWidth: standardMaxWidth, transition: transition ) @@ -1076,7 +1081,8 @@ final class ContextControllerActionsStackNode: ASDisplayNode { let itemSize = itemContainer.update( presentationData: presentationData, constrainedSize: CGSize(width: constrainedSize.width, height: itemConstrainedHeight), - standardWidth: 250.0, + standardMinWidth: 220.0, + standardMaxWidth: 240.0, transitionFraction: alphaTransitionFraction, transition: itemContainerTransition ) diff --git a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift index 8aed53a141..dd1df3eb29 100644 --- a/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift +++ b/submodules/TelegramUI/Sources/PeerInfo/PeerInfoScreen.swift @@ -3542,40 +3542,6 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate var items: [ContextMenuItem] = [] - var isSoundEnabled = true - if let notificationSettings = self.data?.notificationSettings { - switch notificationSettings.messageSound { - case .none: - isSoundEnabled = false - default: - break - } - } - - if !isSoundEnabled { - items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_EnableSound, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Unmute"), color: theme.contextMenu.primaryColor) - }, action: { [weak self] _, f in - f(.default) - - guard let strongSelf = self else { - return - } - let _ = strongSelf.context.engine.peers.updatePeerNotificationSoundInteractive(peerId: strongSelf.peerId, sound: .default).start() - }))) - } else { - items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_DisableSound, icon: { theme in - return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor) - }, action: { [weak self] _, f in - f(.default) - - guard let strongSelf = self else { - return - } - let _ = strongSelf.context.engine.peers.updatePeerNotificationSoundInteractive(peerId: strongSelf.peerId, sound: .none).start() - }))) - } - items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_MuteFor, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Mute2d"), color: theme.contextMenu.primaryColor) }, action: { [weak self] c, _ in @@ -3622,6 +3588,42 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate c.pushItems(items: .single(ContextController.Items(content: .list(subItems)))) }))) + items.append(.separator) + + var isSoundEnabled = true + if let notificationSettings = self.data?.notificationSettings { + switch notificationSettings.messageSound { + case .none: + isSoundEnabled = false + default: + break + } + } + + if !isSoundEnabled { + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_EnableSound, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Unmute"), color: theme.contextMenu.primaryColor) + }, action: { [weak self] _, f in + f(.default) + + guard let strongSelf = self else { + return + } + let _ = strongSelf.context.engine.peers.updatePeerNotificationSoundInteractive(peerId: strongSelf.peerId, sound: .default).start() + }))) + } else { + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_DisableSound, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Muted"), color: theme.contextMenu.primaryColor) + }, action: { [weak self] _, f in + f(.default) + + guard let strongSelf = self else { + return + } + let _ = strongSelf.context.engine.peers.updatePeerNotificationSoundInteractive(peerId: strongSelf.peerId, sound: .none).start() + }))) + } + items.append(.action(ContextMenuActionItem(text: self.presentationData.strings.PeerInfo_NotificationsCustomize, icon: { theme in return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Customize"), color: theme.contextMenu.primaryColor) }, action: { [weak self] _, f in @@ -3795,8 +3797,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewDelegate subItems.append(.separator) let presetValues: [Int32] = [ - 60 * 60, - 24 * 60 * 60, + 1 * 24 * 60 * 60, 7 * 24 * 60 * 60, 31 * 24 * 60 * 60 ] From ef7016e67dd45ba6cba4e2652ff1f9c9848eb80c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 4 Apr 2022 20:06:13 +0400 Subject: [PATCH 2/3] Add range --- submodules/Stripe/Sources/STPBINRange.m | 1 + 1 file changed, 1 insertion(+) diff --git a/submodules/Stripe/Sources/STPBINRange.m b/submodules/Stripe/Sources/STPBINRange.m index 9998b79178..964bfaafeb 100755 --- a/submodules/Stripe/Sources/STPBINRange.m +++ b/submodules/Stripe/Sources/STPBINRange.m @@ -66,6 +66,7 @@ @[@"492937", @"492937", @13, @(STPCardBrandVisa)], @[@"492939", @"492939", @13, @(STPCardBrandVisa)], @[@"492960", @"492960", @13, @(STPCardBrandVisa)], + @[@"2", @"2", @16, @(STPCardBrandVisa)], ]; NSMutableArray *binRanges = [NSMutableArray array]; for (NSArray *range in ranges) { From c7914c433252529b58cad90dbc6fed589e37f95b Mon Sep 17 00:00:00 2001 From: Ali <> Date: Mon, 4 Apr 2022 20:08:05 +0400 Subject: [PATCH 3/3] Update localization --- .../Telegram-iOS/en.lproj/Localizable.strings | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index bf6de61b83..cb6f6cf044 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -7391,7 +7391,7 @@ Sorry for the inconvenience."; "Bot.AddToChatInfo" = "This bot is able to manage a group or channel."; "Bot.AddToChat.Title" = "Add to Group or Channel"; -"Bot.AddToChat.MyChannels" = "CHANNEL I MANAGE"; +"Bot.AddToChat.MyChannels" = "CHANNELS I MANAGE"; "Bot.AddToChat.MyGroups" = "GROUPS I MANAGE"; "Bot.AddToChat.OtherGroups" = "GROUPS"; @@ -7401,28 +7401,28 @@ Sorry for the inconvenience."; "Bot.AddToChat.Add.AddAsMember" = "Add Bot as Member"; "Bot.AddToChat.Add.AdminAlertTitle" = "Add Bot as Admin?"; -"Bot.AddToChat.Add.AdminAlertTextGroup" = "Are you sure you want to add the bot as an admin in the group **%@**?"; -"Bot.AddToChat.Add.AdminAlertTextChannel" = "Are you sure you want to add the bot as an admin in the channel **%@**?"; +"Bot.AddToChat.Add.AdminAlertTextGroup" = "Are you sure you want to add the bot as an admin in **%@**?"; +"Bot.AddToChat.Add.AdminAlertTextChannel" = "Are you sure you want to add the bot as an admin in **%@**?"; "Bot.AddToChat.Add.AdminAlertAdd" = "Add as Admin"; "Bot.AddToChat.Add.MemberAlertTitle" = "Add Bot as Member?"; -"Bot.AddToChat.Add.MemberAlertTextGroup" = "Are you sure you want to add the bot as a member in the group **%@**?"; -"Bot.AddToChat.Add.MemberAlertTextChannel" = "Are you sure you want to add the bot as a member in the channel **%@**?"; +"Bot.AddToChat.Add.MemberAlertTextGroup" = "Are you sure you want to add the bot as a member in **%@**?"; +"Bot.AddToChat.Add.MemberAlertTextChannel" = "Are you sure you want to add the bot as a member in **%@**?"; "Bot.AddToChat.Add.MemberAlertAdd" = "Add as Member"; "PeerInfo.ButtonStop" = "Stop"; -"Localization.ShowTranslateInfoExtended" = "Show 'Translate' button in the message context menu.\n\nGoogle may have access to the messages you translate."; +"Localization.ShowTranslateInfoExtended" = "Show a 'Translate' button in the message context menu.\n\nGoogle may have access to message text you translate."; "WebApp.OpenBot" = "Open Bot"; "WebApp.ReloadPage" = "Reload Page"; "WebApp.RemoveBot" = "Remove Bot"; -"WebApp.AddToAttachmentText" = "%@ asks your permission to be added as an option to your attachments menu so you access it from any chat."; +"WebApp.AddToAttachmentText" = "%@ requests your permission to be added as an option to your attachments menu, so you can access it from any chat."; "WebApp.AddToAttachmentAdd" = "Add"; -"WebApp.AddToAttachmentAlreadyAddedError" = "This bot is already added in the attachment menu."; "WebApp.AddToAttachmentUnavailableError" = "This bot can't be added to the attachment menu."; +"WebApp.AddToAttachmentAlreadyAddedError" = "This bot is already added to your attachment menu."; "WebApp.OpenWebViewAlertTitle" = "Open Web App"; "WebApp.OpenWebViewAlertText" = "**%@** would like to open its web app to proceed.\n\nIt will be able to access your **IP address** and basic device info."; @@ -7434,14 +7434,14 @@ Sorry for the inconvenience."; "Notifications.TelegramTones" = "TELEGRAM TONES"; "Notifications.UploadSound" = "Upload Sound"; -"Notifications.MessageSoundInfo" = "Long tap on any short voice note or mp3 file in chat\nand select \"Save for Notifications\". It will appear here."; +"Notifications.MessageSoundInfo" = "Press and hold a short voice note or mp3 file in any chat and select \"Save for Notifications\". It will appear here."; "Notification.WebAppSentData" = "You have successfully transferred data from the \"%@\" button to the bot."; "Notifications.UploadError.TooLarge.Title" = "Audio is too large"; -"Notifications.UploadError.TooLarge.Text" = "The file is over %@."; +"Notifications.UploadError.TooLarge.Text" = "File is over %@."; "Notifications.UploadError.TooLong.Title" = "%@ is too long."; -"Notifications.UploadError.TooLong.Text" = "The duration is longer than %@."; +"Notifications.UploadError.TooLong.Text" = "Duration must be less than %@."; "Notifications.UploadSuccess.Title" = "Sound Added"; "Notifications.UploadSuccess.Text" = "The sound **%@** was added to your Telegram tones."; "Notifications.SaveSuccess.Text" = "You can now use this sound as a notification tone in your [custom notification settings]().";