diff --git a/src/ui/flutter_app/lib/l10n/intl_en.arb b/src/ui/flutter_app/lib/l10n/intl_en.arb index 4bded089..8a8adb03 100644 --- a/src/ui/flutter_app/lib/l10n/intl_en.arb +++ b/src/ui/flutter_app/lib/l10n/intl_en.arb @@ -430,9 +430,9 @@ "@difficulty": { "description": "Difficulty" }, - "playSounds": "Sound effects", - "@playSounds": { - "description": "Sound effects" + "gameSettings": "Game settings", + "@gameSettings": { + "description": "Settings to change the behaviour of the game." }, "playSoundsInTheGame": "Play sounds in the game", "@playSoundsInTheGame": { diff --git a/src/ui/flutter_app/lib/models/preferences.dart b/src/ui/flutter_app/lib/models/preferences.dart index 17123a99..4d01f40a 100644 --- a/src/ui/flutter_app/lib/models/preferences.dart +++ b/src/ui/flutter_app/lib/models/preferences.dart @@ -52,7 +52,8 @@ class Preferences { this.considerMobility = true, @Deprecated("we won't export the developer settings anymore. People should use the EnvironmentConfig.devMode") this.developerMode = false, - this.experimentsEnabled = false, + @Deprecated("use [EnvironmentConfig.devMode] instead") + this.experimentsEnabled = false, }); @HiveField(0) @@ -98,6 +99,7 @@ class Preferences { ) final bool developerMode; @HiveField(19) + @Deprecated("use [EnvironmentConfig.devMode] instead") final bool experimentsEnabled; /// encodes a Json style map into a [Preferences] object diff --git a/src/ui/flutter_app/lib/screens/game_settings/game_settings_page.dart b/src/ui/flutter_app/lib/screens/game_settings/game_settings_page.dart index 7c7c6c1f..c1ff68fd 100644 --- a/src/ui/flutter_app/lib/screens/game_settings/game_settings_page.dart +++ b/src/ui/flutter_app/lib/screens/game_settings/game_settings_page.dart @@ -23,7 +23,6 @@ import 'package:flutter/material.dart'; import 'package:hive_flutter/hive_flutter.dart' show Box; import 'package:sanmill/generated/intl/l10n.dart'; import 'package:sanmill/models/preferences.dart'; -import 'package:sanmill/screens/env_page.dart'; import 'package:sanmill/services/environment_config.dart'; import 'package:sanmill/services/storage/storage.dart'; import 'package:sanmill/shared/custom_drawer/custom_drawer.dart'; @@ -141,13 +140,6 @@ class GameSettingsPage extends StatelessWidget { debugPrint("$_tag screenReaderSupport: $value"); } - void _setExperimentsEnabled(Preferences _preferences, bool value) { - LocalDatabaseService.preferences = - _preferences.copyWith(experimentsEnabled: value); - - debugPrint("$_tag experimentsEnabled: $value"); - } - Column _buildPrefs(BuildContext context, Box prefBox, _) { final Preferences _preferences = prefBox.get( LocalDatabaseService.preferencesKey, @@ -156,9 +148,14 @@ class GameSettingsPage extends StatelessWidget { final _widowsSettings = [ const CustomSpacer(), - Text(S.of(context).playSounds, style: AppTheme.settingsHeaderStyle), + Text(S.of(context).gameSettings, style: AppTheme.settingsHeaderStyle), SettingsCard( children: [ + SettingsSwitchListTile( + value: _preferences.isAutoRestart, + onChanged: (val) => _setIsAutoRestart(_preferences, val), + titleString: S.of(context).isAutoRestart, + ), SettingsSwitchListTile( value: _preferences.toneEnabled, onChanged: (val) => _setTone(_preferences, val), @@ -173,39 +170,6 @@ class GameSettingsPage extends StatelessWidget { ), ]; - final _developerSettings = [ - const CustomSpacer(), - Text(S.of(context).forDevelopers, style: AppTheme.settingsHeaderStyle), - SettingsCard( - children: [ - SettingsSwitchListTile( - value: EnvironmentConfig.devMode, - onChanged: (_) {}, - titleString: S.of(context).developerMode, - ), - SettingsSwitchListTile( - value: _preferences.experimentsEnabled, - onChanged: (val) => _setExperimentsEnabled(_preferences, val), - titleString: S.of(context).experiments, - ), - SettingsSwitchListTile( - value: _preferences.isAutoRestart, - onChanged: (val) => _setIsAutoRestart(_preferences, val), - titleString: S.of(context).isAutoRestart, - ), - SettingsListTile( - titleString: S.of(context).environmentVariables, - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (_) => const EnvironmentVariablesPage(), - ), - ), - ), - ], - ), - ]; - return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -289,7 +253,6 @@ class GameSettingsPage extends StatelessWidget { ), ], ), - if (EnvironmentConfig.devMode) ..._developerSettings, ], ); } diff --git a/src/ui/flutter_app/lib/screens/rule_settings/rule_settings_page.dart b/src/ui/flutter_app/lib/screens/rule_settings/rule_settings_page.dart index df97ade7..2b1d5718 100644 --- a/src/ui/flutter_app/lib/screens/rule_settings/rule_settings_page.dart +++ b/src/ui/flutter_app/lib/screens/rule_settings/rule_settings_page.dart @@ -20,6 +20,7 @@ import 'package:flutter/material.dart'; import 'package:hive_flutter/hive_flutter.dart' show Box; import 'package:sanmill/generated/intl/l10n.dart'; import 'package:sanmill/models/rules.dart'; +import 'package:sanmill/services/environment_config.dart'; import 'package:sanmill/services/storage/storage.dart'; import 'package:sanmill/shared/custom_drawer/custom_drawer.dart'; import 'package:sanmill/shared/custom_spacer.dart'; @@ -269,21 +270,20 @@ class RuleSettingsPage extends StatelessWidget { Text(S.of(context).moving, style: AppTheme.settingsHeaderStyle), SettingsCard( children: [ - if (LocalDatabaseService.preferences.experimentsEnabled) + if (EnvironmentConfig.devMode) SettingsSwitchListTile( value: _rules.mayMoveInPlacingPhase, onChanged: (val) => _setMayMoveInPlacingPhase(context, _rules, val), titleString: S.of(context).mayMoveInPlacingPhase, subtitleString: S.of(context).mayMoveInPlacingPhase_Detail, - ) - else - SettingsSwitchListTile( - value: _rules.isDefenderMoveFirst, - onChanged: (val) => _setIsDefenderMoveFirst(_rules, val), - titleString: S.of(context).isDefenderMoveFirst, - subtitleString: S.of(context).isDefenderMoveFirst_Detail, ), + SettingsSwitchListTile( + value: _rules.isDefenderMoveFirst, + onChanged: (val) => _setIsDefenderMoveFirst(_rules, val), + titleString: S.of(context).isDefenderMoveFirst, + subtitleString: S.of(context).isDefenderMoveFirst_Detail, + ), SettingsSwitchListTile( value: _rules.isLoseButNotChangeSideWhenNoWay, onChanged: (val) =>