Fix login not being implemented
This commit is contained in:
parent
2bce5cf601
commit
f1e36df8c4
4 changed files with 25 additions and 18 deletions
|
@ -15,7 +15,7 @@ try {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdkVersion 30
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
|
@ -26,7 +26,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "com.wbrawner.budget"
|
||||
minSdkVersion 23
|
||||
targetSdkVersion 29
|
||||
targetSdkVersion 30
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
vectorDrawables {
|
||||
|
@ -59,12 +59,12 @@ dependencies {
|
|||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.core:core:1.3.0'
|
||||
implementation 'androidx.media:media:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
||||
implementation 'com.google.android.material:material:1.1.0'
|
||||
implementation 'androidx.emoji:emoji-bundled:1.0.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.core:core:1.3.2'
|
||||
implementation 'androidx.media:media:1.2.1'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
implementation 'androidx.emoji:emoji-bundled:1.1.0'
|
||||
implementation 'com.github.BlacKCaT27:CurrencyEditText:2.0.2'
|
||||
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
|
||||
// Dagger
|
||||
|
@ -72,11 +72,11 @@ dependencies {
|
|||
kapt "com.google.dagger:dagger-compiler:$dagger"
|
||||
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi"
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'androidx.test:runner:1.2.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
|
||||
androidTestImplementation 'androidx.test:runner:1.3.0'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.2.2'
|
||||
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.2'
|
||||
implementation 'androidx.navigation:navigation-ui-ktx:2.3.2'
|
||||
implementation "ch.acra:acra-http:$acra_version"
|
||||
implementation "ch.acra:acra-advanced-scheduler:$acra_version"
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class SplashViewModel : ViewModel(), AsyncViewModel<AuthenticationState> {
|
|||
suspend fun checkForExistingCredentials() {
|
||||
state.postValue(AsyncState.Success(AuthenticationState.Splash))
|
||||
val authState = try {
|
||||
userRepository.getProfile()
|
||||
AuthenticationState.Authenticated
|
||||
} catch (ignored: Exception) {
|
||||
AuthenticationState.Unauthenticated
|
||||
|
@ -29,8 +30,14 @@ class SplashViewModel : ViewModel(), AsyncViewModel<AuthenticationState> {
|
|||
}
|
||||
|
||||
fun login(username: String, password: String) = launch {
|
||||
AuthenticationState.Authenticated.also {
|
||||
loadBudgetData()
|
||||
try {
|
||||
userRepository.login(username, password).also {
|
||||
loadBudgetData()
|
||||
}
|
||||
AuthenticationState.Authenticated
|
||||
} catch (ignored: Exception) {
|
||||
// TODO: Return error message here
|
||||
AuthenticationState.Unauthenticated
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ buildscript {
|
|||
ext.acra_version = '5.7.0'
|
||||
ext.dagger = '2.23.1'
|
||||
ext.hyperion = '0.9.27'
|
||||
ext.kotlin_version = '1.3.72'
|
||||
ext.kotlin_version = '1.4.21'
|
||||
ext.lifecycle_version = "2.2.0"
|
||||
ext.moshi = '1.8.0'
|
||||
ext.retrofit = '2.6.0'
|
||||
|
@ -14,7 +14,7 @@ buildscript {
|
|||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath 'com.android.tools.build:gradle:4.1.1'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
|
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -1,6 +1,6 @@
|
|||
#Sat May 30 16:13:44 MST 2020
|
||||
#Sun Dec 20 20:40:30 MST 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
|
||||
|
|
Loading…
Reference in a new issue