diff --git a/detekt-config.yml b/detekt-config.yml index aca995b2..43e385d1 100644 --- a/detekt-config.yml +++ b/detekt-config.yml @@ -67,7 +67,10 @@ complexity: threshold: 150 LongMethod: active: true - threshold: 30 + threshold: 20 + excludes: &testFolders + - '**/commonTest/**' + - '**/androidTest/**' LongParameterList: active: true threshold: 5 @@ -298,9 +301,7 @@ style: maxLineLength: 120 excludePackageStatements: false excludeImportStatements: false - excludes: &testFolders - - '**/commonTest/**' - - '**/androidTest/**' + excludes: *testFolders ModifierOrder: active: true NestedClassesVisibility: diff --git a/iosApp/tools/sourcery/templates/AutoMockable.stencil b/iosApp/tools/sourcery/templates/AutoMockable.stencil index 9d3fbf6f..0f326092 100644 --- a/iosApp/tools/sourcery/templates/AutoMockable.stencil +++ b/iosApp/tools/sourcery/templates/AutoMockable.stencil @@ -1,10 +1,10 @@ import Foundation +import UserNotifications #if os(iOS) || os(tvOS) || os(watchOS) import UIKit #elseif os(OSX) import AppKit #endif -import UserNotifications {% for import in argument.autoMockableTestableImports %} @testable import {{ import }} diff --git a/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/di/koin/modules/ViewModelModule.kt b/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/di/koin/modules/ViewModelModule.kt index 7788fa2a..91a201b9 100644 --- a/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/di/koin/modules/ViewModelModule.kt +++ b/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/di/koin/modules/ViewModelModule.kt @@ -2,9 +2,11 @@ package co.nimblehq.blisskmmic.di.koin.modules import co.nimblehq.blisskmmic.presentation.modules.login.LoginViewModel import co.nimblehq.blisskmmic.presentation.modules.resetpassword.ResetPasswordViewModel +import org.koin.core.module.dsl.singleOf import org.koin.dsl.module val viewModelModule = module { - single { LoginViewModel(get()) } - single { ResetPasswordViewModel(get()) } + + singleOf(::LoginViewModel) + singleOf(::ResetPasswordViewModel) } diff --git a/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/presentation/modules/resetpassword/ResetPasswordViewModel.kt b/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/presentation/modules/resetpassword/ResetPasswordViewModel.kt index 42362010..6c6d56ae 100644 --- a/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/presentation/modules/resetpassword/ResetPasswordViewModel.kt +++ b/shared/src/commonMain/kotlin/co/nimblehq/blisskmmic/presentation/modules/resetpassword/ResetPasswordViewModel.kt @@ -33,12 +33,8 @@ class ResetPasswordViewModel( setStateLoading() viewModelScope.launch { resetPasswordUseCase(email) - .catch { error -> - catchResetPasswordError(error) - } - .collect { _ -> - resetPasswordSuccess() - } + .catch { handleResetPasswordError(it) } + .collect { _ -> resetPasswordSuccess() } } } @@ -48,7 +44,7 @@ class ResetPasswordViewModel( } } - private fun catchResetPasswordError(error: Throwable) { + private fun handleResetPasswordError(error: Throwable) { mutableViewState.update { ResetPasswordViewState(error.toErrorMessage()) }