From d1e1a7072fd7ef15c7e63b664c9f62cad020505f Mon Sep 17 00:00:00 2001 From: Achintha Isuru Date: Mon, 2 Sep 2024 10:26:20 +0530 Subject: [PATCH] docs: changed `SharedFlow` to `StateFlow` in the doc site. --- docs/website/android/start.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/website/android/start.md b/docs/website/android/start.md index c1e9f28..6781b57 100644 --- a/docs/website/android/start.md +++ b/docs/website/android/start.md @@ -25,7 +25,7 @@ AuthenticationCoreConfig( discoveryEndpoint = "https://api.asgardeo.io/t//oauth2/token/.well-known/openid-configuration", authnEndpoint = "https://api.asgardeo.io/t//oauth2/authn", - redirectUri = "wso2sample://oauth2", + redirectUri = "wso2.apiauth.sample.android://oauth2", clientId = "", scope = "openid profile email" ) @@ -39,7 +39,7 @@ val authenticationProvider: AuthenticationProvider = asgardeoAuth.getAuthenticationProvider() ``` -AuthenticationProvider handles the authentication process using [SharedFlow](https://developer.android.com/kotlin/flow/stateflow-and-sharedflow#sharedflow). This will help you to handle each state of the authentication process easily. There are four states in the authentication process (AuthenticationState): +AuthenticationProvider handles the authentication process using [StateFlow](https://developer.android.com/kotlin/flow/stateflow-and-sharedflow#stateflow). This will help you to handle each state of the authentication process easily. There are four states in the authentication process (AuthenticationState): - **AuthenticationState.Initial**: Initial state of the authentication process. - **AuthenticationState.Loading**: SDK is calling an API to handle the authentication and waiting for the result. @@ -64,10 +64,11 @@ Then call the `authenticationProvider.initializeAuthentication` to initialize th ```kotlin @Composable internal fun LandingScreen() { + val context: Context = LocalContext.current val authenticationStateFlow = authenticationProvider.getAuthenticationStateFlow() - IsLoggedInStateFlow() - HandleAuthenticationState(authenticationStateFlow) + IsLoggedInStateFlow(context) + HandleAuthenticationState(authenticationStateFlow, context) } @Composable @@ -80,7 +81,7 @@ private fun IsLoggedInStateFlow(context: Context) { } @Composable -private fun HandleAuthenticationState(authenticationStateFlow: SharedFlow) { +private fun HandleAuthenticationState(authenticationStateFlow: StateFlow) { LaunchedEffect(key1 = Unit) { GlobalScope.launch { authenticationStateFlow.collect {