mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Group boosts
This commit is contained in:
parent
b938726fb8
commit
43204554cd
@ -11258,3 +11258,5 @@ Sorry for the inconvenience.";
|
||||
"BoostGift.Members.SectionTitle" = "MEMBERS";
|
||||
"BoostGift.Members.Search" = "Search Members";
|
||||
"BoostGift.Members.MaximumReached" = "You can select maximum %@ members.";
|
||||
|
||||
"Chat.ErrorCantBoost" = "Sorry, you can't boost this group or channel.";
|
||||
|
@ -304,7 +304,7 @@ public enum ResolvedUrl {
|
||||
case premiumOffer(reference: String?)
|
||||
case chatFolder(slug: String)
|
||||
case story(peerId: PeerId, id: Int32)
|
||||
case boost(peerId: PeerId, status: ChannelBoostStatus?, myBoostStatus: MyBoostStatus?)
|
||||
case boost(peerId: PeerId?, status: ChannelBoostStatus?, myBoostStatus: MyBoostStatus?)
|
||||
case premiumGiftCode(slug: String)
|
||||
case premiumMultiGift(reference: String?)
|
||||
}
|
||||
|
@ -120,6 +120,7 @@ import VideoMessageCameraScreen
|
||||
import TopMessageReactions
|
||||
import PeerInfoScreen
|
||||
import AudioWaveform
|
||||
import PeerNameColorScreen
|
||||
|
||||
public enum ChatControllerPeekActions {
|
||||
case standard
|
||||
@ -961,11 +962,21 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
strongSelf.presentThemeSelection()
|
||||
return true
|
||||
case let .setChatWallpaper(wallpaper, _):
|
||||
guard message.effectivelyIncoming(strongSelf.context.account.peerId), let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
||||
strongSelf.presentThemeSelection()
|
||||
guard let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
||||
return true
|
||||
}
|
||||
if peer is TelegramChannel {
|
||||
if let peer = peer as? TelegramChannel, peer.hasPermission(.changeInfo) {
|
||||
let _ = (context.engine.peers.getChannelBoostStatus(peerId: peer.id)
|
||||
|> deliverOnMainQueue).start(next: { [weak self] boostStatus in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.push(ChannelAppearanceScreen(context: self.context, updatedPresentationData: self.updatedPresentationData, peerId: peer.id, boostStatus: boostStatus))
|
||||
})
|
||||
return true
|
||||
}
|
||||
guard message.effectivelyIncoming(strongSelf.context.account.peerId), let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
||||
strongSelf.presentThemeSelection()
|
||||
return true
|
||||
}
|
||||
strongSelf.chatDisplayNode.dismissInput()
|
||||
|
@ -866,18 +866,6 @@ func openResolvedUrlImpl(
|
||||
}
|
||||
})
|
||||
case let .boost(peerId, status, myBoostStatus):
|
||||
guard let status else {
|
||||
return
|
||||
}
|
||||
var isCurrent = false
|
||||
if case let .chat(chatPeerId, _, _) = urlContext, chatPeerId == peerId {
|
||||
isCurrent = true
|
||||
}
|
||||
var forceDark = false
|
||||
if let updatedPresentationData, updatedPresentationData.initial.theme.overallDarkAppearance {
|
||||
forceDark = true
|
||||
}
|
||||
|
||||
var dismissedImpl: (() -> Void)?
|
||||
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||
let updateExternalController = storyProgressPauseContext.update
|
||||
@ -886,24 +874,45 @@ func openResolvedUrlImpl(
|
||||
}
|
||||
}
|
||||
|
||||
let controller = PremiumBoostLevelsScreen(
|
||||
context: context,
|
||||
peerId: peerId,
|
||||
mode: .user(mode: isCurrent ? .current : .external),
|
||||
status: status,
|
||||
myBoostStatus: myBoostStatus,
|
||||
openPeer: { peer in
|
||||
openPeer(peer, .chat(textInputState: nil, subject: nil, peekData: nil))
|
||||
},
|
||||
forceDark: forceDark
|
||||
)
|
||||
controller.disposed = {
|
||||
dismissedImpl?()
|
||||
}
|
||||
navigationController?.pushViewController(controller)
|
||||
|
||||
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||
storyProgressPauseContext.update(controller)
|
||||
if let peerId, let status {
|
||||
var isCurrent = false
|
||||
if case let .chat(chatPeerId, _, _) = urlContext, chatPeerId == peerId {
|
||||
isCurrent = true
|
||||
}
|
||||
var forceDark = false
|
||||
if let updatedPresentationData, updatedPresentationData.initial.theme.overallDarkAppearance {
|
||||
forceDark = true
|
||||
}
|
||||
let controller = PremiumBoostLevelsScreen(
|
||||
context: context,
|
||||
peerId: peerId,
|
||||
mode: .user(mode: isCurrent ? .current : .external),
|
||||
status: status,
|
||||
myBoostStatus: myBoostStatus,
|
||||
openPeer: { peer in
|
||||
openPeer(peer, .chat(textInputState: nil, subject: nil, peekData: nil))
|
||||
},
|
||||
forceDark: forceDark
|
||||
)
|
||||
controller.disposed = {
|
||||
dismissedImpl?()
|
||||
}
|
||||
navigationController?.pushViewController(controller)
|
||||
|
||||
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||
storyProgressPauseContext.update(controller)
|
||||
}
|
||||
} else {
|
||||
let controller = textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: presentationData.strings.Chat_ErrorCantBoost, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})])
|
||||
present(controller, nil)
|
||||
|
||||
controller.dismissed = { _ in
|
||||
dismissedImpl?()
|
||||
}
|
||||
|
||||
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||
storyProgressPauseContext.update(controller)
|
||||
}
|
||||
}
|
||||
case let .premiumGiftCode(slug):
|
||||
var forceDark = false
|
||||
|
@ -787,7 +787,11 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl)
|
||||
return .single(.result(.peer(peer._asPeer(), .chat(textInputState: nil, subject: nil, peekData: nil))))
|
||||
}
|
||||
} else {
|
||||
return .single(.result(.peer(nil, .info(nil))))
|
||||
if case .boost = parameter {
|
||||
return .single(.result(.boost(peerId: nil, status: nil, myBoostStatus: nil)))
|
||||
} else {
|
||||
return .single(.result(.peer(nil, .info(nil))))
|
||||
}
|
||||
}
|
||||
}
|
||||
case let .peerId(peerId):
|
||||
|
@ -86,5 +86,9 @@ public func parseUrl(url: String, wasConcealed: Bool) -> (string: String, concea
|
||||
concealed = false
|
||||
}
|
||||
|
||||
if url.hasPrefix("tg://premium_multigift") || url.hasPrefix("tg://premium_offer") {
|
||||
concealed = false
|
||||
}
|
||||
|
||||
return (rawDisplayUrl, concealed)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user