mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
Group boosts
This commit is contained in:
@@ -832,7 +832,7 @@ public enum CreateGiveawaySubject {
|
||||
case prepaid(PrepaidGiveaway)
|
||||
}
|
||||
|
||||
public func createGiveawayController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: EnginePeer.Id, subject: CreateGiveawaySubject, completion: (() -> Void)? = nil) -> ViewController {
|
||||
public func createGiveawayController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, peerId: EnginePeer.Id, subject: CreateGiveawaySubject, completion: (() -> Void)? = nil) -> ViewController {
|
||||
let actionsDisposable = DisposableSet()
|
||||
|
||||
let initialSubscriptions: Int32
|
||||
@@ -865,6 +865,8 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
|
||||
statePromise.set(stateValue.modify { f($0) })
|
||||
}
|
||||
|
||||
let isGroupValue = Atomic<Bool>(value: false)
|
||||
|
||||
let productsValue = Atomic<[PremiumGiftProduct]?>(value: nil)
|
||||
|
||||
var buyActionImpl: (() -> Void)?
|
||||
@@ -967,6 +969,7 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
|
||||
if let peer = peersMap[peerId], case let .channel(channel) = peer, case .group = channel.info {
|
||||
isGroup = true
|
||||
}
|
||||
let _ = isGroupValue.swap(isGroup)
|
||||
|
||||
let headerItem = CreateGiveawayHeaderItem(theme: presentationData.theme, strings: presentationData.strings, title: presentationData.strings.BoostGift_Title, text: isGroup ? presentationData.strings.BoostGift_Group_Description : presentationData.strings.BoostGift_Description, cancel: {
|
||||
dismissImpl?()
|
||||
@@ -1258,11 +1261,11 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio
|
||||
}
|
||||
|
||||
openChannelsSelectionImpl = {
|
||||
let isGroup = isGroupValue.with { $0 }
|
||||
let state = stateValue.with { $0 }
|
||||
|
||||
let stateContext = ShareWithPeersScreen.StateContext(
|
||||
context: context,
|
||||
subject: .channels(exclude: Set([peerId]), searchQuery: nil),
|
||||
subject: .channels(isGroup: isGroup, exclude: Set([peerId]), searchQuery: nil),
|
||||
initialPeerIds: Set(state.channels.filter { $0 != peerId })
|
||||
)
|
||||
let _ = (stateContext.ready |> filter { $0 } |> take(1) |> deliverOnMainQueue).startStandalone(next: { _ in
|
||||
|
||||
Reference in New Issue
Block a user