mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-31 09:52:04 +00:00
[WIP] Stories
This commit is contained in:
parent
9b7e421107
commit
7015298cd5
@ -839,6 +839,9 @@ public final class PeerExpiringStoryListContext {
|
||||
private var pollDisposable: Disposable?
|
||||
|
||||
private let statePromise = Promise<State>()
|
||||
var state: Signal<State, NoError> {
|
||||
return self.statePromise.get()
|
||||
}
|
||||
|
||||
init(queue: Queue, account: Account, peerId: EnginePeer.Id) {
|
||||
self.queue = queue
|
||||
@ -1034,6 +1037,12 @@ public final class PeerExpiringStoryListContext {
|
||||
private let queue: Queue
|
||||
private let impl: QueueLocalObject<Impl>
|
||||
|
||||
public var state: Signal<State, NoError> {
|
||||
return impl.signalWith { impl, subscriber in
|
||||
return impl.state.start(next: subscriber.putNext)
|
||||
}
|
||||
}
|
||||
|
||||
public init(account: Account, peerId: EnginePeer.Id) {
|
||||
let queue = Queue.mainQueue()
|
||||
self.queue = queue
|
||||
|
@ -472,6 +472,19 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
return super.hitTest(point, with: event)
|
||||
}
|
||||
|
||||
private func isProgressPaused() -> Bool {
|
||||
guard let component = self.component else {
|
||||
return false
|
||||
}
|
||||
if self.inputPanelExternalState.isEditing || component.isProgressPaused || self.displayReactions || self.actionSheet != nil || self.contextController != nil || self.sendMessageContext.audioRecorderValue != nil || self.sendMessageContext.videoRecorderValue != nil || self.displayViewList {
|
||||
return true
|
||||
}
|
||||
if let captionItem = self.captionItem, captionItem.externalState.expandFraction > 0.0 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private func updateScrolling(transition: Transition) {
|
||||
guard let component = self.component, let itemLayout = self.itemLayout else {
|
||||
return
|
||||
@ -535,7 +548,7 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
itemTransition.setFrame(view: view, frame: CGRect(origin: CGPoint(), size: itemLayout.size))
|
||||
|
||||
if let view = view as? StoryContentItem.View {
|
||||
view.setIsProgressPaused(self.inputPanelExternalState.isEditing || component.isProgressPaused || self.displayReactions || self.actionSheet != nil || self.contextController != nil || self.sendMessageContext.audioRecorderValue != nil || self.sendMessageContext.videoRecorderValue != nil || self.displayViewList)
|
||||
view.setIsProgressPaused(self.isProgressPaused())
|
||||
}
|
||||
}
|
||||
|
||||
@ -554,13 +567,10 @@ public final class StoryItemSetContainerComponent: Component {
|
||||
}
|
||||
|
||||
func updateIsProgressPaused() {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
for (_, visibleItem) in self.visibleItems {
|
||||
if let view = visibleItem.view.view {
|
||||
if let view = view as? StoryContentItem.View {
|
||||
view.setIsProgressPaused(self.inputPanelExternalState.isEditing || component.isProgressPaused || self.displayReactions || self.actionSheet != nil || self.contextController != nil || self.sendMessageContext.audioRecorderValue != nil || self.sendMessageContext.videoRecorderValue != nil || self.displayViewList || self.isEditingStory)
|
||||
view.setIsProgressPaused(self.isProgressPaused())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -401,9 +401,11 @@ func keepPeerInfoScreenDataHot(context: AccountContext, peerId: PeerId, chatLoca
|
||||
if case .user = inputData {
|
||||
signals.append(Signal { _ in
|
||||
let listContext = PeerStoryListContext(account: context.account, peerId: peerId, isArchived: false)
|
||||
let expiringListContext = PeerExpiringStoryListContext(account: context.account, peerId: peerId)
|
||||
|
||||
return ActionDisposable {
|
||||
let _ = listContext
|
||||
let _ = expiringListContext
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user