Skip to content

Commit cfedfc9

Browse files
authored
docs: update Kotlin docs (supabase#36718)
* update kotlin docs * fix typo
1 parent 89c8035 commit cfedfc9

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

apps/docs/docs/ref/kotlin/installing.mdx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,25 +151,25 @@ custom_edit_url: https://github.com/supabase/supabase/edit/master/web/spec/supab
151151
<TabPanel id="kotlin" label="build.gradle.kts">
152152

153153
```kotlin
154-
val commonMain by getting {
154+
commonMain {
155155
dependencies {
156-
//supabase modules
156+
//Supabase modules
157157
}
158158
}
159-
val jvmMain by getting {
159+
jvmMain {
160160
dependencies {
161161
implementation("io.ktor:ktor-client-cio:KTOR_VERSION")
162162
}
163163
}
164-
val androidMain by getting {
165-
dependsOn(jvmMain)
164+
androidMain {
165+
dependsOn(jvmMain.get())
166166
}
167-
val jsMain by getting {
167+
jsMain {
168168
dependencies {
169169
implementation("io.ktor:ktor-client-js:KTOR_VERSION")
170170
}
171171
}
172-
val iosMain by getting {
172+
iosMain {
173173
dependencies {
174174
implementation("io.ktor:ktor-client-darwin:KTOR_VERSION")
175175
}

apps/docs/spec/supabase_kt_v3.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,9 +3720,11 @@ functions:
37203720
$ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'
37213721
notes: |
37223722
Listen to session changes.
3723+
- `sessionStatus` is a `Flow<SessionStatus>` that emits the current session status. Everything related to the session is handled by this flow.
3724+
- `events` is a `Flow<AuthEvent>` that emits auth events. This flow is used to listen to auth events that are independent of the current session, like OTP errors, refresh failures, etc. Experimental.
37233725
examples:
37243726
- id: listen-to-auth-changes
3725-
name: Listen to auth changes
3727+
name: Listen to session status changes
37263728
isSpotlight: true
37273729
code: |
37283730
```kotlin
@@ -3742,7 +3744,9 @@ functions:
37423744
}
37433745
}
37443746
SessionStatus.Initializing -> println("Initializing")
3745-
is SessionStatus.RefreshFailure -> println("Refresh failure ${it.cause}") //Either a network error or a internal server error
3747+
is SessionStatus.RefreshFailure -> {
3748+
println("Session expired and could not be refreshed")
3749+
}
37463750
is SessionStatus.NotAuthenticated -> {
37473751
if(it.isSignOut) {
37483752
println("User signed out")
@@ -3759,6 +3763,20 @@ functions:
37593763
- `Initializing`,
37603764
- `RefreshFailure(cause)`,
37613765
- `Authenticated(session, source)`
3766+
- id: listen-to-events
3767+
name: Listen to auth events
3768+
isSpotlight: false
3769+
code: |
3770+
```kotlin
3771+
supabase.auth.events.collect {
3772+
when(it) {
3773+
is AuthEvent.OtpError ->
3774+
println("Found error in current URL / deeplink during the OAuth flow: ${it.error}")
3775+
is AuthEvent.RefreshFailure ->
3776+
println("Failed to refresh session: ${it.error}")
3777+
}
3778+
}
3779+
```
37623780
- id: reset-password-for-email
37633781
title: 'Send a password reset request'
37643782
notes: |
@@ -4053,7 +4071,7 @@ functions:
40534071
supabaseKey = "supabaseKey"
40544072
) {
40554073
install(Auth) {
4056-
minimalSettings() //disables session saving and auto-refreshing
4074+
minimalConfig() //disables session saving and auto-refreshing
40574075
}
40584076
// install other plugins (these will use the service role key)
40594077
}

0 commit comments

Comments
 (0)