From b746a58ef639244c47e74c800875e7d7ad8565f8 Mon Sep 17 00:00:00 2001 From: Jan Tennert Date: Wed, 18 Sep 2024 19:08:46 +0200 Subject: [PATCH 1/2] Remove deprecated methods & properties --- .../io/github/jan/supabase/auth/AuthConfig.kt | 19 ---------- .../io/github/jan/supabase/auth/Auth.kt | 15 -------- .../io/github/jan/supabase/auth/mfa/MfaApi.kt | 35 ------------------- .../supabase/realtime/PostgresChangeFilter.kt | 3 +- 4 files changed, 1 insertion(+), 71 deletions(-) diff --git a/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt b/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt index 53e8534f6..43a0baa15 100644 --- a/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt +++ b/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt @@ -35,23 +35,4 @@ sealed interface ExternalAuthAction { */ data class CustomTabs(val intentBuilder: CustomTabsIntent.Builder.() -> Unit = {}) : ExternalAuthAction - companion object { - /** - * The default action to use for the OAuth flow - */ - val DEFAULT: ExternalAuthAction = ExternalBrowser - - /** - * External browser action - */ - @Deprecated("Use ExternalBrowser object instead", ReplaceWith("ExternalAuthAction.ExternalBrowser")) - val EXTERNAL_BROWSER: ExternalAuthAction = ExternalBrowser - - /** - * Custom tabs action - */ - @Deprecated("Use CustomTabs class instead", ReplaceWith("ExternalAuthAction.CustomTabs()")) - val CUSTOM_TABS: ExternalAuthAction = CustomTabs() - } - } diff --git a/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/Auth.kt b/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/Auth.kt index fcca38ce3..d7c1ad003 100644 --- a/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/Auth.kt +++ b/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/Auth.kt @@ -202,21 +202,6 @@ sealed interface Auth : MainPlugin, CustomSerializationPlugin { config: UserUpdateBuilder.() -> Unit ): UserInfo - /** - * Modifies the current user - * @param updateCurrentUser Whether to update the current user in the [SupabaseClient] - * @param config The configuration to use - * @throws RestException or one of its subclasses if receiving an error response. If the error response contains a error code, an [AuthRestException] will be thrown which can be used to easier identify the problem. - * @throws HttpRequestTimeoutException if the request timed out - * @throws HttpRequestException on network related issues - */ - @Deprecated("Use updateUser instead") - suspend fun modifyUser( - updateCurrentUser: Boolean = true, - redirectUrl: String? = defaultRedirectUrl(), - config: UserUpdateBuilder.() -> Unit - ): UserInfo = updateUser(updateCurrentUser, redirectUrl, config) - /** * Resends an existing signup confirmation email, email change email * @param type The email otp type diff --git a/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/mfa/MfaApi.kt b/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/mfa/MfaApi.kt index 73e2bdd2b..b7ba3ab16 100644 --- a/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/mfa/MfaApi.kt +++ b/Auth/src/commonMain/kotlin/io/github/jan/supabase/auth/mfa/MfaApi.kt @@ -37,43 +37,12 @@ sealed interface MfaApi { */ val statusFlow: Flow - /** - * Checks whether the current session was authenticated with MFA or the user has a verified MFA factor. Note that if the user has verified a factor on another device and the user hasn't been updated on this device, this will return false. - * You can use [Auth.retrieveUserForCurrentSession] to update the user and this property will update. - */ - @Deprecated("Use statusFlow instead", ReplaceWith("statusFlow")) - val isMfaEnabledFlow: Flow - - /** - * Checks whether the user has a verified MFA factor. Note that if the user has verified a factor on another device and the user hasn't been updated on this device, this will return false. - * You can use [Auth.retrieveUserForCurrentSession] to update the user and this property will update. - */ - @Deprecated("Use status.enabled instead", ReplaceWith("status.enabled")) - val isMfaEnabled: Boolean - get() { - val mfaLevel = getAuthenticatorAssuranceLevel() - return mfaLevel.next == AuthenticatorAssuranceLevel.AAL2 - } - /** * Returns all verified factors from the current user session. If the user has no verified factors or there is no session, an empty list is returned. * To fetch up-to-date factors, use [retrieveFactorsForCurrentUser]. */ val verifiedFactors: List - /** - * Checks whether the current session is authenticated with MFA - */ - @Deprecated("Use status.active instead", ReplaceWith("status.active")) - val loggedInUsingMfa: Boolean - get() = getAuthenticatorAssuranceLevel().current == AuthenticatorAssuranceLevel.AAL2 - - /** - * Checks whether the current session is authenticated with MFA - */ - @Deprecated("Use statusFlow instead", ReplaceWith("statusFlow")) - val loggedInUsingMfaFlow: Flow - /** * @param factorType The type of MFA factor to enroll. Currently only supports TOTP. * @param friendlyName Human-readable name assigned to a device @@ -156,10 +125,6 @@ internal class MfaApiImpl( } } - @Deprecated("Use statusFlow instead", replaceWith = ReplaceWith("statusFlow")) - override val isMfaEnabledFlow: Flow = statusFlow.map { it.enabled } - @Deprecated("Use statusFlow instead", replaceWith = ReplaceWith("statusFlow")) - override val loggedInUsingMfaFlow: Flow = statusFlow.map { it.active } override val verifiedFactors: List get() = auth.currentUserOrNull()?.factors?.filter(UserMfaFactor::isVerified) ?: emptyList() diff --git a/Realtime/src/commonMain/kotlin/io/github/jan/supabase/realtime/PostgresChangeFilter.kt b/Realtime/src/commonMain/kotlin/io/github/jan/supabase/realtime/PostgresChangeFilter.kt index 4d5f42fa8..8b94dac8d 100644 --- a/Realtime/src/commonMain/kotlin/io/github/jan/supabase/realtime/PostgresChangeFilter.kt +++ b/Realtime/src/commonMain/kotlin/io/github/jan/supabase/realtime/PostgresChangeFilter.kt @@ -7,7 +7,6 @@ import io.github.jan.supabase.postgrest.query.filter.FilterOperator /** * Used to filter postgres changes */ -@Suppress("DEPRECATION") class PostgresChangeFilter(private val event: String, private val schema: String) { /** @@ -20,7 +19,7 @@ class PostgresChangeFilter(private val event: String, private val schema: String * E.g.: "user_id=eq.1" */ var filter: String? = null - @Deprecated("Use the new `filter` method instead") set + private set /** * Filters the received changes in your table. From 382ae6e1e7d8c037dda42b8beef2399891f2bcdf Mon Sep 17 00:00:00 2001 From: Jan Tennert Date: Wed, 18 Sep 2024 19:17:35 +0200 Subject: [PATCH 2/2] Re-add default ExternalAuthAction --- .../kotlin/io/github/jan/supabase/auth/AuthConfig.kt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt b/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt index 43a0baa15..e20e9fec3 100644 --- a/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt +++ b/Auth/src/androidMain/kotlin/io/github/jan/supabase/auth/AuthConfig.kt @@ -35,4 +35,13 @@ sealed interface ExternalAuthAction { */ data class CustomTabs(val intentBuilder: CustomTabsIntent.Builder.() -> Unit = {}) : ExternalAuthAction + companion object { + + /** + * The default action to use for the OAuth flow + */ + val DEFAULT: ExternalAuthAction = ExternalBrowser + + } + }