Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix and format the code
Browse files Browse the repository at this point in the history
  • Loading branch information
beradeep committed Oct 16, 2023
1 parent 75a76d2 commit 818404d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 35 deletions.
4 changes: 2 additions & 2 deletions config/detekt/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ complexity:
ignoreOverloaded: false
CyclomaticComplexMethod:
active: true
threshold: 15
threshold: 20
ignoreSingleWhenExpression: false
ignoreSimpleWhenEntries: false
ignoreNestingFunctions: false
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -178,10 +174,10 @@ private fun BoxWithConstraintsScope.UI(
}
}

//@ExperimentalFoundationApi
//@Preview
//@Composable
//private fun PreviewOnboarding() {
// @ExperimentalFoundationApi
// @Preview
// @Composable
// private fun PreviewOnboarding() {
// IvyWalletPreview {
// UI(
// accountSuggestions = listOf(),
Expand All @@ -193,10 +189,10 @@ private fun BoxWithConstraintsScope.UI(
// onboardingState = OnboardingState.SPLASH,
// currency = IvyCurrency.getDefault(),
// opGoogleSignIn = null,
////
//// onLoginWithGoogle = {},
//// onSkip = {},
//// onSetCurrency = {},
//
// onLoginWithGoogle = {},
// onSkip = {},
// onSetCurrency = {},
// )
// }
//}
// }
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,12 @@ class OnboardingViewModel @Inject constructor(
val state: State<OnboardingState> = _state

private val _currency = mutableStateOf(IvyCurrency.getDefault())
// val currency = _currency.asLiveData()

private val _opGoogleSignIn = mutableStateOf<OpResult<Unit>?>(null)
// val opGoogleSignIn = _opGoogleSignIn.asLiveData()

private val _accounts = mutableStateOf(listOf<AccountBalance>().toImmutableList())
// val accounts = _accounts.asLiveData()

private val _accountSuggestions = mutableStateOf(listOf<CreateAccountData>().toImmutableList())
// val accountSuggestions = _accountSuggestions.asLiveData()

private val _categories = mutableStateOf(listOf<Category>().toImmutableList())
// val categories = _categories.asLiveData()

private val _categorySuggestions =
mutableStateOf(listOf<CreateCategoryData>().toImmutableList())
// val categorySuggestions = _categorySuggestions.asLiveData()

@Composable
override fun uiState(): OnboardingDetailState {
Expand Down Expand Up @@ -275,15 +264,13 @@ class OnboardingViewModel @Inject constructor(

// --------------------- Accounts ---------------------------------------------------------------
private suspend fun editAccount(account: Account, newBalance: Double) {

TestIdlingResource.increment()

accountCreator.editAccount(account, newBalance) {
_accounts.value = accountsWithBalance()
}

TestIdlingResource.decrement()

}

private suspend fun createAccount(data: CreateAccountData) {
Expand Down

0 comments on commit 818404d

Please sign in to comment.