mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 13:35:19 +00:00
Web apps terms of service
This commit is contained in:
parent
df85d60084
commit
8bf4cbc1f0
@ -11616,3 +11616,6 @@ Sorry for the inconvenience.";
|
||||
|
||||
"ChannelBoost.NoAds" = "Switch Off Ads";
|
||||
"ChannelBoost.EnableNoAdsLevelText" = "Your channel needs **Level %1$@** to switch off ads.";
|
||||
|
||||
"WebApp.TermsOfUse" = "Terms of Use";
|
||||
"WebApp.TermsOfUse_URL" = "https://telegram.org/tos/mini-apps";
|
||||
|
@ -48,6 +48,14 @@ public func cachedPrivacyPage(context: AccountContext) -> Signal<ResolvedUrl, No
|
||||
return cachedInternalInstantPage(context: context, url: privacyUrl)
|
||||
}
|
||||
|
||||
public func cachedWebAppTermsPage(context: AccountContext) -> Signal<ResolvedUrl, NoError> {
|
||||
var privacyUrl = context.sharedContext.currentPresentationData.with { $0 }.strings.WebApp_TermsOfUse_URL
|
||||
if privacyUrl == "WebApp.TermsOfUse_URL" || privacyUrl.isEmpty {
|
||||
privacyUrl = "https://telegram.org/tos/mini-apps"
|
||||
}
|
||||
return cachedInternalInstantPage(context: context, url: privacyUrl)
|
||||
}
|
||||
|
||||
private func cachedInternalInstantPage(context: AccountContext, url: String) -> Signal<ResolvedUrl, NoError> {
|
||||
let (cachedUrl, anchor) = extractAnchor(string: url)
|
||||
return cachedInstantPage(engine: context.engine, url: cachedUrl)
|
||||
|
@ -34,6 +34,7 @@ swift_library(
|
||||
"//submodules/Markdown:Markdown",
|
||||
"//submodules/TextFormat:TextFormat",
|
||||
"//submodules/LocalAuth",
|
||||
"//submodules/InstantPageCache"
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -23,6 +23,7 @@ import PromptUI
|
||||
import PhoneNumberFormat
|
||||
import QrCodeUI
|
||||
import InstantPageUI
|
||||
import InstantPageCache
|
||||
import LocalAuth
|
||||
|
||||
private let durgerKingBotIds: [Int64] = [5104055776, 2200339955]
|
||||
@ -1849,6 +1850,25 @@ public final class WebAppController: ViewController, AttachmentContainable {
|
||||
self?.controllerNode.webView?.reload()
|
||||
})))
|
||||
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_TermsOfUse, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Info"), color: theme.contextMenu.primaryColor)
|
||||
}, action: { [weak self] c, _ in
|
||||
c.dismiss(completion: nil)
|
||||
|
||||
guard let self, let navigationController = self.getNavigationController() else {
|
||||
return
|
||||
}
|
||||
|
||||
let context = self.context
|
||||
let _ = (cachedWebAppTermsPage(context: context)
|
||||
|> deliverOnMainQueue).startStandalone(next: { resolvedUrl in
|
||||
context.sharedContext.openResolvedUrl(resolvedUrl, context: context, urlContext: .generic, navigationController: navigationController, forceExternal: true, openPeer: { peer, navigation in
|
||||
}, sendFile: nil, sendSticker: nil, requestMessageActionUrlAuth: nil, joinVoiceChat: nil, present: { [weak self] c, arguments in
|
||||
self?.push(c)
|
||||
}, dismissInput: {}, contentContext: nil, progress: nil, completion: nil)
|
||||
})
|
||||
})))
|
||||
|
||||
if let _ = attachMenuBot, [.attachMenu, .settings, .generic].contains(source) {
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.WebApp_RemoveBot, textColor: .destructive, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user