mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
Merge pull request #146 from cypherstack/ui-fixes
various incognito mode fixes
This commit is contained in:
commit
90a80ce7a9
8 changed files with 123 additions and 98 deletions
|
@ -79,6 +79,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
|||
transactionIfSentFromStack = widget.transactionIfSentFromStack;
|
||||
walletId = widget.walletId;
|
||||
|
||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final trade = ref
|
||||
.read(tradesServiceProvider)
|
||||
|
@ -96,6 +97,7 @@ class _TradeDetailsViewState extends ConsumerState<TradeDetailsView> {
|
|||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
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/wallets_view/wallets_view.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/unread_notifications_provider.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/prefs.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -83,9 +83,7 @@ class _HomeViewState extends ConsumerState<HomeView> {
|
|||
|
||||
void _loadCNData() {
|
||||
// unawaited future
|
||||
//
|
||||
final externalCalls = Prefs.instance.externalCalls;
|
||||
if (externalCalls) {
|
||||
if (ref.read(prefsChangeNotifierProvider).externalCalls) {
|
||||
_exchangeDataLoadingService.loadAll(ref);
|
||||
} else {
|
||||
Logging.instance.log("User does not want to use external calls",
|
||||
|
|
|
@ -70,6 +70,8 @@ class _WalletSummaryInfoState extends State<WalletSummaryInfo> {
|
|||
builder: (_, ref, __) {
|
||||
final Coin coin =
|
||||
ref.watch(managerProvider.select((value) => value.coin));
|
||||
final externalCalls = ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.externalCalls));
|
||||
|
||||
Future<Decimal>? totalBalanceFuture;
|
||||
Future<Decimal>? availableBalanceFuture;
|
||||
|
@ -176,6 +178,7 @@ class _WalletSummaryInfoState extends State<WalletSummaryInfo> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (externalCalls)
|
||||
Text(
|
||||
"${Format.localizedStringAsFixed(
|
||||
value: priceTuple.item1 * balanceToShow,
|
||||
|
|
|
@ -255,6 +255,8 @@ class _TransactionDetailsViewState
|
|||
const SizedBox(
|
||||
height: 2,
|
||||
),
|
||||
if (ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.externalCalls)))
|
||||
SelectableText(
|
||||
"${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(
|
||||
localeServiceChangeNotifierProvider
|
||||
|
|
|
@ -49,6 +49,8 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final coin = ref.watch(managerProvider.select((value) => value.coin));
|
||||
final externalCalls = ref.watch(
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls));
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
|
@ -70,7 +72,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
width: widget.width,
|
||||
height: widget.height,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).extension<StackColors>()!.colorForCoin(coin),
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.colorForCoin(coin),
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
|
@ -138,7 +142,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
ref.watch(managerProvider
|
||||
.select((value) => value.walletName)),
|
||||
style: STextStyles.itemSubtitle12(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
overflow: TextOverflow.fade,
|
||||
),
|
||||
|
@ -159,6 +165,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
snapshot.hasData) {
|
||||
if (snapshot.data != null) {
|
||||
_cachedBalance = snapshot.data!;
|
||||
if (externalCalls) {
|
||||
_cachedFiatValue = _cachedBalance *
|
||||
ref
|
||||
.watch(
|
||||
|
@ -169,6 +176,7 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
.item1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -185,13 +193,17 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
)} ${coin.ticker}",
|
||||
style: STextStyles.titleBold12(context).copyWith(
|
||||
fontSize: 16,
|
||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (externalCalls)
|
||||
const SizedBox(
|
||||
height: 4,
|
||||
),
|
||||
if (externalCalls)
|
||||
Text(
|
||||
"${Format.localizedStringAsFixed(
|
||||
decimalPlaces: 2,
|
||||
|
@ -206,7 +218,9 @@ class _FavoriteCardState extends ConsumerState<FavoriteCard> {
|
|||
)}",
|
||||
style: STextStyles.itemSubtitle12(context).copyWith(
|
||||
fontSize: 10,
|
||||
color: Theme.of(context).extension<StackColors>()!.textFavoriteCard,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFavoriteCard,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -84,7 +84,9 @@ class NotificationsService extends ChangeNotifier {
|
|||
_timer = Timer.periodic(notificationRefreshInterval, (_) {
|
||||
Logging.instance
|
||||
.log("Periodic notifications update check", level: LogLevel.Info);
|
||||
if (prefs.externalCalls) {
|
||||
_checkTrades();
|
||||
}
|
||||
_checkTransactions();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -569,6 +569,6 @@ class Prefs extends ChangeNotifier {
|
|||
Future<bool> _getHasExternalCalls() async {
|
||||
return await DB.instance.get<dynamic>(
|
||||
boxName: DB.boxNamePrefs, key: "externalCalls") as bool? ??
|
||||
false;
|
||||
true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,9 +202,13 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.externalCalls)))
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
if (ref.watch(prefsChangeNotifierProvider
|
||||
.select((value) => value.externalCalls)))
|
||||
Flexible(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.scaleDown,
|
||||
|
|
Loading…
Reference in a new issue