Minor bug fixes.
M committed
May 11, 2021 at 18:37 UTC
f4c57e22f234e23a44f19cdc3ac933001ca23dcd
11 files changed
+75
-76
ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
+42
-42
@@ -2,100 +2,100 @@
2
"images" : [
3
{
4
"idiom" : "iphone",
5
- "size" : "20x20",
6
- "scale" : "2x"
5
+ "scale" : "2x",
6
+ "size" : "20x20"
7
},
8
{
9
"idiom" : "iphone",
10
- "size" : "20x20",
11
- "scale" : "3x"
10
+ "scale" : "3x",
11
+ "size" : "20x20"
12
},
13
{
14
"idiom" : "iphone",
15
- "size" : "29x29",
16
- "scale" : "2x"
15
+ "scale" : "2x",
16
+ "size" : "29x29"
17
},
18
{
19
"idiom" : "iphone",
20
- "size" : "29x29",
21
- "scale" : "3x"
20
+ "scale" : "3x",
21
+ "size" : "29x29"
22
},
23
{
24
"idiom" : "iphone",
25
- "size" : "40x40",
26
- "scale" : "2x"
25
+ "scale" : "2x",
26
+ "size" : "40x40"
27
},
28
{
29
"idiom" : "iphone",
30
- "size" : "40x40",
31
- "scale" : "3x"
30
+ "scale" : "3x",
31
+ "size" : "40x40"
32
},
33
{
34
- "size" : "60x60",
34
+ "filename" : "app_icon_120.png",
35
"idiom" : "iphone",
36
- "filename" : "cake_xmr_120.png",
37
- "scale" : "2x"
36
+ "scale" : "2x",
37
+ "size" : "60x60"
38
},
39
{
40
- "size" : "60x60",
40
+ "filename" : "app_icon_180.png",
41
"idiom" : "iphone",
42
- "filename" : "cake_xmr_180.png",
43
- "scale" : "3x"
42
+ "scale" : "3x",
43
+ "size" : "60x60"
44
},
45
{
46
"idiom" : "ipad",
47
- "size" : "20x20",
48
- "scale" : "1x"
47
+ "scale" : "1x",
48
+ "size" : "20x20"
49
},
50
{
51
"idiom" : "ipad",
52
- "size" : "20x20",
53
- "scale" : "2x"
52
+ "scale" : "2x",
53
+ "size" : "20x20"
54
},
55
{
56
"idiom" : "ipad",
57
- "size" : "29x29",
58
- "scale" : "1x"
57
+ "scale" : "1x",
58
+ "size" : "29x29"
59
},
60
{
61
"idiom" : "ipad",
62
- "size" : "29x29",
63
- "scale" : "2x"
62
+ "scale" : "2x",
63
+ "size" : "29x29"
64
},
65
{
66
"idiom" : "ipad",
67
- "size" : "40x40",
68
- "scale" : "1x"
67
+ "scale" : "1x",
68
+ "size" : "40x40"
69
},
70
{
71
"idiom" : "ipad",
72
- "size" : "40x40",
73
- "scale" : "2x"
72
+ "scale" : "2x",
73
+ "size" : "40x40"
74
},
75
{
76
"idiom" : "ipad",
77
- "size" : "76x76",
78
- "scale" : "1x"
77
+ "scale" : "1x",
78
+ "size" : "76x76"
79
},
80
{
81
"idiom" : "ipad",
82
- "size" : "76x76",
83
- "scale" : "2x"
82
+ "scale" : "2x",
83
+ "size" : "76x76"
84
},
85
{
86
"idiom" : "ipad",
87
- "size" : "83.5x83.5",
88
- "scale" : "2x"
87
+ "scale" : "2x",
88
+ "size" : "83.5x83.5"
89
},
90
{
91
- "size" : "1024x1024",
91
+ "filename" : "app_icon_1024.png",
92
"idiom" : "ios-marketing",
93
- "filename" : "cake_xmr_1024.png",
94
- "scale" : "1x"
93
+ "scale" : "1x",
94
+ "size" : "1024x1024"
95
}
96
],
97
"info" : {
98
- "version" : 1,
99
- "author" : "xcode"
98
+ "author" : "xcode",
99
+ "version" : 1
100
}
101
-}
\ No newline at end of file
101
+}
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png
Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_1024.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_120.png and /dev/null differ
ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png
Binary files a/ios/Runner/Assets.xcassets/AppIcon.appiconset/cake_xmr_180.png and /dev/null differ
lib/di.dart
+4
-6
@@ -538,8 +538,7 @@ Future setup(
538
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
539
540
getIt.registerFactory(() {
541
- final wallet = getIt.get<AppStore>().wallet;
542
- return WyreService(wallet: wallet);
541
+ return WyreService(appStore: getIt.get<AppStore>());
542
});
543
544
getIt.registerFactory(() {
@@ -551,10 +550,9 @@ Future setup(
550
WyrePage(getIt.get<WyreViewModel>(),
551
ordersStore: getIt.get<OrdersStore>(), url: url));
552
554
- getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>(
555
- (order, _) => OrderDetailsViewModel(
556
- wyreViewModel: getIt.get<WyreViewModel>(),
557
- orderForDetails: order));
553
+ getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) =>
554
+ OrderDetailsViewModel(
555
+ wyreViewModel: getIt.get<WyreViewModel>(), orderForDetails: order));
556
557
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
558
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
lib/entities/calculate_fiat_amount.dart
+3
-2
@@ -4,11 +4,12 @@ String calculateFiatAmount({double price, String cryptoAmount}) {
4
}
5
6
final _amount = double.parse(cryptoAmount);
7
- final result = price * _amount;
7
+ final _result = price * _amount;
8
+ final result = _result < 0 ? _result * -1 : _result;
9
10
if (result == 0.0) {
11
return '0.00';
12
}
13
14
return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01';
14
-}
\ No newline at end of file
15
+}
lib/entities/wyre_service.dart
+20
-23
@@ -1,7 +1,7 @@
1
import 'dart:convert';
2
-import 'package:cake_wallet/core/wallet_base.dart';
2
import 'package:cake_wallet/entities/wyre_exception.dart';
3
import 'package:cake_wallet/exchange/trade_state.dart';
4
+import 'package:cake_wallet/store/app_store.dart';
5
import 'package:flutter/foundation.dart';
6
import 'package:http/http.dart';
7
import 'package:cake_wallet/.secrets.g.dart' as secrets;
@@ -9,15 +9,9 @@ import 'package:cake_wallet/entities/order.dart';
9
import 'package:cake_wallet/entities/wallet_type.dart';
10
11
class WyreService {
12
- WyreService({
13
- @required this.wallet,
14
- this.isTestEnvironment = false}) {
15
- baseApiUrl = isTestEnvironment
16
- ? _baseTestApiUrl
17
- : _baseProductApiUrl;
18
- trackUrl = isTestEnvironment
19
- ? _trackTestUrl
20
- : _trackProductUrl;
12
+ WyreService({@required this.appStore, this.isTestEnvironment = false}) {
13
+ baseApiUrl = isTestEnvironment ? _baseTestApiUrl : _baseProductApiUrl;
14
+ trackUrl = isTestEnvironment ? _trackTestUrl : _trackProductUrl;
15
}
16
17
static const _baseTestApiUrl = 'https://api.testwyre.com';
@@ -31,24 +25,28 @@ class WyreService {
25
static const _trackSuffix = '/track';
26
27
final bool isTestEnvironment;
34
- final WalletBase wallet;
28
+ final AppStore appStore;
29
36
- WalletType get walletType => wallet.type;
37
- String get walletAddress => wallet.address;
38
- String get walletId => wallet.id;
30
+ WalletType get walletType => appStore.wallet.type;
31
+ String get walletAddress => appStore.wallet.address;
32
+ String get walletId => appStore.wallet.id;
33
34
String baseApiUrl;
35
String trackUrl;
36
37
Future<String> getWyreUrl() async {
38
final timestamp = DateTime.now().millisecondsSinceEpoch.toString();
45
- final url = baseApiUrl + _ordersSuffix + _reserveSuffix +
46
- _timeStampSuffix + timestamp;
39
+ final url = baseApiUrl +
40
+ _ordersSuffix +
41
+ _reserveSuffix +
42
+ _timeStampSuffix +
43
+ timestamp;
44
final secretKey = secrets.wyreSecretKey;
45
final accountId = secrets.wyreAccountId;
46
final body = {
47
'destCurrency': walletTypeToCryptoCurrency(walletType).title,
51
- 'dest': walletTypeToString(walletType).toLowerCase() + ':' + walletAddress,
48
+ 'dest':
49
+ walletTypeToString(walletType).toLowerCase() + ':' + walletAddress,
50
'referrerAccountId': accountId,
51
'lockFields': ['destCurrency', 'dest']
52
};
@@ -79,7 +77,7 @@ class WyreService {
77
}
78
79
final orderResponseJSON =
82
- json.decode(orderResponse.body) as Map<String, dynamic>;
80
+ json.decode(orderResponse.body) as Map<String, dynamic>;
81
final transferId = orderResponseJSON['transferId'] as String;
82
final from = orderResponseJSON['sourceCurrency'] as String;
83
final to = orderResponseJSON['destCurrency'] as String;
@@ -87,7 +85,7 @@ class WyreService {
85
final state = TradeState.deserialize(raw: status.toLowerCase());
86
final createdAtRaw = orderResponseJSON['createdAt'] as int;
87
final createdAt =
90
- DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal();
88
+ DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal();
89
90
final transferUrl =
91
baseApiUrl + _transferSuffix + transferId + _trackSuffix;
@@ -98,7 +96,7 @@ class WyreService {
96
}
97
98
final transferResponseJSON =
101
- json.decode(transferResponse.body) as Map<String, dynamic>;
99
+ json.decode(transferResponse.body) as Map<String, dynamic>;
100
final amount = transferResponseJSON['destAmount'] as double;
101
102
return Order(
@@ -110,7 +108,6 @@ class WyreService {
108
createdAt: createdAt,
109
amount: amount.toString(),
110
receiveAddress: walletAddress,
113
- walletId: walletId
114
- );
111
+ walletId: walletId);
112
}
116
-}
\ No newline at end of file
113
+}
lib/view_model/dashboard/dashboard_view_model.dart
+6
-3
@@ -84,6 +84,8 @@ abstract class DashboardViewModelBase with Store {
84
name = appStore.wallet?.name;
85
wallet ??= appStore.wallet;
86
type = wallet.type;
87
+ isOutdatedElectrumWallet =
88
+ wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
89
final _wallet = wallet;
90
91
if (_wallet is MoneroWallet) {
@@ -234,9 +236,8 @@ abstract class DashboardViewModelBase with Store {
236
await wallet.connectToNode(node: node);
237
}
238
237
- @computed
238
- bool get isOutdatedElectrumWallet =>
239
- wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
239
+ @observable
240
+ bool isOutdatedElectrumWallet;
241
242
@action
243
void _onWalletChange(
@@ -246,6 +247,8 @@ abstract class DashboardViewModelBase with Store {
247
this.wallet = wallet;
248
type = wallet.type;
249
name = wallet.name;
250
+ isOutdatedElectrumWallet =
251
+ wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
252
253
if (wallet is MoneroWallet) {
254
subname = wallet.account?.label;