mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-07-08 00:57:51 +02:00
chore: migrate to new version + fixed several critical bugs
- Migrated project to latest Telegram iOS base (v12.3.2+) - Fixed circular dependency between GhostModeManager and MiscSettingsManager - Fixed multiple Bazel build configuration errors (select() default conditions) - Fixed duplicate type definitions in PeerInfoScreen - Fixed swiftmodule directory resolution in build scripts - Added Ghostgram Settings tab in main Settings menu with all 5 features - Cleared sensitive credentials from config.json (template-only now) - Excluded bazel-cache from version control
This commit is contained in:
@@ -22,7 +22,6 @@ swift_library(
|
||||
"//submodules/ChatListSearchItemHeader:ChatListSearchItemHeader",
|
||||
"//submodules/ItemListPeerItem:ItemListPeerItem",
|
||||
"//submodules/ContactsPeerItem:ContactsPeerItem",
|
||||
"//submodules/ChatListSearchItemNode:ChatListSearchItemNode",
|
||||
"//submodules/TelegramPermissionsUI:TelegramPermissionsUI",
|
||||
"//submodules/TelegramNotices:TelegramNotices",
|
||||
"//submodules/AlertUI:AlertUI",
|
||||
@@ -48,6 +47,7 @@ swift_library(
|
||||
"//submodules/ContextUI",
|
||||
"//submodules/TelegramUI/Components/EdgeEffect",
|
||||
"//submodules/TelegramUI/Components/SearchInputPanelComponent",
|
||||
"//submodules/SearchBarNode",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
||||
@@ -129,7 +129,7 @@ class ContactsAddItemNode: ListViewItemNode {
|
||||
self.iconNode = ASImageNode()
|
||||
self.titleNode = TextNode()
|
||||
|
||||
super.init(layerBacked: false, dynamicBounce: false, rotated: false, seeThrough: false)
|
||||
super.init(layerBacked: false, rotated: false, seeThrough: false)
|
||||
|
||||
self.addSubnode(self.backgroundNode)
|
||||
self.addSubnode(self.separatorNode)
|
||||
|
||||
@@ -181,7 +181,7 @@ class ContactListActionItemNode: ListViewItemNode {
|
||||
|
||||
self.activateArea = AccessibilityAreaNode()
|
||||
|
||||
super.init(layerBacked: false, dynamicBounce: false)
|
||||
super.init(layerBacked: false)
|
||||
|
||||
self.addSubnode(self.iconNode)
|
||||
self.addSubnode(self.titleNode)
|
||||
|
||||
@@ -11,6 +11,7 @@ final class ContactListNameIndexHeader: Equatable, ListViewItemHeader {
|
||||
let letter: unichar
|
||||
let stickDirection: ListViewItemHeaderStickDirection = .top
|
||||
public let stickOverInsets: Bool = true
|
||||
public let isSticky: Bool = false
|
||||
|
||||
let height: CGFloat = 29.0
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import AccountContext
|
||||
import TelegramPermissions
|
||||
import TelegramNotices
|
||||
import ContactsPeerItem
|
||||
import ChatListSearchItemNode
|
||||
import ChatListSearchItemHeader
|
||||
import SearchUI
|
||||
import TelegramPermissionsUI
|
||||
@@ -96,7 +95,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
var hasUnseenCloseFriends: Bool
|
||||
}
|
||||
|
||||
case search(PresentationTheme, PresentationStrings)
|
||||
case sort(PresentationTheme, PresentationStrings, ContactsSortOrder)
|
||||
case permissionInfo(PresentationTheme, String, String, Bool)
|
||||
case permissionEnable(PresentationTheme, String)
|
||||
@@ -107,8 +105,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
|
||||
var stableId: ContactListNodeEntryId {
|
||||
switch self {
|
||||
case .search:
|
||||
return .search
|
||||
case .sort:
|
||||
return .sort
|
||||
case .permissionInfo:
|
||||
@@ -133,10 +129,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
|
||||
func item(context: AccountContext, presentationData: PresentationData, interaction: ContactListNodeInteraction, isSearch: Bool, listStyle: ItemListStyle) -> ListViewItem {
|
||||
switch self {
|
||||
case let .search(theme, strings):
|
||||
return ChatListSearchItem(theme: theme, placeholder: strings.Contacts_SearchLabel, activate: {
|
||||
interaction.activateSearch()
|
||||
})
|
||||
case let .sort(_, strings, sortOrder):
|
||||
var text = strings.Contacts_SortedByName
|
||||
if case .presence = sortOrder {
|
||||
@@ -270,12 +262,6 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
|
||||
static func ==(lhs: ContactListNodeEntry, rhs: ContactListNodeEntry) -> Bool {
|
||||
switch lhs {
|
||||
case let .search(lhsTheme, lhsStrings):
|
||||
if case let .search(rhsTheme, rhsStrings) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case let .sort(lhsTheme, lhsStrings, lhsSortOrder):
|
||||
if case let .sort(rhsTheme, rhsStrings, rhsSortOrder) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsSortOrder == rhsSortOrder {
|
||||
return true
|
||||
@@ -376,39 +362,35 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
|
||||
static func <(lhs: ContactListNodeEntry, rhs: ContactListNodeEntry) -> Bool {
|
||||
switch lhs {
|
||||
case .search:
|
||||
return true
|
||||
case .sort:
|
||||
switch rhs {
|
||||
case .search:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case .permissionInfo:
|
||||
switch rhs {
|
||||
case .search, .sort:
|
||||
case .sort:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case .permissionEnable:
|
||||
switch rhs {
|
||||
case .search, .sort, .permissionInfo:
|
||||
case .sort, .permissionInfo:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case .permissionLimited:
|
||||
switch rhs {
|
||||
case .search, .sort, .permissionInfo, .permissionEnable:
|
||||
case .sort, .permissionInfo, .permissionEnable:
|
||||
return false
|
||||
default:
|
||||
return true
|
||||
}
|
||||
case let .option(lhsIndex, _, _, _, _):
|
||||
switch rhs {
|
||||
case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited:
|
||||
case .sort, .permissionInfo, .permissionEnable, .permissionLimited:
|
||||
return false
|
||||
case let .option(rhsIndex, _, _, _, _):
|
||||
return lhsIndex < rhsIndex
|
||||
@@ -417,14 +399,14 @@ private enum ContactListNodeEntry: Comparable, Identifiable {
|
||||
}
|
||||
case let .header(lhsIndex, _):
|
||||
switch rhs {
|
||||
case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
|
||||
case .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
|
||||
return false
|
||||
case let .header(rhsIndex, _), let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
return lhsIndex < rhsIndex
|
||||
}
|
||||
case let .peer(lhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
switch rhs {
|
||||
case .search, .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
|
||||
case .sort, .permissionInfo, .permissionEnable, .permissionLimited, .option:
|
||||
return false
|
||||
case let .peer(rhsIndex, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _), let .header(rhsIndex, _):
|
||||
// if (lhsStoryData == nil) != (rhsStoryData == nil) {
|
||||
@@ -901,9 +883,6 @@ private func preparedContactListNodeTransition(context: AccountContext, presenta
|
||||
switch entry {
|
||||
case .sort:
|
||||
shouldFixScroll = true
|
||||
case .search:
|
||||
//indexSections.apend(CollectionIndexNode.searchIndex)
|
||||
break
|
||||
case let .peer(_, _, _, header, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
if let header = header as? ContactListNameIndexHeader {
|
||||
if !existingSections.contains(header.letter) {
|
||||
@@ -1255,7 +1234,6 @@ public final class ContactListNode: ASDisplayNode {
|
||||
self.presentationData = presentationData
|
||||
|
||||
self.listNode = ListView()
|
||||
self.listNode.dynamicBounceEnabled = false
|
||||
self.listNode.accessibilityPageScrolledString = { row, count in
|
||||
return presentationData.strings.VoiceOver_ScrollStatus(row, count).string
|
||||
}
|
||||
@@ -1419,11 +1397,6 @@ public final class ContactListNode: ASDisplayNode {
|
||||
var peerIndex = 0
|
||||
loop: for entry in entries {
|
||||
switch entry {
|
||||
case .search:
|
||||
if section == CollectionIndexNode.searchIndex {
|
||||
strongSelf.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.PreferSynchronousDrawing, .PreferSynchronousResourceLoading], scrollToItem: ListViewScrollToItem(index: index, position: .top(-navigationBarSearchContentHeight), animated: false, curve: .Default(duration: nil), directionHint: .Down), additionalScrollDistance: 0.0, updateSizeAndInsets: updateSizeAndInsets, stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
break loop
|
||||
}
|
||||
case let .peer(_, _, _, header, _, _, _, _, _, _, _, _, _, _, _, _):
|
||||
if let header = header as? ContactListNameIndexHeader {
|
||||
if let scalar = UnicodeScalar(header.letter) {
|
||||
@@ -2124,8 +2097,6 @@ public final class ContactListNode: ASDisplayNode {
|
||||
strongSelf.authorizationNode.isHidden = authorizationPreviousHidden
|
||||
strongSelf.addSubnode(strongSelf.authorizationNode)
|
||||
|
||||
strongSelf.listNode.dynamicBounceEnabled = false
|
||||
|
||||
strongSelf.listNode.forEachAccessoryItemNode({ accessoryItemNode in
|
||||
if let accessoryItemNode = accessoryItemNode as? ContactsSectionHeaderAccessoryItemNode {
|
||||
accessoryItemNode.updateTheme(theme: presentationData.theme)
|
||||
|
||||
@@ -24,6 +24,7 @@ import ChatListHeaderComponent
|
||||
import TelegramIntents
|
||||
import UndoUI
|
||||
import ShareController
|
||||
import SearchBarNode
|
||||
|
||||
private final class HeaderContextReferenceContentSource: ContextReferenceContentSource {
|
||||
private let controller: ViewController
|
||||
@@ -141,7 +142,6 @@ public class ContactsController: ViewController {
|
||||
|
||||
self.sortButton = SortHeaderButton(presentationData: self.presentationData)
|
||||
|
||||
//super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
|
||||
super.init(navigationBarPresentationData: nil)
|
||||
|
||||
self.tabBarItemContextActionType = .always
|
||||
@@ -226,6 +226,8 @@ public class ContactsController: ViewController {
|
||||
}
|
||||
|
||||
self.sortButton.addTarget(self, action: #selector(self.sortPressed), forControlEvents: .touchUpInside)
|
||||
|
||||
self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .immediate)
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
@@ -242,7 +244,6 @@ public class ContactsController: ViewController {
|
||||
private func updateThemeAndStrings() {
|
||||
self.sortButton.update(theme: self.presentationData.theme, strings: self.presentationData.strings)
|
||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||
self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
|
||||
|
||||
self.title = self.presentationData.strings.Contacts_Title
|
||||
self.tabBarItem.title = self.presentationData.strings.Contacts_Title
|
||||
@@ -280,8 +281,6 @@ public class ContactsController: ViewController {
|
||||
|> take(1)
|
||||
|> map { _ -> Bool in true })
|
||||
|
||||
self.contactsNode.navigationBar = self.navigationBar
|
||||
|
||||
let openPeer: (ContactListPeer, Bool) -> Void = { [weak self] peer, fromSearch in
|
||||
if let strongSelf = self {
|
||||
switch peer {
|
||||
@@ -343,7 +342,7 @@ public class ContactsController: ViewController {
|
||||
}
|
||||
|
||||
self.contactsNode.contactListNode.activateSearch = { [weak self] in
|
||||
self?.activateSearch()
|
||||
self?.activateSearch(isFromTabBar: false)
|
||||
}
|
||||
|
||||
self.contactsNode.contactListNode.openPeer = { [weak self] peer, _, _, _ in
|
||||
@@ -580,18 +579,26 @@ public class ContactsController: ViewController {
|
||||
self.sortButton.contextAction?(self.sortButton.containerNode, nil)
|
||||
}
|
||||
|
||||
private func activateSearch() {
|
||||
if let searchContentNode = self.searchContentNode() {
|
||||
self.contactsNode.activateSearch(placeholderNode: searchContentNode.placeholderNode)
|
||||
private func activateSearch(isFromTabBar: Bool) {
|
||||
let placeholderNode = isFromTabBar ? nil : self.searchContentNode()?.placeholderNode
|
||||
self.contactsNode.activateSearch(placeholderNode: placeholderNode)
|
||||
if placeholderNode != nil {
|
||||
(self.parent as? TabBarController)?.updateIsTabBarHidden(true, transition: .animated(duration: 0.5, curve: .spring))
|
||||
} else {
|
||||
self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: true), transition: .animated(duration: 0.5, curve: .spring))
|
||||
if let searchBarNode = self.currentTabBarSearchNode?() as? SearchBarNode {
|
||||
self.contactsNode.searchDisplayController?.setSearchBar(searchBarNode)
|
||||
searchBarNode.activate()
|
||||
}
|
||||
}
|
||||
self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
|
||||
}
|
||||
|
||||
private func deactivateSearch(animated: Bool) {
|
||||
if let searchContentNode = self.searchContentNode() {
|
||||
self.contactsNode.deactivateSearch(placeholderNode: searchContentNode.placeholderNode, animated: animated)
|
||||
self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
|
||||
}
|
||||
self.contactsNode.deactivateSearch(placeholderNode: self.searchContentNode()?.placeholderNode, animated: animated)
|
||||
self.updateTabBarSearchState(ViewController.TabBarSearchState(isActive: false), transition: .animated(duration: 0.5, curve: .spring))
|
||||
(self.parent as? TabBarController)?.updateIsTabBarHidden(false, transition: .animated(duration: 0.5, curve: .spring))
|
||||
self.requestLayout(transition: .animated(duration: 0.5, curve: .spring))
|
||||
}
|
||||
|
||||
func presentSortMenu(sourceView: UIView, gesture: ContextGesture?) {
|
||||
@@ -796,6 +803,14 @@ public class ContactsController: ViewController {
|
||||
let controller = ContextController(presentationData: self.presentationData, source: .reference(ContactsTabBarContextReferenceContentSource(controller: self, sourceView: sourceView)), items: .single(ContextController.Items(content: .list(items))), recognizer: nil, gesture: gesture)
|
||||
self.context.sharedContext.mainWindow?.presentInGlobalOverlay(controller)
|
||||
}
|
||||
|
||||
override public func tabBarActivateSearch() {
|
||||
self.activateSearch(isFromTabBar: true)
|
||||
}
|
||||
|
||||
override public func tabBarDeactivateSearch() {
|
||||
self.deactivateSearch(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
private final class ContactsTabBarContextReferenceContentSource: ContextReferenceContentSource {
|
||||
|
||||
@@ -53,12 +53,11 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
|
||||
private let context: AccountContext
|
||||
private(set) var searchDisplayController: SearchDisplayController?
|
||||
private var isSearchDisplayControllerActive: Bool = false
|
||||
private var isSearchDisplayControllerActive: ChatListNavigationBar.ActiveSearch?
|
||||
private var storiesUnlocked: Bool = false
|
||||
|
||||
private var containerLayout: (ContainerViewLayout, CGFloat)?
|
||||
|
||||
var navigationBar: NavigationBar?
|
||||
let navigationBarView = ComponentView<Empty>()
|
||||
|
||||
var requestDeactivateSearch: (() -> Void)?
|
||||
@@ -350,7 +349,6 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
chatListTitle: NetworkStatusTitle(text: title, activity: false, hasProxy: false, connectsViaProxy: false, isPasscodeSet: false, isManuallyLocked: false, peerStatus: nil),
|
||||
leftButton: leftButton,
|
||||
rightButtons: rightButtons,
|
||||
backTitle: nil,
|
||||
backPressed: nil
|
||||
)
|
||||
|
||||
@@ -362,14 +360,15 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
strings: self.presentationData.strings,
|
||||
statusBarHeight: layout.statusBarHeight ?? 0.0,
|
||||
sideInset: layout.safeInsets.left,
|
||||
isSearchActive: self.isSearchDisplayControllerActive,
|
||||
isSearchEnabled: true,
|
||||
search: ChatListNavigationBar.Search(isEnabled: true),
|
||||
activeSearch: self.isSearchDisplayControllerActive,
|
||||
primaryContent: primaryContent,
|
||||
secondaryContent: nil,
|
||||
secondaryTransition: 0.0,
|
||||
storySubscriptions: nil,
|
||||
storiesIncludeHidden: true,
|
||||
uploadProgress: [:],
|
||||
headerPanels: nil,
|
||||
tabsNode: tabsNode,
|
||||
tabsNodeIsSearch: tabsNodeIsSearch,
|
||||
accessoryPanelContainer: nil,
|
||||
@@ -416,7 +415,7 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
|
||||
private func updateNavigationScrolling(transition: ContainedViewLayoutTransition) {
|
||||
var offset = self.getEffectiveNavigationScrollingOffset()
|
||||
if self.isSearchDisplayControllerActive {
|
||||
if self.isSearchDisplayControllerActive != nil {
|
||||
offset = 0.0
|
||||
}
|
||||
|
||||
@@ -478,15 +477,15 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func activateSearch(placeholderNode: SearchBarPlaceholderNode) {
|
||||
func activateSearch(placeholderNode: SearchBarPlaceholderNode?) {
|
||||
guard let (containerLayout, navigationBarHeight) = self.containerLayout, self.searchDisplayController == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
self.isSearchDisplayControllerActive = true
|
||||
self.isSearchDisplayControllerActive = ChatListNavigationBar.ActiveSearch(isExternal: placeholderNode == nil)
|
||||
self.storiesUnlocked = false
|
||||
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .list, contentNode: ContactsSearchContainerNode(context: self.context, onlyWriteable: false, categories: [.cloudContacts, .global, .deviceContacts], addContact: { [weak self] phoneNumber in
|
||||
self.searchDisplayController = SearchDisplayController(presentationData: self.presentationData, mode: .navigation, contentNode: ContactsSearchContainerNode(context: self.context, glass: true, externalSearchBar: true, onlyWriteable: false, categories: [.cloudContacts, .global, .deviceContacts], addContact: { [weak self] phoneNumber in
|
||||
if let requestAddContact = self?.requestAddContact {
|
||||
requestAddContact(phoneNumber)
|
||||
}
|
||||
@@ -504,14 +503,14 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
if let requestDeactivateSearch = self?.requestDeactivateSearch {
|
||||
requestDeactivateSearch()
|
||||
}
|
||||
})
|
||||
}, fieldStyle: placeholderNode?.fieldStyle ?? .modern, searchBarIsExternal: placeholderNode == nil)
|
||||
|
||||
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||
self.searchDisplayController?.activate(insertSubnode: { [weak self] subnode, isSearchBar in
|
||||
if let strongSelf = self {
|
||||
if isSearchBar {
|
||||
if let navigationBarComponentView = strongSelf.navigationBarView.view as? ChatListNavigationBar.View {
|
||||
navigationBarComponentView.addSubnode(subnode)
|
||||
navigationBarComponentView.searchContentNode?.addSubnode(subnode)
|
||||
}
|
||||
} else {
|
||||
strongSelf.insertSubnode(subnode, aboveSubnode: strongSelf.contactListNode)
|
||||
@@ -520,16 +519,11 @@ final class ContactsControllerNode: ASDisplayNode, ASGestureRecognizerDelegate {
|
||||
}, placeholder: placeholderNode)
|
||||
}
|
||||
|
||||
func deactivateSearch(placeholderNode: SearchBarPlaceholderNode, animated: Bool) {
|
||||
self.isSearchDisplayControllerActive = false
|
||||
func deactivateSearch(placeholderNode: SearchBarPlaceholderNode?, animated: Bool) {
|
||||
self.isSearchDisplayControllerActive = nil
|
||||
if let searchDisplayController = self.searchDisplayController {
|
||||
let previousFrame = placeholderNode.frame
|
||||
placeholderNode.frame = previousFrame.offsetBy(dx: 0.0, dy: 54.0)
|
||||
|
||||
searchDisplayController.deactivate(placeholder: placeholderNode, animated: animated)
|
||||
self.searchDisplayController = nil
|
||||
|
||||
placeholderNode.frame = previousFrame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
|
||||
private let context: AccountContext
|
||||
private let glass: Bool
|
||||
private let externalSearchBar: Bool
|
||||
private let isPeerEnabled: (ContactListPeer) -> Bool
|
||||
private let addContact: ((String) -> Void)?
|
||||
private let openPeer: (ContactListPeer, ContactsSearchContainerNode.OpenPeerAction) -> Void
|
||||
@@ -265,6 +266,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
public init(
|
||||
context: AccountContext,
|
||||
glass: Bool = false,
|
||||
externalSearchBar: Bool = false,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
||||
onlyWriteable: Bool,
|
||||
categories: ContactsSearchCategories,
|
||||
@@ -278,6 +280,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
) {
|
||||
self.context = context
|
||||
self.glass = glass
|
||||
self.externalSearchBar = externalSearchBar
|
||||
self.isPeerEnabled = isPeerEnabled
|
||||
self.addContact = addContact
|
||||
self.openPeer = openPeer
|
||||
@@ -290,7 +293,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
self.themeAndStringsPromise = Promise((self.presentationData.theme, self.presentationData.strings))
|
||||
|
||||
self.dimNode = ASDisplayNode()
|
||||
self.dimNode.backgroundColor = glass ? .clear : UIColor.black.withAlphaComponent(0.5)
|
||||
self.dimNode.backgroundColor = .clear
|
||||
|
||||
self.backgroundNode = ASDisplayNode()
|
||||
self.backgroundNode.backgroundColor = self.presentationData.theme.list.plainBackgroundColor
|
||||
@@ -686,12 +689,26 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
self.containerViewLayout = (layout, navigationBarHeight)
|
||||
|
||||
let topInset = navigationBarHeight
|
||||
transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: topInset), size: CGSize(width: layout.size.width, height: layout.size.height - topInset)))
|
||||
transition.updateFrame(node: self.dimNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height)))
|
||||
|
||||
self.backgroundNode.frame = CGRect(origin: .zero, size: CGSize(width: layout.size.width, height: navigationBarHeight))
|
||||
|
||||
self.listNode.frame = CGRect(origin: CGPoint(x: 0.0, y: navigationBarHeight), size: CGSize(width: layout.size.width, height: layout.size.height - topInset))
|
||||
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: UIEdgeInsets(top: 0.0, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom, right: layout.safeInsets.right), duration: 0.0, curve: .Default(duration: nil)), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
self.listNode.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: layout.size.width, height: layout.size.height))
|
||||
let listDuration: Double
|
||||
let listCurve: ListViewAnimationCurve
|
||||
switch transition {
|
||||
case .immediate:
|
||||
listDuration = 0.0
|
||||
listCurve = .Default(duration: nil)
|
||||
case let .animated(duration, curve):
|
||||
listDuration = duration
|
||||
if case .spring = curve {
|
||||
listCurve = .Spring(duration: duration)
|
||||
} else {
|
||||
listCurve = .Default(duration: nil)
|
||||
}
|
||||
}
|
||||
self.listNode.transaction(deleteIndices: [], insertIndicesAndItems: [], updateIndicesAndItems: [], options: [.Synchronous], scrollToItem: nil, updateSizeAndInsets: ListViewUpdateSizeAndInsets(size: layout.size, insets: UIEdgeInsets(top: topInset, left: layout.safeInsets.left, bottom: layout.intrinsicInsets.bottom, right: layout.safeInsets.right), duration: listDuration, curve: listCurve), stationaryItemRange: nil, updateOpaqueState: nil, completion: { _ in })
|
||||
|
||||
let size = layout.size
|
||||
let sideInset = layout.safeInsets.left
|
||||
@@ -714,7 +731,7 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
textTransition.updateFrame(node: self.emptyResultsTextNode, frame: CGRect(origin: CGPoint(x: sideInset + padding + (size.width - sideInset * 2.0 - padding * 2.0 - emptyTextSize.width) / 2.0, y: emptyAnimationY + emptyAnimationHeight + emptyAnimationSpacing + emptyTitleSize.height + emptyTextSpacing), size: emptyTextSize))
|
||||
self.emptyResultsAnimationNode.updateLayout(size: self.emptyResultsAnimationSize)
|
||||
|
||||
if self.glass {
|
||||
if self.glass && !self.externalSearchBar {
|
||||
let searchInputSize = self.searchInput.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(
|
||||
@@ -794,14 +811,14 @@ public final class ContactsSearchContainerNode: SearchDisplayControllerContentNo
|
||||
strongSelf.containerLayoutUpdated(layout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||
}
|
||||
|
||||
let containerTransition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .easeInOut)
|
||||
containerTransition.updateAlpha(node: strongSelf.listNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
containerTransition.updateAlpha(node: strongSelf.backgroundNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
//let containerTransition = ContainedViewLayoutTransition.animated(duration: 0.3, curve: .easeInOut)
|
||||
ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.listNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.backgroundNode, alpha: isSearching ? 1.0 : 0.0)
|
||||
strongSelf.dimNode.isHidden = isSearching
|
||||
|
||||
containerTransition.updateAlpha(node: strongSelf.emptyResultsAnimationNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
containerTransition.updateAlpha(node: strongSelf.emptyResultsTitleNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
containerTransition.updateAlpha(node: strongSelf.emptyResultsTextNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsAnimationNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsTitleNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
ContainedViewLayoutTransition.immediate.updateAlpha(node: strongSelf.emptyResultsTextNode, alpha: emptyResults ? 1.0 : 0.0)
|
||||
strongSelf.emptyResultsAnimationNode.visibility = emptyResults
|
||||
})
|
||||
}
|
||||
|
||||
@@ -36,8 +36,9 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
|
||||
|
||||
self.presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData))
|
||||
super.init(navigationBarPresentationData: NavigationBarPresentationData(presentationData: self.presentationData, style: .glass))
|
||||
|
||||
self._hasGlassStyle = true
|
||||
self.navigationPresentation = .modal
|
||||
|
||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||
@@ -86,7 +87,7 @@ public class InviteContactsController: ViewController, MFMessageComposeViewContr
|
||||
|
||||
private func updateThemeAndStrings() {
|
||||
self.statusBar.statusBarStyle = self.presentationData.theme.rootController.statusBarStyle.style
|
||||
self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData))
|
||||
self.navigationBar?.updatePresentationData(NavigationBarPresentationData(presentationData: self.presentationData, style: .glass), transition: .immediate)
|
||||
self.searchContentNode?.updateThemeAndPlaceholder(theme: self.presentationData.theme, placeholder: self.presentationData.strings.Common_Search)
|
||||
self.title = self.presentationData.strings.Contacts_InviteFriends
|
||||
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: self.presentationData.strings.Common_Back, style: .plain, target: nil, action: nil)
|
||||
|
||||
@@ -518,7 +518,7 @@ final class InviteContactsControllerNode: ASDisplayNode {
|
||||
if let requestDeactivateSearch = self?.requestDeactivateSearch {
|
||||
requestDeactivateSearch()
|
||||
}
|
||||
})
|
||||
}, fieldStyle: placeholderNode.fieldStyle)
|
||||
|
||||
self.searchDisplayController?.containerLayoutUpdated(containerLayout, navigationBarHeight: navigationBarHeight, transition: .immediate)
|
||||
self.searchDisplayController?.activate(insertSubnode: { [weak self, weak placeholderNode] subnode, isSearchBar in
|
||||
|
||||
@@ -103,7 +103,7 @@ public class LimitedPermissionItemNode: ListViewItemNode {
|
||||
self.actionButtonTitleNode = TextNode()
|
||||
self.actionButtonTitleNode.isUserInteractionEnabled = false
|
||||
|
||||
super.init(layerBacked: false, dynamicBounce: false)
|
||||
super.init(layerBacked: false)
|
||||
|
||||
self.addSubnode(self.textNode)
|
||||
self.addSubnode(self.activateArea)
|
||||
|
||||
Reference in New Issue
Block a user