mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Add hasWalletAccess
This commit is contained in:
parent
0514af167b
commit
65a6af7226
@ -528,6 +528,7 @@ public protocol AccountContext: class {
|
||||
var wallpaperUploadManager: WallpaperUploadManager? { get }
|
||||
var watchManager: WatchManager? { get }
|
||||
var hasWallets: Signal<Bool, NoError> { get }
|
||||
var hasWalletAccess: Signal<Bool, NoError> { get }
|
||||
|
||||
var currentLimitsConfiguration: Atomic<LimitsConfiguration> { get }
|
||||
|
||||
|
@ -1169,14 +1169,7 @@ public func settingsController(context: AccountContext, accountManager: AccountM
|
||||
|
||||
let hasWallet = contextValue.get()
|
||||
|> mapToSignal { context in
|
||||
return context.account.postbox.preferencesView(keys: [PreferencesKeys.appConfiguration])
|
||||
|> map { view -> Bool in
|
||||
if #available(iOSApplicationExtension 10.3, iOS 10.3, *) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return context.hasWalletAccess
|
||||
}
|
||||
|
||||
let hasPassport = ValuePromise<Bool>(false)
|
||||
|
@ -10,6 +10,7 @@ import AccountContext
|
||||
import LiveLocationManager
|
||||
import TemporaryCachedPeerDataManager
|
||||
import WalletCore
|
||||
import WalletUI
|
||||
|
||||
private final class DeviceSpecificContactImportContext {
|
||||
let disposable = MetaDisposable()
|
||||
@ -139,6 +140,22 @@ public final class AccountContextImpl: AccountContext {
|
||||
}
|
||||
}
|
||||
|
||||
public var hasWalletAccess: Signal<Bool, NoError> {
|
||||
return self.account.postbox.preferencesView(keys: [PreferencesKeys.appConfiguration])
|
||||
|> map { view -> Bool in
|
||||
guard let appConfiguration = view.values[PreferencesKeys.appConfiguration] as? AppConfiguration else {
|
||||
return false
|
||||
}
|
||||
let walletConfiguration = WalletConfiguration.with(appConfiguration: appConfiguration)
|
||||
if walletConfiguration.config != nil && walletConfiguration.blockchainName != nil {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|> distinctUntilChanged
|
||||
}
|
||||
|
||||
public init(sharedContext: SharedAccountContextImpl, account: Account, tonContext: StoredTonContext?, limitsConfiguration: LimitsConfiguration) {
|
||||
self.sharedContextImpl = sharedContext
|
||||
self.account = account
|
||||
|
Loading…
x
Reference in New Issue
Block a user