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

This commit is contained in:
Ilya Laktyushin 2022-04-04 22:19:46 +04:00
commit f85ed53d48
4 changed files with 63 additions and 55 deletions

View File

@ -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]().";

View File

@ -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
)

View File

@ -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) {

View File

@ -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
]