mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-24 12:29:37 +00:00
commit
66fe3f1fdb
20 changed files with 163 additions and 137 deletions
|
@ -451,7 +451,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 75;
|
CURRENT_PROJECT_VERSION = 78;
|
||||||
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
@ -505,7 +505,7 @@
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.5.5;
|
MARKETING_VERSION = 1.5.8;
|
||||||
ONLY_ACTIVE_ARCH = NO;
|
ONLY_ACTIVE_ARCH = NO;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -635,7 +635,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 75;
|
CURRENT_PROJECT_VERSION = 78;
|
||||||
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
@ -689,7 +689,7 @@
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.5.5;
|
MARKETING_VERSION = 1.5.8;
|
||||||
ONLY_ACTIVE_ARCH = NO;
|
ONLY_ACTIVE_ARCH = NO;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
@ -711,7 +711,7 @@
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 75;
|
CURRENT_PROJECT_VERSION = 78;
|
||||||
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
DEVELOPMENT_TEAM = 4DQKUWSG6C;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
@ -765,7 +765,7 @@
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libmonero/cw_shared_external/ios/External/ios/**",
|
||||||
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
"$(PROJECT_DIR)/../crypto_plugins/flutter_libepiccash/ios/libs",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.5.5;
|
MARKETING_VERSION = 1.5.8;
|
||||||
ONLY_ACTIVE_ARCH = NO;
|
ONLY_ACTIVE_ARCH = NO;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
PRODUCT_BUNDLE_IDENTIFIER = com.cypherstack.stackwallet;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
|
|
@ -207,6 +207,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
didLoad = true;
|
didLoad = true;
|
||||||
|
|
||||||
await DB.instance.init();
|
await DB.instance.init();
|
||||||
|
await _prefs.init();
|
||||||
|
|
||||||
_notificationsService = ref.read(notificationsProvider);
|
_notificationsService = ref.read(notificationsProvider);
|
||||||
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
||||||
|
@ -223,7 +224,6 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
tradesService: _tradesService,
|
tradesService: _tradesService,
|
||||||
prefs: _prefs,
|
prefs: _prefs,
|
||||||
);
|
);
|
||||||
await _prefs.init();
|
|
||||||
ref.read(priceAnd24hChangeNotifierProvider).start(true);
|
ref.read(priceAnd24hChangeNotifierProvider).start(true);
|
||||||
await _wallets.load(_prefs);
|
await _wallets.load(_prefs);
|
||||||
loadingCompleter.complete();
|
loadingCompleter.complete();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:stackwallet/models/exchange/response_objects/estimate.dart';
|
import 'package:stackwallet/models/exchange/response_objects/estimate.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
import 'package:stackwallet/services/exchange/change_now/change_now_exchange.dart';
|
||||||
|
import 'package:stackwallet/services/exchange/exchange.dart';
|
||||||
import 'package:stackwallet/services/exchange/exchange_response.dart';
|
import 'package:stackwallet/services/exchange/exchange_response.dart';
|
||||||
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
|
import 'package:stackwallet/services/exchange/simpleswap/simpleswap_exchange.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
|
@ -46,6 +47,9 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
ChangeNowExchange.exchangeName) {
|
ChangeNowExchange.exchangeName) {
|
||||||
ref.read(currentExchangeNameStateProvider.state).state =
|
ref.read(currentExchangeNameStateProvider.state).state =
|
||||||
ChangeNowExchange.exchangeName;
|
ChangeNowExchange.exchangeName;
|
||||||
|
ref.read(exchangeFormStateProvider).exchange =
|
||||||
|
Exchange.fromName(
|
||||||
|
ref.read(currentExchangeNameStateProvider.state).state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -69,6 +73,10 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
ref
|
ref
|
||||||
.read(currentExchangeNameStateProvider.state)
|
.read(currentExchangeNameStateProvider.state)
|
||||||
.state = value;
|
.state = value;
|
||||||
|
ref.read(exchangeFormStateProvider).exchange =
|
||||||
|
Exchange.fromName(ref
|
||||||
|
.read(currentExchangeNameStateProvider.state)
|
||||||
|
.state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -214,6 +222,9 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
SimpleSwapExchange.exchangeName) {
|
SimpleSwapExchange.exchangeName) {
|
||||||
ref.read(currentExchangeNameStateProvider.state).state =
|
ref.read(currentExchangeNameStateProvider.state).state =
|
||||||
SimpleSwapExchange.exchangeName;
|
SimpleSwapExchange.exchangeName;
|
||||||
|
ref.read(exchangeFormStateProvider).exchange =
|
||||||
|
Exchange.fromName(
|
||||||
|
ref.read(currentExchangeNameStateProvider.state).state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
|
@ -237,6 +248,10 @@ class ExchangeProviderOptions extends ConsumerWidget {
|
||||||
ref
|
ref
|
||||||
.read(currentExchangeNameStateProvider.state)
|
.read(currentExchangeNameStateProvider.state)
|
||||||
.state = value;
|
.state = value;
|
||||||
|
ref.read(exchangeFormStateProvider).exchange =
|
||||||
|
Exchange.fromName(ref
|
||||||
|
.read(currentExchangeNameStateProvider.state)
|
||||||
|
.state);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -79,23 +79,25 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
||||||
transactionIfSentFromStack = widget.transactionIfSentFromStack;
|
transactionIfSentFromStack = widget.transactionIfSentFromStack;
|
||||||
walletId = widget.walletId;
|
walletId = widget.walletId;
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
final trade = ref
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
.read(tradesServiceProvider)
|
final trade = ref
|
||||||
.trades
|
.read(tradesServiceProvider)
|
||||||
.firstWhere((e) => e.tradeId == tradeId);
|
.trades
|
||||||
|
.firstWhere((e) => e.tradeId == tradeId);
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
final exchange = Exchange.fromName(trade.exchangeName);
|
final exchange = Exchange.fromName(trade.exchangeName);
|
||||||
final response = await exchange.updateTrade(trade);
|
final response = await exchange.updateTrade(trade);
|
||||||
|
|
||||||
if (mounted && response.value != null) {
|
if (mounted && response.value != null) {
|
||||||
await ref
|
await ref
|
||||||
.read(tradesServiceProvider)
|
.read(tradesServiceProvider)
|
||||||
.edit(trade: response.value!, shouldNotifyListeners: true);
|
.edit(trade: response.value!, shouldNotifyListeners: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,13 +11,13 @@ import 'package:stackwallet/pages/settings_views/global_settings_view/global_set
|
||||||
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
|
import 'package:stackwallet/pages/settings_views/global_settings_view/hidden_settings.dart';
|
||||||
import 'package:stackwallet/pages/wallets_view/wallets_view.dart';
|
import 'package:stackwallet/pages/wallets_view/wallets_view.dart';
|
||||||
import 'package:stackwallet/providers/global/notifications_provider.dart';
|
import 'package:stackwallet/providers/global/notifications_provider.dart';
|
||||||
|
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||||
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
|
||||||
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
|
||||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||||
import 'package:stackwallet/utilities/assets.dart';
|
import 'package:stackwallet/utilities/assets.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
@ -83,9 +83,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
|
|
||||||
void _loadCNData() {
|
void _loadCNData() {
|
||||||
// unawaited future
|
// unawaited future
|
||||||
//
|
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
final externalCalls = Prefs.instance.externalCalls;
|
|
||||||
if (externalCalls) {
|
|
||||||
_exchangeDataLoadingService.loadAll(ref);
|
_exchangeDataLoadingService.loadAll(ref);
|
||||||
} else {
|
} else {
|
||||||
Logging.instance.log("User does not want to use external calls",
|
Logging.instance.log("User does not want to use external calls",
|
||||||
|
@ -289,7 +287,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
||||||
(previous, next) {
|
(previous, next) {
|
||||||
if (next is int) {
|
if (next is int) {
|
||||||
if (next == 1) {
|
if (next == 1) {
|
||||||
_loadCNData();
|
_exchangeDataLoadingService.loadAll(ref);
|
||||||
}
|
}
|
||||||
if (next >= 0 && next <= 1) {
|
if (next >= 0 && next <= 1) {
|
||||||
_pageController.animateToPage(
|
_pageController.animateToPage(
|
||||||
|
|
|
@ -101,10 +101,10 @@ class _HomeViewButtonBarState extends ConsumerState<HomeViewButtonBar> {
|
||||||
ref.read(homeViewPageIndexStateProvider.state).state = 1;
|
ref.read(homeViewPageIndexStateProvider.state).state = 1;
|
||||||
}
|
}
|
||||||
// DateTime now = DateTime.now();
|
// DateTime now = DateTime.now();
|
||||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
// if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
print("loading?");
|
// print("loading?");
|
||||||
await ExchangeDataLoadingService().loadAll(ref);
|
await ExchangeDataLoadingService().loadAll(ref);
|
||||||
}
|
// }
|
||||||
// if (now.difference(_lastRefreshed) > _refreshInterval) {
|
// if (now.difference(_lastRefreshed) > _refreshInterval) {
|
||||||
// await ExchangeDataLoadingService().loadAll(ref);
|
// await ExchangeDataLoadingService().loadAll(ref);
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -70,6 +70,8 @@ class _WalletSummaryInfoState extends State<WalletSummaryInfo> {
|
||||||
builder: (_, ref, __) {
|
builder: (_, ref, __) {
|
||||||
final Coin coin =
|
final Coin coin =
|
||||||
ref.watch(managerProvider.select((value) => value.coin));
|
ref.watch(managerProvider.select((value) => value.coin));
|
||||||
|
final externalCalls = ref.watch(prefsChangeNotifierProvider
|
||||||
|
.select((value) => value.externalCalls));
|
||||||
|
|
||||||
Future<Decimal>? totalBalanceFuture;
|
Future<Decimal>? totalBalanceFuture;
|
||||||
Future<Decimal>? availableBalanceFuture;
|
Future<Decimal>? availableBalanceFuture;
|
||||||
|
@ -176,18 +178,19 @@ class _WalletSummaryInfoState extends State<WalletSummaryInfo> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
if (externalCalls)
|
||||||
"${Format.localizedStringAsFixed(
|
Text(
|
||||||
value: priceTuple.item1 * balanceToShow,
|
"${Format.localizedStringAsFixed(
|
||||||
locale: locale,
|
value: priceTuple.item1 * balanceToShow,
|
||||||
decimalPlaces: 2,
|
locale: locale,
|
||||||
)} $baseCurrency",
|
decimalPlaces: 2,
|
||||||
style: STextStyles.subtitle500(context).copyWith(
|
)} $baseCurrency",
|
||||||
color: Theme.of(context)
|
style: STextStyles.subtitle500(context).copyWith(
|
||||||
.extension<StackColors>()!
|
color: Theme.of(context)
|
||||||
.textFavoriteCard,
|
.extension<StackColors>()!
|
||||||
|
.textFavoriteCard,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -255,17 +255,19 @@ class _TransactionDetailsViewState
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 2,
|
height: 2,
|
||||||
),
|
),
|
||||||
SelectableText(
|
if (ref.watch(prefsChangeNotifierProvider
|
||||||
"${Format.localizedStringAsFixed(value: (coin == Coin.monero ? (amount / 10000.toDecimal()).toDecimal() : coin == Coin.wownero ? (amount / 1000.toDecimal()).toDecimal() : amount) * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1)), locale: ref.watch(
|
.select((value) => value.externalCalls)))
|
||||||
localeServiceChangeNotifierProvider
|
SelectableText(
|
||||||
.select((value) => value.locale),
|
"${Format.localizedStringAsFixed(value: (coin == Coin.monero ? (amount / 10000.toDecimal()).toDecimal() : coin == Coin.wownero ? (amount / 1000.toDecimal()).toDecimal() : amount) * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1)), locale: ref.watch(
|
||||||
), decimalPlaces: 2)} ${ref.watch(
|
localeServiceChangeNotifierProvider
|
||||||
prefsChangeNotifierProvider.select(
|
.select((value) => value.locale),
|
||||||
(value) => value.currency,
|
), decimalPlaces: 2)} ${ref.watch(
|
||||||
),
|
prefsChangeNotifierProvider.select(
|
||||||
)}",
|
(value) => value.currency,
|
||||||
style: STextStyles.itemSubtitle(context),
|
),
|
||||||
),
|
)}",
|
||||||
|
style: STextStyles.itemSubtitle(context),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
TxIcon(
|
TxIcon(
|
||||||
|
|
|
@ -37,6 +37,7 @@ import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
|
||||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||||
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:stackwallet/utilities/text_styles.dart';
|
import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
|
@ -45,12 +46,6 @@ import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
import 'package:stackwallet/hive/db.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
|
||||||
|
|
||||||
/// [eventBus] should only be set during testing
|
/// [eventBus] should only be set during testing
|
||||||
class WalletView extends ConsumerStatefulWidget {
|
class WalletView extends ConsumerStatefulWidget {
|
||||||
const WalletView({
|
const WalletView({
|
||||||
|
@ -235,12 +230,8 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onExchangePressed(BuildContext context) async {
|
void _onExchangePressed(BuildContext context) async {
|
||||||
final _cnLoadingService = ExchangeDataLoadingService();
|
unawaited(_cnLoadingService.loadAll(ref));
|
||||||
final externalCalls = Prefs.instance.externalCalls;
|
|
||||||
if (!externalCalls) {
|
|
||||||
print("loading?");
|
|
||||||
unawaited(_cnLoadingService.loadAll(ref));
|
|
||||||
}
|
|
||||||
final coin = ref.read(managerProvider).coin;
|
final coin = ref.read(managerProvider).coin;
|
||||||
|
|
||||||
if (coin == Coin.epicCash) {
|
if (coin == Coin.epicCash) {
|
||||||
|
@ -371,9 +362,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
||||||
|
|
||||||
void _loadCNData() {
|
void _loadCNData() {
|
||||||
// unawaited future
|
// unawaited future
|
||||||
final externalCalls = DB.instance
|
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||||
.get<dynamic>(boxName: DB.boxNamePrefs, key: "externalCalls") as bool?;
|
|
||||||
if (externalCalls ?? false) {
|
|
||||||
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
_cnLoadingService.loadAll(ref, coin: ref.read(managerProvider).coin);
|
||||||
} else {
|
} else {
|
||||||
Logging.instance.log("User does not want to use external calls",
|
Logging.instance.log("User does not want to use external calls",
|
||||||
|
|
|
@ -49,6 +49,8 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final coin = ref.watch(managerProvider.select((value) => value.coin));
|
final coin = ref.watch(managerProvider.select((value) => value.coin));
|
||||||
|
final externalCalls = ref.watch(
|
||||||
|
prefsChangeNotifierProvider.select((value) => value.externalCalls));
|
||||||
|
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
@ -70,7 +72,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
width: widget.width,
|
width: widget.width,
|
||||||
height: widget.height,
|
height: widget.height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).extension<StackColors>()!.colorForCoin(coin),
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.colorForCoin(coin),
|
||||||
borderRadius: BorderRadius.circular(
|
borderRadius: BorderRadius.circular(
|
||||||
Constants.size.circularBorderRadius,
|
Constants.size.circularBorderRadius,
|
||||||
),
|
),
|
||||||
|
@ -138,7 +142,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
ref.watch(managerProvider
|
ref.watch(managerProvider
|
||||||
.select((value) => value.walletName)),
|
.select((value) => value.walletName)),
|
||||||
style: STextStyles.itemSubtitle12(context).copyWith(
|
style: STextStyles.itemSubtitle12(context).copyWith(
|
||||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFavoriteCard,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.fade,
|
overflow: TextOverflow.fade,
|
||||||
),
|
),
|
||||||
|
@ -159,14 +165,16 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
snapshot.hasData) {
|
snapshot.hasData) {
|
||||||
if (snapshot.data != null) {
|
if (snapshot.data != null) {
|
||||||
_cachedBalance = snapshot.data!;
|
_cachedBalance = snapshot.data!;
|
||||||
_cachedFiatValue = _cachedBalance *
|
if (externalCalls) {
|
||||||
ref
|
_cachedFiatValue = _cachedBalance *
|
||||||
.watch(
|
ref
|
||||||
priceAnd24hChangeNotifierProvider.select(
|
.watch(
|
||||||
(value) => value.getPrice(coin),
|
priceAnd24hChangeNotifierProvider.select(
|
||||||
),
|
(value) => value.getPrice(coin),
|
||||||
)
|
),
|
||||||
.item1;
|
)
|
||||||
|
.item1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Column(
|
return Column(
|
||||||
|
@ -185,30 +193,36 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
||||||
)} ${coin.ticker}",
|
)} ${coin.ticker}",
|
||||||
style: STextStyles.titleBold12(context).copyWith(
|
style: STextStyles.titleBold12(context).copyWith(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFavoriteCard,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
if (externalCalls)
|
||||||
height: 4,
|
const SizedBox(
|
||||||
),
|
height: 4,
|
||||||
Text(
|
),
|
||||||
"${Format.localizedStringAsFixed(
|
if (externalCalls)
|
||||||
decimalPlaces: 2,
|
Text(
|
||||||
value: _cachedFiatValue,
|
"${Format.localizedStringAsFixed(
|
||||||
locale: ref.watch(
|
decimalPlaces: 2,
|
||||||
localeServiceChangeNotifierProvider
|
value: _cachedFiatValue,
|
||||||
.select((value) => value.locale),
|
locale: ref.watch(
|
||||||
),
|
localeServiceChangeNotifierProvider
|
||||||
)} ${ref.watch(
|
.select((value) => value.locale),
|
||||||
prefsChangeNotifierProvider
|
),
|
||||||
.select((value) => value.currency),
|
)} ${ref.watch(
|
||||||
)}",
|
prefsChangeNotifierProvider
|
||||||
style: STextStyles.itemSubtitle12(context).copyWith(
|
.select((value) => value.currency),
|
||||||
fontSize: 10,
|
)}",
|
||||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
style: STextStyles.itemSubtitle12(context).copyWith(
|
||||||
|
fontSize: 10,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.textFavoriteCard,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -254,7 +254,7 @@ Future<Map<String, dynamic>> isolateRestore(
|
||||||
}
|
}
|
||||||
|
|
||||||
final root = getBip32Root(mnemonic, network);
|
final root = getBip32Root(mnemonic, network);
|
||||||
while (currentIndex < lastFoundIndex + 20) {
|
while (currentIndex < lastFoundIndex + 50) {
|
||||||
final mintKeyPair = getBip32NodeFromRoot(MINT_INDEX, currentIndex, root);
|
final mintKeyPair = getBip32NodeFromRoot(MINT_INDEX, currentIndex, root);
|
||||||
final mintTag = CreateTag(
|
final mintTag = CreateTag(
|
||||||
Format.uint8listToString(mintKeyPair.privateKey!),
|
Format.uint8listToString(mintKeyPair.privateKey!),
|
||||||
|
@ -1356,7 +1356,7 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
List<UtxoObject> utxoObjectsToUse = [];
|
List<UtxoObject> utxoObjectsToUse = [];
|
||||||
|
|
||||||
for (var i = 0;
|
for (var i = 0;
|
||||||
satoshisBeingUsed < satoshiAmountToSend && i < spendableOutputs.length;
|
satoshisBeingUsed <= satoshiAmountToSend && i < spendableOutputs.length;
|
||||||
i++) {
|
i++) {
|
||||||
utxoObjectsToUse.add(spendableOutputs[i]);
|
utxoObjectsToUse.add(spendableOutputs[i]);
|
||||||
satoshisBeingUsed += spendableOutputs[i].value;
|
satoshisBeingUsed += spendableOutputs[i].value;
|
||||||
|
|
|
@ -84,7 +84,9 @@ class NotificationsService extends ChangeNotifier {
|
||||||
_timer = Timer.periodic(notificationRefreshInterval, (_) {
|
_timer = Timer.periodic(notificationRefreshInterval, (_) {
|
||||||
Logging.instance
|
Logging.instance
|
||||||
.log("Periodic notifications update check", level: LogLevel.Info);
|
.log("Periodic notifications update check", level: LogLevel.Info);
|
||||||
_checkTrades();
|
if (prefs.externalCalls) {
|
||||||
|
_checkTrades();
|
||||||
|
}
|
||||||
_checkTransactions();
|
_checkTransactions();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,8 @@ import 'package:http/http.dart';
|
||||||
import 'package:stackwallet/hive/db.dart';
|
import 'package:stackwallet/hive/db.dart';
|
||||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
import 'package:tuple/tuple.dart';
|
|
||||||
|
|
||||||
import 'package:stackwallet/utilities/prefs.dart';
|
import 'package:stackwallet/utilities/prefs.dart';
|
||||||
|
import 'package:tuple/tuple.dart';
|
||||||
|
|
||||||
class PriceAPI {
|
class PriceAPI {
|
||||||
static const refreshInterval = 60;
|
static const refreshInterval = 60;
|
||||||
|
|
|
@ -19,9 +19,7 @@ class PriceService extends ChangeNotifier {
|
||||||
|
|
||||||
Tuple2<Decimal, double> getPrice(Coin coin) => _cachedPrices[coin]!;
|
Tuple2<Decimal, double> getPrice(Coin coin) => _cachedPrices[coin]!;
|
||||||
|
|
||||||
PriceService(this.baseTicker) {
|
PriceService(this.baseTicker);
|
||||||
start(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> updatePrice() async {
|
Future<void> updatePrice() async {
|
||||||
final priceMap =
|
final priceMap =
|
||||||
|
|
|
@ -159,8 +159,8 @@ abstract class DefaultNodes {
|
||||||
);
|
);
|
||||||
|
|
||||||
static NodeModel get bitcoincashTestnet => NodeModel(
|
static NodeModel get bitcoincashTestnet => NodeModel(
|
||||||
host: "testnet.hsmiths.com",
|
host: "bitcoincash-testnet.stackwallet.com",
|
||||||
port: 53012,
|
port: 60002,
|
||||||
name: defaultName,
|
name: defaultName,
|
||||||
id: _nodeId(Coin.bitcoincashTestnet),
|
id: _nodeId(Coin.bitcoincashTestnet),
|
||||||
useSSL: true,
|
useSSL: true,
|
||||||
|
|
|
@ -569,6 +569,6 @@ class Prefs extends ChangeNotifier {
|
||||||
Future<bool> _getHasExternalCalls() async {
|
Future<bool> _getHasExternalCalls() async {
|
||||||
return await DB.instance.get<dynamic>(
|
return await DB.instance.get<dynamic>(
|
||||||
boxName: DB.boxNamePrefs, key: "externalCalls") as bool? ??
|
boxName: DB.boxNamePrefs, key: "externalCalls") as bool? ??
|
||||||
false;
|
true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,35 +202,39 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
if (ref.watch(prefsChangeNotifierProvider
|
||||||
width: 10,
|
.select((value) => value.externalCalls)))
|
||||||
),
|
const SizedBox(
|
||||||
Flexible(
|
width: 10,
|
||||||
child: FittedBox(
|
),
|
||||||
fit: BoxFit.scaleDown,
|
if (ref.watch(prefsChangeNotifierProvider
|
||||||
child: Builder(
|
.select((value) => value.externalCalls)))
|
||||||
builder: (_) {
|
Flexible(
|
||||||
// TODO: modify Format.<functions> to take optional Coin parameter so this type oif check isn't done in ui
|
child: FittedBox(
|
||||||
int value = _transaction.amount;
|
fit: BoxFit.scaleDown,
|
||||||
if (coin == Coin.monero) {
|
child: Builder(
|
||||||
value = (value ~/ 10000);
|
builder: (_) {
|
||||||
} else if (coin == Coin.wownero) {
|
// TODO: modify Format.<functions> to take optional Coin parameter so this type oif check isn't done in ui
|
||||||
value = (value ~/ 1000);
|
int value = _transaction.amount;
|
||||||
}
|
if (coin == Coin.monero) {
|
||||||
|
value = (value ~/ 10000);
|
||||||
|
} else if (coin == Coin.wownero) {
|
||||||
|
value = (value ~/ 1000);
|
||||||
|
}
|
||||||
|
|
||||||
return Text(
|
return Text(
|
||||||
"${Format.localizedStringAsFixed(
|
"${Format.localizedStringAsFixed(
|
||||||
value: Format.satoshisToAmount(value) *
|
value: Format.satoshisToAmount(value) *
|
||||||
price,
|
price,
|
||||||
locale: locale,
|
locale: locale,
|
||||||
decimalPlaces: 2,
|
decimalPlaces: 2,
|
||||||
)} $baseCurrency",
|
)} $baseCurrency",
|
||||||
style: STextStyles.label(context),
|
style: STextStyles.label(context),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -11,7 +11,7 @@ description: Stack Wallet
|
||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.5.7+77
|
version: 1.5.8+78
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.17.0 <3.0.0"
|
sdk: ">=2.17.0 <3.0.0"
|
||||||
|
|
2
scripts/prebuild.sh
Normal file → Executable file
2
scripts/prebuild.sh
Normal file → Executable file
|
@ -2,5 +2,5 @@
|
||||||
KEYS=../lib/external_api_keys.dart
|
KEYS=../lib/external_api_keys.dart
|
||||||
if ! test -f "$KEYS"; then
|
if ! test -f "$KEYS"; then
|
||||||
echo 'prebuild.sh: creating template lib/external_api_keys.dart file'
|
echo 'prebuild.sh: creating template lib/external_api_keys.dart file'
|
||||||
echo 'const kChangeNowApiKey = "";' > $KEYS
|
printf 'const kChangeNowApiKey = "";\nconst kSimpleSwapApiKey = "";' > $KEYS
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -29,7 +29,7 @@ git submodule update --init --recursive
|
||||||
KEYS="$HOME/projects/stack_wallet/lib/external_api_keys.dart"
|
KEYS="$HOME/projects/stack_wallet/lib/external_api_keys.dart"
|
||||||
if ! test -f "$KEYS"; then
|
if ! test -f "$KEYS"; then
|
||||||
echo 'prebuild.sh: creating template lib/external_api_keys.dart file'
|
echo 'prebuild.sh: creating template lib/external_api_keys.dart file'
|
||||||
echo 'const kChangeNowApiKey = "";' > $KEYS
|
printf 'const kChangeNowApiKey = "";\nconst kSimpleSwapApiKey = "";' > $KEYS
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#install stack wallet dependencies
|
#install stack wallet dependencies
|
||||||
|
|
Loading…
Reference in a new issue