From de7cdb5bd4363e09a81259aa8cab71571c7bb7e2 Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Thu, 14 Mar 2024 00:40:39 +0800 Subject: [PATCH] perf: add behavior tracking instructions and switch options (#181) --- backend/storage/preferences.go | 2 +- backend/types/preferences.go | 3 + frontend/index.html | 2 - frontend/src/App.vue | 66 +++++++++++++++++-- .../components/dialogs/PreferencesDialog.vue | 13 ++++ frontend/src/components/sidebar/Ribbon.vue | 7 +- frontend/src/langs/en-us.json | 11 +++- frontend/src/langs/es-es.json | 11 +++- frontend/src/langs/fr-fr.json | 11 +++- frontend/src/langs/ja-jp.json | 11 +++- frontend/src/langs/ko-kr.json | 11 +++- frontend/src/langs/pt-br.json | 11 +++- frontend/src/langs/zh-cn.json | 11 +++- frontend/src/langs/zh-tw.json | 11 +++- frontend/src/stores/preferences.js | 8 +++ frontend/src/utils/analytics.js | 46 +++++++++++++ 16 files changed, 216 insertions(+), 19 deletions(-) create mode 100644 frontend/src/utils/analytics.js diff --git a/backend/storage/preferences.go b/backend/storage/preferences.go index 8ca03a0..261bb79 100644 --- a/backend/storage/preferences.go +++ b/backend/storage/preferences.go @@ -27,8 +27,8 @@ func (p *PreferencesStorage) DefaultPreferences() types.Preferences { } func (p *PreferencesStorage) getPreferences() (ret types.Preferences) { - b, err := p.storage.Load() ret = p.DefaultPreferences() + b, err := p.storage.Load() if err != nil { return } diff --git a/backend/types/preferences.go b/backend/types/preferences.go index 846f15c..40d5430 100644 --- a/backend/types/preferences.go +++ b/backend/types/preferences.go @@ -24,6 +24,7 @@ func NewPreferences() Preferences { ScanSize: consts.DEFAULT_SCAN_SIZE, KeyIconStyle: 0, CheckUpdate: true, + AllowTrack: true, }, Editor: PreferencesEditor{ FontSize: consts.DEFAULT_FONT_SIZE, @@ -41,6 +42,7 @@ func NewPreferences() Preferences { } type PreferencesBehavior struct { + Welcomed bool `json:"welcomed" yaml:"welcomed"` AsideWidth int `json:"asideWidth" yaml:"aside_width"` WindowWidth int `json:"windowWidth" yaml:"window_width"` WindowHeight int `json:"windowHeight" yaml:"window_height"` @@ -61,6 +63,7 @@ type PreferencesGeneral struct { UseSysProxyHttp bool `json:"useSysProxyHttp" yaml:"use_sys_proxy_http,omitempty"` CheckUpdate bool `json:"checkUpdate" yaml:"check_update"` SkipVersion string `json:"skipVersion" yaml:"skip_version,omitempty"` + AllowTrack bool `json:"allowTrack" yaml:"allow_track"` } type PreferencesEditor struct { diff --git a/frontend/index.html b/frontend/index.html index b53c808..9d89d63 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -8,8 +8,6 @@
-