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

Commit

Permalink
fix detekt
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacnguyen0809 committed Sep 16, 2024
1 parent a7a0530 commit ffd5332
Show file tree
Hide file tree
Showing 22 changed files with 54 additions and 113 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/compose_screenshot_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Compose preview screenshot tests
run: ./gradlew :shared:ui:testing:validateDebugScreenshotTest
run: ./gradlew :screen:disclaimer:validateDebugScreenshotTest

- name: Upload build reports
uses: actions/upload-artifact@v4
if: always()
with:
name: my-artifact
path: shared/ui/testing/build/reports
path: screen/disclaimer/build/reports
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/BuildConfigConstants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object BuildConfigConstants {
const val IMAGE_DIFFERENCE_THRESHOLD = 0.06f
}
3 changes: 0 additions & 3 deletions buildSrc/src/main/kotlin/Constants.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.ivy.base.legacy.Theme
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.navigation.IvyPreview
import com.ivy.navigation.Navigation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ private fun Preview_Budgets(theme: Theme = Theme.LIGHT) {
}
}


/** For screenshot testing */
@Composable
fun BudgetScreenUiTest(isDark: Boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,14 @@ private fun SelectTypeButton(
}
}

@Suppress("UnusedPrivateMember")
@IvyPreviews
@Composable
private fun PreviewCategoriesCompactModeEnabled(theme: Theme = Theme.LIGHT) {
Preview(theme = theme, compactModeEnabled = true)
}

@Suppress("UnusedPrivateMember")
@IvyPreviews
@Composable
private fun PreviewCategoriesCompactModeEnabledAndSearchBarEnabled(theme: Theme = Theme.LIGHT) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.base.legacy.Theme
import com.ivy.base.model.TransactionType
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ private fun FeatureRow(
}
}


