Merge branch 'master' of gitlab.com:peter-iakovlev/telegram-ios

This commit is contained in:
Ilya Laktyushin 2023-09-19 20:58:41 +04:00
commit b4846170f0
3 changed files with 11 additions and 7 deletions

View File

@ -24,7 +24,7 @@ public func |> <T, U>(value: T, function: ((T) -> U)) -> U {
}
private final class SubscriberDisposable<T, E>: Disposable, CustomStringConvertible {
private let subscriber: Subscriber<T, E>
private weak var subscriber: Subscriber<T, E>?
private var lock = pthread_mutex_t()
private var disposable: Disposable?
@ -41,15 +41,18 @@ private final class SubscriberDisposable<T, E>: Disposable, CustomStringConverti
}
func dispose() {
self.subscriber.markTerminatedWithoutDisposal()
var subscriber: Subscriber<T, E>?
var disposeItem: Disposable?
pthread_mutex_lock(&self.lock)
disposeItem = self.disposable
subscriber = self.subscriber
self.subscriber = nil
self.disposable = nil
pthread_mutex_unlock(&self.lock)
disposeItem?.dispose()
subscriber?.markTerminatedWithoutDisposal()
}
public var description: String {

View File

@ -8289,7 +8289,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
self.postingAvailabilityDisposable?.dispose()
let canPostStatus: Signal<StoriesUploadAvailability, NoError>
#if DEBUG
#if DEBUG && false
canPostStatus = .single(.available)
#else
canPostStatus = self.context.engine.messages.checkStoriesUploadAvailability(target: .peer(self.peerId))
@ -8316,7 +8316,9 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
coordinator?.animateIn()
}
case .channelBoostRequired:
let _ = combineLatest(
self.postingAvailabilityDisposable?.dispose()
self.postingAvailabilityDisposable = combineLatest(
queue: Queue.mainQueue(),
self.context.engine.data.get(TelegramEngine.EngineData.Item.Peer.Peer(id: self.peerId)),
self.context.engine.peers.getChannelBoostStatus(peerId: self.peerId)
@ -8352,7 +8354,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
self.hapticFeedback.impact(.light)
})
}).strict()
default:
break
}
@ -9873,7 +9875,7 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
} else if peerInfoCanEdit(peer: self.data?.peer, chatLocation: self.chatLocation, threadData: self.data?.threadData, cachedData: self.data?.cachedData, isContact: self.data?.isContact) {
rightNavigationButtons.append(PeerInfoHeaderNavigationButtonSpec(key: .edit, isForExpandedView: false))
}
if let data = self.data, data.accountIsPremium, let channel = data.peer as? TelegramChannel, channel.hasPermission(.postStories) {
if let data = self.data, data.accountIsPremium, let channel = data.peer as? TelegramChannel, case .broadcast = channel.info, channel.hasPermission(.postStories) {
rightNavigationButtons.insert(PeerInfoHeaderNavigationButtonSpec(key: .postStory, isForExpandedView: false), at: 0)
}