diff --git a/README-CN.md b/README-CN.md index 37a20b85..65f70216 100644 --- a/README-CN.md +++ b/README-CN.md @@ -15,6 +15,7 @@ ## 特点 - 🏃 同步:得益于 Web 技术,将更快速的与 Scrcpy 保持同步 +- 🤖 自动化:允许自动连接到历史设备并自动执行镜像。 - 💡 定制化:支持对多个设备偏好进行独立配置,并且能够添加备注以及导入导出所有配置的功能 - 🔗 反向供网:集成了 Gnirehtet 反向供网功能 - 🎨 主题:支持浅色模式和深色模式,跟随系统切换 @@ -197,10 +198,11 @@ Windows 及 Linux 端内部集成了 Gnirehtet, 用于提供 PC 到安卓设 14. 设备交互栏添加更多功能:文件推送、旋转屏幕、音频控制等功能 ✅ 15. 支持批量连接历史设备功能 ✅ 16. 支持使用内置终端执行自定义命令 ✅ -17. 添加独立的剪切板同步功能 🚧 -18. 支持通过界面从设备下载选中的文件 🚧 -19. 支持对设备进行分组,以及按组进行批量操作 🚧 -20. 添加对游戏的增强功能,如游戏键位映射 🚧 +17. 支持设备自动执行镜像 ✅ +18. 添加文件传输助手功能 🚧 +19. 支持通过界面从设备下载选中的文件 🚧 +20. 支持对设备进行分组,以及按组进行批量操作 🚧 +21. 添加对游戏的增强功能,如游戏键位映射 🚧 ## 常见问题 diff --git a/README.md b/README.md index 61fe2cc0..7cdd76e1 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ ## Features - 🏃 Synchronous: Benefit from web technologies to synchronize with Scrcpy faster +- 🤖 Automation: Enables automatic connection to historical devices and automatic execution of mirror. - 💡 Customizable: Support independent configuration for multiple devices and ability to add notes and import/export all configurations - 🎨 Theme: Supports light mode and dark mode, system-wide switching - 🔗 Gnirehtet: Integrated Gnirehtet's reverse tethering functionality @@ -195,10 +196,11 @@ Refer to [scrcpy/doc/shortcuts](https://github.com/Genymobile/scrcpy/blob/master 14. Add more features to device interaction bar: file push, screen rotation, audio control etc ✅ 15. Support bulk connecting to historical devices ✅ 16. Support to use built-in terminals to execute custom commands ✅ -17. Add standalone clipboard sync feature 🚧 -18. Support GUI-based selective file downloads from devices 🚧 -19. Support grouping devices and bulk operations by group 🚧 -20. Add game enhancement features such as game keyboard mapping 🚧 +17. Supports automatic execution of mirror on devices. ✅ +18. Add file transmission assistant function 🚧 +19. Support GUI-based selective file downloads from devices 🚧 +20. Support grouping devices and bulk operations by group 🚧 +21. Add game enhancement features such as game keyboard mapping 🚧 ## FAQ diff --git a/src/components/Device/components/MirrorAction/index.vue b/src/components/Device/components/MirrorAction/index.vue index d8de9b29..5e0277df 100644 --- a/src/components/Device/components/MirrorAction/index.vue +++ b/src/components/Device/components/MirrorAction/index.vue @@ -31,7 +31,7 @@ export default { } }, methods: { - async handleClick(row) { + async handleClick(row = this.row) { this.loading = true this.toggleRowExpansion(row, true) diff --git a/src/components/Device/components/WirelessAction/index.vue b/src/components/Device/components/WirelessAction/index.vue index 4cd945f1..af8e5d3f 100644 --- a/src/components/Device/components/WirelessAction/index.vue +++ b/src/components/Device/components/WirelessAction/index.vue @@ -3,7 +3,7 @@ v-if="!row.$wifi" type="primary" text - :disabled="row.$unauthorized || row.$loading || row.$recordLoading" + :disabled="row.$unauthorized" @click="handleWifi(row)" > - + @@ -133,13 +136,18 @@ export default { return { loading: false, deviceList: [], + mirrorActionRefs: [], } }, - computed: {}, async created() { this.getDeviceData() - - this.unAdbWatch = await this.$adb.watch(async (type, ret) => { + this.unAdbWatch = await this.$adb.watch(this.onAdbWatch) + }, + beforeUnmount() { + this?.unAdbWatch?.() + }, + methods: { + async onAdbWatch(type, ret) { if (ret && ret.id) { this.getDeviceData() } @@ -150,12 +158,41 @@ export default { host: ret.$host, } } - }) - }, - beforeUnmount() { - this?.unAdbWatch?.() - }, - methods: { + + if (type === 'remove') { + this.mirrorActionRefs = this.mirrorActionRefs.filter( + item => item.row.id !== ret.id, + ) + } + }, + async getMirrorActionRefs(ref, index) { + await this.$nextTick() + + if (!ref?.row?.id) { + return false + } + + const someFlag = this.mirrorActionRefs.some( + item => item.row.id === ref.row.id, + ) + + if (someFlag) { + return false + } + + this.mirrorActionRefs.push(ref) + + const secondNum = index + + await sleep(secondNum * 2000) + + const autoMirror = this.$store.preference.data.autoMirror + + if (autoMirror) { + ref.handleClick(ref.row) + } + }, + toggleRowExpansion(...args) { this.$refs.elTable.toggleRowExpansion(...args) }, @@ -208,16 +245,13 @@ export default { async getDeviceData({ resetResolve = false } = {}) { this.loading = true + await sleep(500) + try { const data = await this.$store.device.getList() - this.deviceList - = data?.map(item => ({ - ...item, - $loading: false, - $recordLoading: false, - $stopLoading: false, - })) || [] + + this.deviceList = data } catch (error) { console.warn(error) diff --git a/src/locales/languages/en_US.json b/src/locales/languages/en_US.json index 5d3183e7..adf0bea4 100644 --- a/src/locales/languages/en_US.json +++ b/src/locales/languages/en_US.json @@ -183,6 +183,8 @@ "preferences.common.language.english": "English", "preferences.common.auto-connect.name": "Auto Connect", "preferences.common.auto-connect.placeholder": "When enabled, the software will attempt to automatically connect to historical devices upon startup.", + "preferences.common.auto-mirror.name": "Auto Mirror", + "preferences.common.auto-mirror.placeholder": "When enabled, devices in the device list will automatically execution the mirror.", "preferences.video.name": "Video", "preferences.video.disable-video.name": "Disable Video Forwarding", diff --git a/src/locales/languages/zh_CN.json b/src/locales/languages/zh_CN.json index 5b4f4b05..9f99f9da 100644 --- a/src/locales/languages/zh_CN.json +++ b/src/locales/languages/zh_CN.json @@ -181,8 +181,10 @@ "preferences.common.language.placeholder": "选择你需要的语言", "preferences.common.language.chinese": "中文", "preferences.common.language.english": "English", - "preferences.common.auto-connect.name": "自动连接历史设备", - "preferences.common.auto-connect.placeholder": "启用后,该软件将在启动时尝试自动连接到历史设备", + "preferences.common.auto-connect.name": "自动连接设备", + "preferences.common.auto-connect.placeholder": "启用后,该软件将在启动时尝试自动连接到历史无线设备", + "preferences.common.auto-mirror.name": "自动执行镜像", + "preferences.common.auto-mirror.placeholder": "启用后,设备列表中的设备将自动运行镜像", "preferences.video.name": "视频控制", "preferences.video.disable-video.name": "禁用视频转发", diff --git a/src/store/preference/model/common/index.js b/src/store/preference/model/common/index.js index 9e84a0a7..6b052768 100644 --- a/src/store/preference/model/common/index.js +++ b/src/store/preference/model/common/index.js @@ -107,6 +107,13 @@ export default { value: undefined, placeholder: 'preferences.common.auto-connect.placeholder', }, + autoMirror: { + label: 'preferences.common.auto-mirror.name', + field: 'autoMirror', + type: 'Switch', + value: undefined, + placeholder: 'preferences.common.auto-mirror.placeholder', + }, gnirehtetFix: { label: 'preferences.common.gnirehtet.fix.name', field: 'gnirehtetFix',