Allow the FS view to be experimentaly enabled

This commit is contained in:
Vishesh Handa
2020-07-26 18:12:04 +02:00
parent b0acadec6b
commit 2396b34b75
5 changed files with 15 additions and 3 deletions

View File

@ -51,6 +51,7 @@ settings:
title: Experimental Features title: Experimental Features
subtitle: Try out features in Development subtitle: Try out features in Development
backlinks: Show Backlinks in Markdown Preview backlinks: Show Backlinks in Markdown Preview
fs: Show File System
editors: editors:
checklist: checklist:

View File

@ -1,4 +1,3 @@
class Features { class Features {
static bool perFolderConfig = false; static bool perFolderConfig = false;
static bool showFileSystem = false;
} }

View File

@ -38,6 +38,15 @@ class _ExperimentalSettingsScreenState
setState(() {}); setState(() {});
}, },
), ),
SwitchListTile(
title: Text(tr('settings.experimental.fs')),
value: settings.experimentalFs,
onChanged: (bool newVal) {
settings.experimentalFs = newVal;
settings.save();
setState(() {});
},
),
], ],
padding: const EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 0.0), padding: const EdgeInsets.fromLTRB(0.0, 16.0, 0.0, 0.0),
), ),

View File

@ -50,6 +50,7 @@ class Settings {
String debugLogLevel = 'v'; String debugLogLevel = 'v';
bool experimentalBacklinks = true; bool experimentalBacklinks = true;
bool experimentalFs = false;
void load(SharedPreferences pref) { void load(SharedPreferences pref) {
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor; gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
@ -112,6 +113,7 @@ class Settings {
debugLogLevel = pref.getString("debugLogLevel") ?? debugLogLevel; debugLogLevel = pref.getString("debugLogLevel") ?? debugLogLevel;
experimentalBacklinks = experimentalBacklinks =
pref.getBool("experimentalBacklinks") ?? experimentalBacklinks; pref.getBool("experimentalBacklinks") ?? experimentalBacklinks;
experimentalFs = pref.getBool("experimentalFs") ?? experimentalFs;
} }
Future save() async { Future save() async {
@ -176,6 +178,7 @@ class Settings {
_setString(pref, "debugLogLevel", debugLogLevel, defaultSet.debugLogLevel); _setString(pref, "debugLogLevel", debugLogLevel, defaultSet.debugLogLevel);
_setBool(pref, "experimentalBacklinks", experimentalBacklinks, _setBool(pref, "experimentalBacklinks", experimentalBacklinks,
defaultSet.experimentalBacklinks); defaultSet.experimentalBacklinks);
_setBool(pref, "experimentalFs", experimentalFs, defaultSet.experimentalFs);
pref.setInt("settingsVersion", version); pref.setInt("settingsVersion", version);
} }
@ -234,6 +237,7 @@ class Settings {
'imageLocationSpec': imageLocationSpec, 'imageLocationSpec': imageLocationSpec,
'debugLogLevel': debugLogLevel, 'debugLogLevel': debugLogLevel,
'experimentalBacklinks': experimentalBacklinks.toString(), 'experimentalBacklinks': experimentalBacklinks.toString(),
'experimentalFs': experimentalFs.toString(),
}; };
} }

View File

@ -10,7 +10,6 @@ import 'package:share/share.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import 'package:gitjournal/analytics.dart'; import 'package:gitjournal/analytics.dart';
import 'package:gitjournal/features.dart';
import 'package:gitjournal/settings.dart'; import 'package:gitjournal/settings.dart';
import 'package:gitjournal/state_container.dart'; import 'package:gitjournal/state_container.dart';
import 'package:gitjournal/utils.dart'; import 'package:gitjournal/utils.dart';
@ -81,7 +80,7 @@ class AppDrawer extends StatelessWidget {
onTap: () => _navTopLevel(context, '/folders'), onTap: () => _navTopLevel(context, '/folders'),
selected: currentRoute == "/folders", selected: currentRoute == "/folders",
), ),
if (Features.showFileSystem) if (Settings.instance.experimentalFs)
_buildDrawerTile( _buildDrawerTile(
context, context,
icon: FontAwesomeIcons.solidFolderOpen, icon: FontAwesomeIcons.solidFolderOpen,