@IvyPreviews
@Composable
private fun FeatureScreenPreview(isDark: Boolean = false) {
Expand Down Expand Up @@ -202,4 +201,3 @@ private fun FeatureScreenPreview(isDark: Boolean = false) {
fun FeatureScreenUiTest(isDark: Boolean) {
FeatureScreenPreview(isDark)
}

Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.viewmodel.compose.viewModel
import com.ivy.base.legacy.Theme
import com.ivy.data.backup.ImportResult
import com.ivy.importdata.csvimport.flow.ImportFrom
import com.ivy.importdata.csvimport.flow.ImportProcessing
import com.ivy.importdata.csvimport.flow.ImportResultUI
import com.ivy.importdata.csvimport.flow.instructions.ImportInstructions
import com.ivy.legacy.IvyWalletPreview
import com.ivy.legacy.domain.deprecated.logic.csv.model.ImportType
import com.ivy.navigation.ImportScreen
import com.ivy.onboarding.viewmodel.OnboardingViewModel
import com.ivy.data.backup.ImportResult
import com.ivy.legacy.IvyWalletPreview
import com.ivy.ui.annotation.IvyPreviews

@OptIn(ExperimentalStdlibApi::class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.ivy.base.legacy.Theme
Expand Down Expand Up @@ -103,10 +102,11 @@ fun BoxWithConstraintsScope.LoanDetailsScreen(screen: LoanDetailsScreen) {
)
}

@Suppress("LongMethod")
@Composable
private fun BoxWithConstraintsScope.UI(
state: LoanDetailsScreenState,
onEventHandler: (LoanDetailsScreenEvent) -> Unit = {}
onEventHandler: (LoanDetailsScreenEvent) -> Unit = {},
) {
val itemColor = state.loan?.color?.toComposeColor() ?: Gray

Expand Down Expand Up @@ -203,17 +203,24 @@ private fun BoxWithConstraintsScope.UI(
}

LoanModal(
modal = state.loanModalData, onCreateLoan = {
// do nothing
}, onEditLoan = { loan, createLoanTransaction ->
onEventHandler.invoke(LoanModalEvent.OnEditLoanModal(loan, createLoanTransaction))
}, dismiss = {
onEventHandler.invoke(LoanModalEvent.OnDismissLoanModal)
}, onCreateAccount = { createAccountData ->
onEventHandler.invoke(LoanDetailsScreenEvent.OnCreateAccount(createAccountData))
}, accounts = state.accounts, onPerformCalculations = {
onEventHandler.invoke(LoanModalEvent.PerformCalculation)
}, dateTime = state.dateTime,
modal = state.loanModalData,
onCreateLoan = {
// do nothing
},
onEditLoan = { loan, createLoanTransaction ->
onEventHandler.invoke(LoanModalEvent.OnEditLoanModal(loan, createLoanTransaction))
},
dismiss = {
onEventHandler.invoke(LoanModalEvent.OnDismissLoanModal)
},
onCreateAccount = { createAccountData ->
onEventHandler.invoke(LoanDetailsScreenEvent.OnCreateAccount(createAccountData))
},
accounts = state.accounts,
onPerformCalculations = {
onEventHandler.invoke(LoanModalEvent.PerformCalculation)
},
dateTime = state.dateTime,
onSetDate = {
onEventHandler.invoke(LoanModalEvent.OnChangeDate)
},
Expand All @@ -223,17 +230,23 @@ private fun BoxWithConstraintsScope.UI(
)

LoanRecordModal(
modal = state.loanRecordModalData, onCreate = {
onEventHandler.invoke(LoanRecordModalEvent.OnCreateLoanRecord(it))
}, onEdit = {
onEventHandler.invoke(LoanRecordModalEvent.OnEditLoanRecord(it))
}, onDelete = { loanRecord ->
onEventHandler.invoke(LoanRecordModalEvent.OnDeleteLoanRecord(loanRecord))
}, accounts = state.accounts, dismiss = {
onEventHandler.invoke(LoanRecordModalEvent.OnDismissLoanRecord)
}, onCreateAccount = { createAccountData ->
onEventHandler.invoke(LoanDetailsScreenEvent.OnCreateAccount(createAccountData))
},
modal = state.loanRecordModalData,
onCreate = {
onEventHandler.invoke(LoanRecordModalEvent.OnCreateLoanRecord(it))
},
onEdit = {
onEventHandler.invoke(LoanRecordModalEvent.OnEditLoanRecord(it))
},
onDelete = { loanRecord ->
onEventHandler.invoke(LoanRecordModalEvent.OnDeleteLoanRecord(loanRecord))
},
accounts = state.accounts,
dismiss = {
onEventHandler.invoke(LoanRecordModalEvent.OnDismissLoanRecord)
},
onCreateAccount = { createAccountData ->
onEventHandler.invoke(LoanDetailsScreenEvent.OnCreateAccount(createAccountData))
},
dateTime = state.dateTime,
onSetDate = {
onEventHandler.invoke(LoanRecordModalEvent.OnChangeDate)
Expand Down Expand Up @@ -273,7 +286,7 @@ private fun Header(
onDeleteLoan: () -> Unit,
loanAmountPaid: Double = 0.0,
selectedLoanAccount: Account? = null,
onAddRecord: () -> Unit
onAddRecord: () -> Unit,
) {
val contrastColor = findContrastTextColor(itemColor)

Expand Down Expand Up @@ -398,7 +411,7 @@ private fun LoanInfoCard(
loanAmountPaid: Double = 0.0,
selectedLoanAccount: Account? = null,

onAddRecord: () -> Unit
onAddRecord: () -> Unit,
) {
val backgroundColor = if (isDarkColor(loan.color)) {
MediumBlack.copy(alpha = 0.9f)
Expand Down Expand Up @@ -620,7 +633,7 @@ private fun LoanInfoCard(
fun LazyListScope.loanRecords(
loan: Loan,
displayLoanRecords: List<DisplayLoanRecord> = emptyList(),
onClick: (DisplayLoanRecord) -> Unit
onClick: (DisplayLoanRecord) -> Unit,
) {
items(items = displayLoanRecords) { displayLoanRecord ->
LoanRecordItem(
Expand All @@ -644,7 +657,7 @@ private fun LoanRecordItem(
baseCurrency: String,
loanBaseCurrency: String = "",
account: Account? = null,
onClick: () -> Unit
onClick: () -> Unit,
) {
val nav = navigation()
Column(
Expand Down Expand Up @@ -890,6 +903,7 @@ private fun NoLoanRecordsEmptyState() {
}
}

@Suppress("UnusedPrivateMember")
@IvyPreviews
@Composable
private fun Preview_Empty() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.base.legacy.Theme
import com.ivy.data.model.Category
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.base.legacy.Theme
import com.ivy.design.l0_system.UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,20 @@ import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.base.legacy.Theme
import com.ivy.base.model.TransactionType
import com.ivy.data.model.Category
import com.ivy.data.model.IntervalType
import com.ivy.legacy.IvyWalletPreview
import com.ivy.legacy.datamodel.Account
import com.ivy.legacy.ui.component.edit.core.Description
import com.ivy.legacy.utils.onScreenStart
import com.ivy.navigation.EditPlannedScreen
import com.ivy.navigation.screenScopedViewModel
import com.ivy.ui.R
import com.ivy.wallet.ui.edit.core.Category
import com.ivy.legacy.ui.component.edit.core.Description
import com.ivy.ui.annotation.IvyPreviews
import com.ivy.wallet.ui.edit.core.Category
import com.ivy.wallet.ui.edit.core.EditBottomSheet
import com.ivy.wallet.ui.edit.core.Title
import com.ivy.wallet.ui.edit.core.Toolbar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.ivy.base.legacy.Theme
import com.ivy.base.model.TransactionType
Expand All @@ -25,7 +24,6 @@ import com.ivy.design.l0_system.style
import com.ivy.legacy.IvyWalletPreview
import com.ivy.legacy.datamodel.Account
import com.ivy.legacy.datamodel.PlannedPaymentRule
import com.ivy.legacy.utils.timeNowUTC
import com.ivy.navigation.EditPlannedScreen
import com.ivy.navigation.PlannedPaymentsScreen
import com.ivy.navigation.navigation
Expand All @@ -37,7 +35,6 @@ import com.ivy.wallet.ui.theme.Green
import com.ivy.wallet.ui.theme.Orange
import kotlinx.collections.immutable.persistentListOf
import java.time.Instant
import java.time.ZoneOffset
import java.util.UUID

@Composable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fun BoxWithConstraintsScope.ReportScreen(
)
}

@Suppress("LongMethod")
@ExperimentalFoundationApi
@Composable
private fun BoxWithConstraintsScope.UI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.ivy.transactions

import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxWithConstraintsScope
Expand Down
33 changes: 0 additions & 33 deletions shared/ui/core/src/test/java/com/ivy/ui/PaparazziScreenshotTest.kt

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

0 comments on commit ffd5332

Please sign in to comment.