Merge commit '7ff3593c69b1576f5ea3eaab38d4cf240181bdac'

This commit is contained in:
Peter 2019-09-28 01:36:51 +04:00
commit c506a69a9b
3 changed files with 6 additions and 8 deletions

View File

@ -17,7 +17,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>XPC!</string> <string>XPC!</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>5.12</string> <string>$(PRODUCT_BUNDLE_SHORT_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>${BUILD_NUMBER}</string> <string>${BUILD_NUMBER}</string>
<key>NSExtension</key> <key>NSExtension</key>

View File

@ -28,6 +28,7 @@ static_library(
"//submodules/TelegramStringFormatting:TelegramStringFormatting", "//submodules/TelegramStringFormatting:TelegramStringFormatting",
"//submodules/GlassButtonNode:GlassButtonNode", "//submodules/GlassButtonNode:GlassButtonNode",
"//submodules/UrlHandling:UrlHandling", "//submodules/UrlHandling:UrlHandling",
"//submodules/UrlEscaping:UrlEscaping",
"//submodules/LocalAuth:LocalAuth", "//submodules/LocalAuth:LocalAuth",
], ],
frameworks = [ frameworks = [

View File

@ -11,6 +11,7 @@ import ItemListUI
import SwiftSignalKit import SwiftSignalKit
import OverlayStatusController import OverlayStatusController
import ShareController import ShareController
import UrlEscaping
private final class WalletReceiveScreenArguments { private final class WalletReceiveScreenArguments {
let context: AccountContext let context: AccountContext
@ -275,7 +276,7 @@ private func walletReceiveScreenEntries(presentationData: PresentationData, addr
addressText = formatAddress(address) addressText = formatAddress(address)
addressMonospace = true addressMonospace = true
} else { } else {
addressText = invoiceUrl(address: address, state: state, escapeComment: false) addressText = invoiceUrl(address: address, state: state, escapeComment: true)
} }
entries.append(.address(presentationData.theme, addressText, addressMonospace)) entries.append(.address(presentationData.theme, addressText, addressMonospace))
entries.append(.copyAddress(presentationData.theme, state.isEmpty ? presentationData.strings.Wallet_Receive_CopyAddress : presentationData.strings.Wallet_Receive_CopyInvoiceUrl)) entries.append(.copyAddress(presentationData.theme, state.isEmpty ? presentationData.strings.Wallet_Receive_CopyAddress : presentationData.strings.Wallet_Receive_CopyInvoiceUrl))
@ -306,13 +307,9 @@ private func invoiceUrl(address: String, state: WalletReceiveScreenState, escape
arguments += arguments.isEmpty ? "?" : "&" arguments += arguments.isEmpty ? "?" : "&"
arguments += "amount=\(amountValue(state.amount))" arguments += "amount=\(amountValue(state.amount))"
} }
if !state.comment.isEmpty, let escapedComment = state.comment.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) { if !state.comment.isEmpty {
arguments += arguments.isEmpty ? "?" : "&" arguments += arguments.isEmpty ? "?" : "&"
if escapeComment { arguments += "text=\(urlEncodedStringFromString(state.comment))"
arguments += "text=\(escapedComment)"
} else {
arguments += "text=\(state.comment)"
}
} }
return "ton://transfer/\(address)\(arguments)" return "ton://transfer/\(address)\(arguments)"
} }