diff --git a/src/ui/flutter_app/lib/models/preferences.dart b/src/ui/flutter_app/lib/models/preferences.dart
index 606ba18a..17123a99 100644
--- a/src/ui/flutter_app/lib/models/preferences.dart
+++ b/src/ui/flutter_app/lib/models/preferences.dart
@@ -50,7 +50,8 @@ class Preferences {
this.algorithm = 2,
this.drawOnHumanExperience = true,
this.considerMobility = true,
- this.developerMode = false,
+ @Deprecated("we won't export the developer settings anymore. People should use the EnvironmentConfig.devMode")
+ this.developerMode = false,
this.experimentsEnabled = false,
});
@@ -92,6 +93,9 @@ class Preferences {
@HiveField(17)
final bool considerMobility;
@HiveField(18)
+ @Deprecated(
+ "we won't export the developer settings anymore. People should use the EnvironmentConfig.devMode",
+ )
final bool developerMode;
@HiveField(19)
final bool experimentsEnabled;
diff --git a/src/ui/flutter_app/lib/models/temporary.dart b/src/ui/flutter_app/lib/models/temporary.dart
deleted file mode 100644
index 652096dd..00000000
--- a/src/ui/flutter_app/lib/models/temporary.dart
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- This file is part of Sanmill.
- Copyright (C) 2019-2021 The Sanmill developers (see AUTHORS file)
-
- Sanmill is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- Sanmill is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-import 'package:sanmill/services/environment_config.dart';
-
-/// Temporary data model
-///
-/// holds temporary runtime data that isn't yet or shouldn't be saved to the LocalDatabase
-class Temp {
- const Temp._();
-
- /// represents a temporary value for Preferences.developerMode
- static bool developerMode = EnvironmentConfig.devMode;
-}
diff --git a/src/ui/flutter_app/lib/screens/game_page/board.dart b/src/ui/flutter_app/lib/screens/game_page/board.dart
index 128f05a0..069a997d 100644
--- a/src/ui/flutter_app/lib/screens/game_page/board.dart
+++ b/src/ui/flutter_app/lib/screens/game_page/board.dart
@@ -50,9 +50,9 @@ class Board extends StatelessWidget {
(index) => Center(
child: Text(
squareDesc[index],
- style: TextStyle(
+ style: const TextStyle(
// TODO: [Leptopoda] instead of making it transparent when not needed we should not show it in the first place
- color: LocalDatabaseService.preferences.developerMode
+ color: EnvironmentConfig.devMode
? Colors.red
: Colors.transparent,
),
diff --git a/src/ui/flutter_app/lib/screens/game_page/game_page.dart b/src/ui/flutter_app/lib/screens/game_page/game_page.dart
index 72bb375d..8495aac6 100644
--- a/src/ui/flutter_app/lib/screens/game_page/game_page.dart
+++ b/src/ui/flutter_app/lib/screens/game_page/game_page.dart
@@ -33,6 +33,7 @@ import 'package:sanmill/screens/game_settings/game_settings_page.dart';
import 'package:sanmill/services/audios.dart';
import 'package:sanmill/services/engine/engine.dart';
import 'package:sanmill/services/engine/native_engine.dart';
+import 'package:sanmill/services/environment_config.dart';
import 'package:sanmill/services/storage/storage.dart';
import 'package:sanmill/shared/constants.dart';
import 'package:sanmill/shared/custom_drawer/custom_drawer.dart';
@@ -1041,7 +1042,7 @@ class _GamePageState extends State
if (loseReasonStr == null) {
loseReasonStr = S.of(context).gameOverUnknownReason;
debugPrint("$_tag Game over reason string: $loseReasonStr");
- if (LocalDatabaseService.preferences.developerMode) {
+ if (EnvironmentConfig.devMode) {
assert(false);
}
}
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 1dd0b0d8..7c7c6c1f 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/models/temporary.dart';
import 'package:sanmill/screens/env_page.dart';
import 'package:sanmill/services/environment_config.dart';
import 'package:sanmill/services/storage/storage.dart';
@@ -142,13 +141,6 @@ class GameSettingsPage extends StatelessWidget {
debugPrint("$_tag screenReaderSupport: $value");
}
- void _setDeveloperMode(Preferences _preferences, bool value) {
- LocalDatabaseService.preferences =
- _preferences.copyWith(developerMode: value);
-
- debugPrint("$_tag developerMode: $value");
- }
-
void _setExperimentsEnabled(Preferences _preferences, bool value) {
LocalDatabaseService.preferences =
_preferences.copyWith(experimentsEnabled: value);
@@ -187,8 +179,8 @@ class GameSettingsPage extends StatelessWidget {
SettingsCard(
children: [
SettingsSwitchListTile(
- value: _preferences.developerMode,
- onChanged: (val) => _setDeveloperMode(_preferences, val),
+ value: EnvironmentConfig.devMode,
+ onChanged: (_) {},
titleString: S.of(context).developerMode,
),
SettingsSwitchListTile(
@@ -297,7 +289,7 @@ class GameSettingsPage extends StatelessWidget {
),
],
),
- if (Temp.developerMode) ..._developerSettings,
+ if (EnvironmentConfig.devMode) ..._developerSettings,
],
);
}
diff --git a/src/ui/flutter_app/lib/screens/home.dart b/src/ui/flutter_app/lib/screens/home.dart
index 33b96ad9..690c8a34 100644
--- a/src/ui/flutter_app/lib/screens/home.dart
+++ b/src/ui/flutter_app/lib/screens/home.dart
@@ -34,7 +34,7 @@ import 'package:sanmill/screens/help_screen.dart';
import 'package:sanmill/screens/personalization_settings/personalization_settings_page.dart';
import 'package:sanmill/screens/rule_settings/rule_settings_page.dart';
import 'package:sanmill/services/engine/engine.dart';
-import 'package:sanmill/services/storage/storage.dart';
+import 'package:sanmill/services/environment_config.dart';
import 'package:sanmill/shared/constants.dart';
import 'package:sanmill/shared/custom_drawer/custom_drawer.dart';
@@ -105,7 +105,7 @@ class _HomeState extends State with TickerProviderStateMixin {
_screenView = const PersonalizationSettingsPage();
break;
case _DrawerIndex.feedback:
- if (!LocalDatabaseService.preferences.developerMode) {
+ if (!EnvironmentConfig.devMode) {
if (Platform.isWindows) {
debugPrint("flutter_email_sender does not support Windows.");
} else {
@@ -114,13 +114,13 @@ class _HomeState extends State with TickerProviderStateMixin {
}
break;
case _DrawerIndex.Help:
- if (!LocalDatabaseService.preferences.developerMode) {
+ if (!EnvironmentConfig.devMode) {
_screenView = const HelpScreen();
}
break;
case _DrawerIndex.About:
- if (!LocalDatabaseService.preferences.developerMode) {
+ if (!EnvironmentConfig.devMode) {
_screenView = const AboutPage();
}
break;
diff --git a/src/ui/flutter_app/lib/services/engine/native_engine.dart b/src/ui/flutter_app/lib/services/engine/native_engine.dart
index 96e759d4..20a2a2b5 100644
--- a/src/ui/flutter_app/lib/services/engine/native_engine.dart
+++ b/src/ui/flutter_app/lib/services/engine/native_engine.dart
@@ -23,6 +23,7 @@ import 'package:flutter/services.dart';
import 'package:sanmill/mill/position.dart';
import 'package:sanmill/mill/types.dart';
import 'package:sanmill/services/engine/engine.dart';
+import 'package:sanmill/services/environment_config.dart';
import 'package:sanmill/services/storage/storage.dart';
class NativeEngine extends Engine {
@@ -104,7 +105,7 @@ class NativeEngine extends Engine {
}) async {
final _pref = LocalDatabaseService.preferences;
- var timeLimit = _pref.developerMode ? 100 : 6000;
+ var timeLimit = EnvironmentConfig.devMode ? 100 : 6000;
if (_pref.moveTime > 0) {
// TODO: Accurate timeLimit
@@ -113,7 +114,7 @@ class NativeEngine extends Engine {
if (times > timeLimit) {
debugPrint("[engine] Timeout. sleep = $sleep, times = $times");
- if (_pref.developerMode && isActive) {
+ if (EnvironmentConfig.devMode && isActive) {
throw "Exception: waitResponse timeout.";
}
return '';
@@ -149,7 +150,7 @@ class NativeEngine extends Engine {
final _rules = LocalDatabaseService.rules;
await send(
- 'setoption name DeveloperMode value ${_pref.developerMode}',
+ 'setoption name DeveloperMode value ${EnvironmentConfig.devMode}',
);
await send(
'setoption name Algorithm value ${_pref.algorithm}',
diff --git a/src/ui/flutter_app/lib/shared/custom_drawer/custom_drawer.dart b/src/ui/flutter_app/lib/shared/custom_drawer/custom_drawer.dart
index 1db90571..8783c3bb 100644
--- a/src/ui/flutter_app/lib/shared/custom_drawer/custom_drawer.dart
+++ b/src/ui/flutter_app/lib/shared/custom_drawer/custom_drawer.dart
@@ -24,7 +24,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
-import 'package:sanmill/models/temporary.dart';
import 'package:sanmill/services/storage/storage.dart';
import 'package:sanmill/shared/constants.dart';
import 'package:sanmill/shared/theme/app_theme.dart';
diff --git a/src/ui/flutter_app/lib/shared/custom_drawer/src/header.dart b/src/ui/flutter_app/lib/shared/custom_drawer/src/header.dart
index c5fe4168..48f2bb28 100644
--- a/src/ui/flutter_app/lib/shared/custom_drawer/src/header.dart
+++ b/src/ui/flutter_app/lib/shared/custom_drawer/src/header.dart
@@ -29,12 +29,6 @@ class CustomDrawerHeader extends StatelessWidget {
static const String _tag = "[home_drawer]";
- void _enableDeveloperMode() {
- Temp.developerMode = true;
-
- debugPrint("$_tag Developer mode enabled.");
- }
-
@override
Widget build(BuildContext context) {
final List _animatedTextsColors = [
@@ -48,22 +42,19 @@ class CustomDrawerHeader extends StatelessWidget {
LocalDatabaseService.colorSettings.drawerHighlightItemColor,
];
- final animation = GestureDetector(
- onDoubleTap: _enableDeveloperMode,
- child: AnimatedTextKit(
- animatedTexts: [
- ColorizeAnimatedText(
- title,
- textStyle: AppTheme.drawerHeaderTextStyle,
- colors: _animatedTextsColors,
- speed: const Duration(seconds: 3),
- ),
- ],
- pause: const Duration(seconds: 3),
- repeatForever: true,
- stopPauseOnTap: true,
- onTap: () => debugPrint("$_tag DoubleTap to enable developer mode."),
- ),
+ final animation = AnimatedTextKit(
+ animatedTexts: [
+ ColorizeAnimatedText(
+ title,
+ textStyle: AppTheme.drawerHeaderTextStyle,
+ colors: _animatedTextsColors,
+ speed: const Duration(seconds: 3),
+ ),
+ ],
+ pause: const Duration(seconds: 3),
+ repeatForever: true,
+ stopPauseOnTap: true,
+ onTap: () => debugPrint("$_tag DoubleTap to enable developer mode."),
);
final _padding = EdgeInsets.only(
diff --git a/src/ui/flutter_app/lib/shared/painters/painters.dart b/src/ui/flutter_app/lib/shared/painters/painters.dart
index 99f8b582..008c095b 100644
--- a/src/ui/flutter_app/lib/shared/painters/painters.dart
+++ b/src/ui/flutter_app/lib/shared/painters/painters.dart
@@ -23,6 +23,7 @@ import 'package:flutter/material.dart';
import 'package:sanmill/mill/game.dart';
import 'package:sanmill/mill/position.dart';
import 'package:sanmill/mill/types.dart';
+import 'package:sanmill/services/environment_config.dart';
import 'package:sanmill/services/storage/storage.dart';
import 'package:sanmill/shared/theme/app_theme.dart';
diff --git a/src/ui/flutter_app/lib/shared/painters/src/board_painter.dart b/src/ui/flutter_app/lib/shared/painters/src/board_painter.dart
index 2bc79257..bb558ec3 100644
--- a/src/ui/flutter_app/lib/shared/painters/src/board_painter.dart
+++ b/src/ui/flutter_app/lib/shared/painters/src/board_painter.dart
@@ -104,7 +104,7 @@ class BoardPainter extends PiecesBasePainter {
final offset = (width - _squareWidth * 6) / 4;
// Show notations "a b c d e f" on board
- if (LocalDatabaseService.preferences.developerMode) {
+ if (EnvironmentConfig.devMode) {
notationPainterV.paint(
canvas,
_offset.translate(
@@ -131,7 +131,7 @@ class BoardPainter extends PiecesBasePainter {
),
);
- if (LocalDatabaseService.preferences.developerMode) {
+ if (EnvironmentConfig.devMode) {
notationPainterH.paint(
canvas,
_offset.translate(