mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +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.SectionTitle" = "MEMBERS";
|
||||||
"BoostGift.Members.Search" = "Search Members";
|
"BoostGift.Members.Search" = "Search Members";
|
||||||
"BoostGift.Members.MaximumReached" = "You can select maximum %@ 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 premiumOffer(reference: String?)
|
||||||
case chatFolder(slug: String)
|
case chatFolder(slug: String)
|
||||||
case story(peerId: PeerId, id: Int32)
|
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 premiumGiftCode(slug: String)
|
||||||
case premiumMultiGift(reference: String?)
|
case premiumMultiGift(reference: String?)
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,7 @@ import VideoMessageCameraScreen
|
|||||||
import TopMessageReactions
|
import TopMessageReactions
|
||||||
import PeerInfoScreen
|
import PeerInfoScreen
|
||||||
import AudioWaveform
|
import AudioWaveform
|
||||||
|
import PeerNameColorScreen
|
||||||
|
|
||||||
public enum ChatControllerPeekActions {
|
public enum ChatControllerPeekActions {
|
||||||
case standard
|
case standard
|
||||||
@ -961,11 +962,21 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
|||||||
strongSelf.presentThemeSelection()
|
strongSelf.presentThemeSelection()
|
||||||
return true
|
return true
|
||||||
case let .setChatWallpaper(wallpaper, _):
|
case let .setChatWallpaper(wallpaper, _):
|
||||||
guard message.effectivelyIncoming(strongSelf.context.account.peerId), let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
guard let peer = strongSelf.presentationInterfaceState.renderedPeer?.peer else {
|
||||||
strongSelf.presentThemeSelection()
|
|
||||||
return true
|
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
|
return true
|
||||||
}
|
}
|
||||||
strongSelf.chatDisplayNode.dismissInput()
|
strongSelf.chatDisplayNode.dismissInput()
|
||||||
|
@ -866,18 +866,6 @@ func openResolvedUrlImpl(
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
case let .boost(peerId, status, myBoostStatus):
|
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)?
|
var dismissedImpl: (() -> Void)?
|
||||||
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||||
let updateExternalController = storyProgressPauseContext.update
|
let updateExternalController = storyProgressPauseContext.update
|
||||||
@ -886,24 +874,45 @@ func openResolvedUrlImpl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let controller = PremiumBoostLevelsScreen(
|
if let peerId, let status {
|
||||||
context: context,
|
var isCurrent = false
|
||||||
peerId: peerId,
|
if case let .chat(chatPeerId, _, _) = urlContext, chatPeerId == peerId {
|
||||||
mode: .user(mode: isCurrent ? .current : .external),
|
isCurrent = true
|
||||||
status: status,
|
}
|
||||||
myBoostStatus: myBoostStatus,
|
var forceDark = false
|
||||||
openPeer: { peer in
|
if let updatedPresentationData, updatedPresentationData.initial.theme.overallDarkAppearance {
|
||||||
openPeer(peer, .chat(textInputState: nil, subject: nil, peekData: nil))
|
forceDark = true
|
||||||
},
|
}
|
||||||
forceDark: forceDark
|
let controller = PremiumBoostLevelsScreen(
|
||||||
)
|
context: context,
|
||||||
controller.disposed = {
|
peerId: peerId,
|
||||||
dismissedImpl?()
|
mode: .user(mode: isCurrent ? .current : .external),
|
||||||
}
|
status: status,
|
||||||
navigationController?.pushViewController(controller)
|
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 {
|
if let storyProgressPauseContext = contentContext as? StoryProgressPauseContext {
|
||||||
storyProgressPauseContext.update(controller)
|
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):
|
case let .premiumGiftCode(slug):
|
||||||
var forceDark = false
|
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))))
|
return .single(.result(.peer(peer._asPeer(), .chat(textInputState: nil, subject: nil, peekData: nil))))
|
||||||
}
|
}
|
||||||
} else {
|
} 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):
|
case let .peerId(peerId):
|
||||||
|
@ -86,5 +86,9 @@ public func parseUrl(url: String, wasConcealed: Bool) -> (string: String, concea
|
|||||||
concealed = false
|
concealed = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if url.hasPrefix("tg://premium_multigift") || url.hasPrefix("tg://premium_offer") {
|
||||||
|
concealed = false
|
||||||
|
}
|
||||||
|
|
||||||
return (rawDisplayUrl, concealed)
|
return (rawDisplayUrl, concealed)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user