GoogleFragment: Move authevent check to flow collector
lint warns that when checks are exhastive otherwise Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -110,13 +110,13 @@ class GoogleFragment : BaseFragment<FragmentGoogleBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewLifecycleOwner.lifecycleScope.launch {
|
viewLifecycleOwner.lifecycleScope.launch {
|
||||||
AuroraApp.events.authEvent.collect { onEventReceived(it) }
|
AuroraApp.events.authEvent.collect { event ->
|
||||||
|
if (event is AuthEvent.GoogleLogin) onEventReceived(event)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun onEventReceived(event: AuthEvent) {
|
private fun onEventReceived(event: AuthEvent.GoogleLogin) {
|
||||||
when (event) {
|
|
||||||
is AuthEvent.GoogleLogin -> {
|
|
||||||
if (event.success) {
|
if (event.success) {
|
||||||
viewModel.buildGoogleAuthData(event.email, event.token, AuthHelper.Token.AAS)
|
viewModel.buildGoogleAuthData(event.email, event.token, AuthHelper.Token.AAS)
|
||||||
} else {
|
} else {
|
||||||
@@ -131,8 +131,4 @@ class GoogleFragment : BaseFragment<FragmentGoogleBinding>() {
|
|||||||
GoogleFragmentDirections.actionGoogleFragmentToSplashFragment()
|
GoogleFragmentDirections.actionGoogleFragmentToSplashFragment()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user