diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 1277b72c59..511914ef1b 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -7967,3 +7967,5 @@ Sorry for the inconvenience."; "Login.PhoneNumberConfirmation" = "Is this the correct number?"; "Login.Edit" = "Edit"; "Login.Yes" = "Yes"; + +"Checkout.PaymentLiabilityBothAlert" = "Telegram will not have access to your credit card information. Credit card details will be handled only by the payment system, {target}.\n\nPayments will go directly to the developer of {target}. Telegram cannot provide any guarantees, so proceed at your own risk. In case of problems, please contact the developer of {target} or your bank."; diff --git a/submodules/BotPaymentsUI/Sources/BotCheckoutControllerNode.swift b/submodules/BotPaymentsUI/Sources/BotCheckoutControllerNode.swift index 17c73da3c7..5e33e8e693 100644 --- a/submodules/BotPaymentsUI/Sources/BotCheckoutControllerNode.swift +++ b/submodules/BotPaymentsUI/Sources/BotCheckoutControllerNode.swift @@ -1464,10 +1464,16 @@ final class BotCheckoutControllerNode: ItemListControllerNode, PKPaymentAuthoriz if value { strongSelf.pay(savedCredentialsToken: savedCredentialsToken, liabilityNoticeAccepted: true) } else { - let paymentText = strongSelf.presentationData.strings.Checkout_PaymentLiabilityAlert + let paymentText: String + if botPeer.id == providerPeer?.id { + paymentText = strongSelf.presentationData.strings.Checkout_PaymentLiabilityBothAlert + .replacingOccurrences(of: "{target}", with: botPeer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)) + } else { + paymentText = strongSelf.presentationData.strings.Checkout_PaymentLiabilityAlert .replacingOccurrences(of: "{target}", with: botPeer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)) .replacingOccurrences(of: "{payment_system}", with: providerPeer?.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder) ?? "") - + } + strongSelf.present(textAlertController(context: strongSelf.context, title: strongSelf.presentationData.strings.Checkout_LiabilityAlertTitle, text: paymentText, actions: [TextAlertAction(type: .genericAction, title: strongSelf.presentationData.strings.Common_Cancel, action: { }), TextAlertAction(type: .defaultAction, title: strongSelf.presentationData.strings.Common_OK, action: { if let strongSelf = self { let _ = ApplicationSpecificNotice.setBotPaymentLiability(accountManager: strongSelf.context.sharedContext.accountManager, peerId: paymentForm.paymentBotId).start() diff --git a/submodules/InAppPurchaseManager/Sources/StoredTransactionState.swift b/submodules/InAppPurchaseManager/Sources/StoredTransactionState.swift deleted file mode 100644 index 3f0f328d81..0000000000 --- a/submodules/InAppPurchaseManager/Sources/StoredTransactionState.swift +++ /dev/null @@ -1,57 +0,0 @@ -//import Foundation -//import UIKit -//import SwiftSignalKit -//import Postbox -//import TelegramCore -//import TelegramUIPreferences -// -//final class StoredTransactionState: Codable { -// let timestamp: Double -// let playbackRate: AudioPlaybackRate -// -// init(timestamp: Double, playbackRate: AudioPlaybackRate) { -// self.timestamp = timestamp -// self.playbackRate = playbackRate -// } -// -// public init(from decoder: Decoder) throws { -// let container = try decoder.container(keyedBy: StringCodingKey.self) -// -// self.timestamp = try container.decode(Double.self, forKey: "timestamp") -// self.playbackRate = AudioPlaybackRate(rawValue: try container.decode(Int32.self, forKey: "playbackRate")) ?? .x1 -// } -// -// public func encode(to encoder: Encoder) throws { -// var container = encoder.container(keyedBy: StringCodingKey.self) -// -// try container.encode(self.timestamp, forKey: "timestamp") -// try container.encode(self.playbackRate.rawValue, forKey: "playbackRate") -// } -//} -// -//public func storedState(engine: TelegramEngine, : MessageId) -> Signal { -// let key = ValueBoxKey(length: 20) -// key.setInt32(0, value: messageId.namespace) -// key.setInt32(4, value: messageId.peerId.namespace._internalGetInt32Value()) -// key.setInt64(8, value: messageId.peerId.id._internalGetInt64Value()) -// key.setInt32(16, value: messageId.id) -// -// return engine.data.get(TelegramEngine.EngineData.Item.ItemCache.Item(collectionId: ApplicationSpecificItemCacheCollectionId.mediaPlaybackStoredState, id: key)) -// |> map { entry -> MediaPlaybackStoredState? in -// return entry?.get(MediaPlaybackStoredState.self) -// } -//} -// -//public func updateMediaPlaybackStoredStateInteractively(engine: TelegramEngine, messageId: MessageId, state: MediaPlaybackStoredState?) -> Signal { -// let key = ValueBoxKey(length: 20) -// key.setInt32(0, value: messageId.namespace) -// key.setInt32(4, value: messageId.peerId.namespace._internalGetInt32Value()) -// key.setInt64(8, value: messageId.peerId.id._internalGetInt64Value()) -// key.setInt32(16, value: messageId.id) -// -// if let state = state { -// return engine.itemCache.put(collectionId: ApplicationSpecificItemCacheCollectionId.mediaPlaybackStoredState, id: key, item: state) -// } else { -// return engine.itemCache.remove(collectionId: ApplicationSpecificItemCacheCollectionId.mediaPlaybackStoredState, id: key) -// } -//} diff --git a/submodules/TelegramUI/Sources/OpenUrl.swift b/submodules/TelegramUI/Sources/OpenUrl.swift index 29e075649e..0274b69d66 100644 --- a/submodules/TelegramUI/Sources/OpenUrl.swift +++ b/submodules/TelegramUI/Sources/OpenUrl.swift @@ -647,6 +647,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur var domain: String? var start: String? var startGroup: String? + var startChannel: String? var admin: String? var game: String? var post: String? @@ -684,6 +685,10 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur voiceChat = "" } else if queryItem.name == "startattach" { startAttach = "" + } else if queryItem.name == "startgroup" { + startGroup = "" + } else if queryItem.name == "startchannel" { + startChannel = "" } } } @@ -698,7 +703,20 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur if let start = start { result += "?start=\(start)" } else if let startGroup = startGroup { - result += "?startgroup=\(startGroup)" + if !startGroup.isEmpty { + result += "?startgroup=\(startGroup)" + } else { + result += "?startgroup + } + if let admin = admin { + result += "&admin=\(admin)" + } + } else if let startChannel = startChannel { + if !startChannel.isEmpty { + result += "?startchannel=\(startChannel)" + } else { + result += "?startchannel + } if let admin = admin { result += "&admin=\(admin)" } diff --git a/submodules/UrlHandling/Sources/UrlHandling.swift b/submodules/UrlHandling/Sources/UrlHandling.swift index 6845840629..a277e28ba8 100644 --- a/submodules/UrlHandling/Sources/UrlHandling.swift +++ b/submodules/UrlHandling/Sources/UrlHandling.swift @@ -230,6 +230,15 @@ public func parseInternalUrl(query: String) -> ParsedInternalUrl? { } } return .startAttach(peerName, nil, choose) + } else if queryItem.name == "startgroup" || queryItem.name == "startchannel" { + var botAdminRights: ResolvedBotAdminRights? + for queryItem in queryItems { + if queryItem.name == "admin", let value = queryItem.value { + botAdminRights = ResolvedBotAdminRights(value) + break + } + } + return .peerName(peerName, .groupBotStart("", botAdminRights)) } } }