@@ -26,11 +26,19 @@ <h1>Quest connected!</h1>
2626 < p > Your quest is connected via adb. You can return now</ p >
2727 < button onclick ="AdbConnected() "> Continue</ button >
2828</ div >
29+ < div class ="content hidden " id ="launcher ">
30+ < h1 > Prerequisites</ h1 >
31+ < p > Before pairing you have to install Lightning Launcher. For that use the button below. It'll start the download and then initiate the install.</ p >
32+ < button onclick ="Launcher() "> Download and install Lightning Launcher</ button >
33+ < div id ="launcherInstall " class ="hidden ">
34+ < h2 > Installing Lightning Launcher</ h2 >
35+ Please wait a few seconds until the download completes. If you have any issues, please press the download button again.
36+ </ div >
37+ </ div >
2938< div class ="content hidden " id ="pair ">
3039 < h1 > Pairing</ h1 >
3140 < p > Your quest is not connected via adb yet. Input the port and code shown in the wireless adb pairing page.</ p >
3241
33- < button onclick ="settings() "> Open android settings</ button >
3442 < input type ="number " placeholder ="port " id ="port ">
3543 < input type ="number " placeholder ="code " id ="code ">
3644 < button onclick ="pair() "> Pair</ button >
@@ -39,22 +47,25 @@ <h2>Guide</h2>
3947 < img id ="guideImage ">
4048 < p id ="guideText "> </ p >
4149
42- < button onclick ="UpdateGuide(-1) "> <</ button >
43- < button onclick ="UpdateGuide(1) "> ></ button >
50+ < button class =" navigationButton " onclick ="UpdateGuide(-1) "> <</ button >
51+ < button class =" navigationButton " onclick ="UpdateGuide(1) "> ></ button >
4452 </ div >
4553</ div >
4654< div class ="content hidden " id ="remember ">
4755 < h1 > Connect</ h1 >
4856 < p > QAVS has successfully paired with your Quest. We will now connect QAVS with your Quest. For that, input the wireless port from the adb wireless settings page.</ p >
4957
5058
51- < button onclick ="settings() "> Open android settings</ button >
5259 < input type ="number " placeholder ="wireless port " id ="adbport ">
5360 < button onclick ="connect() "> Connect</ button >
61+ < br >
62+ < b > QAVS may crash while connecting to your Quest. If this happens just restart QAVS. It should be connected afterwards</ b >
63+ < p > If this happens repeatedly reboot your Quest</ p >
5464 < h2 > Guide</ h2 >
5565 < div >
5666 < img src ="/images/adb/11.jpg ">
5767 < p > You will find the port in the wireless debugging settings.In this screenshot the port is 46137. Input the one from your settings into the wireless port above and hit connect.</ p >
68+
5869 </ div >
5970</ div >
6071< div class ="content hidden " id ="connecting ">
@@ -84,6 +95,9 @@ <h1>Making connecting persistent, please wait a bit</h1>
8495 < div class ="loaderSquare "> </ div >
8596 </ div >
8697</ div >
98+ < br >
99+ < br >
100+ < br >
87101< a href ="/pair "> Advanced ui</ a >
88102< script >
89103 FirstOpen ( )
@@ -103,8 +117,11 @@ <h1>Making connecting persistent, please wait a bit</h1>
103117 img : "/images/adb/0.jpg" ,
104118 txt : "Place the window on the left side like in the picture"
105119 } , {
106- img : "/images/adb/1.jpg" ,
107- txt : "Open the settings on your Quest with the button above"
120+ img : "/images/adb/0.1.jpg" ,
121+ txt : "Open Lightning Launcher by opening your Library (1), going to 'Unknown sources' (2) and then opening 'Lightning Launcher' (3)"
122+ } , {
123+ img : "/images/adb/0.2.jpg" ,
124+ txt : "In Lightning Launcher press on 'Apps' (1) and then on 'Android Settings' (2)"
108125 } , {
109126 img : "/images/adb/2.jpg" ,
110127 txt : "Scroll down and press on 'About headset'"
@@ -125,7 +142,7 @@ <h1>Making connecting persistent, please wait a bit</h1>
125142 txt : "Click on 'Wireless debugging'. Make sure to click into the blank space"
126143 } , {
127144 img : "/images/adb/8.jpg" ,
128- txt : "Enable wireless debugging"
145+ txt : "Enable wireless debugging and always allow it in your network when prompted "
129146 } , {
130147 img : "/images/adb/9.jpg" ,
131148 txt : "Click on 'Pair device with pairing code'"
@@ -168,10 +185,64 @@ <h1>Making connecting persistent, please wait a bit</h1>
168185 // Found devices
169186 OpenTab ( "connected" )
170187 } else {
188+ InitiatePair ( )
189+ }
190+ } )
191+ }
192+
193+ function Launcher ( ) {
194+ document . getElementById ( 'launcherInstall' ) . className = ""
195+ fetch ( "/api/adb/downloadlauncher" , { method : "POST" } ) . then ( res => {
196+ if ( res . ok ) {
197+ InstallationMonitor ( )
198+ } else {
199+ alert ( "Failed to start download. Please try again." )
200+ document . getElementById ( 'launcherInstall' ) . className = "hidden"
201+ }
202+ } )
203+ }
204+
205+ function InstallationMonitor ( ) {
206+ let install = setInterval ( ( ) => {
207+ IsLauncherInstalled ( ) . then ( isInstalled => {
208+ if ( isInstalled ) {
209+ document . getElementById ( 'launcherInstall' ) . className = "hidden"
210+ clearInterval ( install )
171211 OpenTab ( "pair" )
172212 }
213+ } ) . catch ( err => {
214+ document . getElementById ( 'launcherInstall' ) . className = "hidden"
215+ clearInterval ( install )
216+ alert ( "Failed to check if Lightning Launcher is installed. I will assume that it is. If it isn't, install Lightning Launcher manually via SideQuest" )
217+ OpenTab ( "pair" )
218+ } )
219+ } , 1000 )
220+ }
221+
222+ function IsLauncherInstalled ( ) {
223+ return new Promise ( ( resolve , reject ) => {
224+ fetch ( "/api/android/installedapps" ) . then ( res => res . json ( ) ) . then ( res => {
225+ resolve ( res . some ( app => app . PackageName == "com.threethan.launcher" ) )
226+ } ) . catch ( err => {
227+ reject ( err )
173228 } )
229+ } )
174230 }
231+
232+ function InitiatePair ( ) {
233+ // Check if lightning launcher is installed
234+ IsLauncherInstalled ( ) . then ( isInstalled => {
235+ if ( isInstalled ) {
236+ OpenTab ( "pair" )
237+ } else {
238+ OpenTab ( "launcher" )
239+ }
240+ } ) . catch ( err => {
241+ alert ( "Failed to check if Lightning Launcher is installed. I will assume that it is not." )
242+ OpenTab ( "launcher" )
243+ } )
244+ }
245+
175246 function wireless ( ) {
176247 fetch ( `/api/adb/togglewireless` , {
177248 method : "POST"
0 commit comments