Skip to content

Commit

Permalink
[asgardeo-android-core-auth-direct] changed SharedFlow to `StateFlo…
Browse files Browse the repository at this point in the history
…w` in the Android SDK.
  • Loading branch information
Achintha Isuru committed Sep 2, 2024
1 parent d1e1a70 commit b9feda5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState>
fun getAuthenticationStateFlow(): StateFlow<AuthenticationState>

/**
* Check whether the user is logged in or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down Expand Up @@ -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<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
override fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState> =
override fun getAuthenticationStateFlow(): StateFlow<AuthenticationState> =
authenticationStateProviderManager.getAuthenticationStateFlow()

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -37,9 +37,9 @@ interface AuthenticationStateProviderManager {
/**
* Get authentication state flow
*
* @return authentication state flow [SharedFlow<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState>
fun getAuthenticationStateFlow(): StateFlow<AuthenticationState>

/**
* Emit the authentication state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -92,9 +91,9 @@ internal class AuthenticationStateProviderManagerImpl private constructor(
/**
* Get authentication state flow
*
* @return authentication state flow [SharedFlow<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
override fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState> =
override fun getAuthenticationStateFlow(): StateFlow<AuthenticationState> =
authenticationStateFlow

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -37,9 +37,9 @@ interface AuthenticationProvider {
/**
* Get authentication state flow
*
* @return authentication state flow [SharedFlow<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState>
fun getAuthenticationStateFlow(): StateFlow<AuthenticationState>

/**
* Check whether the user is logged in or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/**
Expand Down Expand Up @@ -89,9 +89,9 @@ internal class AuthenticationProviderImpl private constructor(
/**
* Get authentication state flow
*
* @return authentication state flow [SharedFlow<AuthenticationState>]
* @return authentication state flow [StateFlow<AuthenticationState>]
*/
override fun getAuthenticationStateFlow(): SharedFlow<AuthenticationState> =
override fun getAuthenticationStateFlow(): StateFlow<AuthenticationState> =
authenticationProviderManager.getAuthenticationStateFlow()

/**
Expand Down

0 comments on commit b9feda5

Please sign in to comment.