Remove unused code.

This commit is contained in:
Thomas Andres Gomez 2023-11-20 15:48:50 +01:00
parent 181b734679
commit ad3750e702
3 changed files with 0 additions and 54 deletions

View file

@ -1,39 +0,0 @@
package com.pixelized.rplexicon.data.repository.authentication
import android.content.Context
import com.google.android.gms.auth.api.identity.SignInCredential
import dagger.hilt.android.qualifiers.ApplicationContext
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class AuthenticationRepository @Inject constructor(
@ApplicationContext private val context: Context,
) {
// private val signInCredential = mutableStateOf<SignInCredential?>(null)
// val isAuthenticated: State<Boolean> = derivedStateOf { signInCredential.value != null }
//
// val credential: GoogleAccountCredential by derivedStateOf {
// GoogleAccountCredential
// .usingOAuth2(context, capabilities)
// .setBackOff(ExponentialBackOff())
// .also {
// it.selectedAccount = signInCredential.value?.let {
// Account(it.id, ACCOUNT_TYPE)
// }
// }
// }
fun updateAuthenticationState(
credential: SignInCredential? = null,
) {
// signInCredential.value = credential
}
companion object {
// private const val ACCOUNT_TYPE = "google"
// private val capabilities = listOf(
// SheetsScopes.SPREADSHEETS_READONLY,
// )
}
}

View file

@ -20,14 +20,12 @@ import com.google.firebase.auth.GoogleAuthProvider
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase
import com.pixelized.rplexicon.R
import com.pixelized.rplexicon.data.repository.authentication.AuthenticationRepository
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
@HiltViewModel
class AuthenticationViewModel @Inject constructor(
application: Application,
private val repository: AuthenticationRepository,
) : AndroidViewModel(application) {
private val context: Context get() = getApplication()
@ -35,10 +33,6 @@ class AuthenticationViewModel @Inject constructor(
private val state = mutableStateOf<AuthenticationStateUio>(
AuthenticationStateUio.Initial
// when (repository.isAuthenticated.value) {
// true -> AuthenticationStateUio.Success
// else -> AuthenticationStateUio.Initial
// }
)
@Composable
@ -61,15 +55,12 @@ class AuthenticationViewModel @Inject constructor(
.addOnCompleteListener { task ->
if (task.isSuccessful) {
state.value = AuthenticationStateUio.Success
repository.updateAuthenticationState(credential = googleCredential)
} else {
state.value = AuthenticationStateUio.Failure(task.exception)
repository.updateAuthenticationState(credential = null)
}
}
} else {
state.value = AuthenticationStateUio.Initial
repository.updateAuthenticationState(credential = null)
}
},
)
@ -94,12 +85,10 @@ class AuthenticationViewModel @Inject constructor(
)
} catch (exception: SendIntentException) {
state.value = AuthenticationStateUio.Failure(exception = exception)
repository.updateAuthenticationState()
}
}
.addOnFailureListener { exception ->
state.value = AuthenticationStateUio.Failure(exception = exception)
repository.updateAuthenticationState()
}
}
}

View file

@ -47,10 +47,6 @@ class ObjectsViewModel @Inject constructor(
}
}
fun onDetail(name: String) {
}
fun onUse(name: String): DiceThrow? {
val item = objectsRepository.find(character = character, item = name)
return item?.let {