Skip to content

Commit

Permalink
perf: 💡 Add autoConnect option
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Nov 16, 2023
1 parent 2e66a42 commit a57b847
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/components/Device/components/Wireless/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ export default {
components: {
PairDialog,
},
props: {
reload: {
type: Function,
default: () => () => false,
},
},
data() {
const wirelessList = this.$appStore.get('history.wireless') || []
Expand All @@ -77,6 +83,13 @@ export default {
},
}
},
async created() {
const autoConnect = this.$store.preference.data.autoConnect
if (autoConnect) {
await this.handleBatch()
this.reload()
}
},
methods: {
connect(...args) {
return this.handleConnect(...args)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Device/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div class="h-full flex flex-col">
<div class="flex items-center flex-none space-x-2">
<Wireless ref="wireless" />
<Wireless ref="wireless" :reload="getDeviceData" />

<el-button
type="primary"
Expand Down
2 changes: 2 additions & 0 deletions src/locales/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@
"preferences.common.language.placeholder": "Select language",
"preferences.common.language.chinese": "中文",
"preferences.common.language.english": "English",
"preferences.common.auto-connect.name": "AutoConnect",
"preferences.common.auto-connect.placeholder": "When enabled, the software will attempt to automatically connect to historical devices upon startup.",

"preferences.video.name": "Video",
"preferences.video.video-source.name": "Video Source",
Expand Down
2 changes: 2 additions & 0 deletions src/locales/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@
"preferences.common.language.placeholder": "选择你需要的语言",
"preferences.common.language.chinese": "中文",
"preferences.common.language.english": "English",
"preferences.common.auto-connect.name": "自动连接历史设备",
"preferences.common.auto-connect.placeholder": "启用后,该软件将在启动时尝试自动连接到历史设备",

"preferences.video.name": "视频控制",
"preferences.video.video-source.name": "视频源",
Expand Down
7 changes: 7 additions & 0 deletions src/store/preference/model/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ export default {
},
span: 24,
},
autoConnect: {
label: 'preferences.common.auto-connect.name',
field: 'autoConnect',
type: 'Switch',
value: undefined,
placeholder: 'preferences.common.auto-connect.placeholder',
},
gnirehtetFix: {
label: 'preferences.common.gnirehtet.fix.name',
field: 'gnirehtetFix',
Expand Down

0 comments on commit a57b847

Please sign in to comment.