-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tons of bug fixes and performance improvements
- Loading branch information
1 parent
c7b83d3
commit 4aaf838
Showing
5 changed files
with
98 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,95 +1,103 @@ | ||
<template> | ||
<section> | ||
<h2>Device</h2> | ||
<section> | ||
<h2>Device</h2> | ||
|
||
<!-- No Device Notice --> | ||
<center v-show="!device"> | ||
<v-icon size="50px">mdi-devices</v-icon> | ||
<h1>No Device Found</h1> | ||
<p style="color: #999;">You may need to plug your device in or enable 'USB Debugging'</p> | ||
</center> | ||
<!-- No Device Notice --> | ||
<center v-show="!device"> | ||
<v-icon size="50px">mdi-devices</v-icon> | ||
<h1>No Device Found</h1> | ||
<p style="color: #999;">You may need to plug your device in or enable 'USB Debugging'</p> | ||
</center> | ||
|
||
<!-- Show Device Information --> | ||
<v-list-item v-for="(item, i) in deviceInfo" :key="i" v-show="device"> | ||
<div> | ||
<v-list-item-title v-text="item.title" /> | ||
<p v-text="item.data" class="grey--text" /> | ||
</div> | ||
</v-list-item> | ||
</section> | ||
<!-- Show Device Information --> | ||
<v-list-item v-for="(item, i) in deviceInfo" :key="i" v-show="device"> | ||
<div> | ||
<v-list-item-title v-text="item.title" /> | ||
<p v-text="item.data" class="grey--text" /> | ||
</div> | ||
</v-list-item> | ||
|
||
</section> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
export default { | ||
data() { | ||
return { | ||
return { | ||
device: false, | ||
device: false, | ||
deviceInfo: [ | ||
{ | ||
title: "Model", | ||
command: "adb shell getprop ro.product.model", | ||
data: null, | ||
}, | ||
{ | ||
title: "Device Codename", | ||
command: "adb shell getprop ro.product.device", | ||
data: null, | ||
}, | ||
{ | ||
title: "Android Version", | ||
command: "adb shell getprop ro.build.version.release", | ||
data: null, | ||
}, | ||
{ | ||
title: "Build", | ||
command: "adb shell getprop ro.build.id", | ||
data: null, | ||
}, | ||
{ | ||
title: "SDK Version", | ||
command: "adb shell getprop ro.build.version.sdk", | ||
data: null, | ||
}, | ||
{ | ||
title: "Fingerprint", | ||
command: "adb shell getprop ro.build.fingerprint", | ||
data: null, | ||
} | ||
] | ||
} | ||
deviceInfo: [{ | ||
title: "Model", | ||
command: "adb shell getprop ro.product.model", | ||
data: null, | ||
}, | ||
{ | ||
title: "Device Codename", | ||
command: "adb shell getprop ro.product.device", | ||
data: null, | ||
}, | ||
{ | ||
title: "Android Version", | ||
command: "adb shell getprop ro.build.version.release", | ||
data: null, | ||
}, | ||
{ | ||
title: "Build", | ||
command: "adb shell getprop ro.build.id", | ||
data: null, | ||
}, | ||
{ | ||
title: "SDK Version", | ||
command: "adb shell getprop ro.build.version.sdk", | ||
data: null, | ||
}, | ||
{ | ||
title: "Fingerprint", | ||
command: "adb shell getprop ro.build.fingerprint", | ||
data: null, | ||
} | ||
] | ||
} | ||
}, | ||
methods: { | ||
async refreshList() { | ||
for (const i in this.deviceInfo) { | ||
this.$scrcpy.execute(this.deviceInfo[i].command) | ||
.then((data) => { | ||
this.deviceInfo[i].data = data; | ||
this.device = true; | ||
this.$emit('update:device', true); | ||
}) | ||
.catch((err) => { | ||
this.device = false; | ||
this.$emit('update:device', false); | ||
}) | ||
} | ||
refreshList() { | ||
for (const i in this.deviceInfo) { | ||
this.$scrcpy.execute(this.deviceInfo[i].command) | ||
.then((data) => { | ||
this.deviceInfo[i].data = data; | ||
}) | ||
} | ||
}, | ||
checkDevice() { | ||
this.$scrcpy.execute("adb devices -l") | ||
.then((data) => { | ||
if (data.includes("device product:")) { // Device Detected | ||
if (data.includes("device product:") != this.device) { | ||
this.refreshList(); | ||
} | ||
this.device = true; | ||
this.$emit('update:device', true); | ||
} else { | ||
this.device = false; | ||
this.$emit('update:device', false); | ||
} | ||
}) | ||
} | ||
}, | ||
mounted() { | ||
setInterval(() => { | ||
this.refreshList() | ||
}, 10000); | ||
this.refreshList() | ||
setInterval(() => { | ||
this.checkDevice() | ||
}, process.env.devicePollRate); | ||
this.checkDevice() | ||
} | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters