mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Wallet: fixed ton:// links
This commit is contained in:
parent
16928cdb85
commit
5b85b9dffa
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
@ -31,15 +31,15 @@
|
||||
SUBQUERY (
|
||||
$extensionItem.attachments,
|
||||
$attachment,
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.audio" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.pkpass"
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.file-url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.movie" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.image" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.text" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.audio" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.data" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.vcard" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.apple.pkpass"
|
||||
).@count == $extensionItem.attachments.@count
|
||||
).@count > 0</string>
|
||||
</dict>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>UIDeviceFamily</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.11.1</string>
|
||||
<string>5.12</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUILD_NUMBER}</string>
|
||||
<key>NSExtension</key>
|
||||
|
@ -325,6 +325,7 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
}))
|
||||
dismissInput()
|
||||
case let .wallet(address, amount, comment):
|
||||
dismissInput()
|
||||
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
|
||||
navigationController?.pushViewController(c)
|
||||
}
|
||||
|
@ -451,12 +451,13 @@ private func isValidWalletAddress(_ address: String) -> Bool {
|
||||
}
|
||||
|
||||
public func parseWalletUrl(_ url: URL) -> ParsedWalletUrl? {
|
||||
guard url.scheme == "ton" else {
|
||||
guard url.scheme == "ton" && url.host == "transfer" else {
|
||||
return nil
|
||||
}
|
||||
var address: String?
|
||||
if let host = url.host, isValidWalletAddress(host) {
|
||||
address = host
|
||||
let path = url.path.trimmingCharacters(in: CharacterSet(charactersIn: "/"))
|
||||
if isValidWalletAddress(path) {
|
||||
address = path
|
||||
}
|
||||
var amount: Int64?
|
||||
var comment: String?
|
||||
|
@ -303,18 +303,18 @@ private final class WalletReceiveScreenImpl: ItemListController<WalletReceiveScr
|
||||
private func invoiceUrl(address: String, state: WalletReceiveScreenState, escapeComment: Bool = true) -> String {
|
||||
var arguments = ""
|
||||
if !state.amount.isEmpty {
|
||||
arguments += arguments.isEmpty ? "/?" : "&"
|
||||
arguments += arguments.isEmpty ? "?" : "&"
|
||||
arguments += "amount=\(amountValue(state.amount))"
|
||||
}
|
||||
if !state.comment.isEmpty, let escapedComment = state.comment.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) {
|
||||
arguments += arguments.isEmpty ? "/?" : "&"
|
||||
arguments += arguments.isEmpty ? "?" : "&"
|
||||
if escapeComment {
|
||||
arguments += "text=\(escapedComment)"
|
||||
} else {
|
||||
arguments += "text=\(state.comment)"
|
||||
}
|
||||
}
|
||||
return "ton://\(address)\(arguments)"
|
||||
return "ton://transfer/\(address)\(arguments)"
|
||||
}
|
||||
|
||||
func walletReceiveScreen(context: AccountContext, tonContext: TonContext, walletInfo: WalletInfo, address: String) -> ViewController {
|
||||
|
@ -163,8 +163,10 @@ public final class WalletSplashScreen: ViewController {
|
||||
}
|
||||
var controllers: [UIViewController] = []
|
||||
for controller in navigationController.viewControllers {
|
||||
if controller is WalletInfoScreen {
|
||||
controllers.append(WalletInfoScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: walletInfo, address: address))
|
||||
if let controller = controller as? WalletInfoScreen {
|
||||
let infoScreen = WalletInfoScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: walletInfo, address: address)
|
||||
infoScreen.navigationPresentation = controller.navigationPresentation
|
||||
controllers.append(infoScreen)
|
||||
} else {
|
||||
controllers.append(controller)
|
||||
}
|
||||
@ -300,7 +302,9 @@ public final class WalletSplashScreen: ViewController {
|
||||
}
|
||||
|
||||
if !controllers.contains(where: { $0 is WalletInfoScreen }) {
|
||||
controllers.append(WalletInfoScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: walletInfo, address: address))
|
||||
let infoScreen = WalletInfoScreen(context: strongSelf.context, tonContext: strongSelf.tonContext, walletInfo: walletInfo, address: address)
|
||||
infoScreen.navigationPresentation = .modal
|
||||
controllers.append(infoScreen)
|
||||
}
|
||||
strongSelf.view.endEditing(true)
|
||||
navigationController.setViewControllers(controllers, animated: true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user