mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-24 15:36:59 +01:00
Merge pull request #2109 from BlueWallet/widgetcrasfix
FIX: double completion block being called
This commit is contained in:
commit
bc81f0d4cf
2 changed files with 3 additions and 3 deletions
|
@ -35,7 +35,8 @@ struct WalletData {
|
||||||
var balance: Double
|
var balance: Double
|
||||||
var latestTransactionTime: Int = 0
|
var latestTransactionTime: Int = 0
|
||||||
var formattedBalanceBTC: String {
|
var formattedBalanceBTC: String {
|
||||||
return "\(balance / 100000000) BTC"
|
let value = NSNumber(value: balance / 100000000);
|
||||||
|
return "\(value.decimalValue) BTC"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,8 @@ extension WidgetAPI {
|
||||||
if let response = String(bytes: data, encoding: .utf8), let nextBlockResponse = response.components(separatedBy: #"result":"#).last?.components(separatedBy: ",").first, let nextBlockResponseDouble = Double(nextBlockResponse.filter({characterSet.contains($0)}).trimmingCharacters(in: .whitespacesAndNewlines)) {
|
if let response = String(bytes: data, encoding: .utf8), let nextBlockResponse = response.components(separatedBy: #"result":"#).last?.components(separatedBy: ",").first, let nextBlockResponseDouble = Double(nextBlockResponse.filter({characterSet.contains($0)}).trimmingCharacters(in: .whitespacesAndNewlines)) {
|
||||||
print("Successfully obtained response from Electrum sever")
|
print("Successfully obtained response from Electrum sever")
|
||||||
print(userElectrumSettings)
|
print(userElectrumSettings)
|
||||||
let marketData = MarketData(nextBlock: String(format: "%.0f", (nextBlockResponseDouble / 1024) * 100000000), sats: "0", price: "0", rate: 0)
|
|
||||||
client.close()
|
client.close()
|
||||||
completion(MarketData(nextBlock: String(format: "%.0f", (nextBlockResponseDouble / 1024) * 100000000), sats: "0", price: "0", rate: 0), nil)
|
let marketData = MarketData(nextBlock: String(format: "%.0f", (nextBlockResponseDouble / 1024) * 100000000), sats: "0", price: "0", rate: 0)
|
||||||
completion(marketData, nil)
|
completion(marketData, nil)
|
||||||
} else {
|
} else {
|
||||||
client.close()
|
client.close()
|
||||||
|
|
Loading…
Add table
Reference in a new issue