Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash switch can not record status #1002

Open
wants to merge 1 commit into
base: feature/dev_flutter
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Flutter/lib/kit/apm/crash_kit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,21 @@ class CrashKit extends ApmKit {
}

class CrashLogManager {
static final String KEY_CRASH_SWITCH = 'key_crash_switch';

CrashLogManager._privateConstructor();

bool crashSwitch = false;
bool _crashSwitch = false;

bool get crashSwitch{
return _crashSwitch;
}

set crashSwitch(enable){
_crashSwitch = enable;
SharedPreferences.getInstance()
.then((SharedPreferences prefs) => prefs.setBool(KEY_CRASH_SWITCH, enable));
}

static final CrashLogManager _instance =
CrashLogManager._privateConstructor();
Expand Down
6 changes: 6 additions & 0 deletions Flutter/lib/ui/kit_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import 'package:dokit/dokit.dart';
import 'package:dokit/kit/apm/apm.dart';
import 'package:dokit/kit/apm/crash_kit.dart';
import 'package:dokit/kit/biz/biz.dart';
import 'package:dokit/kit/common/common.dart';
import 'package:dokit/kit/kit.dart';
Expand Down Expand Up @@ -463,6 +464,11 @@ class KitPageManager {
} else {
ResidentPage.tag = KitPageManager.KIT_ALL;
}

if(prefs.getBool(CrashLogManager.KEY_CRASH_SWITCH)!=null) {
CrashLogManager.instance.crashSwitch =
prefs.getBool(CrashLogManager.KEY_CRASH_SWITCH);
}
});
}
}