From c381b17eb25c5fcf5b8dc0980b77d6c5f0d5b525 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Fri, 3 May 2024 18:21:34 +1200 Subject: [PATCH] Fixed android login --- materialious/android/.idea/.gitignore | 3 +++ materialious/android/.idea/compiler.xml | 6 ++++++ .../android/.idea/deploymentTargetSelector.xml | 10 ++++++++++ materialious/android/.idea/migrations.xml | 10 ++++++++++ materialious/android/.idea/misc.xml | 10 ++++++++++ materialious/android/app/capacitor.build.gradle | 1 + .../android/app/src/main/AndroidManifest.xml | 7 +++++++ materialious/android/capacitor.settings.gradle | 3 +++ materialious/capacitor.config.ts | 2 +- materialious/package-lock.json | 9 +++++++++ materialious/package.json | 3 ++- materialious/src/routes/+layout.svelte | 15 +++++++++++++++ materialious/src/routes/auth/+page.svelte | 1 + 13 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 materialious/android/.idea/.gitignore create mode 100644 materialious/android/.idea/compiler.xml create mode 100644 materialious/android/.idea/deploymentTargetSelector.xml create mode 100644 materialious/android/.idea/migrations.xml create mode 100644 materialious/android/.idea/misc.xml diff --git a/materialious/android/.idea/.gitignore b/materialious/android/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/materialious/android/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/materialious/android/.idea/compiler.xml b/materialious/android/.idea/compiler.xml new file mode 100644 index 00000000..b589d56e --- /dev/null +++ b/materialious/android/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/materialious/android/.idea/deploymentTargetSelector.xml b/materialious/android/.idea/deploymentTargetSelector.xml new file mode 100644 index 00000000..b268ef36 --- /dev/null +++ b/materialious/android/.idea/deploymentTargetSelector.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/materialious/android/.idea/migrations.xml b/materialious/android/.idea/migrations.xml new file mode 100644 index 00000000..f8051a6f --- /dev/null +++ b/materialious/android/.idea/migrations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/materialious/android/.idea/misc.xml b/materialious/android/.idea/misc.xml new file mode 100644 index 00000000..0ad17cbd --- /dev/null +++ b/materialious/android/.idea/misc.xml @@ -0,0 +1,10 @@ + + + + + + + + + \ No newline at end of file diff --git a/materialious/android/app/capacitor.build.gradle b/materialious/android/app/capacitor.build.gradle index 4a7786f0..e4215d1b 100644 --- a/materialious/android/app/capacitor.build.gradle +++ b/materialious/android/app/capacitor.build.gradle @@ -9,6 +9,7 @@ android { apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle" dependencies { + implementation project(':capacitor-app') implementation project(':capacitor-browser') } diff --git a/materialious/android/app/src/main/AndroidManifest.xml b/materialious/android/app/src/main/AndroidManifest.xml index 4d7ca380..084fa47e 100644 --- a/materialious/android/app/src/main/AndroidManifest.xml +++ b/materialious/android/app/src/main/AndroidManifest.xml @@ -22,6 +22,13 @@ + + + + + + + { + const authUrl = new URL(data.url); + const username = authUrl.searchParams.get('username'); + const token = authUrl.searchParams.get('token'); + + if (username && token) { + authStore.set({ + username: username, + token: token + }); + } + }); + async function login() { const path = new URL(`${get(instanceStore)}/authorize_token`); const searchParams = new URLSearchParams({ diff --git a/materialious/src/routes/auth/+page.svelte b/materialious/src/routes/auth/+page.svelte index 01bcb4e6..28141f08 100644 --- a/materialious/src/routes/auth/+page.svelte +++ b/materialious/src/routes/auth/+page.svelte @@ -5,6 +5,7 @@ import { onMount } from 'svelte'; import { authStore } from '../../store'; + // Auth response handling for Desktop onMount(() => { authStore.set({ username: $page.url.searchParams.get('username') as string,