Skip to content

Commit

Permalink
feat: back button to navigate in finder
Browse files Browse the repository at this point in the history
  • Loading branch information
Superd22 committed Aug 7, 2022
1 parent 9c12ee3 commit 0c4ba8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 54 deletions.
5 changes: 1 addition & 4 deletions public/appinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@
"main": "index.html",
"title": "GamePads",
"icon": "icon.png",
"requiredPermissions": [
"time.query",
"activity.operation"
]
"disableBackHistoryAPI": true
}
45 changes: 0 additions & 45 deletions src/lib/BluetoothFinder.svelte

This file was deleted.

18 changes: 13 additions & 5 deletions src/lib/DeviceFinder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
let pairables: Device[] = [];
let targetDevice: Device = null;
let isCancelling: boolean = false;
let error: string = "";
const bluetoothService = new WebOSService("com.webos.service.bluetooth2");
Expand Down Expand Up @@ -65,15 +64,13 @@
.subscribe((data) => {
console.debug("Got pairing sub data", data);
switch (data.request) {
case "request:endPairing": {
case "endPairing": {
if (data.returnValue) {
step = Step.Success;
} else {
step = Step.Error;
error = `[${(data as any).errorCode}] ${(data as any).errorText}`;
}
pairing.unsubscribe();
}
case "displayPinCode":
case "displayPasskey": {
Expand All @@ -82,9 +79,11 @@
case "confirmPassKey": {
step = Step.ConfirmCode;
}
default: {
step = Step.WaitingOn;
}
}
});
step = Step.DisplayCode;
}
async function exit() {
Expand Down Expand Up @@ -115,6 +114,13 @@
}
search();
function handleKeydown({ keyCode }) {
if (keyCode !== 461) return;
if (step === Step.Find) return exit();
else return newSync();
}
</script>

<div class="modal focusableArea">
Expand Down Expand Up @@ -190,6 +196,8 @@
{/if}
</div>

<svelte:window on:keydown={handleKeydown} />

<style lang="scss">
.modal {
z-index: 99999;
Expand Down

0 comments on commit 0c4ba8a

Please sign in to comment.