Skip to content

Commit

Permalink
update to supabase 2.0 alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-tennert committed Nov 26, 2023
1 parent de435c0 commit b80f6ba
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
) = composeAuth.rememberSignInWithGoogle(onResult)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ internal class AuthenticationApiImpl(
}

override suspend fun logout() {
auth.logout()
auth.signOut()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,19 @@ internal class ProductApiImpl(

override suspend fun deleteProduct(id: Long) {
table.delete {
ProductDto::id eq id
filter {
ProductDto::id eq id
}
}
}

override suspend fun editContent(id: Long, content: String): ProductDto {
return table.update({
ProductDto::content setTo content
}) {
ProductDto::id eq id
filter {
ProductDto::id eq id
}
}.decodeSingle()
}

Expand All @@ -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()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand All @@ -53,7 +55,9 @@ internal class ProfileApiImpl(

override suspend fun retrieveProfiles(ids: List<String>): List<ProfileDto> {
return profileTable.select {
ProfileDto::id isIn ids
filter {
ProfileDto::id isIn ids
}
}.decodeList()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ internal class RecipeApiImpl(

override suspend fun deleteRecipe(id: Long) {
table.delete {
RecipeDto::id eq id
filter {
RecipeDto::id eq id
}
}
}

Expand All @@ -101,7 +103,9 @@ internal class RecipeApiImpl(
RecipeDto::steps setTo steps
RecipeDto::private setTo private
}) {
RecipeDto::id eq id
filter {
RecipeDto::id eq id
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ internal class ShopApiImpl(

override suspend fun deleteShop(id: Long) {
table.delete {
ShopDto::id eq id
filter {
ShopDto::id eq id
}
}
}

Expand All @@ -99,7 +101,9 @@ internal class ShopApiImpl(
ShopDto::authorizedUsers setTo authorizedUsers
}
) {
ShopDto::id eq id
filter {
ShopDto::id eq id
}
}.decodeSingle()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit b80f6ba

Please sign in to comment.