mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Roll back updating the gallery controller
This commit is contained in:
parent
615d0cfbcc
commit
20d620d630
@ -463,6 +463,7 @@ public class GalleryController: ViewController, StandalonePresentableController
|
||||
}
|
||||
}
|
||||
}
|
||||
|> take(1)
|
||||
|
||||
let semaphore: DispatchSemaphore?
|
||||
if synchronousLoad {
|
||||
@ -486,23 +487,6 @@ public class GalleryController: ViewController, StandalonePresentableController
|
||||
strongSelf.configuration = configuration
|
||||
|
||||
let entries = view.entries
|
||||
|
||||
if let centralEntryStableId = strongSelf.centralEntryStableId {
|
||||
var found = false
|
||||
for i in 0 ..< entries.count {
|
||||
let message = entries[i].message
|
||||
if message.stableId == centralEntryStableId {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
strongSelf.dismiss(forceAway: true)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
var centralEntryStableId: UInt32?
|
||||
loop: for i in 0 ..< entries.count {
|
||||
let message = entries[i].message
|
||||
@ -531,16 +515,14 @@ public class GalleryController: ViewController, StandalonePresentableController
|
||||
strongSelf.entries = entries.reversed()
|
||||
strongSelf.hasLeftEntries = view.hasLater
|
||||
strongSelf.hasRightEntries = view.hasEarlier
|
||||
if strongSelf.centralEntryStableId == nil, let centralEntryStableId = centralEntryStableId {
|
||||
if let centralEntryStableId = centralEntryStableId {
|
||||
strongSelf.centralEntryStableId = centralEntryStableId
|
||||
}
|
||||
} else {
|
||||
strongSelf.entries = entries
|
||||
strongSelf.hasLeftEntries = view.hasEarlier
|
||||
strongSelf.hasRightEntries = view.hasLater
|
||||
if strongSelf.centralEntryStableId == nil {
|
||||
strongSelf.centralEntryStableId = centralEntryStableId
|
||||
}
|
||||
strongSelf.centralEntryStableId = centralEntryStableId
|
||||
}
|
||||
if strongSelf.isViewLoaded {
|
||||
var items: [GalleryItem] = []
|
||||
@ -565,17 +547,13 @@ public class GalleryController: ViewController, StandalonePresentableController
|
||||
strongSelf.galleryNode.pager.replaceItems(items, centralItemIndex: centralItemIndex)
|
||||
|
||||
if strongSelf.temporaryDoNotWaitForReady {
|
||||
if !strongSelf.didSetReady {
|
||||
strongSelf.didSetReady = true
|
||||
strongSelf._ready.set(.single(true))
|
||||
}
|
||||
strongSelf.didSetReady = true
|
||||
strongSelf._ready.set(.single(true))
|
||||
} else {
|
||||
if !strongSelf.didSetReady {
|
||||
let ready = strongSelf.galleryNode.pager.ready() |> timeout(2.0, queue: Queue.mainQueue(), alternate: .single(Void())) |> afterNext { [weak strongSelf] _ in
|
||||
strongSelf?.didSetReady = true
|
||||
}
|
||||
strongSelf._ready.set(ready |> map { true })
|
||||
let ready = strongSelf.galleryNode.pager.ready() |> timeout(2.0, queue: Queue.mainQueue(), alternate: .single(Void())) |> afterNext { [weak strongSelf] _ in
|
||||
strongSelf?.didSetReady = true
|
||||
}
|
||||
strongSelf._ready.set(ready |> map { true })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -590,7 +568,7 @@ public class GalleryController: ViewController, StandalonePresentableController
|
||||
return (true, nil)
|
||||
}
|
||||
semaphore?.signal()
|
||||
if process || true {
|
||||
if process {
|
||||
Queue.mainQueue().async {
|
||||
f()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user