From 818404dce34bf3a4915e52dd58ead8b1a89d403d Mon Sep 17 00:00:00 2001 From: Subhradeep Date: Mon, 16 Oct 2023 16:29:57 +0530 Subject: [PATCH] Fix and format the code --- config/detekt/config.yml | 4 ++-- .../ivy/onboarding/OnboardingDetailState.kt | 2 -- .../com/ivy/onboarding/OnboardingScreen.kt | 22 ++++++++----------- .../onboarding/viewmodel/OnboardingRouter.kt | 9 ++++---- .../viewmodel/OnboardingViewModel.kt | 13 ----------- 5 files changed, 15 insertions(+), 35 deletions(-) diff --git a/config/detekt/config.yml b/config/detekt/config.yml index 279850b169..380130091e 100644 --- a/config/detekt/config.yml +++ b/config/detekt/config.yml @@ -106,7 +106,7 @@ complexity: ignoreOverloaded: false CyclomaticComplexMethod: active: true - threshold: 15 + threshold: 20 ignoreSingleWhenExpression: false ignoreSimpleWhenEntries: false ignoreNestingFunctions: false @@ -313,7 +313,7 @@ naming: ConstructorParameterNaming: active: true parameterPattern: '[a-z][A-Za-z0-9]*' - privateParameterPattern: '[a-z][A-Za-z0-9]*' + privateParameterPattern: '_?[a-z][A-Za-z0-9]*' excludeClassPattern: '$^' EnumNaming: active: true diff --git a/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingDetailState.kt b/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingDetailState.kt index 9b31891cd0..9c4d72b01f 100644 --- a/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingDetailState.kt +++ b/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingDetailState.kt @@ -1,11 +1,9 @@ package com.ivy.onboarding import androidx.compose.runtime.Immutable -import androidx.lifecycle.MutableLiveData import com.ivy.legacy.data.model.AccountBalance import com.ivy.legacy.datamodel.Category import com.ivy.legacy.utils.OpResult -import com.ivy.legacy.utils.asLiveData import com.ivy.wallet.domain.data.IvyCurrency import com.ivy.wallet.domain.deprecated.logic.model.CreateAccountData import com.ivy.wallet.domain.deprecated.logic.model.CreateCategoryData diff --git a/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingScreen.kt b/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingScreen.kt index f2dc18834f..a2d105fe17 100644 --- a/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingScreen.kt +++ b/screen-onboarding/src/main/java/com/ivy/onboarding/OnboardingScreen.kt @@ -5,10 +5,7 @@ import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.BoxWithConstraintsScope import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.livedata.observeAsState -import androidx.compose.ui.tooling.preview.Preview import androidx.lifecycle.viewmodel.compose.viewModel -import com.ivy.legacy.IvyWalletPreview import com.ivy.legacy.data.model.AccountBalance import com.ivy.navigation.OnboardingScreen import com.ivy.onboarding.steps.OnboardingAccounts @@ -18,7 +15,6 @@ import com.ivy.onboarding.steps.OnboardingSplashLogin import com.ivy.onboarding.steps.OnboardingType import com.ivy.onboarding.viewmodel.OnboardingViewModel import com.ivy.wallet.domain.data.IvyCurrency -import com.ivy.legacy.datamodel.Account import com.ivy.legacy.datamodel.Category import com.ivy.wallet.domain.deprecated.logic.model.CreateAccountData import com.ivy.wallet.domain.deprecated.logic.model.CreateCategoryData @@ -178,10 +174,10 @@ private fun BoxWithConstraintsScope.UI( } } -//@ExperimentalFoundationApi -//@Preview -//@Composable -//private fun PreviewOnboarding() { +// @ExperimentalFoundationApi +// @Preview +// @Composable +// private fun PreviewOnboarding() { // IvyWalletPreview { // UI( // accountSuggestions = listOf(), @@ -193,10 +189,10 @@ private fun BoxWithConstraintsScope.UI( // onboardingState = OnboardingState.SPLASH, // currency = IvyCurrency.getDefault(), // opGoogleSignIn = null, -//// -//// onLoginWithGoogle = {}, -//// onSkip = {}, -//// onSetCurrency = {}, +// +// onLoginWithGoogle = {}, +// onSkip = {}, +// onSetCurrency = {}, // ) // } -//} +// } diff --git a/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingRouter.kt b/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingRouter.kt index 8c87c4c487..653c03c4d7 100644 --- a/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingRouter.kt +++ b/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingRouter.kt @@ -1,12 +1,13 @@ package com.ivy.onboarding.viewmodel import androidx.compose.runtime.MutableState -import androidx.lifecycle.MutableLiveData -import com.ivy.legacy.datamodel.Category -import com.ivy.legacy.datamodel.temp.toDomain +import com.ivy.data.db.dao.read.AccountDao +import com.ivy.data.db.dao.read.CategoryDao import com.ivy.legacy.LogoutLogic import com.ivy.legacy.data.SharedPrefs import com.ivy.legacy.data.model.AccountBalance +import com.ivy.legacy.datamodel.Category +import com.ivy.legacy.datamodel.temp.toDomain import com.ivy.legacy.domain.action.exchange.SyncExchangeRatesAct import com.ivy.legacy.utils.OpResult import com.ivy.legacy.utils.ioThread @@ -15,8 +16,6 @@ import com.ivy.navigation.MainScreen import com.ivy.navigation.Navigation import com.ivy.navigation.OnboardingScreen import com.ivy.onboarding.OnboardingState -import com.ivy.data.db.dao.read.AccountDao -import com.ivy.data.db.dao.read.CategoryDao import com.ivy.wallet.domain.data.IvyCurrency import com.ivy.wallet.domain.deprecated.logic.PreloadDataLogic import com.ivy.wallet.domain.deprecated.logic.model.CreateAccountData diff --git a/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingViewModel.kt b/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingViewModel.kt index 663f8ae1cc..50cbe075ce 100644 --- a/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingViewModel.kt +++ b/screen-onboarding/src/main/java/com/ivy/onboarding/viewmodel/OnboardingViewModel.kt @@ -71,23 +71,12 @@ class OnboardingViewModel @Inject constructor( val state: State = _state private val _currency = mutableStateOf(IvyCurrency.getDefault()) -// val currency = _currency.asLiveData() - private val _opGoogleSignIn = mutableStateOf?>(null) -// val opGoogleSignIn = _opGoogleSignIn.asLiveData() - private val _accounts = mutableStateOf(listOf().toImmutableList()) -// val accounts = _accounts.asLiveData() - private val _accountSuggestions = mutableStateOf(listOf().toImmutableList()) -// val accountSuggestions = _accountSuggestions.asLiveData() - private val _categories = mutableStateOf(listOf().toImmutableList()) -// val categories = _categories.asLiveData() - private val _categorySuggestions = mutableStateOf(listOf().toImmutableList()) -// val categorySuggestions = _categorySuggestions.asLiveData() @Composable override fun uiState(): OnboardingDetailState { @@ -275,7 +264,6 @@ class OnboardingViewModel @Inject constructor( // --------------------- Accounts --------------------------------------------------------------- private suspend fun editAccount(account: Account, newBalance: Double) { - TestIdlingResource.increment() accountCreator.editAccount(account, newBalance) { @@ -283,7 +271,6 @@ class OnboardingViewModel @Inject constructor( } TestIdlingResource.decrement() - } private suspend fun createAccount(data: CreateAccountData) {