Improve web app launch confirmation

This commit is contained in:
Ilya Laktyushin 2023-04-15 14:42:39 +04:00
parent 320ac0688e
commit 8e6e02d1cc
2 changed files with 5 additions and 4 deletions

View File

@ -9167,6 +9167,7 @@ Sorry for the inconvenience.";
"WebApp.LaunchMoreInfo" = "More about this bot";
"WebApp.LaunchConfirmation" = "To launch this web app, you will connect to its website.";
"WebApp.LaunchOpenApp" = "Open App";
"WallpaperPreview.PreviewInNightMode" = "Preview this wallpaper in night mode.";
"WallpaperPreview.PreviewInDayMode" = "Preview this wallpaper in day mode.";

View File

@ -168,7 +168,7 @@ private final class WebAppLaunchConfirmationAlertContentNode: AlertContentNode {
let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
let actionTitleInsets: CGFloat = 8.0
var effectiveActionLayout = TextAlertContentActionLayout.horizontal
var effectiveActionLayout = TextAlertContentActionLayout.vertical
for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
@ -260,11 +260,11 @@ public func webAppLaunchConfirmationController(context: AccountContext, updatedP
var dismissImpl: ((Bool) -> Void)?
var contentNode: WebAppLaunchConfirmationAlertContentNode?
let actions: [TextAlertAction] = [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
dismissImpl?(true)
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {
let actions: [TextAlertAction] = [TextAlertAction(type: .defaultAction, title: presentationData.strings.WebApp_LaunchOpenApp, action: {
dismissImpl?(true)
commit()
}), TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
dismissImpl?(true)
})]
let title = peer.compactDisplayTitle