From b9feda5369ac5d2413db1a3bd7cfde6862a83497 Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 2 Sep 2024 10:27:08 +0530 Subject: [PATCH] [asgardeo-android-core-auth-direct] changed `SharedFlow` to `StateFlow` in the Android SDK. --- .../authentication/AuthenticationProviderManager.kt | 6 +++--- .../impl/AuthenticationProviderManagerImpl.kt | 6 +++--- .../AuthenticationStateProviderManager.kt | 6 +++--- .../impl/AuthenticationStateProviderManagerImpl.kt | 5 ++--- .../providers/authentication/AuthenticationProvider.kt | 6 +++--- .../authentication/impl/AuthenticationProviderImpl.kt | 6 +++--- 6 files changed, 17 insertions(+), 18 deletions(-) diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/AuthenticationProviderManager.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/AuthenticationProviderManager.kt index d5445f6..5075500 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/AuthenticationProviderManager.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/AuthenticationProviderManager.kt @@ -25,7 +25,7 @@ import androidx.activity.result.ActivityResultLauncher import androidx.annotation.RequiresApi import io.asgardeo.android.core_auth_direct.models.autheniticator.Authenticator import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow /** * Authentication provider manager that is used to manage the authentication process. @@ -42,9 +42,9 @@ internal interface AuthenticationProviderManager { /** * Get authentication state flow of the authentication state which is exposed to the outside. * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - fun getAuthenticationStateFlow(): SharedFlow + fun getAuthenticationStateFlow(): StateFlow /** * Check whether the user is logged in or not. diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/impl/AuthenticationProviderManagerImpl.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/impl/AuthenticationProviderManagerImpl.kt index 125ce12..fc33307 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/impl/AuthenticationProviderManagerImpl.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication/impl/AuthenticationProviderManagerImpl.kt @@ -35,7 +35,7 @@ import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState import io.asgardeo.android.core_auth_direct.provider.provider_managers.authenticate_handler.AuthenticateHandlerProviderManager import io.asgardeo.android.core_auth_direct.provider.provider_managers.authentication.AuthenticationProviderManager import io.asgardeo.android.core_auth_direct.provider.provider_managers.authentication_state.AuthenticationStateProviderManager -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow import java.lang.ref.WeakReference /** @@ -110,9 +110,9 @@ internal class AuthenticationProviderManagerImpl private constructor( /** * Get authentication state flow of the authentication state which is exposed to the outside. * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - override fun getAuthenticationStateFlow(): SharedFlow = + override fun getAuthenticationStateFlow(): StateFlow = authenticationStateProviderManager.getAuthenticationStateFlow() /** diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/AuthenticationStateProviderManager.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/AuthenticationStateProviderManager.kt index a3f84b6..8c2e950 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/AuthenticationStateProviderManager.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/AuthenticationStateProviderManager.kt @@ -22,7 +22,7 @@ import android.content.Context import io.asgardeo.android.core_auth_direct.models.autheniticator.Authenticator import io.asgardeo.android.core_auth_direct.models.authentication_flow.AuthenticationFlow import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow /** * Authentication state provider manager that is used to manage the authentication state. @@ -37,9 +37,9 @@ interface AuthenticationStateProviderManager { /** * Get authentication state flow * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - fun getAuthenticationStateFlow(): SharedFlow + fun getAuthenticationStateFlow(): StateFlow /** * Emit the authentication state. diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/impl/AuthenticationStateProviderManagerImpl.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/impl/AuthenticationStateProviderManagerImpl.kt index a0fa89f..4f05d48 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/impl/AuthenticationStateProviderManagerImpl.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/provider_managers/authentication_state/impl/AuthenticationStateProviderManagerImpl.kt @@ -29,7 +29,6 @@ import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState import io.asgardeo.android.core_auth_direct.models.state.TokenState import io.asgardeo.android.core_auth_direct.provider.provider_managers.authentication_state.AuthenticationStateProviderManager import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow import java.lang.ref.WeakReference @@ -92,9 +91,9 @@ internal class AuthenticationStateProviderManagerImpl private constructor( /** * Get authentication state flow * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - override fun getAuthenticationStateFlow(): SharedFlow = + override fun getAuthenticationStateFlow(): StateFlow = authenticationStateFlow /** diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/AuthenticationProvider.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/AuthenticationProvider.kt index 4cf5f7e..82a2ebf 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/AuthenticationProvider.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/AuthenticationProvider.kt @@ -26,7 +26,7 @@ import androidx.annotation.RequiresApi import io.asgardeo.android.core_auth_direct.models.autheniticator.Authenticator import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState import io.asgardeo.android.core_auth_direct.provider.providers.authentication.impl.AuthenticationProviderImpl -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow /** * Interface for the authentication provider to be implemented by the application. @@ -37,9 +37,9 @@ interface AuthenticationProvider { /** * Get authentication state flow * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - fun getAuthenticationStateFlow(): SharedFlow + fun getAuthenticationStateFlow(): StateFlow /** * Check whether the user is logged in or not. diff --git a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/impl/AuthenticationProviderImpl.kt b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/impl/AuthenticationProviderImpl.kt index 32ea1e7..4d57eda 100644 --- a/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/impl/AuthenticationProviderImpl.kt +++ b/android/core-auth-direct/src/main/java/io/asgardeo/android/core_auth_direct/provider/providers/authentication/impl/AuthenticationProviderImpl.kt @@ -28,7 +28,7 @@ import io.asgardeo.android.core_auth_direct.models.state.AuthenticationState import io.asgardeo.android.core_auth_direct.provider.provider_managers.authentication.AuthenticationProviderManager import io.asgardeo.android.core_auth_direct.provider.provider_managers.user.UserProviderManager import io.asgardeo.android.core_auth_direct.provider.providers.authentication.AuthenticationProvider -import kotlinx.coroutines.flow.SharedFlow +import kotlinx.coroutines.flow.StateFlow import java.lang.ref.WeakReference /** @@ -89,9 +89,9 @@ internal class AuthenticationProviderImpl private constructor( /** * Get authentication state flow * - * @return authentication state flow [SharedFlow] + * @return authentication state flow [StateFlow] */ - override fun getAuthenticationStateFlow(): SharedFlow = + override fun getAuthenticationStateFlow(): StateFlow = authenticationProviderManager.getAuthenticationStateFlow() /**