mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios
This commit is contained in:
commit
9f4775835f
@ -583,7 +583,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
if let suggestedFilters = self.suggestedFilters, !suggestedFilters.isEmpty {
|
if let suggestedFilters = self.suggestedFilters, !suggestedFilters.isEmpty {
|
||||||
filters = suggestedFilters
|
filters = suggestedFilters
|
||||||
} else {
|
} else {
|
||||||
filters = [.chats, .media, .downloads, .links, .files, .music, .voice]
|
filters = defaultAvailableSearchPanes(hasDownloads: self.hasDownloads).map(\.filter)
|
||||||
}
|
}
|
||||||
|
|
||||||
let overflowInset: CGFloat = 20.0
|
let overflowInset: CGFloat = 20.0
|
||||||
@ -844,7 +844,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
|
|
||||||
strongSelf.context.fetchManager.raisePriority(resourceId: downloadResource.id)
|
strongSelf.context.fetchManager.raisePriority(resourceId: downloadResource.id)
|
||||||
|
|
||||||
Queue.mainQueue().after(0.1, {
|
Queue.mainQueue().after(0.2, {
|
||||||
f(.default)
|
f(.default)
|
||||||
})
|
})
|
||||||
})))
|
})))
|
||||||
@ -860,7 +860,7 @@ public final class ChatListSearchContainerNode: SearchDisplayControllerContentNo
|
|||||||
|
|
||||||
strongSelf.context.fetchManager.cancelInteractiveFetches(resourceId: downloadResource.id)
|
strongSelf.context.fetchManager.cancelInteractiveFetches(resourceId: downloadResource.id)
|
||||||
|
|
||||||
f(.default)
|
f(.dismissWithoutContent)
|
||||||
})))
|
})))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,6 +925,7 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
|
|
||||||
let downloadItems: Signal<(inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]), NoError>
|
let downloadItems: Signal<(inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]), NoError>
|
||||||
if key == .downloads {
|
if key == .downloads {
|
||||||
|
var firstTime = true
|
||||||
downloadItems = combineLatest(queue: .mainQueue(), (context.fetchManager as! FetchManagerImpl).entriesSummary, recentDownloadItems(postbox: context.account.postbox))
|
downloadItems = combineLatest(queue: .mainQueue(), (context.fetchManager as! FetchManagerImpl).entriesSummary, recentDownloadItems(postbox: context.account.postbox))
|
||||||
|> mapToSignal { entries, recentDownloadItems -> Signal<(inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]), NoError> in
|
|> mapToSignal { entries, recentDownloadItems -> Signal<(inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]), NoError> in
|
||||||
var itemSignals: [Signal<DownloadItem?, NoError>] = []
|
var itemSignals: [Signal<DownloadItem?, NoError>] = []
|
||||||
@ -947,7 +948,15 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
|> map { items -> (inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]) in
|
|> map { items -> (inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]) in
|
||||||
return (items.compactMap { $0 }, recentDownloadItems)
|
return (items.compactMap { $0 }, recentDownloadItems)
|
||||||
}
|
}
|
||||||
|> delay(0.1, queue: .mainQueue())
|
|> mapToSignal { value -> Signal<(inProgressItems: [DownloadItem], doneItems: [RenderedRecentDownloadItem]), NoError> in
|
||||||
|
if firstTime {
|
||||||
|
firstTime = false
|
||||||
|
return .single(value)
|
||||||
|
} else {
|
||||||
|
return .single(value)
|
||||||
|
|> delay(0.1, queue: .mainQueue())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
downloadItems = .single(([], []))
|
downloadItems = .single(([], []))
|
||||||
@ -1708,8 +1717,10 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
strongSelf.currentEntries = newEntries
|
strongSelf.currentEntries = newEntries
|
||||||
if key == .downloads, !firstTime, !"".isEmpty {
|
if strongSelf.key == .downloads {
|
||||||
transition.animated = true
|
if !firstTime, !"".isEmpty {
|
||||||
|
transition.animated = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
strongSelf.enqueueTransition(transition, firstTime: firstTime)
|
strongSelf.enqueueTransition(transition, firstTime: firstTime)
|
||||||
|
|
||||||
@ -1959,9 +1970,6 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
self.recentDisposable.dispose()
|
self.recentDisposable.dispose()
|
||||||
self.updatedRecentPeersDisposable.dispose()
|
self.updatedRecentPeersDisposable.dispose()
|
||||||
self.deletedMessagesDisposable?.dispose()
|
self.deletedMessagesDisposable?.dispose()
|
||||||
if self.key == .downloads {
|
|
||||||
print("downloads")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override func didLoad() {
|
override func didLoad() {
|
||||||
@ -2416,6 +2424,11 @@ final class ChatListSearchListPaneNode: ASDisplayNode, ChatListSearchPaneNode {
|
|||||||
options.insert(.AnimateInsertion)
|
options.insert(.AnimateInsertion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.key == .downloads {
|
||||||
|
options.insert(.PreferSynchronousDrawing)
|
||||||
|
options.insert(.PreferSynchronousResourceLoading)
|
||||||
|
}
|
||||||
|
|
||||||
self.listNode.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateSizeAndInsets: nil, updateOpaqueState: nil, completion: { [weak self] _ in
|
self.listNode.transaction(deleteIndices: transition.deletions, insertIndicesAndItems: transition.insertions, updateIndicesAndItems: transition.updates, options: options, updateSizeAndInsets: nil, updateOpaqueState: nil, completion: { [weak self] _ in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let searchOptions = strongSelf.searchOptionsValue
|
let searchOptions = strongSelf.searchOptionsValue
|
||||||
|
@ -3,6 +3,27 @@ import ComponentFlow
|
|||||||
import Lottie
|
import Lottie
|
||||||
import AppBundle
|
import AppBundle
|
||||||
|
|
||||||
|
private final class NullActionClass: NSObject, CAAction {
|
||||||
|
@objc public func run(forKey event: String, object anObject: Any, arguments dict: [AnyHashable : Any]?) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private let nullAction = NullActionClass()
|
||||||
|
|
||||||
|
private final class HierarchyTrackingLayer: CALayer {
|
||||||
|
var didEnterHierarchy: (() -> Void)?
|
||||||
|
var didExitHierarchy: (() -> Void)?
|
||||||
|
|
||||||
|
override func action(forKey event: String) -> CAAction? {
|
||||||
|
if event == kCAOnOrderIn {
|
||||||
|
self.didEnterHierarchy?()
|
||||||
|
} else if event == kCAOnOrderOut {
|
||||||
|
self.didExitHierarchy?()
|
||||||
|
}
|
||||||
|
return nullAction
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public final class LottieAnimationComponent: Component {
|
public final class LottieAnimationComponent: Component {
|
||||||
public struct Animation: Equatable {
|
public struct Animation: Equatable {
|
||||||
public var name: String
|
public var name: String
|
||||||
@ -40,6 +61,28 @@ public final class LottieAnimationComponent: Component {
|
|||||||
private var colorCallbacks: [LOTColorValueCallback] = []
|
private var colorCallbacks: [LOTColorValueCallback] = []
|
||||||
private var animationView: LOTAnimationView?
|
private var animationView: LOTAnimationView?
|
||||||
|
|
||||||
|
private let hierarchyTrackingLayer: HierarchyTrackingLayer
|
||||||
|
|
||||||
|
override init(frame: CGRect) {
|
||||||
|
self.hierarchyTrackingLayer = HierarchyTrackingLayer()
|
||||||
|
|
||||||
|
super.init(frame: frame)
|
||||||
|
|
||||||
|
self.layer.addSublayer(self.hierarchyTrackingLayer)
|
||||||
|
self.hierarchyTrackingLayer.didEnterHierarchy = { [weak self] in
|
||||||
|
guard let strongSelf = self, let animationView = strongSelf.animationView else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if animationView.loopAnimation {
|
||||||
|
animationView.play()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
func update(component: LottieAnimationComponent, availableSize: CGSize, transition: Transition) -> CGSize {
|
func update(component: LottieAnimationComponent, availableSize: CGSize, transition: Transition) -> CGSize {
|
||||||
if self.currentAnimation != component.animation {
|
if self.currentAnimation != component.animation {
|
||||||
if let animationView = self.animationView, animationView.isAnimationPlaying {
|
if let animationView = self.animationView, animationView.isAnimationPlaying {
|
||||||
@ -98,7 +141,7 @@ public final class LottieAnimationComponent: Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func makeView() -> View {
|
public func makeView() -> View {
|
||||||
return View()
|
return View(frame: CGRect())
|
||||||
}
|
}
|
||||||
|
|
||||||
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: Transition) -> CGSize {
|
||||||
|
@ -851,12 +851,6 @@ public final class MediaStreamComponentController: ViewControllerComponentContai
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
if let initialOrientation = self.initialOrientation {
|
|
||||||
self.call.accountContext.sharedContext.applicationBindings.forceOrientation(initialOrientation)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override public func viewDidAppear(_ animated: Bool) {
|
override public func viewDidAppear(_ animated: Bool) {
|
||||||
super.viewDidAppear(animated)
|
super.viewDidAppear(animated)
|
||||||
|
|
||||||
@ -883,6 +877,11 @@ public final class MediaStreamComponentController: ViewControllerComponentContai
|
|||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
self.onViewDidDisappear?()
|
self.onViewDidDisappear?()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let initialOrientation = self.initialOrientation {
|
||||||
|
self.initialOrientation = nil
|
||||||
|
self.call.accountContext.sharedContext.applicationBindings.forceOrientation(initialOrientation)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func dismiss(closing: Bool, manual: Bool) {
|
public func dismiss(closing: Bool, manual: Bool) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user