@@ -23,9 +23,9 @@ const val RC_CREDENTIALS_SAVE = 3
23
23
24
24
class SmartAuthViewModel : ViewModel () {
25
25
private var requestedCredentialsEarlier = false
26
- private lateinit var credentialsClient: CredentialsClient
27
- private lateinit var signInClient: GoogleSignInClient
28
- private lateinit var thisActivity: Activity
26
+ private var credentialsClient: CredentialsClient ? = null
27
+ private var signInClient: GoogleSignInClient ? = null
28
+ private var thisActivity: Activity ? = null
29
29
private val mutableId = MutableLiveData <String >()
30
30
val id: LiveData <String > = mutableId
31
31
private val mutablePassword = MutableLiveData <String >()
@@ -51,7 +51,7 @@ class SmartAuthViewModel : ViewModel() {
51
51
.setPasswordLoginSupported(true )
52
52
crBuilder.setAccountTypes(IdentityProviders .GOOGLE )
53
53
mutableProgress.value = true
54
- credentialsClient.request(crBuilder.build()).addOnCompleteListener(
54
+ credentialsClient? .request(crBuilder.build())? .addOnCompleteListener(
55
55
OnCompleteListener <CredentialRequestResponse > { task ->
56
56
requestedCredentialsEarlier = true
57
57
@@ -73,7 +73,7 @@ class SmartAuthViewModel : ViewModel() {
73
73
fun saveCredential (activity : Activity ? , id : String , password : String ) {
74
74
if (activity == null ) return
75
75
val credential = Credential .Builder (id).setPassword(password).build()
76
- credentialsClient.save(credential).addOnCompleteListener(
76
+ credentialsClient? .save(credential)? .addOnCompleteListener(
77
77
OnCompleteListener <Void > { task ->
78
78
if (task.isSuccessful)
79
79
return @OnCompleteListener
0 commit comments