A full-featured download manager.
refactor: improve preference
Shatyuka8052aa047ee8
diff --git a/src/renderer/components/Preference/Advanced.vue b/src/renderer/components/Preference/Advanced.vueindex c0c5700c..446f70e6 100644--- a/src/renderer/components/Preference/Advanced.vue+++ b/src/renderer/components/Preference/Advanced.vue@@ -371,16 +371,18 @@import is from 'electron-is'import { dialog } from '@electron/remote'import { mapState } from 'vuex'- import { cloneDeep } from 'lodash'+ import { cloneDeep, extend, isEmpty } from 'lodash'import randomize from 'randomatic'import * as clipboard from 'clipboard-polyfill'import ShowInFolder from '@/components/Native/ShowInFolder'import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'import userAgentMap from '@shared/ua'- import { trackerSourceOptions } from '@shared/constants'+ import { APP_RUN_MODE, trackerSourceOptions } from '@shared/constants'import {+ backupConfig,buildRpcUrl,calcFormLabelWidth,+ changedConfig,checkIsNeedRestart,convertCommaToLine,convertLineToComma,@@ -391,6 +393,8 @@import '@/components/Icons/dice'import '@/components/Icons/sync'import '@/components/Icons/refresh'+ import { getLanguage } from '@shared/locales'+ import { getLocaleManager } from '@/components/Locale'const initForm = (config) => {const {@@ -446,8 +450,9 @@},data () {const { locale } = this.$store.state.preference.config- const form = initForm(this.$store.state.preference.config)- const formOriginal = cloneDeep(form)+ const formOriginal = initForm(this.$store.state.preference.config)+ let form = {}+ form = initForm(extend(form, formOriginal, changedConfig.advanced))return {form,@@ -594,6 +599,10 @@.then((config) => {this.form = initForm(config)this.formOriginal = cloneDeep(this.form)+ if (changedConfig.basic.theme !== undefined) {+ this.$electron.ipcRenderer.send('command',+ 'application:change-theme', changedConfig.basic.theme)+ }})},submitForm (formName) {@@ -603,15 +612,19 @@return false}- const changed = diffConfig(this.formOriginal, this.form)const data = {- ...changed,- protocols: {- ...this.form.protocols- }+ ...diffConfig(this.formOriginal, this.form),+ ...changedConfig.basic+ }++ const { btAutoDownloadContent, runMode, openAtLogin, autoHideWindow, btTracker, noProxy } = data++ if ('btAutoDownloadContent' in data) {+ data.pauseMetadata = !btAutoDownloadContent+ data.followMetalink = btAutoDownloadContent+ data.followTorrent = btAutoDownloadContent}- const { btTracker, noProxy } = changedif (btTracker) {data.btTracker = reduceTrackerString(convertLineToComma(btTracker))}@@ -632,7 +645,28 @@this.$msg.success(this.$t('preferences.save-fail-message'))})+ changedConfig.basic = {}+ changedConfig.advanced = {}+if (this.isRenderer) {+ this.$electron.ipcRenderer.send('command',+ 'application:open-at-login', openAtLogin)++ if ('runMode' in data) {+ this.$electron.ipcRenderer.send('command',+ 'application:toggle-dock', runMode === APP_RUN_MODE.STANDARD)+ }++ if ('autoHideWindow' in data) {+ this.$electron.ipcRenderer.send('command',+ 'application:auto-hide-window', autoHideWindow)+ }++ if (checkIsNeedRestart(data)) {+ this.$electron.ipcRenderer.send('command',+ 'application:relaunch')+ }+this.$electron.ipcRenderer.send('command','application:setup-protocols-client', data.protocols)@@ -645,6 +679,41 @@resetForm (formName) {this.syncFormConfig()}+ },+ beforeRouteLeave (to, from, next) {+ changedConfig.advanced = diffConfig(this.formOriginal, this.form)+ if (to.path === '/preference/basic') {+ next()+ } else {+ if (isEmpty(changedConfig.basic) && isEmpty(changedConfig.advanced)) {+ next()+ } else {+ dialog.showMessageBox({+ type: 'warning',+ title: this.$t('preferences.not-saved'),+ message: this.$t('preferences.not-saved-confirm'),+ buttons: [this.$t('app.yes'), this.$t('app.no')],+ cancelId: 1+ }).then(({ response }) => {+ if (response === 0) {+ if (changedConfig.basic.theme !== undefined) {+ this.$electron.ipcRenderer.send('command',+ 'application:change-theme', backupConfig.theme)+ }+ if (changedConfig.basic.locale !== undefined) {+ const lng = getLanguage(backupConfig.locale)+ getLocaleManager().changeLanguage(lng)+ this.$electron.ipcRenderer.send('command',+ 'application:change-locale', lng)+ }+ changedConfig.basic = {}+ changedConfig.advanced = {}+ backupConfig.theme = undefined+ next()+ }+ })+ }+ }}}</script>diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vueindex 1a810b15..2d8cc798 100644--- a/src/renderer/components/Preference/Basic.vue+++ b/src/renderer/components/Preference/Basic.vue@@ -25,6 +25,7 @@<mo-theme-switcherv-model="form.theme"@change="handleThemeChange"+ ref="themeSwitcher"/></el-col><el-col v-if="showHideAppMenuOption" class="form-item-sub" :span="16">@@ -256,19 +257,24 @@<script>import is from 'electron-is'+ import { dialog } from '@electron/remote'import { mapState } from 'vuex'- import { cloneDeep } from 'lodash'+ import { cloneDeep, extend, isEmpty } from 'lodash'import SubnavSwitcher from '@/components/Subnav/SubnavSwitcher'import SelectDirectory from '@/components/Native/SelectDirectory'import ThemeSwitcher from '@/components/Preference/ThemeSwitcher'import { availableLanguages, getLanguage } from '@shared/locales'import { getLocaleManager } from '@/components/Locale'import {+ backupConfig,calcFormLabelWidth,+ changedConfig,checkIsNeedRestart,+ convertLineToComma,diffConfig} from '@shared/utils'import { APP_RUN_MODE } from '@shared/constants'+ import { reduceTrackerString } from '@shared/utils/tracker'const initForm = (config) => {const {@@ -338,8 +344,16 @@},data () {const { locale } = this.$store.state.preference.config- const form = initForm(this.$store.state.preference.config)- const formOriginal = cloneDeep(form)+ const formOriginal = initForm(this.$store.state.preference.config)+ let form = {}+ form = initForm(extend(form, formOriginal, changedConfig.basic))++ if (backupConfig.theme === undefined) {+ backupConfig.theme = formOriginal.theme+ } else {+ formOriginal.theme = backupConfig.theme+ }+ backupConfig.locale = formOriginal.localereturn {form,@@ -480,16 +494,27 @@return false}- const { btAutoDownloadContent, runMode, openAtLogin, autoHideWindow } = this.form- const changed = diffConfig(this.formOriginal, this.form)const data = {- ...changed+ ...diffConfig(this.formOriginal, this.form),+ ...changedConfig.advanced}- if ('btAutoDownloadContent' in changed) {++ const { btAutoDownloadContent, runMode, openAtLogin, autoHideWindow, btTracker, noProxy } = data++ if ('btAutoDownloadContent' in data) {data.pauseMetadata = !btAutoDownloadContentdata.followMetalink = btAutoDownloadContentdata.followTorrent = btAutoDownloadContent}++ if (btTracker) {+ data.btTracker = reduceTrackerString(convertLineToComma(btTracker))+ }++ if (noProxy) {+ data.noProxy = convertLineToComma(noProxy)+ }+console.log('[Motrix] preference changed data:', data)this.$store.dispatch('preference/save', data)@@ -502,16 +527,19 @@this.$msg.success(this.$t('preferences.save-fail-message'))})+ changedConfig.basic = {}+ changedConfig.advanced = {}+if (this.isRenderer) {this.$electron.ipcRenderer.send('command','application:open-at-login', openAtLogin)- if ('runMode' in changed) {+ if ('runMode' in data) {this.$electron.ipcRenderer.send('command','application:toggle-dock', runMode === APP_RUN_MODE.STANDARD)}- if ('autoHideWindow' in changed) {+ if ('autoHideWindow' in data) {this.$electron.ipcRenderer.send('command','application:auto-hide-window', autoHideWindow)}@@ -520,12 +548,53 @@this.$electron.ipcRenderer.send('command','application:relaunch')}++ this.$electron.ipcRenderer.send('command',+ 'application:setup-protocols-client', data.protocols)++ if (checkIsNeedRestart(data)) {+ this.$electron.ipcRenderer.send('command', 'application:relaunch')+ }}})},resetForm (formName) {+ this.$refs.themeSwitcher.currentValue = backupConfig.theme+ this.handleLocaleChange(this.formOriginal.locale)this.syncFormConfig()}+ },+ beforeRouteLeave (to, from, next) {+ changedConfig.basic = diffConfig(this.formOriginal, this.form)+ if (to.path === '/preference/advanced') {+ next()+ } else {+ if (isEmpty(changedConfig.basic) && isEmpty(changedConfig.advanced)) {+ next()+ } else {+ dialog.showMessageBox({+ type: 'warning',+ title: this.$t('preferences.not-saved'),+ message: this.$t('preferences.not-saved-confirm'),+ buttons: [this.$t('app.yes'), this.$t('app.no')],+ cancelId: 1+ }).then(({ response }) => {+ if (response === 0) {+ if (changedConfig.basic.theme !== undefined) {+ this.$electron.ipcRenderer.send('command',+ 'application:change-theme', backupConfig.theme)+ }+ if (changedConfig.basic.locale !== undefined) {+ this.handleLocaleChange(this.formOriginal.locale)+ }+ changedConfig.basic = {}+ changedConfig.advanced = {}+ backupConfig.theme = undefined+ next()+ }+ })+ }+ }}}</script>diff --git a/src/shared/locales/ar/preferences.js b/src/shared/locales/ar/preferences.jsindex a8a45b87..78c9005c 100644--- a/src/shared/locales/ar/preferences.js+++ b/src/shared/locales/ar/preferences.js@@ -78,5 +78,7 @@ export default {'baidu-exporter-help': 'اضغط هنا لبدء الاستخدام','auto-update': 'التحديث التلقائي','auto-check-update': 'تحقق تلقائيًا من التحديث',- 'last-check-update-time': 'آخر مرة تم التحقق من وجود تحديثات'+ 'last-check-update-time': 'آخر مرة تم التحقق من وجود تحديثات',+ 'not-saved': 'التفضيلات غير محفوظة',+ 'not-saved-confirm': 'ستفقد التفضيلات التي تم تغييرها ، هل أنت متأكد من المغادرة؟'}diff --git a/src/shared/locales/bg/preferences.js b/src/shared/locales/bg/preferences.jsindex 0c1c9447..be53253f 100644--- a/src/shared/locales/bg/preferences.js+++ b/src/shared/locales/bg/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Кликнете тук, за да използвате','auto-update':'автоматично обновяване','auto-check-update':'автоматична проверка на актуализациите',- 'last-check-update-time': 'последната актуализация е проверена'+ 'last-check-update-time': 'последната актуализация е проверена',+ 'not-saved': 'Предпочитанията не са запазени',+ 'not-saved-confirm': 'Променените предпочитания ще бъдат загубени, сигурни ли сте, че ще напуснете?'}diff --git a/src/shared/locales/ca/preferences.js b/src/shared/locales/ca/preferences.jsindex 08dcbd3d..855493b4 100644--- a/src/shared/locales/ca/preferences.js+++ b/src/shared/locales/ca/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Fes click aquí per veure l\'ús','auto-update': 'Actualitzar automàticament','auto-check-update': 'Revisar actualitzacions automàticament',- 'last-check-update-time': 'Última revisió d\'actualitzacions'+ 'last-check-update-time': 'Última revisió d\'actualitzacions',+ 'not-saved': 'Preferències no desades',+ 'not-saved-confirm': 'Les preferències modificades es perdran, esteu segur que marxareu?'}diff --git a/src/shared/locales/de/preferences.js b/src/shared/locales/de/preferences.jsindex 3b523ae5..ac560e66 100644--- a/src/shared/locales/de/preferences.js+++ b/src/shared/locales/de/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'mehr über die Verwendung zu erfahren','auto-update': 'Auto-Update','auto-check-update': 'Automatische Updates überprüfen',- 'last-check-update-time': 'letzte kontrolle update - zeit'+ 'last-check-update-time': 'letzte kontrolle update - zeit',+ 'not-saved': 'Einstellungen nicht gespeichert',+ 'not-saved-confirm': 'Die geänderten Einstellungen gehen verloren. Möchten Sie wirklich gehen?'}diff --git a/src/shared/locales/el/preferences.js b/src/shared/locales/el/preferences.jsindex ea60c64b..760fdc83 100644--- a/src/shared/locales/el/preferences.js+++ b/src/shared/locales/el/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Κάντε κλικ εδώ για χρήση','auto-update': 'Αυτόματη ενημέρωση','auto-check-update': 'Αυτόματος έλεγχος για ενημερώσεις',- 'last-check-update-time': 'Τελευταία φορά που έγινε έλεγχος για Ενημερώσεις'+ 'last-check-update-time': 'Τελευταία φορά που έγινε έλεγχος για Ενημερώσεις',+ 'not-saved': 'Οι προτιμήσεις δεν αποθηκεύτηκαν',+ 'not-saved-confirm': 'Οι αλλαγμένες προτιμήσεις θα χαθούν, είστε σίγουροι ότι θα φύγετε;'}diff --git a/src/shared/locales/en-US/preferences.js b/src/shared/locales/en-US/preferences.jsindex e6d95595..c4d51bcc 100644--- a/src/shared/locales/en-US/preferences.js+++ b/src/shared/locales/en-US/preferences.js@@ -78,5 +78,7 @@ export default {'baidu-exporter-help': 'Click here for usage','auto-update': 'Auto Update','auto-check-update': 'Automatically check for update',- 'last-check-update-time': 'Last Time Checking for Update'+ 'last-check-update-time': 'Last Time Checking for Update',+ 'not-saved': 'Preferences not saved',+ 'not-saved-confirm': 'The modified preferences will be lost, are you sure to leave?'}diff --git a/src/shared/locales/es/preferences.js b/src/shared/locales/es/preferences.jsindex 140e580a..a22d3f7a 100644--- a/src/shared/locales/es/preferences.js+++ b/src/shared/locales/es/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Presiona aqui para ver el uso','auto-update': 'Auto-actualizar','auto-check-update': 'Revisar automáticamente por actualizaciones',- 'last-check-update-time': 'Última revisión de actualizaciones'+ 'last-check-update-time': 'Última revisión de actualizaciones',+ 'not-saved': 'Preferencias no guardadas',+ 'not-saved-confirm': 'Las preferencias cambiadas se perderán, ¿está seguro de irse?'}diff --git a/src/shared/locales/fa/preferences.js b/src/shared/locales/fa/preferences.jsindex d4dda08f..4677df4b 100644--- a/src/shared/locales/fa/preferences.js+++ b/src/shared/locales/fa/preferences.js@@ -78,5 +78,7 @@ export default {'baidu-exporter-help': 'برای استفاده اینجا کلیک کنید','auto-update': 'بهروز رسانی خودکار','auto-check-update': 'به صورت خودکار برای بهروز رسانی بررسی کن',- 'last-check-update-time': 'آخرین زمان بررسی برای بهروز رسانی'+ 'last-check-update-time': 'آخرین زمان بررسی برای بهروز رسانی',+ 'not-saved': 'تنظیمات برگزیده ذخیره نشد',+ 'not-saved-confirm': 'تنظیمات برگزیده تغییر یافته از بین خواهند رفت، آیا مطمئن هستید که می روید؟'}diff --git a/src/shared/locales/fr/preferences.js b/src/shared/locales/fr/preferences.jsindex ee783013..30dfc1a3 100644--- a/src/shared/locales/fr/preferences.js+++ b/src/shared/locales/fr/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Cliquez ici pour voir l\'utilisation','auto-update': 'Mettre à jour','auto-check-update': 'Mise à jour automatique',- 'last-check-update-time': 'dernier contrôle la mise à jour du temps'+ 'last-check-update-time': 'dernier contrôle la mise à jour du temps',+ 'not-saved': 'Préférences non enregistrées',+ 'not-saved-confirm': 'Les préférences modifiées seront perdues, êtes-vous sûr de partir ?'}diff --git a/src/shared/locales/hu/preferences.js b/src/shared/locales/hu/preferences.jsindex 8235aabe..b15df615 100644--- a/src/shared/locales/hu/preferences.js+++ b/src/shared/locales/hu/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Kattincs ide a hasznalati naplohoz','auto-update': 'Automatikus frissités','auto-check-update': 'Automatikus keresen frissitéseket',- 'last-check-update-time': 'Legutolsó frissités:'+ 'last-check-update-time': 'Legutolsó frissités:',+ 'not-saved': 'A beállítások nincsenek mentve',+ 'not-saved-confirm': 'A megváltozott beállítások elvesznek. Biztosan kilép?'}diff --git a/src/shared/locales/id/preferences.js b/src/shared/locales/id/preferences.jsindex f47d456a..02ec59c0 100644--- a/src/shared/locales/id/preferences.js+++ b/src/shared/locales/id/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Klik di sini untuk penggunaan','auto-update': 'Pembaruan Otomatis','auto-check-update': 'Secara otomatis memeriksa pembaruan',- 'last-check-update-time': 'Terakhir Kali Memeriksa Pembaruan'+ 'last-check-update-time': 'Terakhir Kali Memeriksa Pembaruan',+ 'not-saved': 'Preferensi tidak disimpan',+ 'not-saved-confirm': 'Preferensi yang dimodifikasi akan hilang, apakah Anda yakin untuk keluar?'}diff --git a/src/shared/locales/it/preferences.js b/src/shared/locales/it/preferences.jsindex 7eef5752..f171e0c3 100644--- a/src/shared/locales/it/preferences.js+++ b/src/shared/locales/it/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Clicca qui per scoprire il funzionamento','auto-update': 'Auto Update','auto-check-update': 'Verifica automaticamente la disponibilità di aggiornamenti',- 'last-check-update-time': 'Ultima volta quando gli aggiornamenti sono stati verificati'+ 'last-check-update-time': 'Ultima volta quando gli aggiornamenti sono stati verificati',+ 'not-saved': 'Preferenze non salvate',+ 'not-saved-confirm': 'Le preferenze modificate andranno perse, sei sicuro di uscire?'}diff --git a/src/shared/locales/ja/preferences.js b/src/shared/locales/ja/preferences.jsindex 40935a97..a8e92ded 100644--- a/src/shared/locales/ja/preferences.js+++ b/src/shared/locales/ja/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'ここをクリックし使用説明を見る','auto-update': '自動更新','auto-check-update': '更新を自動で確認する',- 'last-check-update-time': '前回更新確認時間'+ 'last-check-update-time': '前回更新確認時間',+ 'not-saved': '設定が保存されていません',+ 'not-saved-confirm': '変更された設定は失われます、よろしいですか?'}diff --git a/src/shared/locales/ko/preferences.js b/src/shared/locales/ko/preferences.jsindex f2b2944a..606d406a 100644--- a/src/shared/locales/ko/preferences.js+++ b/src/shared/locales/ko/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': '사용법을 보려면 여기를 클릭하십시오.','auto-update': '자동 업데이트','auto-check-update': '업데이트 자동 확인',- 'last-check-update-time': '마지막 업데이트 확인 시간'+ 'last-check-update-time': '마지막 업데이트 확인 시간',+ 'not-saved': '환경설정이 저장되지 않았습니다',+ 'not-saved-confirm': '수정된 기본 설정이 손실됩니다. 나가시겠습니까?'}diff --git a/src/shared/locales/nb/preferences.js b/src/shared/locales/nb/preferences.jsindex 5ca4cd44..4ef8d779 100644--- a/src/shared/locales/nb/preferences.js+++ b/src/shared/locales/nb/preferences.js@@ -78,5 +78,7 @@ export default {'baidu-exporter-help': 'Klikk her for bruk','auto-update': 'Automatisk oppdatering','auto-check-update': 'Sjekk automatisk for oppdatering',- 'last-check-update-time': 'Siste gang sjekket for oppdatering'+ 'last-check-update-time': 'Siste gang sjekket for oppdatering',+ 'not-saved': 'Preferansene er ikke lagret',+ 'not-saved-confirm': 'De endrede preferansene vil gå tapt, er du sikker på at du vil forlate?'}diff --git a/src/shared/locales/pl/preferences.js b/src/shared/locales/pl/preferences.jsindex 2acec220..b4631ad3 100644--- a/src/shared/locales/pl/preferences.js+++ b/src/shared/locales/pl/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Naciśnij tutaj po pomoc','auto-update': 'Aktualizuj automatycznie','auto-check-update': 'Automatycznie sprawdzaj aktualizacje',- 'last-check-update-time': 'Ostatni raz kiedy sprawdzono aktualizację'+ 'last-check-update-time': 'Ostatni raz kiedy sprawdzono aktualizację',+ 'not-saved': 'Preferencje nie zostały zapisane',+ 'not-saved-confirm': 'Zmienione preferencje zostaną utracone, czy na pewno chcesz wyjść?'}diff --git a/src/shared/locales/pt-BR/preferences.js b/src/shared/locales/pt-BR/preferences.jsindex b7d42589..069cc60e 100644--- a/src/shared/locales/pt-BR/preferences.js+++ b/src/shared/locales/pt-BR/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Clique aqui ver as instruções de uso','auto-update': 'Atualização automática','auto-check-update': 'A verificação automática de atualizações',- 'last-check-update-time': 'última verificação do tempo de atualização'+ 'last-check-update-time': 'última verificação do tempo de atualização',+ 'not-saved': 'Preferências não salvas',+ 'not-saved-confirm': 'As preferências modificadas serão perdidas. Tem certeza de que deseja sair?'}diff --git a/src/shared/locales/ro/preferences.js b/src/shared/locales/ro/preferences.jsindex 7aa51a7b..042aa32b 100644--- a/src/shared/locales/ro/preferences.js+++ b/src/shared/locales/ro/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Faceți clic aici pentru instrucțiuni','auto-update': 'Actualizare automată','auto-check-update': 'Verificați automat dacă sunt disponibile actualizări',- 'last-check-update-time': 'Ultima dată când au fost verificate actualizările disponibile'+ 'last-check-update-time': 'Ultima dată când au fost verificate actualizările disponibile',+ 'not-saved': 'Preferințele nu au fost salvate',+ 'not-saved-confirm': 'Preferințele modificate se vor pierde, sunteți sigur că plecați?'}diff --git a/src/shared/locales/ru/preferences.js b/src/shared/locales/ru/preferences.jsindex 8c522e62..8440c800 100644--- a/src/shared/locales/ru/preferences.js+++ b/src/shared/locales/ru/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Нажмите здесь для использования','auto-update': 'Автоматическое обновление','auto-check-update': 'Автоматически проверять обновления',- 'last-check-update-time': 'Последняя проверка на обновления прошла в'+ 'last-check-update-time': 'Последняя проверка на обновления прошла в',+ 'not-saved': 'Настройки не сохранены',+ 'not-saved-confirm': 'Измененные настройки будут потеряны, вы обязательно уйдете?'}diff --git a/src/shared/locales/tr/preferences.js b/src/shared/locales/tr/preferences.jsindex 18cd44f5..219713b1 100644--- a/src/shared/locales/tr/preferences.js+++ b/src/shared/locales/tr/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Kullanım detayları için buraya tıklayın','auto-update': 'Otomatik güncelleme','auto-check-update': 'Otomatik Kontrol Güncellemesi',- 'last-check-update-time': 'Son Kontrol Güncelleme Saati'+ 'last-check-update-time': 'Son Kontrol Güncelleme Saati',+ 'not-saved': 'Tercihler kaydedilmedi',+ 'not-saved-confirm': 'Değiştirilen tercihler kaybolacak, ayrılacağınızdan emin misiniz?'}diff --git a/src/shared/locales/uk/preferences.js b/src/shared/locales/uk/preferences.jsindex 4b8a06f6..386cbb89 100644--- a/src/shared/locales/uk/preferences.js+++ b/src/shared/locales/uk/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': 'Натисніть тут для використання','auto-update': 'Автоматичне оновлення','auto-check-update': 'Автоматично перевіряти оновлення',- 'last-check-update-time': 'В останнє оновлення перевірялось'+ 'last-check-update-time': 'В останнє оновлення перевірялось',+ 'not-saved': 'Налаштування не збережено',+ 'not-saved-confirm': 'Змінені параметри буде втрачено. Ви впевнені, що залишите?'}diff --git a/src/shared/locales/vi/preferences.js b/src/shared/locales/vi/preferences.jsindex 2b826c67..95f8c82f 100644--- a/src/shared/locales/vi/preferences.js+++ b/src/shared/locales/vi/preferences.js@@ -77,5 +77,7 @@ export default {'baidu-exporter-help': 'Nhấn vào đây để sử dụng','auto-update': 'Tự động cập nhật','auto-check-update': 'Tự động kiểm tra cập nhật',- 'last-check-update-time': 'Kiểm tra cập nhật lần cuối'+ 'last-check-update-time': 'Kiểm tra cập nhật lần cuối',+ 'not-saved': 'Tùy chọn không được lưu',+ 'not-saved-confirm': 'Các tùy chọn đã sửa đổi sẽ bị mất, bạn có chắc chắn thoát không?'}diff --git a/src/shared/locales/zh-CN/preferences.js b/src/shared/locales/zh-CN/preferences.jsindex ac7ed796..1c7111ab 100644--- a/src/shared/locales/zh-CN/preferences.js+++ b/src/shared/locales/zh-CN/preferences.js@@ -80,5 +80,7 @@ export default {'auto-check-update': '自动检查更新','last-check-update-time': '上次检查更新时间','follow-metalink': '自动开始下载磁力链接、种子内的文件',- 'follow-torrent': '种子下载完后自动下载种子内容'+ 'follow-torrent': '种子下载完后自动下载种子内容',+ 'not-saved': '设置未保存',+ 'not-saved-confirm': '已修改的设置将会丢失,确定要离开吗?'}diff --git a/src/shared/locales/zh-TW/preferences.js b/src/shared/locales/zh-TW/preferences.jsindex bcb600c1..2fdd30ba 100644--- a/src/shared/locales/zh-TW/preferences.js+++ b/src/shared/locales/zh-TW/preferences.js@@ -76,5 +76,7 @@ export default {'baidu-exporter-help': '點此檢視使用說明','auto-update': '自動更新','auto-check-update': '自動檢查更新',- 'last-check-update-time': '上次檢查更新時間'+ 'last-check-update-time': '上次檢查更新時間',+ 'not-saved': '設定未保存',+ 'not-saved-confirm': '已修改的設定將會丟失,確定要離開嗎?'}diff --git a/src/shared/utils/index.js b/src/shared/utils/index.jsindex 3e5cd22a..65dd263e 100644--- a/src/shared/utils/index.js+++ b/src/shared/utils/index.js@@ -6,6 +6,7 @@ import {isEmpty,isFunction,isNaN,+ isPlainObject,kebabCase,omitBy,parseInt,@@ -608,7 +609,7 @@ export function removeExtensionDot (extension = '') {export function diffConfig (current = {}, next = {}) {const curr = pick(current, Object.keys(next))const result = omitBy(next, (val, key) => {- if (isArray(val)) {+ if (isArray(val) || isPlainObject(val)) {return JSON.stringify(curr[key]) === JSON.stringify(val)}return curr[key] === val@@ -706,3 +707,6 @@ export const intersection = (array1 = [], array2 = []) => {export const getInverseTheme = (theme) => {return (theme === APP_THEME.LIGHT) ? APP_THEME.DARK : APP_THEME.LIGHT}++export const changedConfig = { basic: {}, advanced: {} }+export const backupConfig = { theme: undefined, locale: undefined }