diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index 6613d9583..6d834d4ee 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -2,100 +2,100 @@ "images" : [ { "idiom" : "iphone", - "size" : "20x20", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "20x20", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "29x29", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "iphone", - "size" : "40x40", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" }, { - "size" : "60x60", + "filename" : "app_icon_120.png", "idiom" : "iphone", - "filename" : "cake_xmr_120.png", - "scale" : "2x" + "scale" : "2x", + "size" : "60x60" }, { - "size" : "60x60", + "filename" : "app_icon_180.png", "idiom" : "iphone", - "filename" : "cake_xmr_180.png", - "scale" : "3x" + "scale" : "3x", + "size" : "60x60" }, { "idiom" : "ipad", - "size" : "20x20", - "scale" : "1x" + "scale" : "1x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "20x20", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "1x" + "scale" : "1x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "29x29", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "1x" + "scale" : "1x", + "size" : "40x40" }, { "idiom" : "ipad", - "size" : "40x40", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "1x" + "scale" : "1x", + "size" : "76x76" }, { "idiom" : "ipad", - "size" : "76x76", - "scale" : "2x" + "scale" : "2x", + "size" : "76x76" }, { "idiom" : "ipad", - "size" : "83.5x83.5", - "scale" : "2x" + "scale" : "2x", + "size" : "83.5x83.5" }, { - "size" : "1024x1024", + "filename" : "app_icon_1024.png", "idiom" : "ios-marketing", - "filename" : "cake_xmr_1024.png", - "scale" : "1x" + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png new file mode 100644 index 000000000..268157627 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png new file mode 100644 index 000000000..cc95df4ed Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png new file mode 100644 index 000000000..71e2cadc1 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png deleted file mode 100644 index 4540659cf..000000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png deleted file mode 100644 index 303625681..000000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png and /dev/null differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png deleted file mode 100644 index a22c1f36d..000000000 Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png and /dev/null differ diff --git a/lib/di.dart b/lib/di.dart index 1885a54b8..cae3a068f 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -538,8 +538,7 @@ Future setup( TradeDetailsPage(getIt.get(param1: trade))); getIt.registerFactory(() { - final wallet = getIt.get().wallet; - return WyreService(wallet: wallet); + return WyreService(appStore: getIt.get()); }); getIt.registerFactory(() { @@ -551,10 +550,9 @@ Future setup( WyrePage(getIt.get(), ordersStore: getIt.get(), url: url)); - getIt.registerFactoryParam( - (order, _) => OrderDetailsViewModel( - wyreViewModel: getIt.get(), - orderForDetails: order)); + getIt.registerFactoryParam((order, _) => + OrderDetailsViewModel( + wyreViewModel: getIt.get(), orderForDetails: order)); getIt.registerFactoryParam((Order order, _) => OrderDetailsPage(getIt.get(param1: order))); diff --git a/lib/entities/calculate_fiat_amount.dart b/lib/entities/calculate_fiat_amount.dart index 6302c23a0..407030d7f 100644 --- a/lib/entities/calculate_fiat_amount.dart +++ b/lib/entities/calculate_fiat_amount.dart @@ -4,11 +4,12 @@ String calculateFiatAmount({double price, String cryptoAmount}) { } final _amount = double.parse(cryptoAmount); - final result = price * _amount; + final _result = price * _amount; + final result = _result < 0 ? _result * -1 : _result; if (result == 0.0) { return '0.00'; } return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01'; -} \ No newline at end of file +} diff --git a/lib/entities/wyre_service.dart b/lib/entities/wyre_service.dart index b83bfce68..63346f0e4 100644 --- a/lib/entities/wyre_service.dart +++ b/lib/entities/wyre_service.dart @@ -1,7 +1,7 @@ import 'dart:convert'; -import 'package:cake_wallet/core/wallet_base.dart'; import 'package:cake_wallet/entities/wyre_exception.dart'; import 'package:cake_wallet/exchange/trade_state.dart'; +import 'package:cake_wallet/store/app_store.dart'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; import 'package:cake_wallet/.secrets.g.dart' as secrets; @@ -9,15 +9,9 @@ import 'package:cake_wallet/entities/order.dart'; import 'package:cake_wallet/entities/wallet_type.dart'; class WyreService { - WyreService({ - @required this.wallet, - this.isTestEnvironment = false}) { - baseApiUrl = isTestEnvironment - ? _baseTestApiUrl - : _baseProductApiUrl; - trackUrl = isTestEnvironment - ? _trackTestUrl - : _trackProductUrl; + WyreService({@required this.appStore, this.isTestEnvironment = false}) { + baseApiUrl = isTestEnvironment ? _baseTestApiUrl : _baseProductApiUrl; + trackUrl = isTestEnvironment ? _trackTestUrl : _trackProductUrl; } static const _baseTestApiUrl = 'https://api.testwyre.com'; @@ -31,24 +25,28 @@ class WyreService { static const _trackSuffix = '/track'; final bool isTestEnvironment; - final WalletBase wallet; + final AppStore appStore; - WalletType get walletType => wallet.type; - String get walletAddress => wallet.address; - String get walletId => wallet.id; + WalletType get walletType => appStore.wallet.type; + String get walletAddress => appStore.wallet.address; + String get walletId => appStore.wallet.id; String baseApiUrl; String trackUrl; Future getWyreUrl() async { final timestamp = DateTime.now().millisecondsSinceEpoch.toString(); - final url = baseApiUrl + _ordersSuffix + _reserveSuffix + - _timeStampSuffix + timestamp; + final url = baseApiUrl + + _ordersSuffix + + _reserveSuffix + + _timeStampSuffix + + timestamp; final secretKey = secrets.wyreSecretKey; final accountId = secrets.wyreAccountId; final body = { 'destCurrency': walletTypeToCryptoCurrency(walletType).title, - 'dest': walletTypeToString(walletType).toLowerCase() + ':' + walletAddress, + 'dest': + walletTypeToString(walletType).toLowerCase() + ':' + walletAddress, 'referrerAccountId': accountId, 'lockFields': ['destCurrency', 'dest'] }; @@ -79,7 +77,7 @@ class WyreService { } final orderResponseJSON = - json.decode(orderResponse.body) as Map; + json.decode(orderResponse.body) as Map; final transferId = orderResponseJSON['transferId'] as String; final from = orderResponseJSON['sourceCurrency'] as String; final to = orderResponseJSON['destCurrency'] as String; @@ -87,7 +85,7 @@ class WyreService { final state = TradeState.deserialize(raw: status.toLowerCase()); final createdAtRaw = orderResponseJSON['createdAt'] as int; final createdAt = - DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal(); + DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal(); final transferUrl = baseApiUrl + _transferSuffix + transferId + _trackSuffix; @@ -98,7 +96,7 @@ class WyreService { } final transferResponseJSON = - json.decode(transferResponse.body) as Map; + json.decode(transferResponse.body) as Map; final amount = transferResponseJSON['destAmount'] as double; return Order( @@ -110,7 +108,6 @@ class WyreService { createdAt: createdAt, amount: amount.toString(), receiveAddress: walletAddress, - walletId: walletId - ); + walletId: walletId); } -} \ No newline at end of file +} diff --git a/lib/view_model/dashboard/dashboard_view_model.dart b/lib/view_model/dashboard/dashboard_view_model.dart index 551769808..97ed234e6 100644 --- a/lib/view_model/dashboard/dashboard_view_model.dart +++ b/lib/view_model/dashboard/dashboard_view_model.dart @@ -84,6 +84,8 @@ abstract class DashboardViewModelBase with Store { name = appStore.wallet?.name; wallet ??= appStore.wallet; type = wallet.type; + isOutdatedElectrumWallet = + wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24; final _wallet = wallet; if (_wallet is MoneroWallet) { @@ -234,9 +236,8 @@ abstract class DashboardViewModelBase with Store { await wallet.connectToNode(node: node); } - @computed - bool get isOutdatedElectrumWallet => - wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24; + @observable + bool isOutdatedElectrumWallet; @action void _onWalletChange( @@ -246,6 +247,8 @@ abstract class DashboardViewModelBase with Store { this.wallet = wallet; type = wallet.type; name = wallet.name; + isOutdatedElectrumWallet = + wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24; if (wallet is MoneroWallet) { subname = wallet.account?.label;