mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-30 11:33:34 +08:00
Generate a random uuid for each user for Sentry
This way, we know if one particular user has lots of errors. Firebase Crashlytics used to do this automatically, I think.
This commit is contained in:
@ -62,6 +62,9 @@ Future<Event> get _environmentEvent async {
|
||||
build: packageInfo.buildNumber,
|
||||
),
|
||||
),
|
||||
userContext: User(
|
||||
id: Settings.instance.pseudoId,
|
||||
),
|
||||
);
|
||||
return environment;
|
||||
}
|
||||
|
@ -3,6 +3,8 @@ import 'package:gitjournal/screens/note_editor.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:gitjournal/core/sorting_mode.dart';
|
||||
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
class Settings {
|
||||
static List<Function> changeObservers = [];
|
||||
|
||||
@ -34,6 +36,9 @@ class Settings {
|
||||
|
||||
bool proMode = false;
|
||||
|
||||
String _pseudoId;
|
||||
String get pseudoId => _pseudoId;
|
||||
|
||||
void load(SharedPreferences pref) {
|
||||
gitAuthor = pref.getString("gitAuthor") ?? gitAuthor;
|
||||
gitAuthorEmail = pref.getString("gitAuthorEmail") ?? gitAuthorEmail;
|
||||
@ -66,6 +71,12 @@ class Settings {
|
||||
|
||||
version = pref.getInt("settingsVersion") ?? version;
|
||||
proMode = pref.getBool("proMode") ?? proMode;
|
||||
|
||||
_pseudoId = pref.getString("pseudoId");
|
||||
if (_pseudoId == null) {
|
||||
_pseudoId = Uuid().v4();
|
||||
pref.setString("pseudoId", _pseudoId);
|
||||
}
|
||||
}
|
||||
|
||||
Future save() async {
|
||||
@ -112,6 +123,7 @@ class Settings {
|
||||
"folderViewHeaderType": folderViewHeaderType,
|
||||
"version": version,
|
||||
"proMode": proMode,
|
||||
'pseudoId': pseudoId,
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user