mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
ADD: Wallet balance hide/show on Watch app
This commit is contained in:
parent
5b8a4d73e2
commit
f4535655a2
7 changed files with 20 additions and 26 deletions
|
@ -154,6 +154,7 @@ function WatchConnectivity() {
|
|||
receiveAddress: receiveAddress,
|
||||
transactions: watchTransactions,
|
||||
xpub: wallet.getXpub() ? wallet.getXpub() : wallet.getSecret(),
|
||||
hideBalance: wallet.hideBalance,
|
||||
});
|
||||
}
|
||||
updateApplicationContext({ wallets: walletsToProcess, randomID: Math.floor(Math.random() * 11) });
|
||||
|
|
|
@ -64,10 +64,8 @@
|
|||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES"
|
||||
notificationPayloadFile = "BlueWalletWatch Extension/PushNotificationPayload.apns">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/BlueWallet">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "B40D4E2F225841EC00428FCC"
|
||||
|
@ -75,7 +73,7 @@
|
|||
BlueprintName = "BlueWalletWatch"
|
||||
ReferencedContainer = "container:BlueWallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
</BuildableProductRunnable>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
@ -83,10 +81,8 @@
|
|||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
debugDocumentVersioning = "YES">
|
||||
<RemoteRunnable
|
||||
runnableDebuggingMode = "2"
|
||||
BundleIdentifier = "com.apple.Carousel"
|
||||
RemotePath = "/BlueWallet">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "B40D4E2F225841EC00428FCC"
|
||||
|
@ -94,16 +90,7 @@
|
|||
BlueprintName = "BlueWalletWatch"
|
||||
ReferencedContainer = "container:BlueWallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</RemoteRunnable>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "B40D4E2F225841EC00428FCC"
|
||||
BuildableName = "BlueWalletWatch.app"
|
||||
BlueprintName = "BlueWalletWatch"
|
||||
ReferencedContainer = "container:BlueWallet.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
|
|
|
@ -38,8 +38,9 @@ class InterfaceController: WKInterfaceController {
|
|||
if wallet.identifier == nil {
|
||||
WatchDataSource.shared.wallets[index].identifier = index
|
||||
}
|
||||
controller.walletBalanceLabel.setHidden(wallet.hideBalance)
|
||||
controller.name = wallet.label
|
||||
controller.balance = wallet.balance
|
||||
controller.balance = wallet.hideBalance ? "" : wallet.balance
|
||||
controller.type = WalletGradient(rawValue: wallet.type) ?? .SegwitHD
|
||||
}
|
||||
noWalletsAvailableLabel.setHidden(!WatchDataSource.shared.wallets.isEmpty)
|
||||
|
|
|
@ -23,8 +23,9 @@ class Wallet: NSObject, NSCoding {
|
|||
let receiveAddress: String
|
||||
let transactions: [Transaction]
|
||||
let xpub: String?
|
||||
let hideBalance: Bool
|
||||
|
||||
init(label: String, balance: String, type: String, preferredBalanceUnit: String, receiveAddress: String, transactions: [Transaction], identifier: Int, xpub: String?) {
|
||||
init(label: String, balance: String, type: String, preferredBalanceUnit: String, receiveAddress: String, transactions: [Transaction], identifier: Int, xpub: String?, hideBalance: Bool = false) {
|
||||
self.label = label
|
||||
self.balance = balance
|
||||
self.type = type
|
||||
|
@ -33,6 +34,7 @@ class Wallet: NSObject, NSCoding {
|
|||
self.transactions = transactions
|
||||
self.identifier = identifier
|
||||
self.xpub = xpub
|
||||
self.hideBalance = hideBalance
|
||||
}
|
||||
|
||||
func encode(with aCoder: NSCoder) {
|
||||
|
@ -44,6 +46,7 @@ class Wallet: NSObject, NSCoding {
|
|||
aCoder.encode(transactions, forKey: "transactions")
|
||||
aCoder.encode(identifier, forKey: "identifier")
|
||||
aCoder.encode(xpub, forKey: "xpub")
|
||||
aCoder.encode(hideBalance, forKey: "hideBalance")
|
||||
}
|
||||
|
||||
required init?(coder aDecoder: NSCoder) {
|
||||
|
@ -54,6 +57,7 @@ class Wallet: NSObject, NSCoding {
|
|||
receiveAddress = aDecoder.decodeObject(forKey: "receiveAddress") as! String
|
||||
transactions = aDecoder.decodeObject(forKey: "transactions") as? [Transaction] ?? [Transaction]()
|
||||
xpub = aDecoder.decodeObject(forKey: "xpub") as? String
|
||||
hideBalance = aDecoder.decodeObject(forKey: "hideBalance") as? Bool ?? false
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import WatchKit
|
|||
|
||||
class WalletInformation: NSObject {
|
||||
|
||||
@IBOutlet private weak var walletBalanceLabel: WKInterfaceLabel!
|
||||
@IBOutlet weak var walletBalanceLabel: WKInterfaceLabel!
|
||||
@IBOutlet private weak var walletNameLabel: WKInterfaceLabel!
|
||||
@IBOutlet private weak var walletGroup: WKInterfaceGroup!
|
||||
static let identifier: String = "WalletInformation"
|
||||
|
|
|
@ -35,7 +35,7 @@ class WatchDataSource: NSObject, WCSessionDelegate {
|
|||
if let walletsToProcess = walletsInfo["wallets"] as? [[String: Any]] {
|
||||
wallets.removeAll();
|
||||
for (index, entry) in walletsToProcess.enumerated() {
|
||||
guard let label = entry["label"] as? String, let balance = entry["balance"] as? String, let type = entry["type"] as? String, let preferredBalanceUnit = entry["preferredBalanceUnit"] as? String, let transactions = entry["transactions"] as? [[String: Any]] else {
|
||||
guard let label = entry["label"] as? String, let balance = entry["balance"] as? String, let type = entry["type"] as? String, let preferredBalanceUnit = entry["preferredBalanceUnit"] as? String, let transactions = entry["transactions"] as? [[String: Any]], let hideBalance = entry["hideBalance"] as? Bool ?? false else {
|
||||
continue
|
||||
}
|
||||
var transactionsProcessed = [Transaction]()
|
||||
|
@ -46,7 +46,7 @@ class WatchDataSource: NSObject, WCSessionDelegate {
|
|||
}
|
||||
let receiveAddress = entry["receiveAddress"] as? String ?? ""
|
||||
let xpub = entry["xpub"] as? String ?? ""
|
||||
let wallet = Wallet(label: label, balance: balance, type: type, preferredBalanceUnit: preferredBalanceUnit, receiveAddress: receiveAddress, transactions: transactionsProcessed, identifier: index, xpub: xpub)
|
||||
let wallet = Wallet(label: label, balance: balance, type: type, preferredBalanceUnit: preferredBalanceUnit, receiveAddress: receiveAddress, transactions: transactionsProcessed, identifier: index, xpub: xpub, hideBalance: hideBalance)
|
||||
wallets.append(wallet)
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@ class WalletDetailsInterfaceController: WKInterfaceController {
|
|||
}
|
||||
let wallet = WatchDataSource.shared.wallets[identifier]
|
||||
self.wallet = wallet
|
||||
walletBalanceLabel.setText(wallet.balance)
|
||||
walletNameLabel.setText(wallet.label)
|
||||
walletBalanceLabel.setHidden(wallet.hideBalance)
|
||||
walletBalanceLabel.setText(wallet.hideBalance ? "" : wallet.balance)
|
||||
walletNameLabel.setText(wallet.label)
|
||||
walletBasicsGroup.setBackgroundImageNamed(WalletGradient(rawValue: wallet.type)?.imageString)
|
||||
createInvoiceButton.setHidden(wallet.type != "lightningCustodianWallet")
|
||||
processWalletsTable()
|
||||
|
|
Loading…
Add table
Reference in a new issue