Skip to content

Commit

Permalink
chore:
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Jan 27, 2025
1 parent ff8dcb3 commit 02b1ec8
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 323 deletions.
5 changes: 0 additions & 5 deletions lib/application/settings/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class SettingsNotifier extends StateNotifier<Settings> {
),
showBalances: true,
showPriceChart: true,
testnetEnabled: false,
),
);

Expand All @@ -47,10 +46,6 @@ class SettingsNotifier extends StateNotifier<Settings> {
state.copyWith(showBalances: showBalances),
);

Future<void> setTestnetEnabled(bool testnetEnabled) => _update(
state.copyWith(testnetEnabled: testnetEnabled),
);

Future<void> setShowPriceChart(bool showPriceChart) => _update(
state.copyWith(showPriceChart: showPriceChart),
);
Expand Down
2 changes: 0 additions & 2 deletions lib/domain/models/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class Settings with _$Settings {
required String languageSeed,
required bool firstLaunch,
required bool showBalances,
required bool testnetEnabled,
required bool activeRPCServer,
required int mainScreenCurrentPage,
required bool showPriceChart,
Expand All @@ -40,7 +39,6 @@ class Settings with _$Settings {
primaryCurrency:
AvailablePrimaryCurrency(AvailablePrimaryCurrencyEnum.native),
showBalances: true,
testnetEnabled: false,
showPriceChart: true,
priceChartIntervalOption: aedappfm.MarketPriceHistoryInterval.hour,
);
Expand Down
24 changes: 1 addition & 23 deletions lib/domain/models/settings.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mixin _$Settings {
String get languageSeed => throw _privateConstructorUsedError;
bool get firstLaunch => throw _privateConstructorUsedError;
bool get showBalances => throw _privateConstructorUsedError;
bool get testnetEnabled => throw _privateConstructorUsedError;
bool get activeRPCServer => throw _privateConstructorUsedError;
int get mainScreenCurrentPage => throw _privateConstructorUsedError;
bool get showPriceChart => throw _privateConstructorUsedError;
Expand All @@ -49,7 +48,6 @@ abstract class $SettingsCopyWith<$Res> {
String languageSeed,
bool firstLaunch,
bool showBalances,
bool testnetEnabled,
bool activeRPCServer,
int mainScreenCurrentPage,
bool showPriceChart,
Expand Down Expand Up @@ -77,7 +75,6 @@ class _$SettingsCopyWithImpl<$Res, $Val extends Settings>
Object? languageSeed = null,
Object? firstLaunch = null,
Object? showBalances = null,
Object? testnetEnabled = null,
Object? activeRPCServer = null,
Object? mainScreenCurrentPage = null,
Object? showPriceChart = null,
Expand Down Expand Up @@ -108,10 +105,6 @@ class _$SettingsCopyWithImpl<$Res, $Val extends Settings>
? _value.showBalances
: showBalances // ignore: cast_nullable_to_non_nullable
as bool,
testnetEnabled: null == testnetEnabled
? _value.testnetEnabled
: testnetEnabled // ignore: cast_nullable_to_non_nullable
as bool,
activeRPCServer: null == activeRPCServer
? _value.activeRPCServer
: activeRPCServer // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -147,7 +140,6 @@ abstract class _$$SettingsImplCopyWith<$Res>
String languageSeed,
bool firstLaunch,
bool showBalances,
bool testnetEnabled,
bool activeRPCServer,
int mainScreenCurrentPage,
bool showPriceChart,
Expand All @@ -173,7 +165,6 @@ class __$$SettingsImplCopyWithImpl<$Res>
Object? languageSeed = null,
Object? firstLaunch = null,
Object? showBalances = null,
Object? testnetEnabled = null,
Object? activeRPCServer = null,
Object? mainScreenCurrentPage = null,
Object? showPriceChart = null,
Expand Down Expand Up @@ -204,10 +195,6 @@ class __$$SettingsImplCopyWithImpl<$Res>
? _value.showBalances
: showBalances // ignore: cast_nullable_to_non_nullable
as bool,
testnetEnabled: null == testnetEnabled
? _value.testnetEnabled
: testnetEnabled // ignore: cast_nullable_to_non_nullable
as bool,
activeRPCServer: null == activeRPCServer
? _value.activeRPCServer
: activeRPCServer // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -238,7 +225,6 @@ class _$SettingsImpl extends _Settings {
required this.languageSeed,
required this.firstLaunch,
required this.showBalances,
required this.testnetEnabled,
required this.activeRPCServer,
required this.mainScreenCurrentPage,
required this.showPriceChart,
Expand All @@ -258,8 +244,6 @@ class _$SettingsImpl extends _Settings {
@override
final bool showBalances;
@override
final bool testnetEnabled;
@override
final bool activeRPCServer;
@override
final int mainScreenCurrentPage;
Expand All @@ -270,7 +254,7 @@ class _$SettingsImpl extends _Settings {

@override
String toString() {
return 'Settings(primaryCurrency: $primaryCurrency, language: $language, environment: $environment, languageSeed: $languageSeed, firstLaunch: $firstLaunch, showBalances: $showBalances, testnetEnabled: $testnetEnabled, activeRPCServer: $activeRPCServer, mainScreenCurrentPage: $mainScreenCurrentPage, showPriceChart: $showPriceChart, priceChartIntervalOption: $priceChartIntervalOption)';
return 'Settings(primaryCurrency: $primaryCurrency, language: $language, environment: $environment, languageSeed: $languageSeed, firstLaunch: $firstLaunch, showBalances: $showBalances, activeRPCServer: $activeRPCServer, mainScreenCurrentPage: $mainScreenCurrentPage, showPriceChart: $showPriceChart, priceChartIntervalOption: $priceChartIntervalOption)';
}

@override
Expand All @@ -290,8 +274,6 @@ class _$SettingsImpl extends _Settings {
other.firstLaunch == firstLaunch) &&
(identical(other.showBalances, showBalances) ||
other.showBalances == showBalances) &&
(identical(other.testnetEnabled, testnetEnabled) ||
other.testnetEnabled == testnetEnabled) &&
(identical(other.activeRPCServer, activeRPCServer) ||
other.activeRPCServer == activeRPCServer) &&
(identical(other.mainScreenCurrentPage, mainScreenCurrentPage) ||
Expand All @@ -312,7 +294,6 @@ class _$SettingsImpl extends _Settings {
languageSeed,
firstLaunch,
showBalances,
testnetEnabled,
activeRPCServer,
mainScreenCurrentPage,
showPriceChart,
Expand All @@ -335,7 +316,6 @@ abstract class _Settings extends Settings {
required final String languageSeed,
required final bool firstLaunch,
required final bool showBalances,
required final bool testnetEnabled,
required final bool activeRPCServer,
required final int mainScreenCurrentPage,
required final bool showPriceChart,
Expand All @@ -356,8 +336,6 @@ abstract class _Settings extends Settings {
@override
bool get showBalances;
@override
bool get testnetEnabled;
@override
bool get activeRPCServer;
@override
int get mainScreenCurrentPage;
Expand Down
6 changes: 0 additions & 6 deletions lib/infrastructure/datasources/preferences.hive.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class PreferencesHiveDatasource {
static const String pinLockUntil = 'archethic_wallet_pin_lock_until';
static const String pinPadShuffle = 'archethic_wallet_pinPadShuffle';
static const String showBalances = 'archethic_wallet_showBalances';
static const String testnetEnabled = 'archethic_wallet_testnetEnabled';
static const String showPriceChart = 'archethic_wallet_showPriceChart';
static const String priceChartScale = 'archethic_wallet_priceChartScale';
static const String activeRPCServer = 'archethic_wallet_activeRPCServer';
Expand Down Expand Up @@ -145,11 +144,6 @@ class PreferencesHiveDatasource {

bool getShowBalances() => _getValue(showBalances, defaultValue: true);

Future<void> setTestnetEnabled(bool value) =>
_setValue(testnetEnabled, value);

bool getTestnetEnabled() => _getValue(testnetEnabled, defaultValue: false);

Future<void> setActiveRPCServer(bool value) =>
_setValue(activeRPCServer, value);

Expand Down
2 changes: 0 additions & 2 deletions lib/infrastructure/repositories/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class SettingsRepository implements SettingsRepositoryInterface {
environment: loadedPreferences.getEnvironment(),
primaryCurrency: loadedPreferences.getPrimaryCurrency(),
showBalances: loadedPreferences.getShowBalances(),
testnetEnabled: loadedPreferences.getTestnetEnabled(),
showPriceChart: loadedPreferences.getShowPriceChart(),
priceChartIntervalOption: loadedPreferences.getPriceChartIntervalOption(),
);
Expand All @@ -40,7 +39,6 @@ class SettingsRepository implements SettingsRepositoryInterface {
await loadedPreferences.setEnvironment(settings.environment);
await loadedPreferences.setPrimaryCurrency(settings.primaryCurrency);
await loadedPreferences.setShowBalances(settings.showBalances);
await loadedPreferences.setTestnetEnabled(settings.testnetEnabled);
await loadedPreferences.setShowPriceChart(settings.showPriceChart);
await loadedPreferences
.setPriceChartIntervalOption(settings.priceChartIntervalOption);
Expand Down
12 changes: 10 additions & 2 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
"passwordBlank": "Password cannot be empty",
"welcomeDisclaimerChoice": "I have read and agree to the privacy policy",
"showBalances": "Show balances",
"testnetEnabled": "Testnet enabled",
"introNewWalletGetFirstInfosWelcome": "Welcome to Archethic Wallet.",
"introNewWalletGetFirstInfosNameRequest": "Let's start by naming your first account, which will be stored on your decentralized keychain",
"introNewWalletGetFirstInfosNameInfos": "It will allow you to distinguish this account from other accounts that you can, if you want, create later.\n\nWARNING : This name will be added to your decentralized keychain and cannot be modified.",
Expand Down Expand Up @@ -673,5 +672,14 @@
}
},
"walletNotCreatedTargetEnv": "The wallet has not been created in the {targetEnv} environment.",
"walletChangeLoadingError": "The change of environment encountered an issue."
"walletChangeLoadingError": "The change of environment encountered an issue.",
"switchEnvHeader": "Switch environment",
"switchEnvHeaderInfo": "Switch to an environment other than your current {currentEnv} environment.",
"@switchEnvHeaderInfo": {
"placeholders": {
"currentEnv": {
"type": "String"
}
}
}
}
12 changes: 10 additions & 2 deletions lib/l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@
"passwordStrengthStrong": "Votre mot de passe est fort.",
"welcomeDisclaimerChoice": "J'ai lu et j'accepte la politique de confidentialité",
"showBalances": "Afficher les balances",
"testnetEnabled": "Testnet activé",
"introNewWalletGetFirstInfosWelcome": "Bienvenue dans le Wallet Archethic.",
"introNewWalletGetFirstInfosNameRequest": "Commençons par donner un nom à votre premier compte, qui sera stocké sur votre porte-clés décentralisé.",
"introNewWalletGetFirstInfosNameInfos": "Il vous permettra de distinguer ce compte avec les autres comptes que vous pourrez, si vous le souhaitez, créer par la suite.\n\nATTENTION : Ce nom sera rattaché à votre porte-clés décentralisé et ne pourra plus être modifié.",
Expand Down Expand Up @@ -669,5 +668,14 @@
}
},
"walletNotCreatedTargetEnv": "Le wallet n'a pas été créé dans l'environnement {targetEnv}.",
"walletChangeLoadingError": "Le changement d'environnement a rencontré un problème."
"walletChangeLoadingError": "Le changement d'environnement a rencontré un problème.",
"switchEnvHeader": "Changer d'environnement",
"switchEnvHeaderInfo": "Permet de basculer sur un autre environnement que votre environnement actuel \"{currentEnv}\"",
"@switchEnvHeaderInfo": {
"placeholders": {
"currentEnv": {
"type": "String"
}
}
}
}
26 changes: 0 additions & 26 deletions lib/ui/menu/settings/customization_menu_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class CustomizationMenuView extends ConsumerWidget
final localizations = AppLocalizations.of(context)!;

final primaryCurrency = ref.watch(selectedPrimaryCurrencyProvider);
final environment = ref.watch(environmentProvider);
return DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
Expand Down Expand Up @@ -77,10 +76,6 @@ class CustomizationMenuView extends ConsumerWidget
const _SettingsListItem.spacer(),
const _ShowPriceChartSettingsListItem(),
const _SettingsListItem.spacer(),
if (environment == aedappfm.Environment.mainnet)
const _TestnetEnabledSettingsListItem(),
if (environment == aedappfm.Environment.mainnet)
const _SettingsListItem.spacer(),
],
),
],
Expand Down Expand Up @@ -153,24 +148,3 @@ class _ShowPriceChartSettingsListItem extends ConsumerWidget {
);
}
}

class _TestnetEnabledSettingsListItem extends ConsumerWidget {
const _TestnetEnabledSettingsListItem();

@override
Widget build(BuildContext context, WidgetRef ref) {
final localizations = AppLocalizations.of(context)!;
final testnetEnabledSetting = ref.watch(
SettingsProviders.settings.select((settings) => settings.testnetEnabled),
);
final preferencesNotifier = ref.read(SettingsProviders.settings.notifier);
return _SettingsListItem.withSwitch(
heading: localizations.testnetEnabled,
icon: Symbols.deployed_code_account,
isSwitched: testnetEnabledSetting,
onChanged: (testnetEnabled) async {
await preferencesNotifier.setTestnetEnabled(testnetEnabled);
},
);
}
}
Loading

0 comments on commit 02b1ec8

Please sign in to comment.