mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-01-31 11:53:50 +01:00
perf: 🚀 Optimize device connection experience
This commit is contained in:
parent
c214e5add6
commit
0690f2d4c0
@ -107,8 +107,6 @@
|
||||
"device.wireless.connect.error.no-address": "Wireless debug address cannot be empty",
|
||||
"device.wireless.connect.success": "Connect success",
|
||||
"device.wireless.connect.batch.name": "Connect all historical devices",
|
||||
"device.wireless.connect.batch.success": "Connected {totalCount} historical devices, {successCount} succeeded, {failCount} failed",
|
||||
"device.wireless.connect.batch.error": "Failed to connect historical devices",
|
||||
"device.wireless.disconnect.start": "Disconnect",
|
||||
"device.wireless.disconnect.progress": "Disconnecting",
|
||||
"device.wireless.disconnect.success": "Disconnected",
|
||||
|
@ -107,8 +107,6 @@
|
||||
"device.wireless.connect.error.no-address": "Адрес беспроводной отладки не может быть пустым",
|
||||
"device.wireless.connect.success": "Успешное подключение",
|
||||
"device.wireless.connect.batch.name": "Подключить все устройства из истории",
|
||||
"device.wireless.connect.batch.success": "Подключено {totalCount} устройств из истории, успешно: {successCount}, неудачно: {failCount}",
|
||||
"device.wireless.connect.batch.error": "Не удалось подключить устройства из истории",
|
||||
"device.wireless.disconnect.start": "Отключить",
|
||||
"device.wireless.disconnect.progress": "Отключение",
|
||||
"device.wireless.disconnect.success": "Отключено",
|
||||
|
@ -107,8 +107,6 @@
|
||||
"device.wireless.connect.error.no-address": "无线调试地址不能为空",
|
||||
"device.wireless.connect.success": "连接设备成功",
|
||||
"device.wireless.connect.batch.name": "连接所有历史设备",
|
||||
"device.wireless.connect.batch.success": "连接历史设备成功,共 {totalCount}个,成功 {successCount}个,失败 {failCount}个",
|
||||
"device.wireless.connect.batch.error": "连接历史设备失败",
|
||||
"device.wireless.disconnect.start": "断开连接",
|
||||
"device.wireless.disconnect.progress": "正在断开",
|
||||
"device.wireless.disconnect.success": "断开连接成功",
|
||||
|
@ -107,8 +107,6 @@
|
||||
"device.wireless.connect.error.no-address": "無線偵錯位址不能為空",
|
||||
"device.wireless.connect.success": "連接裝置成功",
|
||||
"device.wireless.connect.batch.name": "連接所有歷史裝置",
|
||||
"device.wireless.connect.batch.success": "連接歷史裝置成功,共 {totalCount} 個,{successCount} 個成功,{failCount} 個失敗",
|
||||
"device.wireless.connect.batch.error": "連接歷史裝置失敗",
|
||||
"device.wireless.disconnect.start": "斷開連接",
|
||||
"device.wireless.disconnect.progress": "正在斷開",
|
||||
"device.wireless.disconnect.success": "斷開連接成功",
|
||||
|
@ -96,6 +96,8 @@ export default {
|
||||
host: void 0,
|
||||
port: void 0,
|
||||
},
|
||||
|
||||
firstFlag: true,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -131,8 +133,41 @@ export default {
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
'wirelessList.length': {
|
||||
handler(val) {
|
||||
if (val) {
|
||||
this.getFormData()
|
||||
}
|
||||
},
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
if (this.wirelessList?.length) {
|
||||
const unwatch = this.$watch('wirelessList', async (val) => {
|
||||
unwatch()
|
||||
if (!val) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.getFormData()
|
||||
|
||||
if (this.firstFlag) {
|
||||
this.firstFlag = false
|
||||
this.handleConnectAuto()
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
async handleConnectAuto() {
|
||||
const autoConnect = this.$store.preference.data.autoConnect
|
||||
|
||||
if (autoConnect) {
|
||||
await this.handleBatch()
|
||||
this.handleRefresh()
|
||||
}
|
||||
},
|
||||
getFormData() {
|
||||
const lastIndex = this.wirelessList.length - 1
|
||||
const lastWireless = this.wirelessList[lastIndex]
|
||||
|
||||
@ -143,16 +178,7 @@ export default {
|
||||
id: `${lastWireless.host}:${lastWireless.port}`,
|
||||
}
|
||||
}
|
||||
|
||||
const autoConnect = this.$store.preference.data.autoConnect
|
||||
|
||||
if (autoConnect) {
|
||||
await this.handleBatch()
|
||||
this.handleRefresh()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
connect(...args) {
|
||||
return this.handleConnect(...args)
|
||||
},
|
||||
@ -233,22 +259,6 @@ export default {
|
||||
this.loading = true
|
||||
await Promise.allSettled(promises)
|
||||
this.loading = false
|
||||
|
||||
const successCount = totalCount - failCount
|
||||
|
||||
if (successCount) {
|
||||
this.$message({
|
||||
message: this.$t('device.wireless.connect.batch.success', {
|
||||
totalCount,
|
||||
successCount,
|
||||
failCount,
|
||||
}),
|
||||
type: totalCount === successCount ? 'success' : 'warning',
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
this.$message.warning(this.$t('device.wireless.connect.batch.error'))
|
||||
},
|
||||
|
||||
handleUnConnect() {
|
||||
|
@ -137,7 +137,7 @@
|
||||
|
||||
<div class="flex-none flex items-center py-1 overflow-x-auto py-2">
|
||||
<div class="flex-none">
|
||||
<WirelessGroup :key="deviceList.length" ref="wirelessGroupRef" v-bind="{ handleRefresh }" />
|
||||
<WirelessGroup ref="wirelessGroupRef" v-bind="{ handleRefresh }" />
|
||||
</div>
|
||||
|
||||
<div class="flex-1 w-0 space-x-2 flex items-center justify-end">
|
||||
|
@ -59,8 +59,12 @@ export function mergeDevices(historyDevices, currentDevices) {
|
||||
return obj
|
||||
}, {})
|
||||
|
||||
const value = Object.values(defaultsDeep(currentMap, historyMap))
|
||||
.sort((a, b) => sortModel[a.status] - sortModel[b.status])
|
||||
const mergeList = Object.values(defaultsDeep(currentMap, historyMap))
|
||||
|
||||
const excludedKeywords = ['_adb-tls-connect', '_tcp']
|
||||
const filterList = mergeList.filter(({ id = '' }) => !excludedKeywords.some(keyword => id.includes(keyword)))
|
||||
|
||||
const value = filterList.sort((a, b) => sortModel[a.status] - sortModel[b.status])
|
||||
|
||||
return value
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user