mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-03 09:29:48 +00:00
Minor bug fixes.
This commit is contained in:
parent
a439560d4d
commit
f4c57e22f2
11 changed files with 75 additions and 76 deletions
|
@ -2,100 +2,100 @@
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "20x20",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "20x20",
|
"scale" : "3x",
|
||||||
"scale" : "3x"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "29x29",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "29x29",
|
"scale" : "3x",
|
||||||
"scale" : "3x"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "40x40",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"size" : "40x40",
|
"scale" : "3x",
|
||||||
"scale" : "3x"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"filename" : "app_icon_120.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "cake_xmr_120.png",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "60x60"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "60x60",
|
"filename" : "app_icon_180.png",
|
||||||
"idiom" : "iphone",
|
"idiom" : "iphone",
|
||||||
"filename" : "cake_xmr_180.png",
|
"scale" : "3x",
|
||||||
"scale" : "3x"
|
"size" : "60x60"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "20x20",
|
"scale" : "1x",
|
||||||
"scale" : "1x"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "20x20",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "20x20"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "29x29",
|
"scale" : "1x",
|
||||||
"scale" : "1x"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "29x29",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "29x29"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "40x40",
|
"scale" : "1x",
|
||||||
"scale" : "1x"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "40x40",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "40x40"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "76x76",
|
"scale" : "1x",
|
||||||
"scale" : "1x"
|
"size" : "76x76"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "76x76",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "76x76"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "ipad",
|
"idiom" : "ipad",
|
||||||
"size" : "83.5x83.5",
|
"scale" : "2x",
|
||||||
"scale" : "2x"
|
"size" : "83.5x83.5"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"size" : "1024x1024",
|
"filename" : "app_icon_1024.png",
|
||||||
"idiom" : "ios-marketing",
|
"idiom" : "ios-marketing",
|
||||||
"filename" : "cake_xmr_1024.png",
|
"scale" : "1x",
|
||||||
"scale" : "1x"
|
"size" : "1024x1024"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"author" : "xcode",
|
||||||
"author" : "xcode"
|
"version" : 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
Normal file
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png
Normal file
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png
Normal file
BIN
ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 10 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
10
lib/di.dart
10
lib/di.dart
|
@ -538,8 +538,7 @@ Future setup(
|
||||||
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
TradeDetailsPage(getIt.get<TradeDetailsViewModel>(param1: trade)));
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
final wallet = getIt.get<AppStore>().wallet;
|
return WyreService(appStore: getIt.get<AppStore>());
|
||||||
return WyreService(wallet: wallet);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
getIt.registerFactory(() {
|
getIt.registerFactory(() {
|
||||||
|
@ -551,10 +550,9 @@ Future setup(
|
||||||
WyrePage(getIt.get<WyreViewModel>(),
|
WyrePage(getIt.get<WyreViewModel>(),
|
||||||
ordersStore: getIt.get<OrdersStore>(), url: url));
|
ordersStore: getIt.get<OrdersStore>(), url: url));
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>(
|
getIt.registerFactoryParam<OrderDetailsViewModel, Order, void>((order, _) =>
|
||||||
(order, _) => OrderDetailsViewModel(
|
OrderDetailsViewModel(
|
||||||
wyreViewModel: getIt.get<WyreViewModel>(),
|
wyreViewModel: getIt.get<WyreViewModel>(), orderForDetails: order));
|
||||||
orderForDetails: order));
|
|
||||||
|
|
||||||
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
getIt.registerFactoryParam<OrderDetailsPage, Order, void>((Order order, _) =>
|
||||||
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
OrderDetailsPage(getIt.get<OrderDetailsViewModel>(param1: order)));
|
||||||
|
|
|
@ -4,11 +4,12 @@ String calculateFiatAmount({double price, String cryptoAmount}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
final _amount = double.parse(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) {
|
if (result == 0.0) {
|
||||||
return '0.00';
|
return '0.00';
|
||||||
}
|
}
|
||||||
|
|
||||||
return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01';
|
return result > 0.01 ? result.toStringAsFixed(2) : '< 0.01';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:cake_wallet/core/wallet_base.dart';
|
|
||||||
import 'package:cake_wallet/entities/wyre_exception.dart';
|
import 'package:cake_wallet/entities/wyre_exception.dart';
|
||||||
import 'package:cake_wallet/exchange/trade_state.dart';
|
import 'package:cake_wallet/exchange/trade_state.dart';
|
||||||
|
import 'package:cake_wallet/store/app_store.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:http/http.dart';
|
import 'package:http/http.dart';
|
||||||
import 'package:cake_wallet/.secrets.g.dart' as secrets;
|
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';
|
import 'package:cake_wallet/entities/wallet_type.dart';
|
||||||
|
|
||||||
class WyreService {
|
class WyreService {
|
||||||
WyreService({
|
WyreService({@required this.appStore, this.isTestEnvironment = false}) {
|
||||||
@required this.wallet,
|
baseApiUrl = isTestEnvironment ? _baseTestApiUrl : _baseProductApiUrl;
|
||||||
this.isTestEnvironment = false}) {
|
trackUrl = isTestEnvironment ? _trackTestUrl : _trackProductUrl;
|
||||||
baseApiUrl = isTestEnvironment
|
|
||||||
? _baseTestApiUrl
|
|
||||||
: _baseProductApiUrl;
|
|
||||||
trackUrl = isTestEnvironment
|
|
||||||
? _trackTestUrl
|
|
||||||
: _trackProductUrl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const _baseTestApiUrl = 'https://api.testwyre.com';
|
static const _baseTestApiUrl = 'https://api.testwyre.com';
|
||||||
|
@ -31,24 +25,28 @@ class WyreService {
|
||||||
static const _trackSuffix = '/track';
|
static const _trackSuffix = '/track';
|
||||||
|
|
||||||
final bool isTestEnvironment;
|
final bool isTestEnvironment;
|
||||||
final WalletBase wallet;
|
final AppStore appStore;
|
||||||
|
|
||||||
WalletType get walletType => wallet.type;
|
WalletType get walletType => appStore.wallet.type;
|
||||||
String get walletAddress => wallet.address;
|
String get walletAddress => appStore.wallet.address;
|
||||||
String get walletId => wallet.id;
|
String get walletId => appStore.wallet.id;
|
||||||
|
|
||||||
String baseApiUrl;
|
String baseApiUrl;
|
||||||
String trackUrl;
|
String trackUrl;
|
||||||
|
|
||||||
Future<String> getWyreUrl() async {
|
Future<String> getWyreUrl() async {
|
||||||
final timestamp = DateTime.now().millisecondsSinceEpoch.toString();
|
final timestamp = DateTime.now().millisecondsSinceEpoch.toString();
|
||||||
final url = baseApiUrl + _ordersSuffix + _reserveSuffix +
|
final url = baseApiUrl +
|
||||||
_timeStampSuffix + timestamp;
|
_ordersSuffix +
|
||||||
|
_reserveSuffix +
|
||||||
|
_timeStampSuffix +
|
||||||
|
timestamp;
|
||||||
final secretKey = secrets.wyreSecretKey;
|
final secretKey = secrets.wyreSecretKey;
|
||||||
final accountId = secrets.wyreAccountId;
|
final accountId = secrets.wyreAccountId;
|
||||||
final body = {
|
final body = {
|
||||||
'destCurrency': walletTypeToCryptoCurrency(walletType).title,
|
'destCurrency': walletTypeToCryptoCurrency(walletType).title,
|
||||||
'dest': walletTypeToString(walletType).toLowerCase() + ':' + walletAddress,
|
'dest':
|
||||||
|
walletTypeToString(walletType).toLowerCase() + ':' + walletAddress,
|
||||||
'referrerAccountId': accountId,
|
'referrerAccountId': accountId,
|
||||||
'lockFields': ['destCurrency', 'dest']
|
'lockFields': ['destCurrency', 'dest']
|
||||||
};
|
};
|
||||||
|
@ -79,7 +77,7 @@ class WyreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
final orderResponseJSON =
|
final orderResponseJSON =
|
||||||
json.decode(orderResponse.body) as Map<String, dynamic>;
|
json.decode(orderResponse.body) as Map<String, dynamic>;
|
||||||
final transferId = orderResponseJSON['transferId'] as String;
|
final transferId = orderResponseJSON['transferId'] as String;
|
||||||
final from = orderResponseJSON['sourceCurrency'] as String;
|
final from = orderResponseJSON['sourceCurrency'] as String;
|
||||||
final to = orderResponseJSON['destCurrency'] as String;
|
final to = orderResponseJSON['destCurrency'] as String;
|
||||||
|
@ -87,7 +85,7 @@ class WyreService {
|
||||||
final state = TradeState.deserialize(raw: status.toLowerCase());
|
final state = TradeState.deserialize(raw: status.toLowerCase());
|
||||||
final createdAtRaw = orderResponseJSON['createdAt'] as int;
|
final createdAtRaw = orderResponseJSON['createdAt'] as int;
|
||||||
final createdAt =
|
final createdAt =
|
||||||
DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal();
|
DateTime.fromMillisecondsSinceEpoch(createdAtRaw).toLocal();
|
||||||
|
|
||||||
final transferUrl =
|
final transferUrl =
|
||||||
baseApiUrl + _transferSuffix + transferId + _trackSuffix;
|
baseApiUrl + _transferSuffix + transferId + _trackSuffix;
|
||||||
|
@ -98,7 +96,7 @@ class WyreService {
|
||||||
}
|
}
|
||||||
|
|
||||||
final transferResponseJSON =
|
final transferResponseJSON =
|
||||||
json.decode(transferResponse.body) as Map<String, dynamic>;
|
json.decode(transferResponse.body) as Map<String, dynamic>;
|
||||||
final amount = transferResponseJSON['destAmount'] as double;
|
final amount = transferResponseJSON['destAmount'] as double;
|
||||||
|
|
||||||
return Order(
|
return Order(
|
||||||
|
@ -110,7 +108,6 @@ class WyreService {
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
amount: amount.toString(),
|
amount: amount.toString(),
|
||||||
receiveAddress: walletAddress,
|
receiveAddress: walletAddress,
|
||||||
walletId: walletId
|
walletId: walletId);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
name = appStore.wallet?.name;
|
name = appStore.wallet?.name;
|
||||||
wallet ??= appStore.wallet;
|
wallet ??= appStore.wallet;
|
||||||
type = wallet.type;
|
type = wallet.type;
|
||||||
|
isOutdatedElectrumWallet =
|
||||||
|
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
||||||
final _wallet = wallet;
|
final _wallet = wallet;
|
||||||
|
|
||||||
if (_wallet is MoneroWallet) {
|
if (_wallet is MoneroWallet) {
|
||||||
|
@ -234,9 +236,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
await wallet.connectToNode(node: node);
|
await wallet.connectToNode(node: node);
|
||||||
}
|
}
|
||||||
|
|
||||||
@computed
|
@observable
|
||||||
bool get isOutdatedElectrumWallet =>
|
bool isOutdatedElectrumWallet;
|
||||||
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
|
||||||
|
|
||||||
@action
|
@action
|
||||||
void _onWalletChange(
|
void _onWalletChange(
|
||||||
|
@ -246,6 +247,8 @@ abstract class DashboardViewModelBase with Store {
|
||||||
this.wallet = wallet;
|
this.wallet = wallet;
|
||||||
type = wallet.type;
|
type = wallet.type;
|
||||||
name = wallet.name;
|
name = wallet.name;
|
||||||
|
isOutdatedElectrumWallet =
|
||||||
|
wallet.type == WalletType.bitcoin && wallet.seed.split(' ').length < 24;
|
||||||
|
|
||||||
if (wallet is MoneroWallet) {
|
if (wallet is MoneroWallet) {
|
||||||
subname = wallet.account?.label;
|
subname = wallet.account?.label;
|
||||||
|
|
Loading…
Reference in a new issue