Skip to content

Commit b9b057d

Browse files
authored
Merge pull request #484 from supabase-community/development
Release 2.2.0
2 parents 86accdd + 17e218e commit b9b057d

File tree

94 files changed

+1405
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1405
-912
lines changed

Functions/src/commonMain/kotlin/io/github/jan/supabase/functions/Functions.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ import io.ktor.http.HttpStatusCode
4646
class Functions(override val config: Config, override val supabaseClient: SupabaseClient) : MainPlugin<Functions.Config>, CustomSerializationPlugin {
4747

4848
override val apiVersion: Int
49-
get() = Functions.API_VERSION
49+
get() = API_VERSION
5050

5151
override val pluginKey: String
5252
get() = key
@@ -120,10 +120,7 @@ class Functions(override val config: Config, override val supabaseClient: Supaba
120120
* @param jwtToken A jwt token to use for the requests. If not provided, the token from the [Auth] plugin, or the supabaseKey will be used
121121
* @property serializer A serializer used for serializing/deserializing objects e.g. in [Functions.invoke] or [EdgeFunction.invoke]. Defaults to [KotlinXSerializer]
122122
*/
123-
data class Config(
124-
override var customUrl: String? = null,
125-
override var jwtToken: String? = null,
126-
) : MainConfig, CustomSerializationConfig {
123+
class Config : MainConfig(), CustomSerializationConfig {
127124

128125
override var serializer: SupabaseSerializer? = null
129126

@@ -133,6 +130,8 @@ class Functions(override val config: Config, override val supabaseClient: Supaba
133130

134131
override val key = "functions"
135132

133+
override val logger = SupabaseClient.createLogger("Supabase-Functions")
134+
136135
/**
137136
* The current functions api version
138137
*/

GoTrue/build.gradle.kts

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,14 @@ kotlin {
6363
// api(libs.cache4k)
6464
}
6565
}
66-
val nonJvmMain by creating {
66+
val desktopMain by creating {
67+
dependsOn(commonMain)
68+
dependencies {
69+
api(libs.ktor.server.core)
70+
api(libs.ktor.server.cio)
71+
}
72+
}
73+
val nonDesktopMain by creating {
6774
dependsOn(commonMain)
6875
}
6976
val nonLinuxMain by creating {
@@ -79,9 +86,7 @@ kotlin {
7986
}
8087
val jvmMain by getting {
8188
dependsOn(nonLinuxMain)
82-
dependencies {
83-
implementation(libs.javalin)
84-
}
89+
dependsOn(desktopMain)
8590
}
8691
val androidMain by getting {
8792
dependsOn(nonLinuxMain)
@@ -90,20 +95,32 @@ kotlin {
9095
api(libs.androidx.browser)
9196
}
9297
}
93-
val mingwX64Main by getting {
98+
val mingwMain by getting {
9499
dependsOn(nonLinuxMain)
95-
dependsOn(nonJvmMain)
100+
dependsOn(nonDesktopMain) //no ktor server engine supports the windows target
101+
//dependsOn(desktopMain)
96102
}
97103
val appleMain by getting {
98104
dependsOn(nonLinuxMain)
99-
dependsOn(nonJvmMain)
100105
}
101106
val jsMain by getting {
102107
dependsOn(nonLinuxMain)
103-
dependsOn(nonJvmMain)
108+
dependsOn(nonDesktopMain)
104109
}
105110
val linuxMain by getting {
106-
dependsOn(nonJvmMain)
111+
dependsOn(desktopMain)
112+
}
113+
val iosMain by getting {
114+
dependsOn(nonDesktopMain)
115+
}
116+
val tvosMain by getting {
117+
dependsOn(nonDesktopMain)
118+
}
119+
val watchosMain by getting {
120+
dependsOn(nonDesktopMain)
121+
}
122+
val macosMain by getting {
123+
dependsOn(desktopMain)
107124
}
108125
}
109126
}

GoTrue/src/androidMain/kotlin/io/github/jan/supabase/gotrue/AuthConfig.kt

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,11 @@ package io.github.jan.supabase.gotrue
33
import io.github.jan.supabase.gotrue.ExternalAuthAction.CUSTOM_TABS
44
import io.github.jan.supabase.gotrue.ExternalAuthAction.EXTERNAL_BROWSER
55
import io.github.jan.supabase.plugins.CustomSerializationConfig
6-
import io.github.jan.supabase.plugins.MainConfig
76

87
/**
98
* The configuration for [Auth]
109
*/
11-
actual class AuthConfig : MainConfig, CustomSerializationConfig, AuthConfigDefaults() {
12-
13-
/**
14-
* The scheme for the redirect url, when using deep linking
15-
*/
16-
var scheme: String? = null
17-
18-
/**
19-
* The host for the redirect url, when using deep linking
20-
*/
21-
var host: String? = null
10+
actual class AuthConfig : CustomSerializationConfig, AuthConfigDefaults() {
2211

2312
/**
2413
* Whether to stop auto-refresh on focus loss, and resume it on focus again
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.github.jan.supabase.gotrue
2+
3+
import io.github.jan.supabase.annotations.SupabaseInternal
4+
5+
@SupabaseInternal
6+
internal actual fun Auth.defaultPlatformRedirectUrl(): String? = config.deepLinkOrNull

GoTrue/src/androidMain/kotlin/io/github/jan/supabase/gotrue/RedirectUrl.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

GoTrue/src/androidMain/kotlin/io/github/jan/supabase/gotrue/setupPlatform.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import androidx.lifecycle.DefaultLifecycleObserver
55
import androidx.lifecycle.LifecycleOwner
66
import androidx.lifecycle.ProcessLifecycleOwner
77
import androidx.startup.Initializer
8-
import co.touchlab.kermit.Logger
98
import io.github.jan.supabase.annotations.SupabaseInternal
9+
import io.github.jan.supabase.logging.d
1010
import kotlinx.coroutines.Dispatchers
1111
import kotlinx.coroutines.launch
1212

@@ -37,17 +37,17 @@ private fun addLifecycleCallbacks(gotrue: Auth) {
3737

3838
override fun onStart(owner: LifecycleOwner) {
3939
if(!gotrue.isAutoRefreshRunning && gotrue.config.alwaysAutoRefresh) {
40-
Logger.d("Auth") {
40+
Auth.logger.d {
4141
"Trying to re-load session from storage..."
4242
}
4343
scope.launch {
4444
val sessionFound = gotrue.loadFromStorage()
4545
if(!sessionFound) {
46-
Logger.d("Auth") {
46+
Auth.logger.d {
4747
"No session found, not starting auto refresh"
4848
}
4949
} else {
50-
Logger.d("Auth") {
50+
Auth.logger.d {
5151
"Session found, auto refresh started"
5252
}
5353
}
@@ -56,7 +56,7 @@ private fun addLifecycleCallbacks(gotrue: Auth) {
5656
}
5757
override fun onStop(owner: LifecycleOwner) {
5858
if(gotrue.isAutoRefreshRunning) {
59-
Logger.d("Auth") { "Cancelling auto refresh because app is switching to the background" }
59+
Auth.logger.d { "Cancelling auto refresh because app is switching to the background" }
6060
scope.launch {
6161
gotrue.stopAutoRefreshForCurrentSession()
6262
gotrue.resetLoadingState()

GoTrue/src/appleMain/kotlin/io/github/jan/supabase/gotrue/Apple.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package io.github.jan.supabase.gotrue
22

3-
import co.touchlab.kermit.Logger
43
import io.github.jan.supabase.SupabaseClient
54
import io.github.jan.supabase.gotrue.user.UserSession
5+
import io.github.jan.supabase.logging.d
66
import kotlinx.coroutines.launch
77
import platform.Foundation.NSURL
88
import platform.Foundation.NSURLComponents
@@ -16,14 +16,14 @@ import platform.Foundation.NSURLQueryItem
1616
*/
1717
fun SupabaseClient.handleDeeplinks(url: NSURL, onSessionSuccess: (UserSession) -> Unit = {}) {
1818
if (url.scheme != auth.config.scheme || url.host != auth.config.host) {
19-
Logger.d("Auth") { "Received deeplink with wrong scheme or host" }
19+
Auth.logger.d { "Received deeplink with wrong scheme or host" }
2020
return
2121
}
2222
when (auth.config.flowType) {
2323
FlowType.IMPLICIT -> {
2424
val fragment = url.fragment
2525
if (fragment == null) {
26-
Logger.d("Auth") { "No fragment for deeplink" }
26+
Auth.logger.d { "No fragment for deeplink" }
2727
return
2828
}
2929
auth.parseFragmentAndImportSession(fragment, onSessionSuccess)

GoTrue/src/appleMain/kotlin/io/github/jan/supabase/gotrue/AuthConfig.kt

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package io.github.jan.supabase.gotrue
2+
3+
import io.github.jan.supabase.annotations.SupabaseInternal
4+
5+
@SupabaseInternal
6+
internal actual fun Auth.defaultPlatformRedirectUrl(): String? = config.deepLinkOrNull

GoTrue/src/appleMain/kotlin/io/github/jan/supabase/gotrue/RedirectUrl.kt

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)