From b80f6ba5bdbc4e0b24098ef4131b1cc5c9276c11 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 26 Nov 2023 21:41:33 +0100 Subject: [PATCH] update to supabase 2.0 alpha --- .../ui/screen/login/AuthScreen.android.kt | 4 ++-- .../einkaufszettel/data/remote/AuthenticationApi.kt | 2 +- .../jan/einkaufszettel/data/remote/ProductApi.kt | 12 +++++++++--- .../jan/einkaufszettel/data/remote/ProfileApi.kt | 8 ++++++-- .../jan/einkaufszettel/data/remote/RecipeApi.kt | 8 ++++++-- .../github/jan/einkaufszettel/data/remote/ShopApi.kt | 8 ++++++-- .../einkaufszettel/ui/screen/login/AuthScreen.js.kt | 4 +++- gradle/libs.versions.toml | 2 +- 8 files changed, 34 insertions(+), 14 deletions(-) diff --git a/composeApp/src/androidMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.android.kt b/composeApp/src/androidMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.android.kt index eeab9b5..878fb81 100644 --- a/composeApp/src/androidMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.android.kt +++ b/composeApp/src/androidMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.android.kt @@ -3,10 +3,10 @@ package io.github.jan.einkaufszettel.ui.screen.login import androidx.compose.runtime.Composable import io.github.jan.supabase.compose.auth.ComposeAuth import io.github.jan.supabase.compose.auth.composable.NativeSignInResult -import io.github.jan.supabase.compose.auth.composable.rememberLoginWithGoogle +import io.github.jan.supabase.compose.auth.composable.rememberSignInWithGoogle @Composable internal actual fun loginWithGoogle( composeAuth: ComposeAuth, onResult: (NativeSignInResult) -> Unit -) = composeAuth.rememberLoginWithGoogle(onResult) \ No newline at end of file +) = composeAuth.rememberSignInWithGoogle(onResult) \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/AuthenticationApi.kt b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/AuthenticationApi.kt index ac8b9b8..84826b8 100644 --- a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/AuthenticationApi.kt +++ b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/AuthenticationApi.kt @@ -38,7 +38,7 @@ internal class AuthenticationApiImpl( } override suspend fun logout() { - auth.logout() + auth.signOut() } } \ No newline at end of file diff --git a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProductApi.kt b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProductApi.kt index ca9b81b..40908a6 100644 --- a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProductApi.kt +++ b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProductApi.kt @@ -69,7 +69,9 @@ internal class ProductApiImpl( override suspend fun deleteProduct(id: Long) { table.delete { - ProductDto::id eq id + filter { + ProductDto::id eq id + } } } @@ -77,7 +79,9 @@ internal class ProductApiImpl( return table.update({ ProductDto::content setTo content }) { - ProductDto::id eq id + filter { + ProductDto::id eq id + } }.decodeSingle() } @@ -86,7 +90,9 @@ internal class ProductApiImpl( ProductDto::doneBy setTo doneById ProductDto::doneSince setTo if(doneById != null) Clock.System.now() else null }) { - ProductDto::id eq id + filter { + ProductDto::id eq id + } }.decodeSingle() } diff --git a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProfileApi.kt b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProfileApi.kt index 5d64725..b850af2 100644 --- a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProfileApi.kt +++ b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ProfileApi.kt @@ -34,7 +34,9 @@ internal class ProfileApiImpl( override suspend fun retrieveProfile(uid: String): ProfileDto? { val result = profileTable.select { - ProfileDto::id eq uid + filter { + ProfileDto::id eq uid + } } return result.decodeSingleOrNull() } @@ -53,7 +55,9 @@ internal class ProfileApiImpl( override suspend fun retrieveProfiles(ids: List): List { return profileTable.select { - ProfileDto::id isIn ids + filter { + ProfileDto::id isIn ids + } }.decodeList() } diff --git a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/RecipeApi.kt b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/RecipeApi.kt index 694e081..5ec9bef 100644 --- a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/RecipeApi.kt +++ b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/RecipeApi.kt @@ -82,7 +82,9 @@ internal class RecipeApiImpl( override suspend fun deleteRecipe(id: Long) { table.delete { - RecipeDto::id eq id + filter { + RecipeDto::id eq id + } } } @@ -101,7 +103,9 @@ internal class RecipeApiImpl( RecipeDto::steps setTo steps RecipeDto::private setTo private }) { - RecipeDto::id eq id + filter { + RecipeDto::id eq id + } } } diff --git a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ShopApi.kt b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ShopApi.kt index 1c568e1..93ee425 100644 --- a/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ShopApi.kt +++ b/composeApp/src/commonMain/kotlin/io/github/jan/einkaufszettel/data/remote/ShopApi.kt @@ -88,7 +88,9 @@ internal class ShopApiImpl( override suspend fun deleteShop(id: Long) { table.delete { - ShopDto::id eq id + filter { + ShopDto::id eq id + } } } @@ -99,7 +101,9 @@ internal class ShopApiImpl( ShopDto::authorizedUsers setTo authorizedUsers } ) { - ShopDto::id eq id + filter { + ShopDto::id eq id + } }.decodeSingle() } diff --git a/composeApp/src/jsMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.js.kt b/composeApp/src/jsMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.js.kt index 0eaac70..e5b4849 100644 --- a/composeApp/src/jsMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.js.kt +++ b/composeApp/src/jsMain/kotlin/io/github/jan/einkaufszettel/ui/screen/login/AuthScreen.js.kt @@ -1,13 +1,15 @@ package io.github.jan.einkaufszettel.ui.screen.login import androidx.compose.runtime.Composable +import io.github.jan.supabase.annotations.SupabaseInternal import io.github.jan.supabase.compose.auth.ComposeAuth import io.github.jan.supabase.compose.auth.composable.NativeSignInResult -import io.github.jan.supabase.compose.auth.composable.defaultLoginBehavior +import io.github.jan.supabase.compose.auth.defaultLoginBehavior import io.github.jan.supabase.gotrue.auth import io.github.jan.supabase.gotrue.providers.Google import kotlinx.browser.document +@OptIn(SupabaseInternal::class) @Composable internal actual fun loginWithGoogle( composeAuth: ComposeAuth, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d80641d..9650196 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ koin = "3.5.0" koin-compose = "1.1.0" ktor = "2.3.5" sqlDelight = "2.0.0" -supabase = "1.5.0-alpha-1" +supabase = "2.0.0-alpha-1" lifecycle = "2.6.2" windowsizeclass = "0.3.1" okio = "3.6.0"