mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
Make settings search bar initially hidden
This commit is contained in:
parent
347bed0fc4
commit
22b0bd93b8
@ -47,6 +47,7 @@ private struct ItemListNodeTransition<Entry: ItemListNodeEntry> {
|
|||||||
let searchItem: ItemListControllerSearch?
|
let searchItem: ItemListControllerSearch?
|
||||||
let focusItemTag: ItemListItemTag?
|
let focusItemTag: ItemListItemTag?
|
||||||
let ensureVisibleItemTag: ItemListItemTag?
|
let ensureVisibleItemTag: ItemListItemTag?
|
||||||
|
let scrollToItem: ListViewScrollToItem?
|
||||||
let firstTime: Bool
|
let firstTime: Bool
|
||||||
let animated: Bool
|
let animated: Bool
|
||||||
let animateAlpha: Bool
|
let animateAlpha: Bool
|
||||||
@ -63,8 +64,9 @@ struct ItemListNodeState<Entry: ItemListNodeEntry> {
|
|||||||
let crossfadeState: Bool
|
let crossfadeState: Bool
|
||||||
let focusItemTag: ItemListItemTag?
|
let focusItemTag: ItemListItemTag?
|
||||||
let ensureVisibleItemTag: ItemListItemTag?
|
let ensureVisibleItemTag: ItemListItemTag?
|
||||||
|
let initialScrollToItem: ListViewScrollToItem?
|
||||||
|
|
||||||
init(entries: [Entry], style: ItemListStyle, focusItemTag: ItemListItemTag? = nil, ensureVisibleItemTag: ItemListItemTag? = nil, emptyStateItem: ItemListControllerEmptyStateItem? = nil, searchItem: ItemListControllerSearch? = nil, crossfadeState: Bool = false, animateChanges: Bool = true) {
|
init(entries: [Entry], style: ItemListStyle, focusItemTag: ItemListItemTag? = nil, ensureVisibleItemTag: ItemListItemTag? = nil, emptyStateItem: ItemListControllerEmptyStateItem? = nil, searchItem: ItemListControllerSearch? = nil, initialScrollToItem: ListViewScrollToItem? = nil, crossfadeState: Bool = false, animateChanges: Bool = true) {
|
||||||
self.entries = entries
|
self.entries = entries
|
||||||
self.style = style
|
self.style = style
|
||||||
self.emptyStateItem = emptyStateItem
|
self.emptyStateItem = emptyStateItem
|
||||||
@ -73,6 +75,7 @@ struct ItemListNodeState<Entry: ItemListNodeEntry> {
|
|||||||
self.animateChanges = animateChanges
|
self.animateChanges = animateChanges
|
||||||
self.focusItemTag = focusItemTag
|
self.focusItemTag = focusItemTag
|
||||||
self.ensureVisibleItemTag = ensureVisibleItemTag
|
self.ensureVisibleItemTag = ensureVisibleItemTag
|
||||||
|
self.initialScrollToItem = initialScrollToItem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +262,13 @@ class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UIScrollV
|
|||||||
if previous?.style != state.style {
|
if previous?.style != state.style {
|
||||||
updatedStyle = state.style
|
updatedStyle = state.style
|
||||||
}
|
}
|
||||||
return ItemListNodeTransition(theme: theme, entries: transition, updateStyle: updatedStyle, emptyStateItem: state.emptyStateItem, searchItem: state.searchItem, focusItemTag: state.focusItemTag, ensureVisibleItemTag: state.ensureVisibleItemTag, firstTime: previous == nil, animated: previous != nil && state.animateChanges, animateAlpha: previous != nil && state.animateChanges, crossfade: state.crossfadeState, mergedEntries: state.entries)
|
|
||||||
|
var scrollToItem: ListViewScrollToItem?
|
||||||
|
if previous == nil {
|
||||||
|
scrollToItem = state.initialScrollToItem
|
||||||
|
}
|
||||||
|
|
||||||
|
return ItemListNodeTransition(theme: theme, entries: transition, updateStyle: updatedStyle, emptyStateItem: state.emptyStateItem, searchItem: state.searchItem, focusItemTag: state.focusItemTag, ensureVisibleItemTag: state.ensureVisibleItemTag, scrollToItem: scrollToItem, firstTime: previous == nil, animated: previous != nil && state.animateChanges, animateAlpha: previous != nil && state.animateChanges, crossfade: state.crossfadeState, mergedEntries: state.entries)
|
||||||
}) |> deliverOnMainQueue).start(next: { [weak self] transition in
|
}) |> deliverOnMainQueue).start(next: { [weak self] transition in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.enqueueTransition(transition)
|
strongSelf.enqueueTransition(transition)
|
||||||
@ -423,7 +432,9 @@ class ItemListControllerNode<Entry: ItemListNodeEntry>: ASDisplayNode, UIScrollV
|
|||||||
let focusItemTag = transition.focusItemTag
|
let focusItemTag = transition.focusItemTag
|
||||||
let ensureVisibleItemTag = transition.ensureVisibleItemTag
|
let ensureVisibleItemTag = transition.ensureVisibleItemTag
|
||||||
var scrollToItem: ListViewScrollToItem?
|
var scrollToItem: ListViewScrollToItem?
|
||||||
if self.listNode.experimentalSnapScrollToItem, let ensureVisibleItemTag = ensureVisibleItemTag {
|
if let item = transition.scrollToItem {
|
||||||
|
scrollToItem = item
|
||||||
|
} else if self.listNode.experimentalSnapScrollToItem, let ensureVisibleItemTag = ensureVisibleItemTag {
|
||||||
for i in 0 ..< transition.mergedEntries.count {
|
for i in 0 ..< transition.mergedEntries.count {
|
||||||
if let tag = transition.mergedEntries[i].tag, tag.isEqual(to: ensureVisibleItemTag) {
|
if let tag = transition.mergedEntries[i].tag, tag.isEqual(to: ensureVisibleItemTag) {
|
||||||
scrollToItem = ListViewScrollToItem(index: i, position: ListViewScrollPosition.visible, animated: true, curve: .Default(duration: nil), directionHint: .Down)
|
scrollToItem = ListViewScrollToItem(index: i, position: ListViewScrollPosition.visible, animated: true, curve: .Default(duration: nil), directionHint: .Down)
|
||||||
|
@ -1143,7 +1143,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
|
|||||||
})
|
})
|
||||||
|
|
||||||
let (hasPassport, hasWatchApp) = hasPassportAndWatch
|
let (hasPassport, hasWatchApp) = hasPassportAndWatch
|
||||||
let listState = ItemListNodeState(entries: settingsEntries(account: context.account, presentationData: presentationData, state: state, view: view, proxySettings: proxySettings, notifyExceptions: preferencesAndExceptions.1, notificationsAuthorizationStatus: preferencesAndExceptions.2, notificationsWarningSuppressed: preferencesAndExceptions.3, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedPacks: featuredAndArchived.1, hasPassport: hasPassport, hasWatchApp: hasWatchApp, accountsAndPeers: accountsAndPeers.1, inAppNotificationSettings: inAppNotificationSettings), style: .blocks, searchItem: searchItem)
|
let listState = ItemListNodeState(entries: settingsEntries(account: context.account, presentationData: presentationData, state: state, view: view, proxySettings: proxySettings, notifyExceptions: preferencesAndExceptions.1, notificationsAuthorizationStatus: preferencesAndExceptions.2, notificationsWarningSuppressed: preferencesAndExceptions.3, unreadTrendingStickerPacks: unreadTrendingStickerPacks, archivedPacks: featuredAndArchived.1, hasPassport: hasPassport, hasWatchApp: hasWatchApp, accountsAndPeers: accountsAndPeers.1, inAppNotificationSettings: inAppNotificationSettings), style: .blocks, searchItem: searchItem, initialScrollToItem: ListViewScrollToItem(index: 0, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: 0.0), directionHint: .Up))
|
||||||
|
|
||||||
return (controllerState, (listState, arguments))
|
return (controllerState, (listState, arguments))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user