mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
DebugLogLevel: Save the last used log level
This way it's easier to return back to see what's going wrong.
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
|
import 'package:gitjournal/settings.dart';
|
||||||
import 'package:gitjournal/utils/logger.dart';
|
import 'package:gitjournal/utils/logger.dart';
|
||||||
|
|
||||||
class DebugScreen extends StatefulWidget {
|
class DebugScreen extends StatefulWidget {
|
||||||
@ -9,7 +10,7 @@ class DebugScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _DebugScreenState extends State<DebugScreen> {
|
class _DebugScreenState extends State<DebugScreen> {
|
||||||
ScrollController _controller = ScrollController();
|
ScrollController _controller = ScrollController();
|
||||||
String filterLevel = 'v';
|
String filterLevel = Settings.instance.debugLogLevel;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -206,6 +207,9 @@ class _DebugScreenState extends State<DebugScreen> {
|
|||||||
var l = await showDialog(context: context, builder: (context) => dialog);
|
var l = await showDialog(context: context, builder: (context) => dialog);
|
||||||
if (l != null) {
|
if (l != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
Settings.instance.debugLogLevel = l;
|
||||||
|
Settings.instance.save();
|
||||||
|
|
||||||
filterLevel = l;
|
filterLevel = l;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ class Settings {
|
|||||||
SettingsMarkdownDefaultView.Default;
|
SettingsMarkdownDefaultView.Default;
|
||||||
|
|
||||||
String imageLocationSpec = "."; // . means the same folder
|
String imageLocationSpec = "."; // . means the same folder
|
||||||
|
String debugLogLevel = 'v';
|
||||||
|
|
||||||
void load(SharedPreferences pref) {
|
void load(SharedPreferences pref) {
|
||||||
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
||||||
@ -99,6 +100,8 @@ class Settings {
|
|||||||
|
|
||||||
imageLocationSpec =
|
imageLocationSpec =
|
||||||
pref.getString("imageLocationSpec") ?? imageLocationSpec;
|
pref.getString("imageLocationSpec") ?? imageLocationSpec;
|
||||||
|
|
||||||
|
debugLogLevel = pref.getString("debugLogLevel") ?? debugLogLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future save() async {
|
Future save() async {
|
||||||
@ -155,6 +158,7 @@ class Settings {
|
|||||||
defaultSet.homeScreen.toInternalString());
|
defaultSet.homeScreen.toInternalString());
|
||||||
_setString(pref, "imageLocationSpec", imageLocationSpec,
|
_setString(pref, "imageLocationSpec", imageLocationSpec,
|
||||||
defaultSet.imageLocationSpec);
|
defaultSet.imageLocationSpec);
|
||||||
|
_setString(pref, "debugLogLevel", debugLogLevel, defaultSet.debugLogLevel);
|
||||||
|
|
||||||
pref.setInt("settingsVersion", version);
|
pref.setInt("settingsVersion", version);
|
||||||
|
|
||||||
@ -214,6 +218,7 @@ class Settings {
|
|||||||
'markdownDefaultView': markdownDefaultView.toInternalString(),
|
'markdownDefaultView': markdownDefaultView.toInternalString(),
|
||||||
'homeScreen': homeScreen.toInternalString(),
|
'homeScreen': homeScreen.toInternalString(),
|
||||||
'imageLocationSpec': imageLocationSpec,
|
'imageLocationSpec': imageLocationSpec,
|
||||||
|
'debugLogLevel': debugLogLevel,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user