mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
familiarity fix
This commit is contained in:
parent
4b0d44a239
commit
9fce8ca107
4 changed files with 64 additions and 12 deletions
|
@ -9,7 +9,6 @@ import 'package:stackwallet/models/node_model.dart';
|
||||||
import 'package:stackwallet/models/notification_model.dart';
|
import 'package:stackwallet/models/notification_model.dart';
|
||||||
import 'package:stackwallet/models/trade_wallet_lookup.dart';
|
import 'package:stackwallet/models/trade_wallet_lookup.dart';
|
||||||
import 'package:stackwallet/services/wallets_service.dart';
|
import 'package:stackwallet/services/wallets_service.dart';
|
||||||
import 'package:stackwallet/utilities/constants.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';
|
||||||
|
|
||||||
|
@ -151,17 +150,6 @@ class DB {
|
||||||
_loadSharedCoinCacheBoxes(),
|
_loadSharedCoinCacheBoxes(),
|
||||||
]);
|
]);
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|
||||||
try {
|
|
||||||
if (_boxPrefs!.get("familiarity") == null) {
|
|
||||||
await _boxPrefs!.put("familiarity", 0);
|
|
||||||
}
|
|
||||||
int count = _boxPrefs!.get("familiarity") as int;
|
|
||||||
await _boxPrefs!.put("familiarity", count + 1);
|
|
||||||
Constants.exchangeForExperiencedUsers(count + 1);
|
|
||||||
} catch (e, s) {
|
|
||||||
print("$e $s");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,11 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
await DB.instance.init();
|
await DB.instance.init();
|
||||||
await ref.read(prefsChangeNotifierProvider).init();
|
await ref.read(prefsChangeNotifierProvider).init();
|
||||||
|
|
||||||
|
final familiarity = ref.read(prefsChangeNotifierProvider).familiarity + 1;
|
||||||
|
ref.read(prefsChangeNotifierProvider).familiarity = familiarity;
|
||||||
|
|
||||||
|
Constants.exchangeForExperiencedUsers(familiarity);
|
||||||
|
|
||||||
if (Util.isDesktop) {
|
if (Util.isDesktop) {
|
||||||
_desktopHasPassword =
|
_desktopHasPassword =
|
||||||
await ref.read(storageCryptoHandlerProvider).hasPassword();
|
await ref.read(storageCryptoHandlerProvider).hasPassword();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||||
import 'package:stackwallet/providers/global/debug_service_provider.dart';
|
import 'package:stackwallet/providers/global/debug_service_provider.dart';
|
||||||
import 'package:stackwallet/providers/providers.dart';
|
import 'package:stackwallet/providers/providers.dart';
|
||||||
|
import 'package:stackwallet/utilities/constants.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/background.dart';
|
import 'package:stackwallet/widgets/background.dart';
|
||||||
|
@ -127,6 +128,42 @@ class HiddenSettings extends StatelessWidget {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
const SizedBox(
|
||||||
|
height: 12,
|
||||||
|
),
|
||||||
|
Consumer(
|
||||||
|
builder: (_, ref, __) {
|
||||||
|
if (ref.watch(prefsChangeNotifierProvider
|
||||||
|
.select((value) => value.familiarity)) <
|
||||||
|
6) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () async {
|
||||||
|
final familiarity = ref
|
||||||
|
.read(prefsChangeNotifierProvider)
|
||||||
|
.familiarity;
|
||||||
|
if (familiarity < 6) {
|
||||||
|
ref
|
||||||
|
.read(prefsChangeNotifierProvider)
|
||||||
|
.familiarity = 6;
|
||||||
|
|
||||||
|
Constants.exchangeForExperiencedUsers(6);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: RoundedWhiteContainer(
|
||||||
|
child: Text(
|
||||||
|
"Enable exchange",
|
||||||
|
style: STextStyles.button(context).copyWith(
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.accentColorDark),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Container();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
// const SizedBox(
|
// const SizedBox(
|
||||||
// height: 12,
|
// height: 12,
|
||||||
// ),
|
// ),
|
||||||
|
|
|
@ -37,6 +37,7 @@ class Prefs extends ChangeNotifier {
|
||||||
_gotoWalletOnStartup = await _getGotoWalletOnStartup();
|
_gotoWalletOnStartup = await _getGotoWalletOnStartup();
|
||||||
_startupWalletId = await _getStartupWalletId();
|
_startupWalletId = await _getStartupWalletId();
|
||||||
_externalCalls = await _getHasExternalCalls();
|
_externalCalls = await _getHasExternalCalls();
|
||||||
|
_familiarity = await _getHasFamiliarity();
|
||||||
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -328,6 +329,27 @@ class Prefs extends ChangeNotifier {
|
||||||
false;
|
false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// familiarity
|
||||||
|
|
||||||
|
int _familiarity = 0;
|
||||||
|
|
||||||
|
int get familiarity => _familiarity;
|
||||||
|
|
||||||
|
set familiarity(int familiarity) {
|
||||||
|
if (_familiarity != familiarity) {
|
||||||
|
DB.instance.put<dynamic>(
|
||||||
|
boxName: DB.boxNamePrefs, key: "familiarity", value: familiarity);
|
||||||
|
_familiarity = familiarity;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<int> _getHasFamiliarity() async {
|
||||||
|
return await DB.instance.get<dynamic>(
|
||||||
|
boxName: DB.boxNamePrefs, key: "familiarity") as int? ??
|
||||||
|
0;
|
||||||
|
}
|
||||||
|
|
||||||
// show testnet coins
|
// show testnet coins
|
||||||
|
|
||||||
bool _showTestNetCoins = false;
|
bool _showTestNetCoins = false;
|
||||||
|
|
Loading…
Reference in a new issue