mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Tune account deletion layout
This commit is contained in:
parent
17c61062b8
commit
59ab7bce00
@ -18,15 +18,17 @@ public class InviteLinkHeaderItem: ListViewItem, ItemListItem {
|
||||
public let title: String?
|
||||
public let text: String
|
||||
public let animationName: String
|
||||
public let hideOnSmallScreens: Bool
|
||||
public let sectionId: ItemListSectionId
|
||||
public let linkAction: ((ItemListTextItemLinkAction) -> Void)?
|
||||
|
||||
public init(context: AccountContext, theme: PresentationTheme, title: String? = nil, text: String, animationName: String, sectionId: ItemListSectionId, linkAction: ((ItemListTextItemLinkAction) -> Void)? = nil) {
|
||||
public init(context: AccountContext, theme: PresentationTheme, title: String? = nil, text: String, animationName: String, hideOnSmallScreens: Bool = false, sectionId: ItemListSectionId, linkAction: ((ItemListTextItemLinkAction) -> Void)? = nil) {
|
||||
self.context = context
|
||||
self.theme = theme
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.animationName = animationName
|
||||
self.hideOnSmallScreens = hideOnSmallScreens
|
||||
self.sectionId = sectionId
|
||||
self.linkAction = linkAction
|
||||
}
|
||||
@ -118,7 +120,11 @@ class InviteLinkHeaderItemNode: ListViewItemNode {
|
||||
if params.width > params.availableHeight && params.width > 320.0 {
|
||||
iconSize = CGSize(width: 140.0, height: 140.0)
|
||||
} else {
|
||||
iconSize = CGSize(width: 124.0, height: 124.0)
|
||||
if item.hideOnSmallScreens {
|
||||
iconSize = .zero
|
||||
} else {
|
||||
iconSize = CGSize(width: 124.0, height: 124.0)
|
||||
}
|
||||
}
|
||||
let topInset: CGFloat = iconSize.height - 4.0
|
||||
let spacing: CGFloat = 5.0
|
||||
@ -137,6 +143,7 @@ class InviteLinkHeaderItemNode: ListViewItemNode {
|
||||
if let _ = item.title {
|
||||
contentSize.height += titleLayout.size.height + spacing
|
||||
}
|
||||
|
||||
let insets = itemListNeighborsGroupedInsets(neighbors, params)
|
||||
|
||||
let layout = ListViewItemNodeLayout(contentSize: contentSize, insets: insets)
|
||||
|
@ -44,7 +44,7 @@ private enum DeleteAccountEntryTag: Equatable, ItemListItemTag {
|
||||
|
||||
|
||||
private enum DeleteAccountDataEntry: ItemListNodeEntry, Equatable {
|
||||
case header(PresentationTheme, String, String, String)
|
||||
case header(PresentationTheme, String, String, String, Bool)
|
||||
case peers(PresentationTheme, [EnginePeer])
|
||||
case phone(PresentationTheme, PresentationStrings)
|
||||
case password(PresentationTheme, String)
|
||||
@ -76,8 +76,8 @@ private enum DeleteAccountDataEntry: ItemListNodeEntry, Equatable {
|
||||
|
||||
static func == (lhs: DeleteAccountDataEntry, rhs: DeleteAccountDataEntry) -> Bool {
|
||||
switch lhs {
|
||||
case let .header(lhsTheme, lhsAnimation, lhsTitle, lhsText):
|
||||
if case let .header(rhsTheme, rhsAnimation, rhsTitle, rhsText) = rhs, lhsTheme === rhsTheme, lhsAnimation == rhsAnimation, lhsTitle == rhsTitle, lhsText == rhsText {
|
||||
case let .header(lhsTheme, lhsAnimation, lhsTitle, lhsText, lhsHideOnSmallScreens):
|
||||
if case let .header(rhsTheme, rhsAnimation, rhsTitle, rhsText, rhsHideOnSmallScreens) = rhs, lhsTheme === rhsTheme, lhsAnimation == rhsAnimation, lhsTitle == rhsTitle, lhsText == rhsText, lhsHideOnSmallScreens == rhsHideOnSmallScreens {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@ -117,8 +117,8 @@ private enum DeleteAccountDataEntry: ItemListNodeEntry, Equatable {
|
||||
func item(presentationData: ItemListPresentationData, arguments: Any) -> ListViewItem {
|
||||
let arguments = arguments as! DeleteAccountDataArguments
|
||||
switch self {
|
||||
case let .header(theme, animation, title, text):
|
||||
return InviteLinkHeaderItem(context: arguments.context, theme: theme, title: title, text: text, animationName: animation, sectionId: self.section, linkAction: nil)
|
||||
case let .header(theme, animation, title, text, hideOnSmallScreens):
|
||||
return InviteLinkHeaderItem(context: arguments.context, theme: theme, title: title, text: text, animationName: animation, hideOnSmallScreens: hideOnSmallScreens, sectionId: self.section, linkAction: nil)
|
||||
case let .peers(_, peers):
|
||||
return DeleteAccountPeersItem(context: arguments.context, theme: presentationData.theme, strings: presentationData.strings, peers: peers, sectionId: self.section)
|
||||
case let .info(_, text):
|
||||
@ -145,6 +145,7 @@ private func deleteAccountDataEntries(presentationData: PresentationData, mode:
|
||||
let headerTitle: String
|
||||
let headerText: String
|
||||
let headerAnimation: String
|
||||
var hideOnSmallScreen = false
|
||||
|
||||
switch mode {
|
||||
case .peers:
|
||||
@ -163,13 +164,15 @@ private func deleteAccountDataEntries(presentationData: PresentationData, mode:
|
||||
headerAnimation = "Delete4"
|
||||
headerTitle = presentationData.strings.DeleteAccount_EnterPhoneNumber
|
||||
headerText = ""
|
||||
hideOnSmallScreen = true
|
||||
case .password:
|
||||
headerAnimation = "Delete5"
|
||||
headerTitle = presentationData.strings.DeleteAccount_EnterPassword
|
||||
headerText = ""
|
||||
hideOnSmallScreen = true
|
||||
}
|
||||
|
||||
entries.append(.header(presentationData.theme, headerAnimation, headerTitle, headerText))
|
||||
entries.append(.header(presentationData.theme, headerAnimation, headerTitle, headerText, hideOnSmallScreen))
|
||||
|
||||
switch mode {
|
||||
case .peers:
|
||||
|
@ -118,8 +118,17 @@ final class DeleteAccountFooterItemNode: ItemListControllerFooterItemNode {
|
||||
let buttonWidth = layout.size.width - layout.safeInsets.left - layout.safeInsets.right - buttonInset * 2.0
|
||||
let buttonHeight = self.buttonNode.updateLayout(width: buttonWidth, transition: transition)
|
||||
let topInset: CGFloat = 9.0
|
||||
let bottomInset: CGFloat = 23.0
|
||||
let spacing: CGFloat = 23.0
|
||||
|
||||
let bottomInset: CGFloat
|
||||
let spacing: CGFloat
|
||||
|
||||
if layout.size.width > 320.0 {
|
||||
bottomInset = 23.0
|
||||
spacing = 23.0
|
||||
} else {
|
||||
bottomInset = 16.0
|
||||
spacing = 16.0
|
||||
}
|
||||
|
||||
let insets = layout.insets(options: [.input])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user