From dae7091fde85ce9f2e99f54e432005c52f2c303c Mon Sep 17 00:00:00 2001 From: Brian Yencho Date: Tue, 24 Oct 2023 09:11:07 -0500 Subject: [PATCH] Update the formatting of non-resource files (#153) --- app/src/main/AndroidManifest.xml | 8 +++++--- app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt | 2 +- .../network/interceptor/AuthTokenInterceptor.kt | 1 + .../x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt | 1 + .../bitwarden/ui/auth/feature/login/LoginViewModel.kt | 5 ++++- .../ui/platform/feature/rootnav/RootNavViewModel.kt | 2 +- .../test/java/com/x8bit/bitwarden/MainViewModelTest.kt | 2 +- .../network/serializer/LocalDateTimeSerializerTest.kt | 1 + .../bitwarden/ui/auth/feature/login/LoginViewModelTest.kt | 2 +- .../ui/platform/feature/rootnav/RootNavViewModelTest.kt | 2 +- 10 files changed, 17 insertions(+), 9 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index de3400d13..6d05f4a76 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,8 +15,8 @@ tools:targetApi="31"> @@ -25,11 +25,13 @@ + + + android:host="captcha-callback" + android:scheme="bitwarden" /> diff --git a/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt index abd63484b..26b0154c9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/MainViewModel.kt @@ -2,8 +2,8 @@ package com.x8bit.bitwarden import android.content.Intent import androidx.lifecycle.ViewModel -import com.x8bit.bitwarden.data.auth.repository.util.getCaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.AuthRepository +import com.x8bit.bitwarden.data.auth.repository.util.getCaptchaCallbackTokenResult import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/interceptor/AuthTokenInterceptor.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/interceptor/AuthTokenInterceptor.kt index 154037453..c0e063010 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/interceptor/AuthTokenInterceptor.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/network/interceptor/AuthTokenInterceptor.kt @@ -4,6 +4,7 @@ import okhttp3.Interceptor import okhttp3.Response import java.io.IOException import javax.inject.Singleton + /** * Interceptor responsible for adding the auth token(Bearer) to API requests. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt index 3bc3f4d19..17b64333f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginScreen.kt @@ -52,6 +52,7 @@ fun LoginScreen( is LoginEvent.NavigateToCaptcha -> { intentHandler.startCustomTabsActivity(uri = event.uri) } + is LoginEvent.ShowToast -> { Toast.makeText(context, event.message, Toast.LENGTH_SHORT).show() } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModel.kt index ec2973a81..6e4f81ed4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModel.kt @@ -7,10 +7,10 @@ import android.os.Parcelable import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.data.auth.repository.model.LoginResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.generateUriForCaptcha -import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.ui.platform.base.BaseViewModel import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.BasicDialogState @@ -73,6 +73,7 @@ class LoginViewModel @Inject constructor( is LoginAction.Internal.ReceiveCaptchaToken -> { handleCaptchaTokenReceived(action.tokenResult) } + is LoginAction.Internal.ReceiveLoginResult -> { handleReceiveLoginResult(action = action) } @@ -89,6 +90,7 @@ class LoginViewModel @Inject constructor( ), ) } + is LoginResult.Error -> { mutableStateFlow.update { it.copy( @@ -101,6 +103,7 @@ class LoginViewModel @Inject constructor( ) } } + is LoginResult.Success -> { mutableStateFlow.update { it.copy(loadingDialogState = LoadingDialogState.Hidden) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt index b72270760..a5b03d281 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt @@ -3,8 +3,8 @@ package com.x8bit.bitwarden.ui.platform.feature.rootnav import android.os.Parcelable import androidx.lifecycle.SavedStateHandle import androidx.lifecycle.viewModelScope -import com.x8bit.bitwarden.data.auth.repository.model.AuthState import com.x8bit.bitwarden.data.auth.repository.AuthRepository +import com.x8bit.bitwarden.data.auth.repository.model.AuthState import com.x8bit.bitwarden.ui.platform.base.BaseViewModel import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.launchIn diff --git a/app/src/test/java/com/x8bit/bitwarden/MainViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/MainViewModelTest.kt index b997fa2a7..da6c70f91 100644 --- a/app/src/test/java/com/x8bit/bitwarden/MainViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/MainViewModelTest.kt @@ -1,8 +1,8 @@ package com.x8bit.bitwarden import android.content.Intent -import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.AuthRepository +import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import io.mockk.every import io.mockk.mockk import io.mockk.mockkStatic diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/network/serializer/LocalDateTimeSerializerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/network/serializer/LocalDateTimeSerializerTest.kt index 62c04e25d..9c11150f2 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/network/serializer/LocalDateTimeSerializerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/network/serializer/LocalDateTimeSerializerTest.kt @@ -38,6 +38,7 @@ class LocalDateTimeSerializerTest { ), ) } + @Test fun `properly deserializes raw JSON with nano seconds to LocalDate`() { assertEquals( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModelTest.kt index 59f749eec..36370df52 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/login/LoginViewModelTest.kt @@ -4,10 +4,10 @@ import android.net.Uri import androidx.lifecycle.SavedStateHandle import app.cash.turbine.test import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.data.auth.repository.model.LoginResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.generateUriForCaptcha -import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.ui.platform.base.BaseViewModelTest import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.BasicDialogState diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt index 4c35830ff..b6bbcb2b0 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModelTest.kt @@ -1,10 +1,10 @@ package com.x8bit.bitwarden.ui.platform.feature.rootnav import androidx.lifecycle.SavedStateHandle +import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.data.auth.repository.model.AuthState import com.x8bit.bitwarden.data.auth.repository.model.AuthState.Authenticated import com.x8bit.bitwarden.data.auth.repository.model.AuthState.Unauthenticated -import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.ui.platform.base.BaseViewModelTest import io.mockk.every import io.mockk.mockk