feat: add anonymous analytics (#1254)

This commit is contained in:
Levi authored and GitHub committed 2026-01-23 22:29:15 +08:00
1 parent 7c696ee6e0
commit d61da67456
7 files changed
+204 -10

No files matched your search

+18
View File
@@ -11,6 +11,8 @@ const String _bookmark = 'bookmark';
const String _createHistory = 'createHistory';
const String _webToken = 'webToken';
const String _runAsMenubarApp = 'runAsMenubarApp';
const String _analyticsEnabled = 'analyticsEnabled';
const String _analyticsClientId = 'analyticsClientId';
class Database {
static final Database _instance = Database._internal();
@@ -118,4 +120,20 @@ class Database {
bool getRunAsMenubarApp() {
return box.get(_runAsMenubarApp, defaultValue: false) as bool;
}
void saveAnalyticsEnabled(bool value) {
box.put(_analyticsEnabled, value);
}
bool getAnalyticsEnabled() {
return box.get(_analyticsEnabled, defaultValue: true) as bool;
}
void saveAnalyticsClientId(String clientId) {
box.put(_analyticsClientId, clientId);
}
String? getAnalyticsClientId() {
return box.get(_analyticsClientId) as String?;
}
}