Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update use pcke and launcheffect

Hieu Vuf1c7cc1e664b
diff --git a/apps/docs/pages/guides/getting-started/tutorials/with-kotlin.mdx b/apps/docs/pages/guides/getting-started/tutorials/with-kotlin.mdx
index 927b45e0c9d..0552530f8d9 100644
--- a/apps/docs/pages/guides/getting-started/tutorials/with-kotlin.mdx
+++ b/apps/docs/pages/guides/getting-started/tutorials/with-kotlin.mdx
@@ -150,6 +150,7 @@ object SupabaseModule {
) {
install(Postgrest)
install(GoTrue) {
+ flowType = FlowType.PKCE
scheme = "app"
host = "supabase.com"
}
@@ -1210,10 +1211,12 @@ class DeepLinkHandlerActivity : ComponentActivity() {
val navController = rememberNavController()
val emailState = remember { mutableStateOf("") }
val createdAtState = remember { mutableStateOf("") }
- callback = { email, created ->
- emailState.value = email
- createdAtState.value = created
- }
+ LaunchedEffect(key1 = emailState, block = {
+ callback = { email, created ->
+ emailState.value = email
+ createdAtState.value = created
+ }
+ })
ManageProductsTheme {
Surface(
modifier = Modifier.fillMaxSize(),
diff --git a/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/DeepLinkHandlerActivity.kt b/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/DeepLinkHandlerActivity.kt
index 0ecd879deba..a663d4b6ce2 100644
--- a/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/DeepLinkHandlerActivity.kt
+++ b/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/DeepLinkHandlerActivity.kt
@@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
+import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
@@ -41,10 +42,12 @@ class DeepLinkHandlerActivity : ComponentActivity() {
val navController = rememberNavController()
val emailState = remember { mutableStateOf("") }
val createdAtState = remember { mutableStateOf("") }
- callback = { email, created ->
- emailState.value = email
- createdAtState.value = created
- }
+ LaunchedEffect(key1 = emailState, block = {
+ callback = { email, created ->
+ emailState.value = email
+ createdAtState.value = created
+ }
+ })
ManageProductsTheme {
Surface(
modifier = Modifier.fillMaxSize(),
diff --git a/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/di/SupabaseModule.kt b/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/di/SupabaseModule.kt
index a9a55683d05..c3a5eec2b34 100644
--- a/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/di/SupabaseModule.kt
+++ b/examples/product-sample-supabase-kt/app/src/main/java/com/example/manageproducts/di/SupabaseModule.kt
@@ -4,8 +4,10 @@ import com.example.manageproducts.BuildConfig
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
+import io.github.jan.supabase.annotiations.SupabaseExperimental
import dagger.hilt.components.SingletonComponent
import io.github.jan.supabase.SupabaseClient
+import io.github.jan.supabase.gotrue.FlowType
import io.github.jan.supabase.createSupabaseClient
import io.github.jan.supabase.gotrue.GoTrue
import io.github.jan.supabase.gotrue.gotrue
@@ -19,7 +21,8 @@ import javax.inject.Singleton
@InstallIn(SingletonComponent::class)
@Module
object SupabaseModule {
-
+
+ @OptIn(SupabaseExperimental::class)
@Provides
@Singleton
fun provideSupabaseClient(): SupabaseClient {
@@ -28,7 +31,11 @@ object SupabaseModule {
supabaseKey = BuildConfig.API_KEY
) {
install(Postgrest)
- install(GoTrue)
+ install(GoTrue) {
+ flowType = FlowType.PKCE
+ scheme = "app"
+ host = "supabase.com"
+ }
install(Storage)
}
}