cleanup splash fragment duplicacy
This commit is contained in:
@@ -19,51 +19,20 @@
|
||||
|
||||
package com.aurora.store.view.ui.splash
|
||||
|
||||
import android.accounts.AccountManager
|
||||
import android.util.Log
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.aurora.extensions.hide
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.model.AuthState
|
||||
import com.aurora.store.util.CertUtil.GOOGLE_ACCOUNT_TYPE
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class SplashFragment : BaseFlavouredSplashFragment() {
|
||||
|
||||
private val TAG = SplashFragment::class.java.simpleName
|
||||
|
||||
override fun attachActions() {
|
||||
binding.btnAnonymous.hide()
|
||||
super.attachActions()
|
||||
|
||||
binding.btnGoogle.addOnClickListener {
|
||||
if (viewModel.authState.value != AuthState.Fetching) {
|
||||
binding.btnGoogle.updateProgress(true)
|
||||
if (canLoginWithMicroG) {
|
||||
Log.i(TAG, "Found supported microG, trying to request credentials")
|
||||
val accountIntent = AccountManager.newChooseAccountIntent(
|
||||
null,
|
||||
null,
|
||||
arrayOf(GOOGLE_ACCOUNT_TYPE),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
)
|
||||
startForAccount.launch(accountIntent)
|
||||
} else {
|
||||
findNavController().navigate(R.id.googleFragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
binding.btnAnonymous.hide()
|
||||
}
|
||||
|
||||
override fun resetActions() {
|
||||
binding.btnAnonymous.hide()
|
||||
super.resetActions()
|
||||
|
||||
binding.btnGoogle.apply {
|
||||
updateProgress(false)
|
||||
isEnabled = true
|
||||
}
|
||||
binding.btnAnonymous.hide()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user