Fix channel ownership transfer alert layout

This commit is contained in:
Ilya Laktyushin 2020-05-11 04:56:04 +04:00
parent 46fd026a2c
commit bd2b30b51f
10 changed files with 1862 additions and 1859 deletions

View File

@ -5504,3 +5504,5 @@ Any member of this group will be able to see messages in the channel.";
"ChatList.Context.AddToFolder" = "Add to Folder"; "ChatList.Context.AddToFolder" = "Add to Folder";
"ChatList.Context.Back" = "Back"; "ChatList.Context.Back" = "Back";
"ChatList.AddedToFolderTooltip" = "%1$@ has been added to folder %2$@"; "ChatList.AddedToFolderTooltip" = "%1$@ has been added to folder %2$@";
"OwnershipTransfer.Transfer" = "Transfer";

View File

@ -200,7 +200,7 @@ private final class ArchivedStickersNoticeAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }

View File

@ -199,7 +199,7 @@ private final class BotCheckoutPasswordAlertContentNode: AlertContentNode {
let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count)) let maxActionWidth: CGFloat = floor(size.width / CGFloat(self.actionNodes.count))
let actionTitleInsets: CGFloat = 8.0 let actionTitleInsets: CGFloat = 8.0
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionsHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionsHeight))
minActionsWidth += actionTitleSize.width + actionTitleInsets minActionsWidth += actionTitleSize.width + actionTitleInsets
} }

View File

@ -313,7 +313,7 @@ private final class ChannelOwnershipTransferAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }
@ -419,7 +419,7 @@ private func commitChannelOwnershipTransferController(context: AccountContext, p
let contentNode = ChannelOwnershipTransferAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: { let contentNode = ChannelOwnershipTransferAlertContentNode(theme: AlertControllerTheme(presentationData: presentationData), ptheme: presentationData.theme, strings: presentationData.strings, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_Cancel, action: {
dismissImpl?() dismissImpl?()
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Done, action: { }), TextAlertAction(type: .defaultAction, title: presentationData.strings.OwnershipTransfer_Transfer, action: {
proceedImpl?() proceedImpl?()
})]) })])

View File

@ -148,7 +148,7 @@ private final class CallRatingAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }

View File

@ -126,7 +126,7 @@ private final class CallSuggestTabAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }

View File

@ -225,7 +225,7 @@ private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }
@ -244,10 +244,10 @@ private final class ChatMessageActionUrlAuthAlertContentNode: AlertContentNode {
var actionsHeight: CGFloat = 0.0 var actionsHeight: CGFloat = 0.0
switch effectiveActionLayout { switch effectiveActionLayout {
case .horizontal: case .horizontal:
actionsHeight = actionButtonHeight actionsHeight = actionButtonHeight
case .vertical: case .vertical:
actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count) actionsHeight = actionButtonHeight * CGFloat(self.actionNodes.count)
} }
let resultWidth = contentWidth + insets.left + insets.right let resultWidth = contentWidth + insets.left + insets.right

View File

@ -292,7 +292,7 @@ private final class ChatTextLinkEditAlertContentNode: AlertContentNode {
var effectiveActionLayout = TextAlertContentActionLayout.horizontal var effectiveActionLayout = TextAlertContentActionLayout.horizontal
for actionNode in self.actionNodes { for actionNode in self.actionNodes {
let actionTitleSize = actionNode.titleNode.measure(CGSize(width: maxActionWidth, height: actionButtonHeight)) let actionTitleSize = actionNode.titleNode.updateLayout(CGSize(width: maxActionWidth, height: actionButtonHeight))
if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 { if case .horizontal = effectiveActionLayout, actionTitleSize.height > actionButtonHeight * 0.6667 {
effectiveActionLayout = .vertical effectiveActionLayout = .vertical
} }