mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-07 01:10:09 +00:00
Various fixes
This commit is contained in:
parent
06d97d2f4d
commit
b5737f0eea
@ -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.";
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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<MediaPlaybackStoredState?, NoError> {
|
||||
// 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<Never, NoError> {
|
||||
// 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)
|
||||
// }
|
||||
//}
|
||||
@ -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)"
|
||||
}
|
||||
|
||||
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user