Don't link unused code

This commit is contained in:
Ali 2020-02-01 23:34:19 +04:00
parent 615e2c7e1a
commit 7e4a7df596
23 changed files with 111 additions and 23 deletions

4
BUCK
View File

@ -48,8 +48,8 @@ resource_dependencies = [
"//submodules/LegacyComponents:LegacyComponentsResources",
"//submodules/TelegramUI:TelegramUIAssets",
"//submodules/TelegramUI:TelegramUIResources",
"//submodules/WalletUI:WalletUIAssets",
"//submodules/WalletUI:WalletUIResources",
#"//submodules/WalletUI:WalletUIAssets",
#"//submodules/WalletUI:WalletUIResources",
"//submodules/PasswordSetupUI:PasswordSetupUIResources",
"//submodules/PasswordSetupUI:PasswordSetupUIAssets",
"//submodules/OverlayStatusController:OverlayStatusControllerResources",

View File

@ -16,7 +16,7 @@ static_library(
"//submodules/Postbox:Postbox#shared",
"//submodules/TelegramCore:TelegramCore#shared",
"//submodules/SyncCore:SyncCore#shared",
"//submodules/WalletCore:WalletCore",
#"//submodules/WalletCore:WalletCore",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",

View File

@ -8,7 +8,10 @@ import SwiftSignalKit
import Display
import DeviceLocationManager
import TemporaryCachedPeerDataManager
#if ENABLE_WALLET
import WalletCore
#endif
public final class TelegramApplicationOpenUrlCompletion {
public let completion: (Bool) -> Void
@ -175,7 +178,9 @@ public enum ResolvedUrl {
case share(url: String?, text: String?, to: String?)
case wallpaper(WallpaperUrlParameter)
case theme(String)
#if ENABLE_WALLET
case wallet(address: String, amount: Int64?, comment: String?)
#endif
case settings(ResolvedUrlSettingsSection)
}
@ -378,10 +383,12 @@ public final class ContactSelectionControllerParams {
}
}
#if ENABLE_WALLET
public enum OpenWalletContext {
case generic
case send(address: String, amount: Int64?, comment: String?)
}
#endif
public let defaultContactLabel: String = "_$!<Mobile>!$_"
@ -464,7 +471,9 @@ public protocol SharedAccountContext: class {
func openAddContact(context: AccountContext, firstName: String, lastName: String, phoneNumber: String, label: String, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, completed: @escaping () -> Void)
func openAddPersonContact(context: AccountContext, peerId: PeerId, pushController: @escaping (ViewController) -> Void, present: @escaping (ViewController, Any?) -> Void)
func presentContactsWarningSuppression(context: AccountContext, present: (ViewController, Any?) -> Void)
#if ENABLE_WALLET
func openWallet(context: AccountContext, walletContext: OpenWalletContext, present: @escaping (ViewController) -> Void)
#endif
func openImagePicker(context: AccountContext, completion: @escaping (UIImage) -> Void, present: @escaping (ViewController) -> Void)
func makeRecentSessionsController(context: AccountContext, activeSessionsContext: ActiveSessionsContext) -> ViewController & RecentSessionsController
@ -477,6 +486,7 @@ public protocol SharedAccountContext: class {
func beginNewAuth(testingEnvironment: Bool)
}
#if ENABLE_WALLET
private final class TonInstanceData {
var config: String?
var blockchainName: String?
@ -541,10 +551,15 @@ public final class TonContext {
}
}
#endif
public protocol AccountContext: class {
var sharedContext: SharedAccountContext { get }
var account: Account { get }
#if ENABLE_WALLET
var tonContext: StoredTonContext? { get }
#endif
var liveLocationManager: LiveLocationManager? { get }
var fetchManager: FetchManager { get }
@ -552,8 +567,11 @@ public protocol AccountContext: class {
var peerChannelMemberCategoriesContextsManager: PeerChannelMemberCategoriesContextsManager { get }
var wallpaperUploadManager: WallpaperUploadManager? { get }
var watchManager: WatchManager? { get }
#if ENABLE_WALLET
var hasWallets: Signal<Bool, NoError> { get }
var hasWalletAccess: Signal<Bool, NoError> { get }
#endif
var currentLimitsConfiguration: Atomic<LimitsConfiguration> { get }
var currentContentSettings: Atomic<ContentSettings> { get }

View File

@ -99,7 +99,7 @@ private final class ContextControllerContentSourceImpl: ContextControllerContent
}
}
public class ChatListControllerImpl: TelegramBaseController, ChatListController, UIViewControllerPreviewingDelegate, TabBarContainedController {
public class ChatListControllerImpl: TelegramBaseController, ChatListController, UIViewControllerPreviewingDelegate/*, TabBarContainedController*/ {
private var validLayout: ContainerViewLayout?
public let context: AccountContext
@ -1808,7 +1808,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
}
}
public func presentTabBarPreviewingController(sourceNodes: [ASDisplayNode]) {
/*public func presentTabBarPreviewingController(sourceNodes: [ASDisplayNode]) {
if self.isNodeLoaded {
let _ = (self.context.account.postbox.transaction { transaction -> [ChatListFilterPreset] in
let settings = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.chatListFilterSettings) as? ChatListFilterSettings ?? ChatListFilterSettings.default
@ -1852,5 +1852,5 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
public func updateTabBarPreviewingControllerPresentation(_ update: TabBarContainedControllerPresentationUpdate) {
}
}*/
}

View File

@ -78,7 +78,7 @@ static_library(
"//submodules/InstantPageCache:InstantPageCache",
"//submodules/AppBundle:AppBundle",
"//submodules/ContextUI:ContextUI",
"//submodules/WalletUI:WalletUI",
#"//submodules/WalletUI:WalletUI",
"//submodules/Markdown:Markdown",
"//submodules/UndoUI:UndoUI",
"//submodules/DeleteChatPeerActionSheetItem:DeleteChatPeerActionSheetItem",

View File

@ -17,7 +17,6 @@ import ItemListUI
import PresentationDataUtils
import OverlayStatusController
import AccountContext
import WalletUI
@objc private final class DebugControllerMailComposeDelegate: NSObject, MFMailComposeViewControllerDelegate {
public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {

View File

@ -219,7 +219,11 @@ func logoutOptionsController(context: AccountContext, navigationController: Navi
presentControllerImpl?(alertController, nil)
})
#if ENABLE_WALLET
let hasWallets = context.hasWallets
#else
let hasWallets: Signal<Bool, NoError> = .single(false)
#endif
let signal = combineLatest(queue: .mainQueue(),
context.sharedContext.presentationData,

View File

@ -882,6 +882,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
})
allItems.append(passport)
#if ENABLE_WALLET
if hasWallet {
let wallet = SettingsSearchableItem(id: .wallet(0), title: strings.Settings_Wallet, alternate: synonyms(strings.SettingsSearch_Synonyms_Wallet), icon: .wallet, breadcrumbs: [], present: { context, _, present in
context.sharedContext.openWallet(context: context, walletContext: .generic, present: { c in
@ -890,6 +891,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
})
allItems.append(wallet)
}
#endif
let support = SettingsSearchableItem(id: .support(0), title: strings.Settings_Support, alternate: synonyms(strings.SettingsSearch_Synonyms_Support), icon: .support, breadcrumbs: [], present: { context, _, present in
let _ = (supportPeerId(account: context.account)

View File

@ -33,7 +33,9 @@ import PeerAvatarGalleryUI
import MapResourceToAvatarSizes
import AppBundle
import ContextUI
#if ENABLE_WALLET
import WalletUI
#endif
import PhoneNumberFormat
import AccountUtils
import AuthTransferUI
@ -221,7 +223,9 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
case themes(PresentationTheme, UIImage?, String)
case language(PresentationTheme, UIImage?, String, String)
case passport(PresentationTheme, UIImage?, String, String)
#if ENABLE_WALLET
case wallet(PresentationTheme, UIImage?, String, String)
#endif
case watch(PresentationTheme, UIImage?, String, String)
case askAQuestion(PresentationTheme, UIImage?, String)
@ -243,8 +247,12 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
return SettingsSection.media.rawValue
case .notificationsAndSounds, .privacyAndSecurity, .dataAndStorage, .themes, .language, .contentStickers:
return SettingsSection.generalSettings.rawValue
case .passport, .wallet, .watch :
case .passport, .watch:
return SettingsSection.advanced.rawValue
#if ENABLE_WALLET
case .wallet:
return SettingsSection.advanced.rawValue
#endif
case .askAQuestion, .faq:
return SettingsSection.help.rawValue
}
@ -290,8 +298,10 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
return 1012
case .contentStickers:
return 1013
#if ENABLE_WALLET
case .wallet:
return 1014
#endif
case .passport:
return 1015
case .watch:
@ -457,12 +467,14 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
} else {
return false
}
#if ENABLE_WALLET
case let .wallet(lhsTheme, lhsImage, lhsText, lhsValue):
if case let .wallet(rhsTheme, rhsImage, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsImage === rhsImage, lhsText == rhsText, lhsValue == rhsValue {
return true
} else {
return false
}
#endif
case let .watch(lhsTheme, lhsImage, lhsText, lhsValue):
if case let .watch(rhsTheme, rhsImage, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsImage === rhsImage, lhsText == rhsText, lhsValue == rhsValue {
return true
@ -596,10 +608,12 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
arguments.openPassport()
})
#if ENABLE_WALLET
case let .wallet(theme, image, text, value):
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
arguments.openWallet()
})
#endif
case let .watch(theme, image, text, value):
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
arguments.openWatch()
@ -685,9 +699,11 @@ private func settingsEntries(account: Account, presentationData: PresentationDat
entries.append(.language(presentationData.theme, PresentationResourcesSettings.language, presentationData.strings.Settings_AppLanguage, languageName.isEmpty ? presentationData.strings.Localization_LanguageName : languageName))
entries.append(.contentStickers(presentationData.theme, PresentationResourcesSettings.stickers, presentationData.strings.ChatSettings_Stickers, unreadTrendingStickerPacks == 0 ? "" : "\(unreadTrendingStickerPacks)", archivedPacks))
#if ENABLE_WALLET
if hasWallet {
entries.append(.wallet(presentationData.theme, PresentationResourcesSettings.wallet, "Gram Wallet", ""))
}
#endif
if hasPassport {
entries.append(.passport(presentationData.theme, PresentationResourcesSettings.passport, presentationData.strings.Settings_Passport, ""))
}
@ -989,6 +1005,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
pushControllerImpl?(SecureIdAuthController(context: context, mode: .list))
})
}, openWallet: {
#if ENABLE_WALLET
let _ = (contextValue.get()
|> deliverOnMainQueue
|> take(1)).start(next: { context in
@ -996,6 +1013,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
pushControllerImpl?(c)
})
})
#endif
}, openWatch: {
let _ = (contextValue.get()
|> deliverOnMainQueue
@ -1252,11 +1270,14 @@ public func settingsController(context: AccountContext, accountManager: AccountM
}
)
)
#if ENABLE_WALLET
let hasWallet = contextValue.get()
|> mapToSignal { context in
return context.hasWalletAccess
}
#else
let hasWallet: Signal<Bool, NoError> = .single(false)
#endif
let hasPassport = ValuePromise<Bool>(false)
let updatePassport: () -> Void = {

View File

@ -186,8 +186,8 @@ framework(
"//submodules/MessageReactionListUI:MessageReactionListUI",
"//submodules/SegmentedControlNode:SegmentedControlNode",
"//submodules/AppBundle:AppBundle",
"//submodules/WalletUI:WalletUI",
"//submodules/WalletCore:WalletCore",
#"//submodules/WalletUI:WalletUI",
#"//submodules/WalletCore:WalletCore",
"//submodules/Markdown:Markdown",
"//submodules/SearchPeerMembers:SearchPeerMembers",
"//submodules/WidgetItems:WidgetItems",

View File

@ -10,8 +10,10 @@ import TelegramPresentationData
import AccountContext
import LiveLocationManager
import TemporaryCachedPeerDataManager
#if ENABLE_WALLET
import WalletCore
import WalletUI
#endif
import PhoneNumberFormat
private final class DeviceSpecificContactImportContext {
@ -106,7 +108,9 @@ public final class AccountContextImpl: AccountContext {
}
public let account: Account
#if ENABLE_WALLET
public let tonContext: StoredTonContext?
#endif
public let fetchManager: FetchManager
private let prefetchManager: PrefetchManager?
@ -142,6 +146,7 @@ public final class AccountContextImpl: AccountContext {
private let deviceSpecificContactImportContexts: QueueLocalObject<DeviceSpecificContactImportContexts>
private var managedAppSpecificContactsDisposable: Disposable?
#if ENABLE_WALLET
public var hasWallets: Signal<Bool, NoError> {
return WalletStorageInterfaceImpl(postbox: self.account.postbox).getWalletRecords()
|> map { records in
@ -164,11 +169,15 @@ public final class AccountContextImpl: AccountContext {
}
|> distinctUntilChanged
}
#endif
public init(sharedContext: SharedAccountContextImpl, account: Account, tonContext: StoredTonContext?, limitsConfiguration: LimitsConfiguration, contentSettings: ContentSettings, temp: Bool = false) {
public init(sharedContext: SharedAccountContextImpl, account: Account, /*tonContext: StoredTonContext?, */limitsConfiguration: LimitsConfiguration, contentSettings: ContentSettings, temp: Bool = false)
{
self.sharedContextImpl = sharedContext
self.account = account
#if ENABLE_WALLET
self.tonContext = tonContext
#endif
self.downloadedMediaStoreManager = DownloadedMediaStoreManagerImpl(postbox: account.postbox, accountManager: sharedContext.accountManager)

View File

@ -26,10 +26,14 @@ import WatchBridge
import LegacyDataImport
import SettingsUI
import AppBundle
#if ENABLE_WALLET
import WalletUI
#endif
import UrlHandling
#if ENABLE_WALLET
import WalletUrl
import WalletCore
#endif
import OpenSSLEncryptionProvider
import AppLock
import PresentationDataUtils
@ -680,6 +684,7 @@ final class SharedApplicationContext {
})
}
#if ENABLE_WALLET
let tonKeychain: TonKeychain
#if targetEnvironment(simulator)
@ -741,6 +746,7 @@ final class SharedApplicationContext {
}
})
#endif
#endif
let sharedContextSignal = accountManagerSignal
|> deliverOnMainQueue
@ -1003,8 +1009,10 @@ final class SharedApplicationContext {
|> deliverOnMainQueue
|> map { accountAndSettings -> AuthorizedApplicationContext? in
return accountAndSettings.flatMap { account, limitsConfiguration, callListSettings, contentSettings in
#if ENABLE_WALLET
let tonContext = StoredTonContext(basePath: account.basePath, postbox: account.postbox, network: account.network, keychain: tonKeychain)
let context = AccountContextImpl(sharedContext: sharedApplicationContext.sharedContext, account: account, tonContext: tonContext, limitsConfiguration: limitsConfiguration, contentSettings: contentSettings)
#endif
let context = AccountContextImpl(sharedContext: sharedApplicationContext.sharedContext, account: account/*, tonContext: tonContext*/, limitsConfiguration: limitsConfiguration, contentSettings: contentSettings)
return AuthorizedApplicationContext(sharedApplicationContext: sharedApplicationContext, mainWindow: self.mainWindow, watchManagerArguments: watchManagerArgumentsPromise.get(), context: context, accountManager: sharedApplicationContext.sharedContext.accountManager, showCallsTab: callListSettings.showTab, reinitializedNotificationSettings: {
let _ = (self.context.get()
|> take(1)
@ -1741,10 +1749,13 @@ final class SharedApplicationContext {
}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), on: .root, blockInteraction: false, completion: {})
} else if let confirmationCode = parseConfirmationCodeUrl(url) {
authContext.rootController.applyConfirmationCode(confirmationCode)
} else if let _ = parseWalletUrl(url) {
}
#if ENABLE_WALLET
if let _ = parseWalletUrl(url) {
let presentationData = authContext.sharedContext.currentPresentationData.with { $0 }
authContext.rootController.currentWindow?.present(standardTextAlertController(theme: AlertControllerTheme(presentationData: presentationData), title: nil, text: "Please log in to your account to use Gram Wallet.", actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), on: .root, blockInteraction: false, completion: {})
}
#endif
}
})
}

View File

@ -49,8 +49,10 @@ import ReactionSelectionNode
import AvatarNode
import MessageReactionListUI
import AppBundle
#if ENABLE_WALLET
import WalletUI
import WalletUrl
#endif
import LocalizedPeerData
import PhoneNumberFormat
import SettingsUI
@ -5695,9 +5697,9 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
if let strongSelf = self {
if let (host, port, username, password, secret) = parseProxyUrl(code) {
strongSelf.openResolved(ResolvedUrl.proxy(host: host, port: port, username: username, password: password, secret: secret))
} else if let url = URL(string: code), let parsedWalletUrl = parseWalletUrl(url) {
}/* else if let url = URL(string: code), let parsedWalletUrl = parseWalletUrl(url) {
//strongSelf.openResolved(ResolvedUrl.wallet(address: parsedWalletUrl.address, amount: parsedWalletUrl.amount, comment: parsedWalletUrl.comment))
}
}*/
}
}, presentSchedulePicker: { [weak self] done in
if let strongSelf = self {

View File

@ -813,8 +813,10 @@ final class ChatRecentActionsControllerNode: ViewControllerTracingNode {
break
case .theme:
break
#if ENABLE_WALLET
case .wallet:
break
#endif
case .settings:
break
}

View File

@ -371,11 +371,13 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
present(textAlertController(context: context, title: nil, text: errorText, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
}))
dismissInput()
#if ENABLE_WALLET
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)
}
#endif
case let .settings(section):
dismissInput()
switch section {

View File

@ -16,8 +16,10 @@ import AccountContext
import UrlEscaping
import PassportUI
import UrlHandling
#if ENABLE_WALLET
import WalletUI
import WalletUrl
#endif
import OpenInExternalAppUI
public struct ParsedSecureIdUrl {
@ -144,6 +146,7 @@ func formattedConfirmationCode(_ code: Int) -> String {
}
func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, url: String, forceExternal: Bool, presentationData: PresentationData, navigationController: NavigationController?, dismissInput: @escaping () -> Void) {
#if ENABLE_WALLET
if url.hasPrefix("ton://") {
if let url = URL(string: url), let parsedUrl = parseWalletUrl(url) {
context.sharedContext.openWallet(context: context, walletContext: .send(address: parsedUrl.address, amount: parsedUrl.amount, comment: parsedUrl.comment)) { c in
@ -153,6 +156,7 @@ func openExternalUrlImpl(context: AccountContext, urlContext: OpenURLContext, ur
return
}
#endif
if forceExternal || url.lowercased().hasPrefix("tel:") || url.lowercased().hasPrefix("calshow:") {
context.sharedContext.applicationBindings.openUrl(url)

View File

@ -271,7 +271,7 @@ public class ShareRootControllerImpl {
|> castError(ShareAuthorizationError.self)
|> map { sharedData, limitsConfigurationAndContentSettings, data -> (AccountContext, PostboxAccessChallengeData, [AccountWithInfo]) in
updateLegacyLocalization(strings: sharedContext.currentPresentationData.with({ $0 }).strings)
let context = AccountContextImpl(sharedContext: sharedContext, account: account, tonContext: nil, limitsConfiguration: limitsConfigurationAndContentSettings.0, contentSettings: limitsConfigurationAndContentSettings.1)
let context = AccountContextImpl(sharedContext: sharedContext, account: account/*, tonContext: nil*/, limitsConfiguration: limitsConfigurationAndContentSettings.0, contentSettings: limitsConfigurationAndContentSettings.1)
return (context, data.data, otherAccounts)
}
}

View File

@ -15,13 +15,15 @@ import PeersNearbyUI
import PeerInfoUI
import SettingsUI
import UrlHandling
#if ENABLE_WALLET
import WalletUI
import WalletCore
#endif
import LegacyMediaPickerUI
import LocalMediaResources
import OverlayStatusController
import AlertUI
import PresentationDataUtils
import WalletCore
private enum CallStatusText: Equatable {
case none
@ -892,7 +894,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
}
public func makeTempAccountContext(account: Account) -> AccountContext {
return AccountContextImpl(sharedContext: self, account: account, tonContext: nil, limitsConfiguration: .defaultValue, contentSettings: .default, temp: true)
return AccountContextImpl(sharedContext: self, account: account/*, tonContext: nil*/, limitsConfiguration: .defaultValue, contentSettings: .default, temp: true)
}
public func openChatMessage(_ params: OpenChatMessageParams) -> Bool {
@ -1146,6 +1148,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
return ChatMessageDateHeader(timestamp: timestamp, scheduled: false, presentationData: ChatPresentationData(theme: ChatPresentationThemeData(theme: theme, wallpaper: wallpaper), fontSize: fontSize, strings: strings, dateTimeFormat: dateTimeFormat, nameDisplayOrder: nameOrder, disableAnimations: false, largeEmoji: false, chatBubbleCorners: chatBubbleCorners, animatedEmojiScale: 1.0, isPreview: true), context: context)
}
#if ENABLE_WALLET
public func openWallet(context: AccountContext, walletContext: OpenWalletContext, present: @escaping (ViewController) -> Void) {
guard let storedContext = context.tonContext else {
return
@ -1205,6 +1208,7 @@ public final class SharedAccountContextImpl: SharedAccountContext {
}
})
}
#endif
public func openImagePicker(context: AccountContext, completion: @escaping (UIImage) -> Void, present: @escaping (ViewController) -> Void) {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }

View File

@ -66,10 +66,12 @@ func handleTextLinkActionImpl(context: AccountContext, peerId: PeerId?, navigate
controller.present(JoinLinkPreviewController(context: context, link: link, navigateToPeer: { peerId in
openResolvedPeerImpl(peerId, .chat(textInputState: nil, subject: nil))
}, parentNavigationController: controller.navigationController as? NavigationController), in: .window(.root))
#if ENABLE_WALLET
case let .wallet(address, amount, comment):
context.sharedContext.openWallet(context: context, walletContext: .send(address: address, amount: amount, comment: comment)) { c in
(controller.navigationController as? NavigationController)?.pushViewController(c)
}
#endif
default:
break
}

View File

@ -1,3 +1,5 @@
#if ENABLE_WALLET
import Foundation
import UIKit
import Display
@ -278,3 +280,5 @@ final class WalletContextImpl: WalletContext {
})
}
}
#endif

View File

@ -13,7 +13,7 @@ static_library(
"//submodules/MtProtoKit:MtProtoKit#shared",
"//submodules/AccountContext:AccountContext",
"//submodules/TelegramUIPreferences:TelegramUIPreferences",
"//submodules/WalletUrl:WalletUrl",
#"//submodules/WalletUrl:WalletUrl",
],
frameworks = [
"$SDKROOT/System/Library/Frameworks/Foundation.framework",

View File

@ -12,7 +12,9 @@ import MtProtoKitDynamic
import TelegramPresentationData
import TelegramUIPreferences
import AccountContext
#if ENABLE_WALLET
import WalletUrl
#endif
public enum ParsedInternalPeerUrlParameter {
case botStart(String)
@ -425,11 +427,13 @@ public func parseWallpaperUrl(_ url: String) -> WallpaperUrlParameter? {
}
public func resolveUrlImpl(account: Account, url: String) -> Signal<ResolvedUrl, NoError> {
#if ENABLE_WALLET
if url.hasPrefix("ton://") {
if let url = URL(string: url), let parsedUrl = parseWalletUrl(url) {
return .single(.wallet(address: parsedUrl.address, amount: parsedUrl.amount, comment: parsedUrl.comment))
}
}
#endif
let schemes = ["http://", "https://", ""]
let baseTelegramMePaths = ["telegram.me", "t.me"]
for basePath in baseTelegramMePaths {

View File

@ -37,8 +37,8 @@ static_library(
"//submodules/LocalAuth:LocalAuth",
"//submodules/ScreenCaptureDetection:ScreenCaptureDetection",
"//submodules/AnimatedStickerNode:AnimatedStickerNode",
"//submodules/WalletUrl:WalletUrl",
"//submodules/WalletCore:WalletCore",
#"//submodules/WalletUrl:WalletUrl",
#"//submodules/WalletCore:WalletCore",
"//submodules/StringPluralization:StringPluralization",
"//submodules/ActivityIndicator:ActivityIndicator",
"//submodules/ProgressNavigationButtonNode:ProgressNavigationButtonNode",