From 6f87da586951b31826925c4f07260488abc2bb37 Mon Sep 17 00:00:00 2001 From: Sk Niyaj Ali Date: Thu, 8 Aug 2024 17:53:43 +0530 Subject: [PATCH] Refactor: dependencies to version catalog and remove unused files (#1717) --- build.gradle.kts | 48 +- config/detekt/detekt.yml | 846 ++++++++++-------- .../mifospay/core/analytics/AnalyticsEvent.kt | 1 + .../analytics/di/FirebaseAnalyticsHelper.kt | 2 +- .../mifospay/analytics/ExampleUnitTest.kt | 5 +- .../org/mifospay/common/CreditCardUtils.kt | 12 +- .../kotlin/org/mifospay/common/FileUtils.kt | 8 +- .../org/mifospay/common/ExampleUnitTest.kt | 3 +- core/data/build.gradle.kts | 2 +- .../domain/usecase/account/TransferFunds.kt | 13 +- .../domain/usecase/client/CreateClient.kt | 2 +- .../domain/usecase/client/UpdateClient.kt | 2 +- .../domain/usecase/invoice/FetchInvoice.kt | 4 +- .../data/domain/usecase/user/CreateUser.kt | 4 +- .../data/domain/usecase/user/UpdateUser.kt | 4 +- .../fineract/repository/FineractRepository.kt | 1 + .../local/MifosLocalAssetRepository.kt | 2 +- .../core/data/util/ErrorJsonMessageHelper.kt | 4 +- .../core/datastore/ExampleUnitTest.kt | 3 +- core/designsystem/build.gradle.kts | 4 +- .../designsystem/component/BottomSheet.kt | 6 +- .../core/designsystem/component/Button.kt | 1 + .../designsystem/component/MifosScaffold.kt | 14 +- .../designsystem/component/PermissionBox.kt | 7 +- .../{Background.kt => BackgroundTheme.kt} | 0 .../theme/{Gradient.kt => GradientColors.kt} | 0 .../mifospay/core/designsystem/theme/Theme.kt | 1 + .../theme/{Tint.kt => TintTheme.kt} | 0 .../designsystem/utils/ExpirationDateMask.kt | 1 + .../mobilewallet/model/ExampleUnitTest.kt | 3 +- .../core/network/JvmLocalAssetManager.kt | 2 +- .../mifospay/core/network/di/LocalModule.kt | 4 +- .../mifospay/core/network/di/NetworkModule.kt | 3 +- .../LocalAssetDataSource.kt | 2 +- .../LocalAssetManager.kt | 2 +- .../MifosLocalAssetDataSource.kt | 5 +- .../core/network/services/RunReportService.kt | 1 + .../mifospay/network/ExampleUnitTest.kt | 3 +- .../org/mifospay/core/ui/ExpiryDateInput.kt | 2 +- .../mifospay/ui/ExampleUnitTest.kt | 3 +- feature/accounts/build.gradle.kts | 2 +- .../choose/sim/ChooseSimDialogSheet.kt | 88 +- .../accounts/link/LinkBankAccountScreen.kt | 28 +- .../feature/bank/accounts/ExampleUnitTest.kt | 3 +- feature/auth/build.gradle.kts | 16 +- .../feature/auth/login/LoginScreen.kt | 6 +- .../MobileVerificationScreen.kt | 2 +- .../MobileVerificationViewModel.kt | 6 +- .../auth/navigation/LoginScreenNavigation.kt | 1 + .../MobileVerificationScreenNavigation.kt | 2 +- .../auth/navigation/SignupScreenNavigation.kt | 8 +- .../feature/auth/signup/SignupScreen.kt | 7 +- .../feature/auth/signup/SignupViewModel.kt | 8 +- .../SocialSignupMethodScreen.kt | 5 +- .../mifospay/auth/ExampleUnitTest.kt | 3 +- .../editpassword/EditPasswordScreen.kt | 4 +- .../editpassword/EditPasswordViewModel.kt | 1 + .../feature/editpassword/ExampleUnitTest.kt | 3 +- feature/faq/build.gradle.kts | 4 +- .../org/mifospay/feature/faq/FAQViewModel.kt | 1 - .../org/mifospay/feature/faq/FaqScreen.kt | 1 - .../java/com/example/faq/ExampleUnitTest.kt | 3 +- .../mifospay/feature/finance/FinanceScreen.kt | 3 +- .../feature/finance/ExampleUnitTest.kt | 3 +- .../mifospay/feature/TransactionsHistory.kt | 3 +- .../mifospay/feature/history/HistoryScreen.kt | 13 +- .../org/mifospay/history/ExampleUnitTest.kt | 3 +- .../mifospay/feature/home/ExampleUnitTest.kt | 3 +- feature/invoices/build.gradle.kts | 1 - .../feature/invoices/InvoiceDetailScreen.kt | 3 +- .../org/mifospay/invoices/ExampleUnitTest.kt | 3 +- feature/kyc/build.gradle.kts | 1 + .../mifospay/feature/kyc/KYCLevel2Screen.kt | 1 + .../feature/kyc/KYCLevel3ViewModel.kt | 1 + .../java/org/mifospay/kyc/ExampleUnitTest.kt | 3 +- .../feature/make/transfer/ExampleUnitTest.kt | 3 +- .../feature/merchants/ExampleUnitTest.kt | 3 +- .../mifospay/notification/ExampleUnitTest.kt | 3 +- .../feature/passcode/ExampleUnitTest.kt | 3 +- .../org/mifospay/payments/ExampleUnitTest.kt | 3 +- feature/profile/build.gradle.kts | 3 +- .../org/mifospay/profile/ExampleUnitTest.kt | 3 +- feature/qr/build.gradle.kts | 10 +- .../mifospay/feature/read/qr/ReadQrScreen.kt | 4 +- .../feature/read/qr/utils/QrCodeAnalyzer.kt | 3 +- .../mifospay/feature/qr/ExampleUnitTest.kt | 3 +- feature/receipt/build.gradle.kts | 4 +- .../mifospay/feature/receipt/ReceiptScreen.kt | 1 + .../org/mifospay/receipt/ExampleUnitTest.kt | 3 +- feature/request-money/build.gradle.kts | 1 - .../request/money/PayVpaMobileScreen.kt | 1 + .../feature/request/money/SetAmountDialog.kt | 2 +- .../feature/request/money/ShowQrContent.kt | 1 + .../feature/request/money/util/ImageUtils.kt | 3 +- .../feature/savedcards/AddCardDialogSheet.kt | 2 +- .../feature/savedcards/CardsScreen.kt | 8 +- .../mifospay/savedcards/ExampleUnitTest.kt | 3 +- feature/send-money/build.gradle.kts | 2 +- .../feature/send/money/SendScreenRoute.kt | 35 +- .../feature/send/money/ExampleUnitTest.kt | 3 +- feature/settings/build.gradle.kts | 5 +- .../settings/navigation/SettingsNavigation.kt | 6 +- .../feature/settings/ExampleUnitTest.kt | 3 +- .../standing/instruction/SIDetailsScreen.kt | 1 + .../standing/instruction/ExampleUnitTest.kt | 3 +- feature/upi-setup/build.gradle.kts | 3 - .../ExampleInstrumentedTest.kt | 2 +- .../navigation/SetupUpiPinNavigation.kt | 4 +- .../screens/DebitCardScreen.kt | 6 +- .../screens/DebitCardScreenContent.kt | 13 +- .../screens/OtpScreen.kt | 14 +- .../screens/SetUpUPiPinScreen.kt | 8 +- .../screens/SetUpUpiScreenContent.kt | 12 +- .../screens/UpiPinScreen.kt | 81 +- .../viewmodel/DebitCardViewModal.kt | 3 +- .../viewmodel/SetUpUpiViewModal.kt | 3 +- .../ExampleUnitTest.kt | 5 +- gradle/libs.versions.toml | 22 +- mifospay/build.gradle.kts | 83 +- .../prodReleaseRuntimeClasspath.txt | 44 +- .../main/java/org/mifospay/MainActivity.kt | 5 +- .../src/main/java/org/mifospay/MifosPayApp.kt | 2 - .../java/org/mifospay/base/BaseFragment.kt | 2 +- .../org/mifospay/common/ui/SearchActivity.kt | 2 - .../common/ui/adapter/SearchAdapter.kt | 61 -- .../api/services/MifosPayMessagingService.kt | 1 + .../org/mifospay/navigation/MifosNavHost.kt | 6 +- .../src/main/java/org/mifospay/ui/MifosApp.kt | 8 +- .../main/java/org/mifospay/utils/FileUtils.kt | 239 ----- .../org/mifospay/utils/NotificationUtils.kt | 1 + .../main/java/org/mifospay/utils/Toaster.kt | 52 -- .../layout/activity_bank_account_detail.xml | 197 ---- .../res/layout/activity_bank_accounts.xml | 60 -- .../main/res/layout/activity_edit_profile.xml | 169 ---- .../src/main/res/layout/activity_invoice.xml | 172 ---- .../res/layout/activity_link_bank_account.xml | 123 --- .../src/main/res/layout/activity_login.xml | 20 - .../layout/activity_merchant_transaction.xml | 132 --- .../layout/activity_mobile_verification.xml | 19 - .../src/main/res/layout/activity_new_si.xml | 228 ----- .../src/main/res/layout/activity_read_qr.xml | 57 -- .../src/main/res/layout/activity_receipt.xml | 208 ----- .../src/main/res/layout/activity_search.xml | 45 - .../src/main/res/layout/activity_send.xml | 25 - .../src/main/res/layout/activity_settings.xml | 77 -- .../res/layout/activity_setup_upi_pin.xml | 168 ---- .../src/main/res/layout/activity_show_qr.xml | 62 -- .../main/res/layout/activity_si_details.xml | 292 ------ .../src/main/res/layout/activity_signup.xml | 312 ------- .../layout/activity_specific_transactions.xml | 41 - .../layout/activity_transaction_history.xml | 82 -- .../content_bottom_sheet_account_details.xml | 55 -- .../src/main/res/layout/dialog_add_card.xml | 135 --- .../layout/dialog_change_profile_picture.xml | 93 -- .../src/main/res/layout/dialog_set_amt.xml | 27 - .../main/res/layout/dialog_setup_upi_pin.xml | 201 ----- .../main/res/layout/dialog_setup_upi_pin2.xml | 14 - .../res/layout/dialog_transaction_detail.xml | 196 ---- .../src/main/res/layout/faq_list_child.xml | 16 - .../src/main/res/layout/faq_list_group.xml | 17 - .../src/main/res/layout/fragment_accounts.xml | 50 -- .../src/main/res/layout/fragment_cards.xml | 19 - .../main/res/layout/fragment_debit_card.xml | 73 -- .../src/main/res/layout/fragment_finance.xml | 9 - .../src/main/res/layout/fragment_history.xml | 80 -- .../src/main/res/layout/fragment_invoices.xml | 58 -- mifospay/src/main/res/layout/fragment_kyc.xml | 127 --- .../src/main/res/layout/fragment_kyc_desc.xml | 132 --- .../src/main/res/layout/fragment_kyc_lvl1.xml | 109 --- .../src/main/res/layout/fragment_kyc_lvl2.xml | 58 -- .../src/main/res/layout/fragment_kyc_lvl3.xml | 37 - .../res/layout/fragment_make_transfer.xml | 143 --- .../main/res/layout/fragment_merchants.xml | 65 -- mifospay/src/main/res/layout/fragment_otp.xml | 40 - .../src/main/res/layout/fragment_payments.xml | 9 - .../src/main/res/layout/fragment_profile.xml | 29 - .../src/main/res/layout/fragment_request.xml | 72 -- .../src/main/res/layout/fragment_send.xml | 225 ----- mifospay/src/main/res/layout/fragment_si.xml | 41 - .../res/layout/fragment_upi_pin_setup.xml | 41 - mifospay/src/main/res/layout/invoice_item.xml | 95 -- .../src/main/res/layout/item_bank_account.xml | 100 --- mifospay/src/main/res/layout/item_card.xml | 65 -- .../src/main/res/layout/item_casual_list.xml | 62 -- .../src/main/res/layout/item_merchant.xml | 34 - .../src/main/res/layout/item_other_banks.xml | 29 - .../main/res/layout/item_popular_banks.xml | 24 - mifospay/src/main/res/layout/item_search.xml | 14 - mifospay/src/main/res/layout/item_si.xml | 63 -- .../res/layout/item_specific_transaction.xml | 157 ---- .../src/main/res/layout/nav_drawer_header.xml | 52 -- .../src/main/res/layout/placeholder_state.xml | 42 - .../res/layout/profile_username_and_image.xml | 36 - .../main/res/layout/scrollable_tab_layout.xml | 29 - .../src/main/res/menu/menu_nav_drawer.xml | 26 - mifospay/src/main/res/menu/menu_overflow.xml | 14 - .../src/main/res/menu/menu_saved_card.xml | 14 - mifospay/src/main/res/menu/menu_share_qr.xml | 10 - .../src/main/res/menu/menu_si_details.xml | 11 - 199 files changed, 964 insertions(+), 6656 deletions(-) rename core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/{Background.kt => BackgroundTheme.kt} (100%) rename core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/{Gradient.kt => GradientColors.kt} (100%) rename core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/{Tint.kt => TintTheme.kt} (100%) rename core/network/src/main/kotlin/org/mifospay/core/network/{local_assets => localAssets}/LocalAssetDataSource.kt (87%) rename core/network/src/main/kotlin/org/mifospay/core/network/{local_assets => localAssets}/LocalAssetManager.kt (69%) rename core/network/src/main/kotlin/org/mifospay/core/network/{local_assets => localAssets}/MifosLocalAssetDataSource.kt (92%) rename feature/auth/src/main/kotlin/org/mifospay/feature/auth/{mobile_verify => mobileVerify}/MobileVerificationScreen.kt (99%) rename feature/auth/src/main/kotlin/org/mifospay/feature/auth/{mobile_verify => mobileVerify}/MobileVerificationViewModel.kt (95%) rename feature/auth/src/main/kotlin/org/mifospay/feature/auth/{social_signup => socialSignup}/SocialSignupMethodScreen.kt (98%) rename feature/upi-setup/src/androidTest/java/org/mifospay/feature/{upi_setup => upiSetup}/ExampleInstrumentedTest.kt (94%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/navigation/SetupUpiPinNavigation.kt (93%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/DebitCardScreen.kt (96%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/DebitCardScreenContent.kt (92%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/OtpScreen.kt (89%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/SetUpUPiPinScreen.kt (95%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/SetUpUpiScreenContent.kt (94%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/screens/UpiPinScreen.kt (74%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/viewmodel/DebitCardViewModal.kt (95%) rename feature/upi-setup/src/main/kotlin/org/mifospay/feature/{upi_setup => upiSetup}/viewmodel/SetUpUpiViewModal.kt (86%) rename feature/upi-setup/src/test/java/org/mifospay/feature/{upi_setup => upiSetup}/ExampleUnitTest.kt (79%) delete mode 100644 mifospay/src/main/java/org/mifospay/common/ui/adapter/SearchAdapter.kt delete mode 100644 mifospay/src/main/java/org/mifospay/utils/FileUtils.kt delete mode 100644 mifospay/src/main/java/org/mifospay/utils/Toaster.kt delete mode 100644 mifospay/src/main/res/layout/activity_bank_account_detail.xml delete mode 100644 mifospay/src/main/res/layout/activity_bank_accounts.xml delete mode 100644 mifospay/src/main/res/layout/activity_edit_profile.xml delete mode 100644 mifospay/src/main/res/layout/activity_invoice.xml delete mode 100644 mifospay/src/main/res/layout/activity_link_bank_account.xml delete mode 100644 mifospay/src/main/res/layout/activity_login.xml delete mode 100644 mifospay/src/main/res/layout/activity_merchant_transaction.xml delete mode 100644 mifospay/src/main/res/layout/activity_mobile_verification.xml delete mode 100644 mifospay/src/main/res/layout/activity_new_si.xml delete mode 100644 mifospay/src/main/res/layout/activity_read_qr.xml delete mode 100644 mifospay/src/main/res/layout/activity_receipt.xml delete mode 100644 mifospay/src/main/res/layout/activity_search.xml delete mode 100644 mifospay/src/main/res/layout/activity_send.xml delete mode 100644 mifospay/src/main/res/layout/activity_settings.xml delete mode 100644 mifospay/src/main/res/layout/activity_setup_upi_pin.xml delete mode 100644 mifospay/src/main/res/layout/activity_show_qr.xml delete mode 100644 mifospay/src/main/res/layout/activity_si_details.xml delete mode 100644 mifospay/src/main/res/layout/activity_signup.xml delete mode 100644 mifospay/src/main/res/layout/activity_specific_transactions.xml delete mode 100644 mifospay/src/main/res/layout/activity_transaction_history.xml delete mode 100644 mifospay/src/main/res/layout/content_bottom_sheet_account_details.xml delete mode 100644 mifospay/src/main/res/layout/dialog_add_card.xml delete mode 100644 mifospay/src/main/res/layout/dialog_change_profile_picture.xml delete mode 100644 mifospay/src/main/res/layout/dialog_set_amt.xml delete mode 100644 mifospay/src/main/res/layout/dialog_setup_upi_pin.xml delete mode 100644 mifospay/src/main/res/layout/dialog_setup_upi_pin2.xml delete mode 100644 mifospay/src/main/res/layout/dialog_transaction_detail.xml delete mode 100644 mifospay/src/main/res/layout/faq_list_child.xml delete mode 100644 mifospay/src/main/res/layout/faq_list_group.xml delete mode 100644 mifospay/src/main/res/layout/fragment_accounts.xml delete mode 100644 mifospay/src/main/res/layout/fragment_cards.xml delete mode 100644 mifospay/src/main/res/layout/fragment_debit_card.xml delete mode 100644 mifospay/src/main/res/layout/fragment_finance.xml delete mode 100644 mifospay/src/main/res/layout/fragment_history.xml delete mode 100644 mifospay/src/main/res/layout/fragment_invoices.xml delete mode 100644 mifospay/src/main/res/layout/fragment_kyc.xml delete mode 100644 mifospay/src/main/res/layout/fragment_kyc_desc.xml delete mode 100644 mifospay/src/main/res/layout/fragment_kyc_lvl1.xml delete mode 100644 mifospay/src/main/res/layout/fragment_kyc_lvl2.xml delete mode 100644 mifospay/src/main/res/layout/fragment_kyc_lvl3.xml delete mode 100644 mifospay/src/main/res/layout/fragment_make_transfer.xml delete mode 100644 mifospay/src/main/res/layout/fragment_merchants.xml delete mode 100644 mifospay/src/main/res/layout/fragment_otp.xml delete mode 100644 mifospay/src/main/res/layout/fragment_payments.xml delete mode 100644 mifospay/src/main/res/layout/fragment_profile.xml delete mode 100644 mifospay/src/main/res/layout/fragment_request.xml delete mode 100644 mifospay/src/main/res/layout/fragment_send.xml delete mode 100644 mifospay/src/main/res/layout/fragment_si.xml delete mode 100644 mifospay/src/main/res/layout/fragment_upi_pin_setup.xml delete mode 100644 mifospay/src/main/res/layout/invoice_item.xml delete mode 100644 mifospay/src/main/res/layout/item_bank_account.xml delete mode 100644 mifospay/src/main/res/layout/item_card.xml delete mode 100644 mifospay/src/main/res/layout/item_casual_list.xml delete mode 100644 mifospay/src/main/res/layout/item_merchant.xml delete mode 100644 mifospay/src/main/res/layout/item_other_banks.xml delete mode 100644 mifospay/src/main/res/layout/item_popular_banks.xml delete mode 100644 mifospay/src/main/res/layout/item_search.xml delete mode 100644 mifospay/src/main/res/layout/item_si.xml delete mode 100644 mifospay/src/main/res/layout/item_specific_transaction.xml delete mode 100644 mifospay/src/main/res/layout/nav_drawer_header.xml delete mode 100644 mifospay/src/main/res/layout/placeholder_state.xml delete mode 100644 mifospay/src/main/res/layout/profile_username_and_image.xml delete mode 100644 mifospay/src/main/res/layout/scrollable_tab_layout.xml delete mode 100644 mifospay/src/main/res/menu/menu_nav_drawer.xml delete mode 100644 mifospay/src/main/res/menu/menu_overflow.xml delete mode 100644 mifospay/src/main/res/menu/menu_saved_card.xml delete mode 100644 mifospay/src/main/res/menu/menu_share_qr.xml delete mode 100644 mifospay/src/main/res/menu/menu_si_details.xml diff --git a/build.gradle.kts b/build.gradle.kts index 8ef8b6c45..9d0508d94 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -26,33 +26,41 @@ plugins { alias(libs.plugins.secrets) apply false alias(libs.plugins.room) apply false alias(libs.plugins.kotlin.android) apply false - id("io.gitlab.arturbosch.detekt").version("1.18.1") + alias(libs.plugins.detekt) + alias(libs.plugins.detekt.compiler) alias(libs.plugins.module.graph) apply true // Plugin applied to allow module graph generation } -val detektProjectBaseline by tasks.registering(DetektCreateBaselineTask::class) { - description = "Overrides current baseline." - ignoreFailures.set(true) - parallel.set(true) - setSource(files(rootDir)) - config.setFrom(files("$rootDir/detekt.yml")) - baseline.set(file("$rootDir/baseline.xml")) - include("**/*.kt") - include("**/*.kts") - exclude("**/resources/**") - exclude("**/build/**") - exclude("**/buildSrc/**") - exclude("**/test/**/*.kt") +val detektFormatting = libs.detekt.formatting +val twitterComposeRules = libs.twitter.detekt.compose + +val reportMerge by tasks.registering(io.gitlab.arturbosch.detekt.report.ReportMergeTask::class) { + output.set(rootProject.layout.buildDirectory.file("reports/detekt/merge.html")) // or "reports/detekt/merge.sarif" } -allprojects { - apply(plugin = "io.gitlab.arturbosch.detekt") +subprojects { + apply { + plugin("io.gitlab.arturbosch.detekt") + } detekt { - config = files("$rootDir/config/detekt/detekt.yml") - buildUponDefaultConfig = true - parallel = true - ignoreFailures = false + config.from(rootProject.files("config/detekt/detekt.yml")) + reports.xml.required.set(true) + } + + tasks.withType().configureEach { + finalizedBy(reportMerge) + } + + reportMerge { + input.from(tasks.withType().map { + it.htmlReportFile } + ) + } + + dependencies { + detektPlugins(detektFormatting) + detektPlugins(twitterComposeRules) } } diff --git a/config/detekt/detekt.yml b/config/detekt/detekt.yml index 84bd2298b..844107b1c 100644 --- a/config/detekt/detekt.yml +++ b/config/detekt/detekt.yml @@ -2,21 +2,22 @@ build: maxIssues: 0 excludeCorrectable: false weights: - # complexity: 2 - # LongParameterList: 1 - # style: 1 - # comments: 1 + # complexity: 2 + # LongParameterList: 1 + # style: 1 + # comments: 1 config: validation: true warningsAsErrors: false + checkExhaustiveness: false # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]' - excludes: '' + excludes: "" processors: active: true exclude: - - 'DetektProgressListener' + - "DetektProgressListener" # - 'KtFileCountProcessor' # - 'PackageCountProcessor' # - 'ClassCountProcessor' @@ -33,24 +34,27 @@ processors: console-reports: active: true exclude: - - 'ProjectStatisticsReport' - - 'ComplexityReport' - - 'NotificationReport' - # - 'FindingsReport' - - 'FileBasedFindingsReport' + - "ProjectStatisticsReport" + - "ComplexityReport" + - "NotificationReport" + - "FindingsReport" + - "FileBasedFindingsReport" + # - 'LiteFindingsReport' output-reports: active: true - exclude: + exclude: [] # - 'TxtOutputReport' # - 'XmlOutputReport' # - 'HtmlOutputReport' + # - 'MdOutputReport' + # - 'SarifOutputReport' comments: active: true AbsentOrWrongFileLicense: active: false - licenseTemplateFile: 'license.template' + licenseTemplateFile: "license.template" licenseTemplateIsRegex: false CommentOverPrivateFunction: active: false @@ -61,46 +65,101 @@ comments: EndOfSentenceFormat: active: false endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)' + KDocReferencesNonPublicProperty: + active: false + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + OutdatedDocumentation: + active: false + matchTypeParameters: true + matchDeclarationsOrder: true + allowParamOnConstructorProperties: false UndocumentedPublicClass: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] searchInNestedClass: true searchInInnerClass: true searchInInnerObject: true searchInInnerInterface: true + searchInProtectedClass: false UndocumentedPublicFunction: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + searchProtectedFunction: false UndocumentedPublicProperty: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + searchProtectedProperty: false complexity: active: true + CognitiveComplexMethod: + active: false + threshold: 15 ComplexCondition: active: true - threshold: 15 + threshold: 4 ComplexInterface: active: false threshold: 10 includeStaticDeclarations: false includePrivateDeclarations: false - ComplexMethod: - active: false + ignoreOverloaded: false + CyclomaticComplexMethod: + active: true threshold: 15 ignoreSingleWhenExpression: false ignoreSimpleWhenEntries: false ignoreNestingFunctions: false nestingFunctions: - - 'also' - - 'apply' - - 'forEach' - - 'isNotNull' - - 'ifNull' - - 'let' - - 'run' - - 'use' - - 'with' + - "also" + - "apply" + - "forEach" + - "isNotNull" + - "ifNull" + - "let" + - "run" + - "use" + - "with" LabeledExpression: active: false ignoredLabels: [] @@ -108,42 +167,73 @@ complexity: active: true threshold: 600 LongMethod: - active: false - threshold: 100 - ignoreAnnotated: [] + active: true + threshold: 150 #60 LongParameterList: - active: false - functionThreshold: 6 - constructorThreshold: 7 + active: true + # Updating Common values based on current scenario + functionThreshold: 20 #6 + constructorThreshold: 30 #7 ignoreDefaultParameters: false ignoreDataClasses: true - ignoreAnnotated: [] + ignoreAnnotatedParameter: [] MethodOverloading: active: false threshold: 6 NamedArguments: active: false threshold: 3 + ignoreArgumentsMatchingNames: false NestedBlockDepth: active: true - threshold: 8 + threshold: 4 + NestedScopeFunctions: + active: false + threshold: 1 + functions: + - "kotlin.apply" + - "kotlin.run" + - "kotlin.with" + - "kotlin.let" + - "kotlin.also" ReplaceSafeCallChainWithRun: active: false StringLiteralDuplication: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] threshold: 3 ignoreAnnotation: true excludeStringsWithLessThan5Characters: true - ignoreStringsRegex: '$^' + ignoreStringsRegex: "$^" TooManyFunctions: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - thresholdInFiles: 11 - thresholdInClasses: 11 - thresholdInInterfaces: 11 - thresholdInObjects: 11 - thresholdInEnums: 11 + active: true + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + # Modifying default values 11 to 20 + thresholdInFiles: 20 + thresholdInClasses: 20 + thresholdInInterfaces: 20 + thresholdInObjects: 20 + thresholdInEnums: 20 ignoreDeprecated: false ignorePrivate: false ignoreOverridden: false @@ -152,18 +242,28 @@ coroutines: active: true GlobalCoroutineUsage: active: false + InjectDispatcher: + active: true + dispatcherNames: + - "IO" + - "Default" + - "Unconfined" RedundantSuspendModifier: - active: false + active: true SleepInsteadOfDelay: + active: true + SuspendFunSwallowedCancellation: active: false - SuspendFunWithFlowReturnType: + SuspendFunWithCoroutineScopeReceiver: active: false + SuspendFunWithFlowReturnType: + active: true empty-blocks: active: true EmptyCatchBlock: active: true - allowedExceptionNameRegex: '_|(ignore|expected).*' + allowedExceptionNameRegex: "_|(ignore|expected).*" EmptyClassBlock: active: true EmptyDefaultConstructor: @@ -177,7 +277,7 @@ empty-blocks: EmptyForBlock: active: true EmptyFunctionBlock: - active: false + active: false # Turning off for current implementation ignoreOverridden: false EmptyIfBlock: active: true @@ -199,320 +299,235 @@ exceptions: ExceptionRaisedInUnexpectedLocation: active: true methodNames: - - 'equals' - - 'finalize' - - 'hashCode' - - 'toString' + - "equals" + - "finalize" + - "hashCode" + - "toString" InstanceOfCheckForException: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: true + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] NotImplementedDeclaration: active: false ObjectExtendsThrowable: active: false PrintStackTrace: - active: false + active: true RethrowCaughtException: active: true ReturnFromFinally: active: true ignoreLabeled: false SwallowedException: - active: false + active: false # Turning off for current implementation ignoredExceptionTypes: - - 'InterruptedException' - - 'MalformedURLException' - - 'NumberFormatException' - - 'ParseException' - allowedExceptionNameRegex: '_|(ignore|expected).*' + - "InterruptedException" + - "MalformedURLException" + - "NumberFormatException" + - "ParseException" + allowedExceptionNameRegex: "_|(ignore|expected).*" ThrowingExceptionFromFinally: active: true ThrowingExceptionInMain: active: false ThrowingExceptionsWithoutMessageOrCause: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] exceptions: - - 'ArrayIndexOutOfBoundsException' - - 'Exception' - - 'IllegalArgumentException' - - 'IllegalMonitorStateException' - - 'IllegalStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' + - "ArrayIndexOutOfBoundsException" + - "Exception" + - "IllegalArgumentException" + - "IllegalMonitorStateException" + - "IllegalStateException" + - "IndexOutOfBoundsException" + - "NullPointerException" + - "RuntimeException" + - "Throwable" ThrowingNewInstanceOfSameException: active: true TooGenericExceptionCaught: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] exceptionNames: - - 'ArrayIndexOutOfBoundsException' - - 'Error' - - 'Exception' - - 'IllegalMonitorStateException' - - 'IndexOutOfBoundsException' - - 'NullPointerException' - - 'RuntimeException' - - 'Throwable' - allowedExceptionNameRegex: '_|(ignore|expected).*' + - "ArrayIndexOutOfBoundsException" + - "Error" + - "Exception" + - "IllegalMonitorStateException" + - "IndexOutOfBoundsException" + - "NullPointerException" + - "RuntimeException" + - "Throwable" + allowedExceptionNameRegex: "_|(ignore|expected).*" TooGenericExceptionThrown: active: false exceptionNames: - - 'Error' - - 'Exception' - - 'RuntimeException' - - 'Throwable' - -formatting: - active: true - android: false - autoCorrect: true - AnnotationOnSeparateLine: - active: false - autoCorrect: true - AnnotationSpacing: - active: false - autoCorrect: true - ArgumentListWrapping: - active: false - autoCorrect: true - indentSize: 4 - maxLineLength: 120 - ChainWrapping: - active: true - autoCorrect: true - CommentSpacing: - active: true - autoCorrect: true - EnumEntryNameCase: - active: false - autoCorrect: true - Filename: - active: true - FinalNewline: - active: true - autoCorrect: true - insertFinalNewLine: true - ImportOrdering: - active: false - autoCorrect: true - layout: '*,java.**,javax.**,kotlin.**,^' - Indentation: - active: false - autoCorrect: true - indentSize: 4 - continuationIndentSize: 4 - MaximumLineLength: - active: true - maxLineLength: 120 - ignoreBackTickedIdentifier: false - ModifierOrdering: - active: true - autoCorrect: true - MultiLineIfElse: - active: true - autoCorrect: true - NoBlankLineBeforeRbrace: - active: true - autoCorrect: true - NoConsecutiveBlankLines: - active: true - autoCorrect: true - NoEmptyClassBody: - active: true - autoCorrect: true - NoEmptyFirstLineInMethodBlock: - active: false - autoCorrect: true - NoLineBreakAfterElse: - active: true - autoCorrect: true - NoLineBreakBeforeAssignment: - active: true - autoCorrect: true - NoMultipleSpaces: - active: true - autoCorrect: true - NoSemicolons: - active: true - autoCorrect: true - NoTrailingSpaces: - active: true - autoCorrect: true - NoUnitReturn: - active: true - autoCorrect: true - NoUnusedImports: - active: true - autoCorrect: true - NoWildcardImports: - active: true - PackageName: - active: true - autoCorrect: true - ParameterListWrapping: - active: true - autoCorrect: true - indentSize: 4 - maxLineLength: 120 - SpacingAroundAngleBrackets: - active: false - autoCorrect: true - SpacingAroundColon: - active: true - autoCorrect: true - SpacingAroundComma: - active: true - autoCorrect: true - SpacingAroundCurly: - active: true - autoCorrect: true - SpacingAroundDot: - active: true - autoCorrect: true - SpacingAroundDoubleColon: - active: false - autoCorrect: true - SpacingAroundKeyword: - active: true - autoCorrect: true - SpacingAroundOperators: - active: true - autoCorrect: true - SpacingAroundParens: - active: true - autoCorrect: true - SpacingAroundRangeOperator: - active: true - autoCorrect: true - SpacingAroundUnaryOperator: - active: false - autoCorrect: true - SpacingBetweenDeclarationsWithAnnotations: - active: false - autoCorrect: true - SpacingBetweenDeclarationsWithComments: - active: false - autoCorrect: true - StringTemplate: - active: true - autoCorrect: true + - "Error" + - "Exception" + - "RuntimeException" + - "Throwable" naming: active: true BooleanPropertyNaming: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - allowedPattern: '^(is|has|are)' + allowedPattern: "^(is|has|are)" ClassNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - classPattern: '[A-Z][a-zA-Z0-9]*' + classPattern: "[A-Z][a-zA-Z0-9]*" ConstructorParameterNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - parameterPattern: '[a-z][A-Za-z0-9]*' - privateParameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true + parameterPattern: "[a-z][A-Za-z0-9]*" + privateParameterPattern: "[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" EnumNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - enumEntryPattern: '[A-Z][_a-zA-Z0-9]*' + enumEntryPattern: "[A-Z][_a-zA-Z0-9]*" ForbiddenClassName: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] forbiddenName: [] FunctionMaxLength: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] maximumFunctionNameLength: 30 FunctionMinLength: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] minimumFunctionNameLength: 3 FunctionNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)' - excludeClassPattern: '$^' - ignoreOverridden: true - ignoreAnnotated: - - 'Composable' + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + functionPattern: "[a-z][a-zA-Z0-9]*" + excludeClassPattern: "$^" + ignoreAnnotated: ["Composable"] FunctionParameterNaming: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - parameterPattern: '[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true + active: true + parameterPattern: "[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" InvalidPackageDeclaration: + active: true + rootPackage: "" + requireRootInDeclaration: false + LambdaParameterNaming: active: false - excludes: ['**/*.kts'] - rootPackage: '' + parameterPattern: "[a-z][A-Za-z0-9]*|_" MatchingDeclarationName: - active: false + active: true mustBeFirst: true MemberNameEqualsClassName: active: true ignoreOverridden: true NoNameShadowing: - active: false + active: true NonBooleanPropertyPrefixedWithIs: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] ObjectPropertyNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - constantPattern: '[A-Za-z][_A-Za-z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*' + constantPattern: "[A-Za-z][_A-Za-z0-9]*" + propertyPattern: "[A-Za-z][_A-Za-z0-9]*" + privatePropertyPattern: "(_)?[A-Za-z][_A-Za-z0-9]*" PackageNaming: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: true packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*' TopLevelPropertyNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - constantPattern: '[A-Z][_A-Z0-9]*' - propertyPattern: '[A-Za-z][_A-Za-z0-9]*' - privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*' + constantPattern: "[A-Z][_A-Z0-9]*" + propertyPattern: "[A-Za-z][_A-Za-z0-9]*" + privatePropertyPattern: "_?[A-Za-z][_A-Za-z0-9]*" VariableMaxLength: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - maximumVariableNameLength: 64 + maximumVariableNameLength: 100 #64 VariableMinLength: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] minimumVariableNameLength: 1 VariableNaming: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - variablePattern: '[a-z][A-Za-z0-9]*' - privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*' - excludeClassPattern: '$^' - ignoreOverridden: true + variablePattern: "[a-z][A-Za-z0-9]*" + privateVariablePattern: "(_)?[a-z][A-Za-z0-9]*" + excludeClassPattern: "$^" performance: active: true ArrayPrimitive: active: true + CouldBeSequence: + active: false + threshold: 3 ForEachOnRange: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] SpreadOperator: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + UnnecessaryPartOfBinaryExpression: + active: false UnnecessaryTemporaryInstantiation: active: true potential-bugs: active: true AvoidReferentialEquality: - active: false + active: true forbiddenTypePatterns: - - 'kotlin.String' + - "kotlin.String" + CastNullableToNonNullableType: + active: false CastToNullableType: active: false Deprecation: @@ -520,9 +535,19 @@ potential-bugs: DontDowncastCollectionTypes: active: false DoubleMutabilityForCollection: - active: false - DuplicateCaseInWhenExpression: active: true + mutableTypes: + - "kotlin.collections.MutableList" + - "kotlin.collections.MutableMap" + - "kotlin.collections.MutableSet" + - "java.util.ArrayList" + - "java.util.LinkedHashSet" + - "java.util.HashSet" + - "java.util.LinkedHashMap" + - "java.util.HashMap" + ElseCaseInsteadOfExhaustiveWhen: + active: false + ignoredSubjectTypes: [] EqualsAlwaysReturnsTrueOrFalse: active: true EqualsWithHashCodeExist: @@ -532,17 +557,25 @@ potential-bugs: ExplicitGarbageCollectionCall: active: true HasPlatformType: - active: false + active: true IgnoredReturnValue: - active: false - restrictToAnnotatedMethods: true + active: true + restrictToConfig: true returnValueAnnotations: - - '*.CheckResult' - - '*.CheckReturnValue' + - "CheckResult" + - "*.CheckResult" + - "CheckReturnValue" + - "*.CheckReturnValue" ignoreReturnValueAnnotations: - - '*.CanIgnoreReturnValue' + - "CanIgnoreReturnValue" + - "*.CanIgnoreReturnValue" + returnValueTypes: + - "kotlin.sequences.Sequence" + - "kotlinx.coroutines.flow.*Flow" + - "java.util.stream.*Stream" + ignoreFunctionCall: [] ImplicitDefaultLocale: - active: false + active: true ImplicitUnitReturnType: active: false allowExplicitReturnType: true @@ -554,53 +587,104 @@ potential-bugs: active: true LateinitUsage: active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] - excludeAnnotatedProperties: [] - ignoreOnClassesPattern: '' + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] + ignoreOnClassesPattern: "" MapGetWithNotNullAssertionOperator: - active: false - MissingWhenCase: active: true - allowElseExpression: true + MissingPackageDeclaration: + active: false + excludes: ["**/*.kts"] + NullCheckOnMutableProperty: + active: false NullableToStringCall: active: false - RedundantElseInWhen: - active: true + PropertyUsedBeforeDeclaration: + active: false UnconditionalJumpStatementInLoop: active: false + UnnecessaryNotNullCheck: + active: false UnnecessaryNotNullOperator: active: true UnnecessarySafeCall: active: true UnreachableCatchBlock: - active: false + active: true UnreachableCode: active: true UnsafeCallOnNullableType: active: true + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + ] UnsafeCast: active: true UnusedUnaryOperator: - active: false + active: true UselessPostfixExpression: - active: false + active: true WrongEqualsTypeParameter: active: true style: active: true + AlsoCouldBeApply: + active: false + BracesOnIfStatements: + active: false + singleLine: "never" + multiLine: "always" + BracesOnWhenStatements: + active: false + singleLine: "necessary" + multiLine: "consistent" + CanBeNonNullable: + active: false + CascadingCallWrapping: + active: false + includeElvis: true ClassOrdering: active: false CollapsibleIfStatements: active: false DataClassContainsFunctions: active: false - conversionFunctionPrefix: 'to' + conversionFunctionPrefix: + - "to" + allowOperators: false DataClassShouldBeImmutable: active: false DestructuringDeclarationWithTooManyEntries: - active: false + active: true maxDestructuringEntries: 3 + DoubleNegativeLambda: + active: false + negativeFunctions: + - reason: "Use `takeIf` instead." + value: "takeUnless" + - reason: "Use `all` instead." + value: "none" + negativeFunctionNameParts: + - "not" + - "non" EqualsNullCall: active: true EqualsOnSignatureLine: @@ -608,60 +692,82 @@ style: ExplicitCollectionElementAccessMethod: active: false ExplicitItLambdaParameter: - active: false + active: true ExpressionBodySyntax: active: false includeLineWrapping: false + ForbiddenAnnotation: + active: false + annotations: + - reason: "it is a java annotation. Use `Suppress` instead." + value: "java.lang.SuppressWarnings" + - reason: "it is a java annotation. Use `kotlin.Deprecated` instead." + value: "java.lang.Deprecated" + - reason: "it is a java annotation. Use `kotlin.annotation.MustBeDocumented` instead." + value: "java.lang.annotation.Documented" + - reason: "it is a java annotation. Use `kotlin.annotation.Target` instead." + value: "java.lang.annotation.Target" + - reason: "it is a java annotation. Use `kotlin.annotation.Retention` instead." + value: "java.lang.annotation.Retention" + - reason: "it is a java annotation. Use `kotlin.annotation.Repeatable` instead." + value: "java.lang.annotation.Repeatable" + - reason: "Kotlin does not support @Inherited annotation, see https://youtrack.jetbrains.com/issue/KT-22265" + value: "java.lang.annotation.Inherited" ForbiddenComment: - active: false - values: - - 'FIXME:' - - 'STOPSHIP:' - - 'TODO:' - allowedPatterns: '' + active: false # Turning off for this implementation + comments: + - reason: "Forbidden FIXME todo marker in comment, please fix the problem." + value: "FIXME:" + - reason: "Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code." + value: "STOPSHIP:" + - reason: "Forbidden TODO todo marker in comment, please do the changes." + value: "TODO:" + allowedPatterns: "" ForbiddenImport: active: false imports: [] - forbiddenPatterns: '' + forbiddenPatterns: "" ForbiddenMethodCall: active: false methods: - - 'kotlin.io.print' - - 'kotlin.io.println' - ForbiddenPublicDataClass: - active: true - excludes: ['**'] - ignorePackages: - - '*.internal' - - '*.internal.*' - ForbiddenVoid: + - reason: "print does not allow you to configure the output stream. Use a logger instead." + value: "kotlin.io.print" + - reason: "println does not allow you to configure the output stream. Use a logger instead." + value: "kotlin.io.println" + ForbiddenSuppress: active: false + rules: [] + ForbiddenVoid: + active: true ignoreOverridden: false ignoreUsageInGenerics: false FunctionOnlyReturningConstant: active: true ignoreOverridableFunction: true ignoreActualFunction: true - excludedFunctions: '' - excludeAnnotatedFunction: - - 'dagger.Provides' - LibraryCodeMustSpecifyReturnType: - active: true - excludes: ['**'] - LibraryEntitiesShouldNotBePublic: - active: true - excludes: ['**'] + excludedFunctions: [] LoopWithTooManyJumpStatements: active: true maxJumpCount: 1 MagicNumber: - active: false - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] + active: false # true + excludes: + [ + "**/test/**", + "**/androidTest/**", + "**/commonTest/**", + "**/jvmTest/**", + "**/androidUnitTest/**", + "**/androidInstrumentedTest/**", + "**/jsTest/**", + "**/iosTest/**", + "**/*.kts", + ] ignoreNumbers: - - '-1' - - '0' - - '1' - - '2' + - "-1" + - "0" + - "1" + - "2" ignoreHashCodeFunction: true ignorePropertyDeclaration: false ignoreLocalVariableDeclaration: false @@ -672,36 +778,44 @@ style: ignoreEnums: false ignoreRanges: false ignoreExtensionFunctions: true - MandatoryBracesIfStatements: - active: false MandatoryBracesLoops: active: false + MaxChainedCallsOnSameLine: + active: false + maxChainedCalls: 5 MaxLineLength: active: true maxLineLength: 120 excludePackageStatements: true excludeImportStatements: true excludeCommentStatements: false + excludeRawStrings: true MayBeConst: active: true ModifierOrder: active: true MultilineLambdaItParameter: active: false + MultilineRawStringIndentation: + active: false + indentSize: 4 + trimmingMethods: + - "trimIndent" + - "trimMargin" NestedClassesVisibility: active: true NewLineAtEndOfFile: - active: false + active: false # Turning off for current implementation NoTabs: active: false - ObjectLiteralToLambda: + NullableBooleanCheck: active: false + ObjectLiteralToLambda: + active: true OptionalAbstractKeyword: active: true OptionalUnit: active: false - OptionalWhenBraces: - active: false PreferToOverPairSyntax: active: false ProtectedMemberInFinalClass: @@ -709,13 +823,14 @@ style: RedundantExplicitType: active: false RedundantHigherOrderMapUsage: - active: false + active: true RedundantVisibilityModifierRule: active: false ReturnCount: - active: false + active: true max: 2 - excludedFunctions: 'equals' + excludedFunctions: + - "equals" excludeLabeled: false excludeReturnFromLambda: true excludeGuardClauses: false @@ -725,49 +840,72 @@ style: active: true SpacingBetweenPackageAndImports: active: false + StringShouldBeRawString: + active: false + maxEscapedCharacterCount: 2 + ignoredCharacters: [] ThrowsCount: active: true max: 2 excludeGuardClauses: false TrailingWhitespace: active: false + TrimMultilineRawString: + active: false + trimmingMethods: + - "trimIndent" + - "trimMargin" UnderscoresInNumericLiterals: active: false - acceptableDecimalLength: 5 + acceptableLength: 4 + allowNonStandardGrouping: false UnnecessaryAbstractClass: active: true - excludeAnnotatedClasses: - - 'dagger.Module' UnnecessaryAnnotationUseSiteTarget: active: false UnnecessaryApply: active: true - UnnecessaryFilter: + UnnecessaryBackticks: active: false + UnnecessaryBracesAroundTrailingLambda: + active: false + UnnecessaryFilter: + active: true UnnecessaryInheritance: active: true + UnnecessaryInnerClass: + active: false UnnecessaryLet: active: false UnnecessaryParentheses: active: false + allowForUnclearPrecedence: false UntilInsteadOfRangeTo: active: false UnusedImports: active: false + UnusedParameter: + active: true + allowedNames: "ignored|expected" UnusedPrivateClass: active: true UnusedPrivateMember: - active: false - allowedNames: '(_|ignored|expected|serialVersionUID)' + active: true + allowedNames: "" + ignoreAnnotated: ['Preview', 'DevicePreviews'] + UnusedPrivateProperty: + active: true + allowedNames: "_|ignored|expected|serialVersionUID" + UseAnyOrNoneInsteadOfFind: + active: true UseArrayLiteralsInAnnotations: - active: false + active: true UseCheckNotNull: - active: false + active: true UseCheckOrError: - active: false + active: true UseDataClass: active: false - excludeAnnotatedClasses: [] allowVars: false UseEmptyCounterpart: active: false @@ -775,23 +913,27 @@ style: active: false UseIfInsteadOfWhen: active: false + ignoreWhenContainingVariableDeclaration: false UseIsNullOrEmpty: + active: true + UseLet: active: false UseOrEmpty: - active: false + active: true UseRequire: - active: false + active: true UseRequireNotNull: + active: true + UseSumOfInsteadOfFlatMapSize: active: false UselessCallOnNotNull: active: true UtilityClassWithPublicConstructor: - active: false + active: true VarCouldBeVal: active: true + ignoreLateinitVar: false WildcardImport: active: true - excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**'] excludeImports: - - 'java.util.*' - - 'kotlinx.android.synthetic.*' + - "java.util.*" \ No newline at end of file diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt index d26e91f5a..fcc9e9d44 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/AnalyticsEvent.kt @@ -10,6 +10,7 @@ package org.mifospay.core.analytics * * @param extras - list of parameters which supply additional context to the event. See `Param`. */ +@Suppress("UtilityClassWithPublicConstructor") data class AnalyticsEvent( val type: String, val extras: List = emptyList(), diff --git a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt index 197e9cb9a..3c0dc003d 100644 --- a/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt +++ b/core/analytics/src/main/kotlin/org/mifospay/core/analytics/di/FirebaseAnalyticsHelper.kt @@ -1,7 +1,7 @@ package org.mifospay.core.analytics.di import com.google.firebase.analytics.FirebaseAnalytics -import com.google.firebase.analytics.ktx.logEvent +import com.google.firebase.analytics.logEvent import org.mifospay.core.analytics.AnalyticsEvent import org.mifospay.core.analytics.AnalyticsHelper import javax.inject.Inject diff --git a/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt b/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt index 9b7dcdd30..e7c0b88cf 100644 --- a/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt +++ b/core/analytics/src/test/java/org/mifospay/mobilewallet/mifospay/analytics/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.mobilewallet.mifospay.analytics +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt b/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt index b5a417ad5..77937e93b 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/CreditCardUtils.kt @@ -2,27 +2,23 @@ package org.mifospay.common object CreditCardUtils { fun validateCreditCardNumber(str: String): Boolean { - val u = 2 - if (u - 2 == 0) { - return true // for backend testing. remove after testing. - } - if (str.length == 0) { + if (str.isEmpty()) { return false } val ints = IntArray(str.length) - for (i in 0 until str.length) { + for (i in str.indices) { ints[i] = str.substring(i, i + 1).toInt() } run { var i = ints.size - 2 while (i >= 0) { var j = ints[i] - j = j * 2 + j *= 2 if (j > 9) { j = j % 10 + 1 } ints[i] = j - i = i - 2 + i -= 2 } } var sum = 0 diff --git a/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt b/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt index 5dc7d60bb..9c7068177 100644 --- a/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt +++ b/core/common/src/main/kotlin/org/mifospay/common/FileUtils.kt @@ -1,5 +1,6 @@ package org.mifospay.common +import android.util.Log import java.io.File import java.io.FileOutputStream import java.io.InputStream @@ -7,18 +8,19 @@ import java.io.OutputStream object FileUtils { - fun writeInputStreamDataToFile(`in`: InputStream, file: File?): Boolean { + fun writeInputStreamDataToFile(inputStream: InputStream, file: File?): Boolean { return try { val out: OutputStream = FileOutputStream(file) val buf = ByteArray(1024) var len: Int - while (`in`.read(buf).also { len = it } > 0) { + while (inputStream.read(buf).also { len = it } > 0) { out.write(buf, 0, len) } out.close() - `in`.close() + inputStream.close() true } catch (e: Exception) { + Log.e("Message",e.message.toString()) false } } diff --git a/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt b/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt index b51d0704e..2ea33e12f 100644 --- a/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt +++ b/core/common/src/test/java/org/mifospay/common/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.common +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/core/data/build.gradle.kts b/core/data/build.gradle.kts index 7713ed2d1..15398df7b 100644 --- a/core/data/build.gradle.kts +++ b/core/data/build.gradle.kts @@ -39,5 +39,5 @@ dependencies { implementation(libs.jetbrains.kotlin.jdk7) testImplementation(libs.junit) - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") + androidTestImplementation(libs.espresso.core) } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt index eda384ffc..b8b38c903 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/account/TransferFunds.kt @@ -1,23 +1,24 @@ package org.mifospay.core.data.domain.usecase.account -import okhttp3.ResponseBody -import org.mifospay.core.data.base.UseCase -import org.mifospay.core.data.fineract.repository.FineractRepository +import com.mifospay.core.model.entity.TPTResponse +import com.mifospay.core.model.entity.accounts.savings.SavingAccount import com.mifospay.core.model.entity.beneficary.Beneficiary import com.mifospay.core.model.entity.beneficary.BeneficiaryPayload import com.mifospay.core.model.entity.beneficary.BeneficiaryUpdatePayload -import com.mifospay.core.model.entity.payload.TransferPayload -import com.mifospay.core.model.entity.TPTResponse -import com.mifospay.core.model.entity.accounts.savings.SavingAccount import com.mifospay.core.model.entity.client.Client import com.mifospay.core.model.entity.client.ClientAccounts +import com.mifospay.core.model.entity.payload.TransferPayload import com.mifospay.core.model.utils.DateHelper +import okhttp3.ResponseBody +import org.mifospay.core.data.base.UseCase +import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.util.Constants import rx.Subscriber import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers import javax.inject.Inject +@Suppress("UnusedPrivateMember") class TransferFunds @Inject constructor( private val apiRepository: FineractRepository) : UseCase() { diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt index 789f2bb7a..234e1bc11 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/CreateClient.kt @@ -30,7 +30,7 @@ class CreateClient @Inject constructor(private val apiRepository: FineractReposi message = (e as HttpException).response()?.errorBody()?.string().toString() message = getUserMessage(message) } catch (e1: Exception) { - message = "Error" + message = e1.message.toString() } useCaseCallback.onError(message) } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt index cb6d2ecd8..2a6ffe270 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/client/UpdateClient.kt @@ -33,7 +33,7 @@ class UpdateClient @Inject constructor(private val fineractRepository: FineractR message = (e as HttpException).response()?.errorBody()?.string().toString() message = getUserMessage(message) } catch (e1: Exception) { - message = "Error" + message = e1.message.toString() } useCaseCallback.onError(message) } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt index 62f1c5a83..23f9ce870 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/invoice/FetchInvoice.kt @@ -1,8 +1,9 @@ package org.mifospay.core.data.domain.usecase.invoice import android.net.Uri -import org.mifospay.core.data.base.UseCase +import android.util.Log import com.mifospay.core.model.entity.Invoice +import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.fineract.repository.FineractRepository import org.mifospay.core.data.util.Constants import rx.Subscriber @@ -51,6 +52,7 @@ class FetchInvoice @Inject constructor(private val mFineractRepository: Fineract } } catch (e: IndexOutOfBoundsException) { + Log.e("Error", e.message.toString()) useCaseCallback.onError("Invalid link used to open the App") } } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt index 270230474..9a4821550 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/CreateUser.kt @@ -23,12 +23,12 @@ class CreateUser @Inject constructor(private val apiRepository: FineractReposito override fun onCompleted() {} override fun onError(e: Throwable) { getUserMessage(e) - var message = "Error" + var message: String try { message = (e as HttpException).response()!!.errorBody()!!.string() message = getUserMessage(message) } catch (e1: Exception) { - message = "Error" + message = e1.message.toString() } useCaseCallback.onError(message) } diff --git a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt index af1102cd3..5cb280f7b 100644 --- a/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt +++ b/core/data/src/main/java/org/mifospay/core/data/domain/usecase/user/UpdateUser.kt @@ -23,12 +23,12 @@ class UpdateUser @Inject constructor( .subscribe(object : Subscriber() { override fun onCompleted() {} override fun onError(e: Throwable) { - var message = "Error" + var message: String try { message = (e as HttpException).response()!!.errorBody()!!.string() message = getUserMessage(message) } catch (e1: Exception) { - message = "Error" + message = e1.message.toString() } useCaseCallback.onError(message) } diff --git a/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt b/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt index dd35b4ac6..7d7ec21af 100644 --- a/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/fineract/repository/FineractRepository.kt @@ -43,6 +43,7 @@ import javax.inject.Singleton @Singleton +@Suppress("TooManyFunctions") class FineractRepository @Inject constructor( private val fineractApiManager: FineractApiManager, private val selfApiManager: SelfServiceApiManager diff --git a/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt b/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt index ce541cb0c..ccb0413f5 100644 --- a/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt +++ b/core/data/src/main/java/org/mifospay/core/data/repository/local/MifosLocalAssetRepository.kt @@ -9,7 +9,7 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.flowOn import org.mifospay.core.network.Dispatcher import org.mifospay.core.network.MifosDispatchers -import org.mifospay.core.network.local_assets.MifosLocalAssetDataSource +import org.mifospay.core.network.localAssets.MifosLocalAssetDataSource import javax.inject.Inject /** diff --git a/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt b/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt index d00e28b01..5c8c282cd 100644 --- a/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt +++ b/core/data/src/main/java/org/mifospay/core/data/util/ErrorJsonMessageHelper.kt @@ -18,12 +18,12 @@ object ErrorJsonMessageHelper { @JvmStatic fun getUserMessage(e: Throwable): String? { - var message: String? = "Error" + var message: String? try { message = (e as HttpException).response()?.errorBody()?.string().toString() message = getUserMessage(message) } catch (e1: Exception) { - message = "Error" + message = e1.message.toString() } return message } diff --git a/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt b/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt index 2529d1a43..6b793648c 100644 --- a/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt +++ b/core/datastore/src/test/java/org/mifospay/core/datastore/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.core.datastore +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/core/designsystem/build.gradle.kts b/core/designsystem/build.gradle.kts index 95a6b997d..2430b822f 100644 --- a/core/designsystem/build.gradle.kts +++ b/core/designsystem/build.gradle.kts @@ -23,6 +23,6 @@ dependencies { api(libs.androidx.compose.ui.util) api(libs.androidx.activity.compose) - //testImplementation(libs.androidx.compose.ui.test) - //androidTestImplementation(libs.androidx.compose.ui.test) + testImplementation(libs.androidx.compose.ui.test) + androidTestImplementation(libs.androidx.compose.ui.test) } \ No newline at end of file diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt index f6b612202..9e69f8a0e 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/BottomSheet.kt @@ -23,7 +23,8 @@ import kotlinx.coroutines.launch @Composable fun MifosBottomSheet( content: @Composable () -> Unit, - onDismiss: () -> Unit + onDismiss: () -> Unit, + modifier: Modifier = Modifier, ) { val coroutineScope = rememberCoroutineScope() val modalSheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) @@ -50,7 +51,8 @@ fun MifosBottomSheet( showBottomSheet = false dismissSheet() }, - sheetState = modalSheetState + sheetState = modalSheetState, + modifier = modifier, ) { content() } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt index 3476ea400..ab841c5ae 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/Button.kt @@ -288,6 +288,7 @@ fun MifosButtonLeadingIconPreview() { /** * Mifos Wallet button default values. */ +@Suppress("ForbiddenComment") object MifosButtonDefaults { // TODO: File bug // OutlinedButton border color doesn't respect disabled state by default diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt index de9ef7300..9abbf0388 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/MifosScaffold.kt @@ -7,12 +7,6 @@ import androidx.compose.material3.Scaffold import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.Color -data class FloatingActionButtonContent( - val onClick: (() -> Unit), - val contentColor: Color, - val content: (@Composable () -> Unit) -) - @Composable fun MifosScaffold( topBarTitle: Int? = null, @@ -44,4 +38,10 @@ fun MifosScaffold( snackbarHost = snackbarHost, content = scaffoldContent, ) -} \ No newline at end of file +} + +data class FloatingActionButtonContent( + val onClick: (() -> Unit), + val contentColor: Color, + val content: (@Composable () -> Unit) +) diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt index 40820a898..0c1f425d0 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/component/PermissionBox.kt @@ -20,6 +20,7 @@ import androidx.core.content.ContextCompat import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver +@Suppress("LongMethod", "CyclomaticComplexMethod") @Composable fun PermissionBox( requiredPermissions: List, @@ -57,9 +58,9 @@ fun PermissionBox( } val decideCurrentPermissionStatus: (Boolean, Boolean) -> String = - { permissionGranted, shouldShowPermissionRationale -> - if (permissionGranted) "Granted" - else if (shouldShowPermissionRationale) "Rejected" + { granted, rationale -> + if (granted) "Granted" + else if (rationale) "Rejected" else "Denied" } diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Background.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt similarity index 100% rename from core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Background.kt rename to core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/BackgroundTheme.kt diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Gradient.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt similarity index 100% rename from core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Gradient.kt rename to core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/GradientColors.kt diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt index acf5f35f3..31f4b925d 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Theme.kt @@ -73,6 +73,7 @@ private val DarkDefaultColorScheme = darkColorScheme( scrim = md_theme_dark_scrim, ) +@Suppress("UnusedParameter") @Composable fun MifosTheme( darkTheme: Boolean = isSystemInDarkTheme(), diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Tint.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt similarity index 100% rename from core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/Tint.kt rename to core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/theme/TintTheme.kt diff --git a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt index 49462009b..931d254b5 100644 --- a/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt +++ b/core/designsystem/src/main/kotlin/org/mifospay/core/designsystem/utils/ExpirationDateMask.kt @@ -5,6 +5,7 @@ import androidx.compose.ui.text.input.OffsetMapping import androidx.compose.ui.text.input.TransformedText import androidx.compose.ui.text.input.VisualTransformation +@Suppress("ReturnCount") class ExpirationDateMask : VisualTransformation { override fun filter(text: AnnotatedString): TransformedText { return makeExpirationFilter(text) diff --git a/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt b/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt index 78d4bfb37..ec0ddd756 100644 --- a/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt +++ b/core/model/src/test/java/com/mifos/mobilewallet/model/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package com.mifos.mobilewallet.model +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt index ed4a3c7ff..5c43c784f 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/JvmLocalAssetManager.kt @@ -1,7 +1,7 @@ package org.mifospay.core.network import androidx.annotation.VisibleForTesting -import org.mifospay.core.network.local_assets.LocalAssetManager +import org.mifospay.core.network.localAssets.LocalAssetManager import java.io.File import java.io.InputStream import java.util.Properties diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt b/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt index f484301da..cb998b332 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/di/LocalModule.kt @@ -4,8 +4,8 @@ import dagger.Binds import dagger.Module import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent -import org.mifospay.core.network.local_assets.LocalAssetDataSource -import org.mifospay.core.network.local_assets.MifosLocalAssetDataSource +import org.mifospay.core.network.localAssets.LocalAssetDataSource +import org.mifospay.core.network.localAssets.MifosLocalAssetDataSource @Module @InstallIn(SingletonComponent::class) diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt b/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt index ff523d153..699290073 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/di/NetworkModule.kt @@ -12,7 +12,7 @@ import org.mifospay.core.network.BaseURL import org.mifospay.core.network.FineractApiManager import org.mifospay.core.network.MifosWalletOkHttpClient import org.mifospay.core.network.SelfServiceApiManager -import org.mifospay.core.network.local_assets.LocalAssetManager +import org.mifospay.core.network.localAssets.LocalAssetManager import org.mifospay.core.network.services.AccountTransfersService import org.mifospay.core.network.services.AuthenticationService import org.mifospay.core.network.services.BeneficiaryService @@ -38,6 +38,7 @@ import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) +@Suppress("TooManyFunctions") class NetworkModule { @Provides diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetDataSource.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt similarity index 87% rename from core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetDataSource.kt rename to core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt index 011870ed3..e112cc86f 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetDataSource.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetDataSource.kt @@ -1,4 +1,4 @@ -package org.mifospay.core.network.local_assets +package org.mifospay.core.network.localAssets import com.mifospay.core.model.City import com.mifospay.core.model.Country diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetManager.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt similarity index 69% rename from core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetManager.kt rename to core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt index 9d37058ab..b5db8e70e 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/LocalAssetManager.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/LocalAssetManager.kt @@ -1,4 +1,4 @@ -package org.mifospay.core.network.local_assets +package org.mifospay.core.network.localAssets import java.io.InputStream diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/MifosLocalAssetDataSource.kt b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt similarity index 92% rename from core/network/src/main/kotlin/org/mifospay/core/network/local_assets/MifosLocalAssetDataSource.kt rename to core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt index f0db9c078..3c74ae5e8 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/local_assets/MifosLocalAssetDataSource.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/localAssets/MifosLocalAssetDataSource.kt @@ -1,5 +1,6 @@ -package org.mifospay.core.network.local_assets +package org.mifospay.core.network.localAssets +import android.annotation.SuppressLint import com.mifospay.core.model.City import com.mifospay.core.model.Country import com.mifospay.core.model.State @@ -16,6 +17,7 @@ import javax.inject.Inject class MifosLocalAssetDataSource @Inject constructor( @Dispatcher(MifosDispatchers.IO) private val ioDispatcher: CoroutineDispatcher, private val networkJson: Json, + @SuppressLint("VisibleForTests") private val assets: LocalAssetManager = JvmLocalAssetManager, ) : LocalAssetDataSource { @@ -47,6 +49,7 @@ class MifosLocalAssetDataSource @Inject constructor( } } + @Suppress("UnusedPrivateProperty") companion object { private const val COUNTRIES_ASSET = "countries.json" private const val STATES_ASSET = "states.json" diff --git a/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt b/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt index 587a8dc75..62d675d68 100644 --- a/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt +++ b/core/network/src/main/kotlin/org/mifospay/core/network/services/RunReportService.kt @@ -9,6 +9,7 @@ import rx.Observable /** * Created by ankur on 06/June/2018 */ +@Suppress("FunctionParameterNaming") interface RunReportService { @GET(ApiEndPoints.RUN_REPORT + "/Savings Transaction Receipt") fun getTransactionReceipt( diff --git a/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt b/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt index f31f36e6d..8b722a1ed 100644 --- a/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt +++ b/core/network/src/test/java/org/mifospay/mobilewallet/mifospay/network/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.mobilewallet.mifospay.network +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt b/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt index 0a53dfbf1..d2ec8f055 100644 --- a/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt +++ b/core/ui/src/main/kotlin/org/mifospay/core/ui/ExpiryDateInput.kt @@ -1,4 +1,4 @@ -package org.mifos.mobilewallet.mifospay.ui +package org.mifospay.core.ui import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row diff --git a/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt b/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt index 14443a05e..3eff5cb78 100644 --- a/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt +++ b/core/ui/src/test/java/org/mifospay/mobilewallet/mifospay/ui/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.mobilewallet.mifospay.ui +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/accounts/build.gradle.kts b/feature/accounts/build.gradle.kts index f04dd9717..a29573183 100644 --- a/feature/accounts/build.gradle.kts +++ b/feature/accounts/build.gradle.kts @@ -9,7 +9,7 @@ android { dependencies { implementation(projects.core.data) + // TODO:: this should be removed implementation(libs.compose.material) - implementation(libs.androidx.appcompat) implementation(projects.feature.upiSetup) } \ No newline at end of file diff --git a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/choose/sim/ChooseSimDialogSheet.kt b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/choose/sim/ChooseSimDialogSheet.kt index 11ff9e039..37d43de09 100644 --- a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/choose/sim/ChooseSimDialogSheet.kt +++ b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/choose/sim/ChooseSimDialogSheet.kt @@ -1,6 +1,6 @@ package org.mifospay.feature.bank.accounts.choose.sim -import android.widget.Toast +import androidx.compose.animation.AnimatedVisibility import androidx.compose.foundation.Image import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement @@ -14,22 +14,26 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.painter.Painter import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import kotlinx.coroutines.delay import org.mifospay.core.designsystem.component.MifosBottomSheet import org.mifospay.core.designsystem.component.MifosButton import org.mifospay.core.designsystem.theme.MifosTheme @@ -37,15 +41,20 @@ import org.mifospay.feature.bank.accounts.R @Composable fun ChooseSimDialogSheet( - onSimSelected: (Int) -> Unit + onSimSelected: (Int) -> Unit, + modifier: Modifier = Modifier, ) { - MifosBottomSheet(content = { - ChooseSimDialogSheetContent { selectedSim -> - onSimSelected.invoke(selectedSim) - } - }, onDismiss = { - onSimSelected.invoke(-1) - }) + MifosBottomSheet( + content = { + ChooseSimDialogSheetContent( + onSimSelected = onSimSelected + ) + }, + onDismiss = { + onSimSelected.invoke(-1) + }, + modifier = modifier, + ) } /** @@ -53,12 +62,25 @@ fun ChooseSimDialogSheet( * show both of them and implement send SMS after select and confirm. */ @Composable -fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { - val context = LocalContext.current +@Suppress("LongMethod") +fun ChooseSimDialogSheetContent( + onSimSelected: (Int) -> Unit, + modifier: Modifier = Modifier, +) { var selectedSim by rememberSaveable { mutableIntStateOf(-1) } + var showMessage by remember { mutableStateOf(false) } + val message = stringResource(id = R.string.feature_accounts_choose_a_sim) + + LaunchedEffect(key1 = showMessage) { + if (showMessage) { + delay(5000) + showMessage = false + } + } + Column( horizontalAlignment = Alignment.CenterHorizontally, - modifier = Modifier + modifier = modifier .fillMaxSize() .padding(8.dp) ) { @@ -95,8 +117,10 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { ) Spacer(modifier = Modifier.width(24.dp)) - Text(text = stringResource(id = R.string.feature_accounts_or), - color = MaterialTheme.colorScheme.onSurface) + Text( + text = stringResource(id = R.string.feature_accounts_or), + color = MaterialTheme.colorScheme.onSurface + ) Spacer(modifier = Modifier.width(24.dp)) SimCard( simNumber = 2, @@ -110,17 +134,25 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { color = MaterialTheme.colorScheme.onSurface, style = MaterialTheme.typography.bodySmall ) + + AnimatedVisibility( + visible = showMessage + ) { + Text( + text = message, + color = MaterialTheme.colorScheme.error, + style = MaterialTheme.typography.bodySmall, + modifier = Modifier.padding(vertical = 4.dp) + ) + } + MifosButton( modifier = Modifier .width(200.dp) .padding(top = 16.dp), onClick = { if (selectedSim == -1) { - Toast.makeText( - context, - context.getString(R.string.feature_accounts_choose_a_sim), - Toast.LENGTH_SHORT - ).show() + showMessage = true } else { onSimSelected(selectedSim) } @@ -134,17 +166,21 @@ fun ChooseSimDialogSheetContent(onSimSelected: (Int) -> Unit) { @Composable fun SimCard( - simNumber: Int, isSelected: Boolean, onSimSelected: () -> Unit + simNumber: Int, + isSelected: Boolean, + onSimSelected: () -> Unit, + modifier: Modifier = Modifier, ) { val drawable: Painter = painterResource( id = if (isSelected) { R.drawable.feature_accounts_sim_card_selected } else R.drawable.feature_accounts_sim_card_unselected ) - Image(painter = drawable, + Image( + painter = drawable, contentDescription = "SIM Card $simNumber", contentScale = ContentScale.Fit, - modifier = Modifier + modifier = modifier .size(50.dp) .clickable { onSimSelected() } ) @@ -154,6 +190,10 @@ fun SimCard( @Composable fun SimSelectionPreview() { MifosTheme { - ChooseSimDialogSheetContent(onSimSelected = {}) + Surface { + ChooseSimDialogSheetContent( + onSimSelected = {} + ) + } } } diff --git a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt index d0102be60..1b8be231b 100644 --- a/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt +++ b/feature/accounts/src/main/kotlin/org/mifospay/feature/bank/accounts/link/LinkBankAccountScreen.kt @@ -69,16 +69,18 @@ fun LinkBankAccountRoute( var showOverlyProgressBar by rememberSaveable { mutableStateOf(false) } if (showSimBottomSheet) { - ChooseSimDialogSheet { selectedSim -> - showSimBottomSheet = false - if (selectedSim != -1) { - showOverlyProgressBar = true - viewModel.fetchBankAccountDetails { - showOverlyProgressBar = false - onBackClick() + ChooseSimDialogSheet( + onSimSelected = { selectedSim -> + showSimBottomSheet = false + if (selectedSim != -1) { + showOverlyProgressBar = true + viewModel.fetchBankAccountDetails { + showOverlyProgressBar = false + onBackClick() + } } } - } + ) } LinkBankAccountScreen( @@ -175,7 +177,10 @@ fun BankListScreenContent( Spacer(modifier = Modifier.height(24.dp)) Text( text = stringResource(id = R.string.feature_accounts_popular_banks), - style = TextStyle(MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.Medium), + style = TextStyle( + MaterialTheme.colorScheme.onSurface, + fontWeight = FontWeight.Medium + ), modifier = Modifier.padding(start = 16.dp) ) Spacer(modifier = Modifier.height(12.dp)) @@ -186,7 +191,10 @@ fun BankListScreenContent( Spacer(modifier = Modifier.height(24.dp)) Text( text = stringResource(id = R.string.feature_accounts_other_banks), - style = TextStyle(MaterialTheme.colorScheme.onSurface, fontWeight = FontWeight.Medium), + style = TextStyle( + MaterialTheme.colorScheme.onSurface, + fontWeight = FontWeight.Medium + ), modifier = Modifier.padding(start = 16.dp) ) Spacer(modifier = Modifier.height(12.dp)) diff --git a/feature/accounts/src/test/java/org/mifospay/feature/bank/accounts/ExampleUnitTest.kt b/feature/accounts/src/test/java/org/mifospay/feature/bank/accounts/ExampleUnitTest.kt index 0bb0f96e9..f74122aa9 100644 --- a/feature/accounts/src/test/java/org/mifospay/feature/bank/accounts/ExampleUnitTest.kt +++ b/feature/accounts/src/test/java/org/mifospay/feature/bank/accounts/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.bank.accounts +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/auth/build.gradle.kts b/feature/auth/build.gradle.kts index c5341dd36..413236026 100644 --- a/feature/auth/build.gradle.kts +++ b/feature/auth/build.gradle.kts @@ -17,21 +17,19 @@ dependencies { implementation(projects.feature.passcode) implementation(libs.compose.country.code.picker) + // TODO:: this should be removed + implementation(libs.compose.material) // Credentials Manager - implementation("androidx.credentials:credentials:1.2.1") + implementation(libs.androidx.credentials) // optional - needed for credentials support from play services, for devices running // Android 13 and below. - implementation("androidx.credentials:credentials-play-services-auth:1.2.1") - implementation("com.google.android.libraries.identity.googleid:googleid:1.1.0") + implementation(libs.androidx.credentials.play.services.auth) + implementation(libs.googleid) - implementation("com.mifos.mobile:mifos-passcode:0.3.0") + implementation(libs.mifosPasscode) - implementation("com.google.android.gms:play-services-auth:20.7.0") - - // we need it for country picker library - implementation("androidx.compose.material:material:1.6.0") - implementation(libs.compose.country.code.picker) // remove after moving auth code to module + implementation(libs.play.services.auth) implementation(libs.androidx.core.ktx) implementation(libs.androidx.appcompat) diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt index f652b31b6..3ecafefa1 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/login/LoginScreen.kt @@ -31,7 +31,6 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.PasswordVisualTransformation @@ -48,11 +47,9 @@ import org.mifospay.core.designsystem.component.MfOverlayLoadingWheel import org.mifospay.core.designsystem.component.MifosOutlinedTextField import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.designsystem.theme.grey -import org.mifospay.core.designsystem.theme.styleMedium16sp -import org.mifospay.core.designsystem.theme.styleMedium30sp import org.mifospay.core.designsystem.theme.styleNormal18sp import org.mifospay.feature.auth.R -import org.mifospay.feature.auth.social_signup.SocialSignupMethodContentScreen +import org.mifospay.feature.auth.socialSignup.SocialSignupMethodContentScreen import org.mifospay.feature.passcode.PassCodeActivity @Composable @@ -86,6 +83,7 @@ fun LoginScreen( } @Composable +@Suppress("LongMethod") fun LoginScreenContent( showProgress: Boolean, login: (username: String, password: String) -> Unit, diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt similarity index 99% rename from feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationScreen.kt rename to feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt index 0214fde34..41ec67c66 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationScreen.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.auth.mobile_verify +package org.mifospay.feature.auth.mobileVerify import android.widget.Toast import androidx.compose.foundation.background diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationViewModel.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationViewModel.kt similarity index 95% rename from feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationViewModel.kt rename to feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationViewModel.kt index 1191e5e41..c86499876 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobile_verify/MobileVerificationViewModel.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/mobileVerify/MobileVerificationViewModel.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.auth.mobile_verify +package org.mifospay.feature.auth.mobileVerify import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -17,6 +17,7 @@ import org.mifospay.core.data.domain.usecase.client.SearchClient import javax.inject.Inject @HiltViewModel +@Suppress("UnusedParameter") class MobileVerificationViewModel @Inject constructor( private val mUseCaseHandler: UseCaseHandler, private val searchClientUseCase: SearchClient @@ -32,7 +33,8 @@ class MobileVerificationViewModel @Inject constructor( * Verify Mobile number that it already exist or not then request otp */ fun verifyMobileAndRequestOtp( - fullNumber: String, mobileNo: String, + fullNumber: String, + mobileNo: String, onError: (String?) -> Unit ) { showProgress = true diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/LoginScreenNavigation.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/LoginScreenNavigation.kt index aa6e34356..5c1d3bb96 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/LoginScreenNavigation.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/LoginScreenNavigation.kt @@ -7,6 +7,7 @@ import org.mifospay.feature.auth.login.LoginScreen const val LOGIN_ROUTE = "login_route" +@Suppress("UnusedParameter") fun NavGraphBuilder.loginScreen( onDismissSignUp: () -> Unit, onNavigateToMobileVerificationScreen:(Int,String,String,String,String,) -> Unit diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt index c03a08bf9..9c96c64df 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/MobileVerificationScreenNavigation.kt @@ -8,7 +8,7 @@ import androidx.navigation.NavType import androidx.navigation.compose.composable import androidx.navigation.navArgument import org.mifospay.common.Constants -import org.mifospay.feature.auth.mobile_verify.MobileVerificationScreen +import org.mifospay.feature.auth.mobileVerify.MobileVerificationScreen const val MOBILE_VERIFICATION_ROUTE = "mobile_verification_route" diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/SignupScreenNavigation.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/SignupScreenNavigation.kt index 9a40e949c..eff3adfcf 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/SignupScreenNavigation.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/navigation/SignupScreenNavigation.kt @@ -11,6 +11,7 @@ import org.mifospay.feature.auth.signup.SignupScreen const val SIGNUP_ROUTE = "signup_route" +@Suppress("UnusedParameter") fun NavGraphBuilder.signupScreen( onLoginSuccess: () -> Unit, onRegisterSuccess: () -> Unit @@ -57,9 +58,14 @@ fun NavController.navigateToSignup( lastName: String = "", businessName: String = "" ) { - this.navigate("$SIGNUP_ROUTE?savingProductId=$savingProductId&mobileNumber=$mobileNumber&country=$country&email=$email&firstName=$firstName&lastName=$lastName&businessName=$businessName") + this.navigate( + "$SIGNUP_ROUTE?savingProductId=$savingProductId" + + "&mobileNumber=$mobileNumber&country=$country&email=$email" + + "&firstName=$firstName&lastName=$lastName&businessName=$businessName" + ) } +@Suppress("UnusedParameter") fun onRegisterSuccess(s: String?) { // registered but unable to login or user not updated with client // TODO :: Consider this case diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt index 2ab5f9fb3..43cfa23c5 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupScreen.kt @@ -83,7 +83,7 @@ fun SignupScreen( } } - SignupScreen( + SignupScreenContent( showProgressState = viewModel.showProgress, data = viewModel.signupData, stateList = stateList, @@ -96,7 +96,8 @@ fun SignupScreen( } @Composable -fun SignupScreen( +@Suppress("LongMethod", "CyclomaticComplexMethod") +fun SignupScreenContent( showProgressState: Boolean = false, data: SignupData, stateList: List, @@ -469,7 +470,7 @@ private fun getPasswordStrengthColor(password: String): Color { @Preview @Composable fun SignupScreenPreview() { - SignupScreen( + SignupScreenContent( showProgressState = false, data = SignupData(), stateList = listOf(), diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt index fa4ff7433..c84b77c9f 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/signup/SignupViewModel.kt @@ -17,6 +17,8 @@ import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn +import org.mifospay.common.Constants +import org.mifospay.common.DebugUtil import org.mifospay.core.data.base.UseCase import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.client.CreateClient @@ -28,8 +30,6 @@ import org.mifospay.core.data.domain.usecase.user.DeleteUser import org.mifospay.core.data.domain.usecase.user.FetchUserDetails import org.mifospay.core.data.domain.usecase.user.UpdateUser import org.mifospay.core.data.repository.local.LocalAssetRepository -import org.mifospay.common.Constants -import org.mifospay.common.DebugUtil import org.mifospay.core.datastore.PreferencesHelper import javax.inject.Inject @@ -187,9 +187,9 @@ class SignupViewModel @Inject constructor( useCaseHandler.execute(authenticateUserUseCase, requestValue, object : UseCase.UseCaseCallback { override fun onSuccess(response: AuthenticateUser.ResponseValue) { - response?.user?.let { createAuthenticatedService(it) } + createAuthenticatedService(response.user) fetchClientData(showToastMessage) - response?.user?.let { fetchUserDetails(it) } + fetchUserDetails(response.user) } override fun onError(message: String) { diff --git a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/social_signup/SocialSignupMethodScreen.kt b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt similarity index 98% rename from feature/auth/src/main/kotlin/org/mifospay/feature/auth/social_signup/SocialSignupMethodScreen.kt rename to feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt index dbf4c29cb..106ba0fb9 100644 --- a/feature/auth/src/main/kotlin/org/mifospay/feature/auth/social_signup/SocialSignupMethodScreen.kt +++ b/feature/auth/src/main/kotlin/org/mifospay/feature/auth/socialSignup/SocialSignupMethodScreen.kt @@ -1,6 +1,6 @@ @file:Suppress("MaxLineLength") -package org.mifospay.feature.auth.social_signup +package org.mifospay.feature.auth.socialSignup import android.content.Context import android.util.Log @@ -68,6 +68,7 @@ fun SocialSignupMethodContentScreen( } @Composable +@Suppress("NestedBlockDepth") fun SocialSignupMethodScreen( onDismissSignUp: () -> Unit ) { @@ -180,6 +181,7 @@ fun SocialSignupMethodScreen( } @Composable +@Suppress("LongMethod") fun SignupMethodContentScreen( showProgress: Boolean, onSignUpAsMerchant: (Boolean) -> Unit, @@ -293,6 +295,7 @@ fun SignupMethodContentScreen( } } +@Suppress("UnusedParameter") fun GoogleIdTokenCredential?.signUpWithMifos( context: Context, mifosSavingsProductId: Int, diff --git a/feature/auth/src/test/java/org/mifospay/mobilewallet/mifospay/auth/ExampleUnitTest.kt b/feature/auth/src/test/java/org/mifospay/mobilewallet/mifospay/auth/ExampleUnitTest.kt index ef6307ea8..f5a6e9b70 100644 --- a/feature/auth/src/test/java/org/mifospay/mobilewallet/mifospay/auth/ExampleUnitTest.kt +++ b/feature/auth/src/test/java/org/mifospay/mobilewallet/mifospay/auth/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.mobilewallet.mifospay.auth +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt index 59069ccf7..99c21a24f 100644 --- a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt +++ b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordScreen.kt @@ -103,11 +103,11 @@ fun EditPasswordScreen( }, backPress = onBackPress, - scaffoldContent = { it -> + scaffoldContent = { paddingValues -> Column( modifier = Modifier .fillMaxSize() - .padding(it) + .padding(paddingValues) ) { MfPasswordTextField( modifier = Modifier diff --git a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt index 87fb51e77..f34565c94 100644 --- a/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt +++ b/feature/editpassword/src/main/kotlin/org/mifospay/feature/editpassword/EditPasswordViewModel.kt @@ -14,6 +14,7 @@ import org.mifospay.core.datastore.PreferencesHelper import javax.inject.Inject @HiltViewModel +@Suppress("NestedBlockDepth") class EditPasswordViewModel @Inject constructor( private val mUseCaseHandler: UseCaseHandler, private val mPreferencesHelper: PreferencesHelper, diff --git a/feature/editpassword/src/test/java/org/mifospay/feature/editpassword/ExampleUnitTest.kt b/feature/editpassword/src/test/java/org/mifospay/feature/editpassword/ExampleUnitTest.kt index 82de60950..d72c43f12 100644 --- a/feature/editpassword/src/test/java/org/mifospay/feature/editpassword/ExampleUnitTest.kt +++ b/feature/editpassword/src/test/java/org/mifospay/feature/editpassword/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.editpassword +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/faq/build.gradle.kts b/feature/faq/build.gradle.kts index 5b0e09cca..bb726e6ee 100644 --- a/feature/faq/build.gradle.kts +++ b/feature/faq/build.gradle.kts @@ -4,9 +4,9 @@ plugins { } android { - namespace = "com.example.faq" + namespace = "org.mifospay.feature.faq" } dependencies { - implementation(libs.androidx.appcompat) + } \ No newline at end of file diff --git a/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FAQViewModel.kt b/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FAQViewModel.kt index cfc5d7219..0ea1db768 100644 --- a/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FAQViewModel.kt +++ b/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FAQViewModel.kt @@ -1,7 +1,6 @@ package org.mifospay.feature.faq import androidx.lifecycle.ViewModel -import com.example.faq.R import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject diff --git a/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FaqScreen.kt b/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FaqScreen.kt index 58cefe3da..731965773 100644 --- a/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FaqScreen.kt +++ b/feature/faq/src/main/kotlin/org/mifospay/feature/faq/FaqScreen.kt @@ -10,7 +10,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel -import com.example.faq.R import org.mifospay.core.designsystem.component.MifosTopBar import org.mifospay.core.ui.FaqItemScreen diff --git a/feature/faq/src/test/java/com/example/faq/ExampleUnitTest.kt b/feature/faq/src/test/java/com/example/faq/ExampleUnitTest.kt index 61332a34d..83b1cbcfa 100644 --- a/feature/faq/src/test/java/com/example/faq/ExampleUnitTest.kt +++ b/feature/faq/src/test/java/com/example/faq/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package com.example.faq +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/finance/src/main/kotlin/org/mifospay/feature/finance/FinanceScreen.kt b/feature/finance/src/main/kotlin/org/mifospay/feature/finance/FinanceScreen.kt index 106b018fb..4109afb9f 100644 --- a/feature/finance/src/main/kotlin/org/mifospay/feature/finance/FinanceScreen.kt +++ b/feature/finance/src/main/kotlin/org/mifospay/feature/finance/FinanceScreen.kt @@ -2,10 +2,10 @@ package org.mifospay.feature.finance import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize -import com.google.accompanist.pager.rememberPagerState import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import com.google.accompanist.pager.rememberPagerState import com.mifospay.core.model.domain.BankAccountDetails import org.mifospay.core.ui.MifosScrollableTabRow import org.mifospay.core.ui.utility.TabContent @@ -14,6 +14,7 @@ import org.mifospay.feature.kyc.KYCScreen import org.mifospay.feature.merchants.ui.MerchantScreen import org.mifospay.feature.savedcards.CardsScreen +@Suppress("UnusedParameter") @Composable fun FinanceRoute( onAddBtn: () -> Unit, diff --git a/feature/finance/src/test/java/org/mifospay/feature/finance/ExampleUnitTest.kt b/feature/finance/src/test/java/org/mifospay/feature/finance/ExampleUnitTest.kt index 69dac2ab7..756a91d32 100644 --- a/feature/finance/src/test/java/org/mifospay/feature/finance/ExampleUnitTest.kt +++ b/feature/finance/src/test/java/org/mifospay/feature/finance/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.finance +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/TransactionsHistory.kt b/feature/history/src/main/kotlin/org/mifospay/feature/TransactionsHistory.kt index 57704c6c5..c034032c8 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/TransactionsHistory.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/TransactionsHistory.kt @@ -1,14 +1,15 @@ package org.mifospay.feature +import com.mifospay.core.model.domain.Transaction import org.mifospay.core.data.base.TaskLooper import org.mifospay.core.data.base.UseCase.UseCaseCallback import org.mifospay.core.data.base.UseCaseFactory -import com.mifospay.core.model.domain.Transaction import org.mifospay.core.data.base.UseCaseHandler import org.mifospay.core.data.domain.usecase.account.FetchAccount import org.mifospay.core.data.domain.usecase.account.FetchAccountTransactions import javax.inject.Inject +@Suppress("UnusedPrivateProperty") class TransactionsHistory @Inject constructor( private val mUsecaseHandler: UseCaseHandler, private val fetchAccountTransactionsUseCase: FetchAccountTransactions, diff --git a/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt b/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt index eb220fdac..252d0793a 100644 --- a/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt +++ b/feature/history/src/main/kotlin/org/mifospay/feature/history/HistoryScreen.kt @@ -25,7 +25,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview @@ -38,10 +37,8 @@ import com.mifospay.core.model.domain.Currency import com.mifospay.core.model.domain.Transaction import com.mifospay.core.model.domain.TransactionType import com.mifospay.core.model.entity.accounts.savings.TransferDetail - import org.mifospay.core.designsystem.component.MifosBottomSheet import org.mifospay.core.designsystem.component.MifosLoadingWheel -import org.mifospay.core.designsystem.theme.chipSelectedColor import org.mifospay.core.designsystem.theme.lightGrey import org.mifospay.core.ui.EmptyContentScreen import org.mifospay.core.ui.TransactionItemScreen @@ -166,15 +163,19 @@ fun HistoryScreen( } @Composable -fun Chip(selected: Boolean, onClick: () -> Unit, label: String) { +fun Chip( + selected: Boolean, + onClick: () -> Unit, + label: String +) { val context = LocalContext.current - val backgroundColor = if (selected) chipSelectedColor else lightGrey + val backgroundColor = if (selected) MaterialTheme.colorScheme.primary else lightGrey Button( onClick = { onClick() Toast.makeText(context, label, Toast.LENGTH_SHORT).show() }, - colors = ButtonDefaults.buttonColors(if (selected) MaterialTheme.colorScheme.primary else lightGrey) + colors = ButtonDefaults.buttonColors(backgroundColor) ) { Text( modifier = Modifier.padding(top = 4.dp, bottom = 4.dp, start = 16.dp, end = 16.dp), diff --git a/feature/history/src/test/java/org/mifospay/history/ExampleUnitTest.kt b/feature/history/src/test/java/org/mifospay/history/ExampleUnitTest.kt index b7d4749b3..bcbd7d191 100644 --- a/feature/history/src/test/java/org/mifospay/history/ExampleUnitTest.kt +++ b/feature/history/src/test/java/org/mifospay/history/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.history +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/home/src/test/java/org/mifospay/feature/home/ExampleUnitTest.kt b/feature/home/src/test/java/org/mifospay/feature/home/ExampleUnitTest.kt index 26ea788c3..b855ccb47 100644 --- a/feature/home/src/test/java/org/mifospay/feature/home/ExampleUnitTest.kt +++ b/feature/home/src/test/java/org/mifospay/feature/home/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.home +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/invoices/build.gradle.kts b/feature/invoices/build.gradle.kts index 7c117caa1..3f05205ca 100644 --- a/feature/invoices/build.gradle.kts +++ b/feature/invoices/build.gradle.kts @@ -10,5 +10,4 @@ android { dependencies { implementation(projects.core.data) implementation(projects.feature.receipt) - implementation(libs.androidx.appcompat) } \ No newline at end of file diff --git a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt index 2be5ee22a..1f5f168aa 100644 --- a/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt +++ b/feature/invoices/src/main/kotlin/org/mifospay/feature/invoices/InvoiceDetailScreen.kt @@ -21,7 +21,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.input.pointer.pointerInput import androidx.compose.ui.platform.LocalClipboardManager -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString import androidx.compose.ui.text.font.FontWeight @@ -99,6 +98,7 @@ fun InvoiceDetailScreen( } @Composable +@Suppress("LongMethod") fun InvoiceDetailsContent( invoice: Invoice?, merchantId: String?, @@ -112,7 +112,6 @@ fun InvoiceDetailsContent( .fillMaxWidth() .padding(horizontal = 16.dp) ) { - val context = LocalContext.current Text( text = stringResource(R.string.feature_invoices_invoice_details), modifier = Modifier.padding(top = 16.dp) diff --git a/feature/invoices/src/test/java/org/mifospay/invoices/ExampleUnitTest.kt b/feature/invoices/src/test/java/org/mifospay/invoices/ExampleUnitTest.kt index a6c7da760..9eb7e5d27 100644 --- a/feature/invoices/src/test/java/org/mifospay/invoices/ExampleUnitTest.kt +++ b/feature/invoices/src/test/java/org/mifospay/invoices/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.invoices +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/kyc/build.gradle.kts b/feature/kyc/build.gradle.kts index 19e52e55c..ce0d7e475 100644 --- a/feature/kyc/build.gradle.kts +++ b/feature/kyc/build.gradle.kts @@ -13,5 +13,6 @@ dependencies { implementation(libs.sheets.compose.dialogs.core) implementation(libs.sheets.compose.dialogs.calender) implementation(libs.compose.country.code.picker) + // TODO:: this should be removed implementation(libs.squareup.okhttp) } \ No newline at end of file diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt index d8507b6de..5426a66c2 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel2Screen.kt @@ -117,6 +117,7 @@ fun KYCLevel2Screen( } +@Suppress("LongMethod", "CyclomaticComplexMethod") @Composable fun Kyc2Form( modifier: Modifier, diff --git a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3ViewModel.kt b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3ViewModel.kt index afdc0e666..0d9df9841 100644 --- a/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3ViewModel.kt +++ b/feature/kyc/src/main/kotlin/org/mifospay/feature/kyc/KYCLevel3ViewModel.kt @@ -9,6 +9,7 @@ import org.mifospay.core.data.repository.local.LocalRepository import javax.inject.Inject @HiltViewModel +@Suppress("UnusedPrivateProperty") class KYCLevel3ViewModel @Inject constructor( private val mUseCaseHandler: UseCaseHandler, private val mLocalRepository: LocalRepository diff --git a/feature/kyc/src/test/java/org/mifospay/kyc/ExampleUnitTest.kt b/feature/kyc/src/test/java/org/mifospay/kyc/ExampleUnitTest.kt index 51713c988..f117e1df6 100644 --- a/feature/kyc/src/test/java/org/mifospay/kyc/ExampleUnitTest.kt +++ b/feature/kyc/src/test/java/org/mifospay/kyc/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.kyc +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/make-transfer/src/test/java/org/mifospay/feature/make/transfer/ExampleUnitTest.kt b/feature/make-transfer/src/test/java/org/mifospay/feature/make/transfer/ExampleUnitTest.kt index 3a3b0cf4d..9961f6fc5 100644 --- a/feature/make-transfer/src/test/java/org/mifospay/feature/make/transfer/ExampleUnitTest.kt +++ b/feature/make-transfer/src/test/java/org/mifospay/feature/make/transfer/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.make.transfer +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/merchants/src/test/java/org/mifospay/feature/merchants/ExampleUnitTest.kt b/feature/merchants/src/test/java/org/mifospay/feature/merchants/ExampleUnitTest.kt index 3a6a0cc59..5c7840a18 100644 --- a/feature/merchants/src/test/java/org/mifospay/feature/merchants/ExampleUnitTest.kt +++ b/feature/merchants/src/test/java/org/mifospay/feature/merchants/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.merchants +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/notification/src/test/java/org/mifospay/notification/ExampleUnitTest.kt b/feature/notification/src/test/java/org/mifospay/notification/ExampleUnitTest.kt index bd23e0c73..0b99d81c6 100644 --- a/feature/notification/src/test/java/org/mifospay/notification/ExampleUnitTest.kt +++ b/feature/notification/src/test/java/org/mifospay/notification/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.notification +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/passcode/src/test/java/org/mifospay/mobilewallet/mifospay/feature/passcode/ExampleUnitTest.kt b/feature/passcode/src/test/java/org/mifospay/mobilewallet/mifospay/feature/passcode/ExampleUnitTest.kt index 2214e65f7..618f111b4 100644 --- a/feature/passcode/src/test/java/org/mifospay/mobilewallet/mifospay/feature/passcode/ExampleUnitTest.kt +++ b/feature/passcode/src/test/java/org/mifospay/mobilewallet/mifospay/feature/passcode/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.mobilewallet.mifospay.feature.passcode +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/payments/src/test/java/org/mifospay/payments/ExampleUnitTest.kt b/feature/payments/src/test/java/org/mifospay/payments/ExampleUnitTest.kt index dbd15bfa5..81c62c062 100644 --- a/feature/payments/src/test/java/org/mifospay/payments/ExampleUnitTest.kt +++ b/feature/payments/src/test/java/org/mifospay/payments/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.payments +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/profile/build.gradle.kts b/feature/profile/build.gradle.kts index cd0e4ca74..ddd8e19b8 100644 --- a/feature/profile/build.gradle.kts +++ b/feature/profile/build.gradle.kts @@ -14,9 +14,8 @@ android { dependencies { implementation(projects.core.data) - implementation(libs.squareup.okhttp) implementation(libs.compose.country.code.picker) + // TODO:: this should be removed implementation(libs.compose.material) implementation(libs.coil.kt.compose) - implementation(libs.androidx.appcompat) } \ No newline at end of file diff --git a/feature/profile/src/test/java/org/mifospay/profile/ExampleUnitTest.kt b/feature/profile/src/test/java/org/mifospay/profile/ExampleUnitTest.kt index ab70f76c0..5259d9d33 100644 --- a/feature/profile/src/test/java/org/mifospay/profile/ExampleUnitTest.kt +++ b/feature/profile/src/test/java/org/mifospay/profile/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.profile +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/qr/build.gradle.kts b/feature/qr/build.gradle.kts index 57b3499cf..07c69c5be 100644 --- a/feature/qr/build.gradle.kts +++ b/feature/qr/build.gradle.kts @@ -8,14 +8,10 @@ android { } dependencies { - //Todo: Remove these after migration - implementation("com.jakewharton:butterknife-annotations:10.2.3") - implementation("com.jakewharton:butterknife:10.2.3@aar") - implementation("me.dm7.barcodescanner:zxing:1.9.13") - implementation("com.journeyapps:zxing-android-embedded:4.2.0") - implementation(project(":core:data")) + implementation(libs.zxing) + implementation(projects.core.data) implementation(libs.androidx.camera.view) implementation(libs.androidx.camera.lifecycle) - + // TODO:: this should be removed implementation("com.google.guava:guava:27.0.1-android") } \ No newline at end of file diff --git a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt index d087e0ddf..3251a74c7 100644 --- a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt +++ b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/ReadQrScreen.kt @@ -6,6 +6,7 @@ import android.graphics.Bitmap import android.graphics.BitmapFactory import android.net.Uri import android.os.Build +import android.util.Log import android.util.Size import androidx.activity.compose.rememberLauncherForActivityResult import androidx.activity.result.contract.ActivityResultContracts @@ -32,7 +33,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.res.stringResource @@ -201,7 +201,7 @@ fun loadBitmapFromUri(context: Context, uri: Uri): Bitmap? { val stream = context.contentResolver.openInputStream(uri) BitmapFactory.decodeStream(stream) } catch (e: Exception) { - e.printStackTrace() + Log.e("Error", e.message.toString()) null } } diff --git a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/utils/QrCodeAnalyzer.kt b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/utils/QrCodeAnalyzer.kt index 7bf7c09fc..5d2434507 100644 --- a/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/utils/QrCodeAnalyzer.kt +++ b/feature/qr/src/main/kotlin/org/mifospay/feature/read/qr/utils/QrCodeAnalyzer.kt @@ -1,6 +1,7 @@ package org.mifospay.feature.read.qr.utils import android.graphics.ImageFormat +import android.util.Log import androidx.camera.core.ImageAnalysis import androidx.camera.core.ImageProxy import com.google.zxing.BarcodeFormat @@ -47,7 +48,7 @@ class QrCodeAnalyzer( }.decode(binaryBmp) onQrCodeScanned(result.text) } catch (e: Exception) { - e.printStackTrace() + Log.e("Error", e.message.toString()) } finally { image.close() } diff --git a/feature/qr/src/test/java/org/mifospay/feature/qr/ExampleUnitTest.kt b/feature/qr/src/test/java/org/mifospay/feature/qr/ExampleUnitTest.kt index 0d2a2fba0..3b5186d2a 100644 --- a/feature/qr/src/test/java/org/mifospay/feature/qr/ExampleUnitTest.kt +++ b/feature/qr/src/test/java/org/mifospay/feature/qr/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.qr +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/receipt/build.gradle.kts b/feature/receipt/build.gradle.kts index 8d2cc7f90..a58729894 100644 --- a/feature/receipt/build.gradle.kts +++ b/feature/receipt/build.gradle.kts @@ -8,9 +8,7 @@ android { } dependencies { + // TODO:: this should be removed implementation(libs.squareup.okhttp) implementation(projects.core.data) - implementation(libs.androidx.appcompat) - implementation(projects.feature.passcode) - implementation(libs.mifosPasscode) } \ No newline at end of file diff --git a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt index c6237e84b..6dde78ee1 100644 --- a/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt +++ b/feature/receipt/src/main/kotlin/org/mifospay/feature/receipt/ReceiptScreen.kt @@ -67,6 +67,7 @@ import java.io.File * PR link : https://github.com/openMF/mobile-wallet/pull/1618 */ @Composable +@Suppress("UnusedParameter") fun ReceiptScreenRoute( uri: Uri?, viewModel: ReceiptViewModel = hiltViewModel(), diff --git a/feature/receipt/src/test/java/org/mifospay/receipt/ExampleUnitTest.kt b/feature/receipt/src/test/java/org/mifospay/receipt/ExampleUnitTest.kt index f9580eadf..c3a5b88fd 100644 --- a/feature/receipt/src/test/java/org/mifospay/receipt/ExampleUnitTest.kt +++ b/feature/receipt/src/test/java/org/mifospay/receipt/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.receipt +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/request-money/build.gradle.kts b/feature/request-money/build.gradle.kts index ba4dd78bb..53547859e 100644 --- a/feature/request-money/build.gradle.kts +++ b/feature/request-money/build.gradle.kts @@ -14,6 +14,5 @@ dependencies { implementation(projects.core.data) implementation(libs.zxing) - implementation(libs.zxing.android.embedded) implementation(libs.coil.kt.compose) } \ No newline at end of file diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/PayVpaMobileScreen.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/PayVpaMobileScreen.kt index f142c107a..1b409a9ee 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/PayVpaMobileScreen.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/PayVpaMobileScreen.kt @@ -94,6 +94,7 @@ fun PayVpsMobileScreen() { } } +@Suppress("CyclomaticComplexMethod") @Composable fun rememberQrBitmapPainter( content: String, diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt index ea7f48f60..219651b51 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/SetAmountDialog.kt @@ -34,7 +34,7 @@ import org.mifospay.core.designsystem.component.MifosCustomDialog import org.mifospay.core.designsystem.component.MifosOutlinedButton import org.mifospay.core.designsystem.icon.MifosIcons -@Suppress("MaxLineLength") +@Suppress("MaxLineLength", "ReturnCount") @Composable fun SetAmountDialog( dismissDialog: () -> Unit, diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt index 66c7495fb..48e70ecf1 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/ShowQrContent.kt @@ -20,6 +20,7 @@ import coil.compose.AsyncImage import org.mifospay.core.designsystem.component.MifosButton @Composable +@Suppress("ImplicitDefaultLocale") fun ShowQrContent( qrDataBitmap: Bitmap, amount: String?, diff --git a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt index 895930161..b2a777b79 100644 --- a/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt +++ b/feature/request-money/src/main/kotlin/org/mifospay/feature/request/money/util/ImageUtils.kt @@ -3,6 +3,7 @@ package org.mifospay.feature.request.money.util import android.content.Context import android.graphics.Bitmap import android.net.Uri +import android.util.Log import androidx.core.content.FileProvider import org.mifospay.feature.request.money.BuildConfig import java.io.File @@ -25,7 +26,7 @@ object ImageUtils { BuildConfig.LIBRARY_PACKAGE_NAME+ ".provider", file ) } catch (e: IOException) { - e.printStackTrace() + Log.d("Error", e.message.toString()) } return uri } diff --git a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt index a7072449a..aeb0b68f4 100644 --- a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt +++ b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/AddCardDialogSheet.kt @@ -51,7 +51,7 @@ fun AddCardDialogSheet( ) } -@Suppress("MaxLineLength") +@Suppress("MaxLineLength", "CyclomaticComplexMethod", "ReturnCount") @Composable fun AddCardDialogSheetContent( cancelClicked: () -> Unit, diff --git a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt index b249f533f..656adf7d5 100644 --- a/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt +++ b/feature/savedcards/src/main/kotlin/org/mifospay/feature/savedcards/CardsScreen.kt @@ -50,10 +50,6 @@ import org.mifospay.core.ui.EmptyContentScreen import org.mifospay.core.ui.utility.AddCardChip import org.mifospay.savedcards.R -enum class CardMenuAction { - EDIT, DELETE, CANCEL -} - @Composable fun CardsScreen( viewModel: CardsScreenViewModel = hiltViewModel(), @@ -111,6 +107,10 @@ fun CardsScreen( ) } +enum class CardMenuAction { + EDIT, DELETE, CANCEL +} + @Composable fun CardsScreen( cardState: CardsUiState, diff --git a/feature/savedcards/src/test/java/org/mifospay/savedcards/ExampleUnitTest.kt b/feature/savedcards/src/test/java/org/mifospay/savedcards/ExampleUnitTest.kt index ee0eea6c9..8427429bb 100644 --- a/feature/savedcards/src/test/java/org/mifospay/savedcards/ExampleUnitTest.kt +++ b/feature/savedcards/src/test/java/org/mifospay/savedcards/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.savedcards +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/send-money/build.gradle.kts b/feature/send-money/build.gradle.kts index 4605e59c2..f47e71b55 100644 --- a/feature/send-money/build.gradle.kts +++ b/feature/send-money/build.gradle.kts @@ -11,7 +11,7 @@ dependencies { implementation(projects.core.data) // we need it for country picker library - implementation("androidx.compose.material:material:1.6.0") + implementation(libs.compose.material) implementation(libs.compose.country.code.picker) // remove after moving auth code to module // Google Bar code scanner diff --git a/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt b/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt index 81dbcc904..5b797db6f 100644 --- a/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt +++ b/feature/send-money/src/main/kotlin/org/mifospay/feature/send/money/SendScreenRoute.kt @@ -5,8 +5,6 @@ import android.net.Uri import android.provider.ContactsContract import android.util.Log import android.widget.Toast -import androidx.activity.compose.rememberLauncherForActivityResult -import androidx.activity.result.contract.ActivityResultContracts import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues @@ -58,11 +56,6 @@ import org.mifospay.core.designsystem.component.MifosNavigationTopAppBar import org.mifospay.core.designsystem.theme.styleMedium16sp import org.mifospay.core.designsystem.theme.styleNormal18sp - -enum class SendMethodType { - VPA, MOBILE -} - @Composable fun SendScreenRoute( viewModel: SendPaymentViewModel = hiltViewModel(), @@ -98,7 +91,10 @@ fun SendScreenRoute( showToast(context.getString(it)) }, proceedWithTransferFlow = { externalId, transferAmount -> - proceedWithMakeTransferFlow.invoke(externalIdOrMobile, transferAmount.toString()) + proceedWithMakeTransferFlow.invoke( + externalIdOrMobile, + transferAmount.toString() + ) } ) } else { @@ -108,14 +104,18 @@ fun SendScreenRoute( ) } +enum class SendMethodType { + VPA, MOBILE +} + @Composable +@Suppress("LongMethod", "CyclomaticComplexMethod") fun SendMoneyScreen( showToolBar: Boolean, showProgress: Boolean, onSubmit: (String, String, SendMethodType) -> Unit, onBackClick: () -> Unit, ) { - val context = LocalContext.current var amount by rememberSaveable { mutableStateOf("") } @@ -136,29 +136,12 @@ fun SendMoneyScreen( } } - val contactLauncher = rememberLauncherForActivityResult( - contract = ActivityResultContracts.PickContact() - ) { uri: Uri? -> - uri?.let { contactUri = uri } - } - LaunchedEffect(key1 = contactUri) { contactUri?.let { mobileNumber = getContactPhoneNumber(it, context) } } - val permissionLauncher = rememberLauncherForActivityResult( - contract = ActivityResultContracts.RequestPermission(), - onResult = { isGranted: Boolean -> - if (isGranted) { - contactLauncher.launch(null) - } else { - // Handle permission denial - } - } - ) - val options = GmsBarcodeScannerOptions.Builder() .setBarcodeFormats( Barcode.FORMAT_QR_CODE, diff --git a/feature/send-money/src/test/java/org/mifospay/feature/send/money/ExampleUnitTest.kt b/feature/send-money/src/test/java/org/mifospay/feature/send/money/ExampleUnitTest.kt index 1d7ba503a..b7e3cc8a0 100644 --- a/feature/send-money/src/test/java/org/mifospay/feature/send/money/ExampleUnitTest.kt +++ b/feature/send-money/src/test/java/org/mifospay/feature/send/money/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.send.money +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/settings/build.gradle.kts b/feature/settings/build.gradle.kts index a5f872319..4f3ce9ec2 100644 --- a/feature/settings/build.gradle.kts +++ b/feature/settings/build.gradle.kts @@ -9,9 +9,8 @@ android { dependencies { implementation(projects.core.data) - implementation(projects.feature.passcode) + // TODO: this should be removed implementation(projects.feature.auth) - implementation(projects.feature.editpassword) + implementation(projects.feature.passcode) implementation(libs.mifosPasscode) - implementation(libs.androidx.appcompat) } \ No newline at end of file diff --git a/feature/settings/src/main/kotlin/org/mifospay/feature/settings/navigation/SettingsNavigation.kt b/feature/settings/src/main/kotlin/org/mifospay/feature/settings/navigation/SettingsNavigation.kt index 7d29d01f9..96ee44980 100644 --- a/feature/settings/src/main/kotlin/org/mifospay/feature/settings/navigation/SettingsNavigation.kt +++ b/feature/settings/src/main/kotlin/org/mifospay/feature/settings/navigation/SettingsNavigation.kt @@ -8,11 +8,13 @@ import org.mifospay.feature.settings.SettingsScreenRoute const val SETTINGS_ROUTE = "settings_route" -fun NavController.navigateToSettings(navOptions: NavOptions? = null) = navigate(SETTINGS_ROUTE) +fun NavController.navigateToSettings(navOptions: NavOptions? = null) { + this.navigate(SETTINGS_ROUTE, navOptions) +} fun NavGraphBuilder.settingsScreen( onBackPress: () -> Unit, - navigateToEditPasswordScreen:() -> Unit + navigateToEditPasswordScreen: () -> Unit ) { composable(route = SETTINGS_ROUTE) { SettingsScreenRoute( diff --git a/feature/settings/src/test/java/org/mifospay/feature/settings/ExampleUnitTest.kt b/feature/settings/src/test/java/org/mifospay/feature/settings/ExampleUnitTest.kt index 30d1c82d9..4e320020b 100644 --- a/feature/settings/src/test/java/org/mifospay/feature/settings/ExampleUnitTest.kt +++ b/feature/settings/src/test/java/org/mifospay/feature/settings/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.settings +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/SIDetailsScreen.kt b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/SIDetailsScreen.kt index 345ce0fbb..c302a7451 100644 --- a/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/SIDetailsScreen.kt +++ b/feature/standing-instruction/src/main/kotlin/org/mifospay/feature/standing/instruction/SIDetailsScreen.kt @@ -45,6 +45,7 @@ fun SIDetailsScreen( ) } +@Suppress("UnusedParameter") @Composable fun SIDetailsScreen( siDetailsUiState: SiDetailsUiState, diff --git a/feature/standing-instruction/src/test/java/org/mifospay/feature/standing/instruction/ExampleUnitTest.kt b/feature/standing-instruction/src/test/java/org/mifospay/feature/standing/instruction/ExampleUnitTest.kt index 2527f068b..7d86a3eb1 100644 --- a/feature/standing-instruction/src/test/java/org/mifospay/feature/standing/instruction/ExampleUnitTest.kt +++ b/feature/standing-instruction/src/test/java/org/mifospay/feature/standing/instruction/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package org.mifospay.feature.standing.instruction +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/feature/upi-setup/build.gradle.kts b/feature/upi-setup/build.gradle.kts index 8960c532b..802983c10 100644 --- a/feature/upi-setup/build.gradle.kts +++ b/feature/upi-setup/build.gradle.kts @@ -9,7 +9,4 @@ android { dependencies { implementation(projects.core.data) - - // need this because of M2 dependency in this module - implementation("androidx.compose.material:material:1.6.0") } \ No newline at end of file diff --git a/feature/upi-setup/src/androidTest/java/org/mifospay/feature/upi_setup/ExampleInstrumentedTest.kt b/feature/upi-setup/src/androidTest/java/org/mifospay/feature/upiSetup/ExampleInstrumentedTest.kt similarity index 94% rename from feature/upi-setup/src/androidTest/java/org/mifospay/feature/upi_setup/ExampleInstrumentedTest.kt rename to feature/upi-setup/src/androidTest/java/org/mifospay/feature/upiSetup/ExampleInstrumentedTest.kt index 3b28ad872..0e1174e4d 100644 --- a/feature/upi-setup/src/androidTest/java/org/mifospay/feature/upi_setup/ExampleInstrumentedTest.kt +++ b/feature/upi-setup/src/androidTest/java/org/mifospay/feature/upiSetup/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup +package org.mifospay.feature.upiSetup import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/navigation/SetupUpiPinNavigation.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt similarity index 93% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/navigation/SetupUpiPinNavigation.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt index 73aadf02e..0e41ab148 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/navigation/SetupUpiPinNavigation.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/navigation/SetupUpiPinNavigation.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.navigation +package org.mifospay.feature.upiSetup.navigation import android.os.Bundle import androidx.navigation.NavController @@ -8,7 +8,7 @@ import androidx.navigation.compose.composable import androidx.navigation.navArgument import com.mifospay.core.model.domain.BankAccountDetails import org.mifospay.common.Constants -import org.mifospay.feature.upi_setup.screens.SetupUpiPinScreenRoute +import org.mifospay.feature.upiSetup.screens.SetupUpiPinScreenRoute const val SETUP_UPI_PIN_ROUTE = "setup_upi_pin_route" diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt similarity index 96% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreen.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt index ac3ce0f1b..480e3c87a 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreen.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -18,8 +18,8 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import org.mifospay.core.designsystem.component.MifosLoadingWheel import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.VerifyStepHeader -import org.mifospay.feature.upi_setup.viewmodel.DebitCardUiState -import org.mifospay.feature.upi_setup.viewmodel.DebitCardViewModel +import org.mifospay.feature.upiSetup.viewmodel.DebitCardUiState +import org.mifospay.feature.upiSetup.viewmodel.DebitCardViewModel @Composable fun DebitCardScreen( diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreenContent.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt similarity index 92% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreenContent.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt index a87294661..9ebdfef6e 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/DebitCardScreenContent.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/DebitCardScreenContent.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer @@ -6,9 +6,9 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.OutlinedTextField -import androidx.compose.material.TextFieldDefaults import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -29,8 +29,8 @@ import androidx.compose.ui.text.input.VisualTransformation import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel -import org.mifospay.feature.upi_setup.viewmodel.DebitCardViewModel -import org.mifos.mobilewallet.mifospay.ui.ExpiryDateInput +import org.mifospay.core.ui.ExpiryDateInput +import org.mifospay.feature.upiSetup.viewmodel.DebitCardViewModel @Composable @@ -64,7 +64,7 @@ fun DebitCardScreenContents( val formattedCardNumber = formatCardNumber(it) formattedCardNumber }, - colors = TextFieldDefaults.outlinedTextFieldColors( + colors = OutlinedTextFieldDefaults.colors( focusedBorderColor = Color.DarkGray, unfocusedBorderColor = Color.LightGray, cursorColor = MaterialTheme.colorScheme.onSurface @@ -81,6 +81,7 @@ fun DebitCardScreenContents( } } +@Suppress("ReturnCount") fun formatCardNumber(text: AnnotatedString): TransformedText { val trimmed = if (text.text.length >= 16) text.text.substring(0..15) else text.text var out = "" diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/OtpScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt similarity index 89% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/OtpScreen.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt index ffd591d16..328764583 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/OtpScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/OtpScreen.kt @@ -1,12 +1,13 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding -import androidx.compose.material.Card -import androidx.compose.material.Text +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -14,9 +15,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.OtpTextField import org.mifospay.core.ui.VerifyStepHeader -import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.feature.upi_setup.R @@ -35,7 +36,10 @@ fun OtpScreen( bottom = 15.dp, start = 10.dp, end = 10.dp - ), elevation = 1.dp + ), + elevation = CardDefaults.cardElevation( + defaultElevation = 1.dp + ) ) { Column( modifier = Modifier.fillMaxWidth(), diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUPiPinScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt similarity index 95% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUPiPinScreen.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt index 78e3740a3..3906c6c7b 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUPiPinScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUPiPinScreen.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import android.app.Activity import android.content.Intent @@ -22,8 +22,8 @@ import androidx.hilt.navigation.compose.hiltViewModel import com.mifospay.core.model.domain.BankAccountDetails import org.mifospay.common.Constants import org.mifospay.core.designsystem.icon.MifosIcons +import org.mifospay.feature.upiSetup.viewmodel.SetUpUpiViewModal import org.mifospay.feature.upi_setup.R -import org.mifospay.feature.upi_setup.viewmodel.SetUpUpiViewModal @Composable fun SetupUpiPinScreenRoute( @@ -76,10 +76,10 @@ fun SetupUpiPinScreen( } }) }, - content = { it -> + content = { paddingValues -> Column( modifier = Modifier - .padding(it), + .padding(paddingValues), verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally ) { diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUpiScreenContent.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt similarity index 94% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUpiScreenContent.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt index 70d2c0873..8a4f1b9e9 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/SetUpUpiScreenContent.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/SetUpUpiScreenContent.kt @@ -1,9 +1,8 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import android.util.Log import android.widget.Toast import androidx.compose.foundation.layout.Column -import androidx.compose.material.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -14,7 +13,8 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.hilt.navigation.compose.hiltViewModel import com.mifospay.core.model.domain.BankAccountDetails import org.mifospay.common.Constants -import org.mifospay.feature.upi_setup.viewmodel.SetUpUpiViewModal +import org.mifospay.core.designsystem.theme.MifosTheme +import org.mifospay.feature.upiSetup.viewmodel.SetUpUpiViewModal @Composable fun SetUpUpiScreenContent( @@ -105,7 +105,7 @@ fun ChangeUpi( @Preview @Composable fun PreviewSetUpUpiPin() { - MaterialTheme { + MifosTheme { SetUpUpiScreenContent(bankAccountDetails = BankAccountDetails(), type = Constants.SETUP, correctlySettingUpi = {}) @@ -115,7 +115,7 @@ fun PreviewSetUpUpiPin() { @Preview @Composable fun PreviewForgetUpiPin() { - MaterialTheme { + MifosTheme { SetUpUpiScreenContent(bankAccountDetails = BankAccountDetails(), type = Constants.FORGOT, correctlySettingUpi = {}) @@ -125,7 +125,7 @@ fun PreviewForgetUpiPin() { @Preview @Composable fun PreviewChangeUpiPin() { - MaterialTheme { + MifosTheme { SetUpUpiScreenContent(bankAccountDetails = BankAccountDetails(), type = Constants.CHANGE, correctlySettingUpi = {}) diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/UpiPinScreen.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt similarity index 74% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/UpiPinScreen.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt index 43d7c2962..e17376cc3 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/screens/UpiPinScreen.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/screens/UpiPinScreen.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.screens +package org.mifospay.feature.upiSetup.screens import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column @@ -11,11 +11,13 @@ import androidx.compose.foundation.layout.wrapContentHeight import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.Card -import androidx.compose.material.Text +import androidx.compose.material3.Card +import androidx.compose.material3.CardDefaults import androidx.compose.material3.MaterialTheme import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -32,8 +34,8 @@ import androidx.compose.ui.unit.sp import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch -import org.mifospay.core.ui.VerifyStepHeader import org.mifospay.core.designsystem.theme.MifosTheme +import org.mifospay.core.ui.VerifyStepHeader import org.mifospay.feature.upi_setup.R @Composable @@ -50,7 +52,10 @@ fun UpiPinScreen( bottom = 15.dp, start = 10.dp, end = 10.dp - ), elevation = 1.dp + ), + elevation = CardDefaults.cardElevation( + defaultElevation = 1.dp + ) ) { Column( modifier = Modifier.fillMaxWidth(), @@ -70,47 +75,55 @@ fun UpiPinScreen( fun UpiPinScreenContent( correctlySettingUpi: (String) -> Unit ) { - val steps1 = rememberSaveable { mutableStateOf(0) } + val steps1 = rememberSaveable { mutableIntStateOf(0) } val upiPin1 = rememberSaveable { mutableStateOf("") } val upiPin2 = rememberSaveable { mutableStateOf("") } val upiPinTobeMatched1 = rememberSaveable { mutableStateOf("") } val snackbarHostState = remember { SnackbarHostState() } Text( - text = if (steps1.value == 0) stringResource(id = R.string.feature_upi_setup_enter_upi_pin) + text = if (steps1.intValue == 0) stringResource(id = R.string.feature_upi_setup_enter_upi_pin) else stringResource(id = R.string.feature_upi_setup_reenter_upi), color = MaterialTheme.colorScheme.onSurface, fontSize = 18.sp, style = MaterialTheme.typography.headlineMedium ) - if (steps1.value == 0) { - BasicTextField(value = upiPin1.value, onValueChange = { - upiPin1.value = it + if (steps1.intValue == 0) { + BasicTextField( + value = upiPin1.value, + onValueChange = { + upiPin1.value = it - if (upiPin1.value.length == 4) { - steps1.value = 1 - upiPinTobeMatched1.value = upiPin1.value - } - }, keyboardActions = KeyboardActions(onDone = { - if (upiPin1.value.length == 4) { - steps1.value = 1 - upiPinTobeMatched1.value = upiPin1.value - } - }), keyboardOptions = KeyboardOptions.Default.copy( - keyboardType = KeyboardType.Number, imeAction = ImeAction.Done - ), decorationBox = { - Row(horizontalArrangement = Arrangement.Center) { - repeat(4) { index -> - UpiPinCharView( - index = index, text = upiPin1.value - ) - Spacer(modifier = Modifier.width(8.dp)) + if (upiPin1.value.length == 4) { + steps1.intValue = 1 + upiPinTobeMatched1.value = upiPin1.value } - } - }, modifier = Modifier - .fillMaxWidth() - .padding(16.dp) + }, + keyboardActions = KeyboardActions( + onDone = { + if (upiPin1.value.length == 4) { + steps1.intValue = 1 + upiPinTobeMatched1.value = upiPin1.value + } + } + ), + keyboardOptions = KeyboardOptions.Default.copy( + keyboardType = KeyboardType.Number, imeAction = ImeAction.Done + ), + decorationBox = { + Row(horizontalArrangement = Arrangement.Center) { + repeat(4) { index -> + UpiPinCharView( + index = index, text = upiPin1.value + ) + Spacer(modifier = Modifier.width(8.dp)) + } + } + }, + modifier = Modifier + .fillMaxWidth() + .padding(16.dp) ) } else { BasicTextField(value = upiPin2.value, onValueChange = { @@ -166,7 +179,7 @@ fun UpiPinCharView( index > text.length -> "_" else -> text[index].toString() } - androidx.compose.material3.Text( + Text( modifier = Modifier .width(40.dp) .wrapContentHeight(align = Alignment.CenterVertically), @@ -185,6 +198,6 @@ fun UpiPinCharView( @Composable fun UpiScreenPreview() { MifosTheme { - UpiPinScreen(verificationStatus = false, contentVisibility = true, {}) + UpiPinScreen(verificationStatus = false, contentVisibility = true) {} } } \ No newline at end of file diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/DebitCardViewModal.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt similarity index 95% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/DebitCardViewModal.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt index 76d4aeb93..fac395b1b 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/DebitCardViewModal.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/DebitCardViewModal.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.viewmodel +package org.mifospay.feature.upiSetup.viewmodel import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope @@ -10,6 +10,7 @@ import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel +@Suppress("UnusedParameter") class DebitCardViewModel @Inject constructor() : ViewModel() { private val _debitCardUiState = MutableStateFlow(DebitCardUiState.Initials) diff --git a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/SetUpUpiViewModal.kt b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt similarity index 86% rename from feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/SetUpUpiViewModal.kt rename to feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt index 45cf40326..4f210f800 100644 --- a/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upi_setup/viewmodel/SetUpUpiViewModal.kt +++ b/feature/upi-setup/src/main/kotlin/org/mifospay/feature/upiSetup/viewmodel/SetUpUpiViewModal.kt @@ -1,4 +1,4 @@ -package org.mifospay.feature.upi_setup.viewmodel +package org.mifospay.feature.upiSetup.viewmodel import androidx.lifecycle.ViewModel import com.mifospay.core.model.domain.BankAccountDetails @@ -7,6 +7,7 @@ import javax.inject.Inject @HiltViewModel +@Suppress("UnusedParameter") class SetUpUpiViewModal @Inject constructor() : ViewModel() { fun requestOtp(bankAccountDetails: BankAccountDetails?): String { val otp = "0000" diff --git a/feature/upi-setup/src/test/java/org/mifospay/feature/upi_setup/ExampleUnitTest.kt b/feature/upi-setup/src/test/java/org/mifospay/feature/upiSetup/ExampleUnitTest.kt similarity index 79% rename from feature/upi-setup/src/test/java/org/mifospay/feature/upi_setup/ExampleUnitTest.kt rename to feature/upi-setup/src/test/java/org/mifospay/feature/upiSetup/ExampleUnitTest.kt index 512b23b51..113cf993e 100644 --- a/feature/upi-setup/src/test/java/org/mifospay/feature/upi_setup/ExampleUnitTest.kt +++ b/feature/upi-setup/src/test/java/org/mifospay/feature/upiSetup/ExampleUnitTest.kt @@ -1,9 +1,8 @@ -package org.mifospay.feature.upi_setup +package org.mifospay.feature.upiSetup +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6a6dafd6f..73c6adefb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,9 +6,13 @@ androidGradlePlugin = "8.4.0" checkstyleVersion = "10.16.0" compileSdk = "34" constraintlayoutVersion = "2.1.4" +swiperefreshLayoutVersion = "1.1.0" coreKtxVersion = "1.12.0" +credentialsVersion = "1.2.2" +googleidVersion = "1.1.1" materialNavigationVersion = "1.7.0-alpha04" minSdk = "24" +playServicesAuthVersion = "21.2.0" targetSdk = "34" androidTools = "31.4.0" androidxActivity = "1.8.2" @@ -56,7 +60,8 @@ sheets_compose_dialogs_core = "1.3.0" protobuf = "3.25.2" protobufPlugin = "0.9.4" androidxDataStore = "1.0.0" -detekt = "1.18.1" +detekt = "1.23.5" +twitter-detekt-compose = "0.0.26" androidxComposeMaterial3Adaptive = "1.0.0-alpha08" androidxComposeRuntimeTracing = "1.0.0-beta01" androidxCoreSplashscreen = "1.0.1" @@ -81,7 +86,10 @@ android-pdf-viewer = { module = "com.github.barteksc:android-pdf-viewer", versio androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityVersion" } androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompatVersion" } androidx-constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayoutVersion" } +androidx-swiperefresh-layout = {module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref="swiperefreshLayoutVersion"} androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtxVersion" } +androidx-credentials = { module = "androidx.credentials:credentials", version.ref = "credentialsVersion" } +androidx-credentials-play-services-auth = { module = "androidx.credentials:credentials-play-services-auth", version.ref = "credentialsVersion" } androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentVersion" } android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" } @@ -97,12 +105,13 @@ compose-material = { group = "androidx.compose.material", name = "material", ver androidx-compose-material-iconsExtended = { group = "androidx.compose.material", name = "material-icons-extended" } androidx-compose-material3-windowSizeClass = { group = "androidx.compose.material3", name = "material3-window-size-class" } androidx-compose-ui = { group = "androidx.compose.ui", name = "ui"} -androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4"} +androidx-compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4"} androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest"} androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling"} androidx-compose-runtime = { group = "androidx.compose.runtime", name = "runtime" } androidx-material-navigation = { module = "androidx.compose.material:material-navigation", version.ref = "materialNavigationVersion" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyleVersion" } +googleid = { module = "com.google.android.libraries.identity.googleid:googleid", version.ref = "googleidVersion" } hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" } hilt-android-testing = { group = "com.google.dagger", name = "hilt-android-testing", version.ref = "hilt" } hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } @@ -116,6 +125,7 @@ androidx-lifecycle-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx" androidx-lifecycle-extensions = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "lifecycleExtensionsVersion" } jakewharton-butterknife = { module = "com.jakewharton:butterknife", version.ref = "butterKnifeVersion" } jakewharton-compiler = { module = "com.jakewharton:butterknife-compiler", version.ref = "butterKnifeVersion" } +play-services-auth = { module = "com.google.android.gms:play-services-auth", version.ref = "playServicesAuthVersion" } squareup-retrofit2 = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofitVersion" } squareup-retrofit-adapter-rxjava = { module = "com.squareup.retrofit2:adapter-rxjava", version.ref = "retrofitVersion" } squareup-retrofit-converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofitVersion" } @@ -138,6 +148,8 @@ kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx- retrofit-kotlin-serialization = { group = "com.jakewharton.retrofit", name = "retrofit2-kotlinx-serialization-converter", version.ref = "retrofitKotlinxSerializationJson" } kotlinx-coroutines-guava = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-guava", version.ref = "kotlinxCoroutines" } kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "kotlinxCoroutines" } +kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutines" } work-testing = { group = "androidx.work", name = "work-testing", version = "2.8.1" } androidx-test-ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "androidx-test-ext-junit" } espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espresso-core" } @@ -162,6 +174,11 @@ androidx-browser = { group = "androidx.browser", name = "browser", version.ref = google-play-services-code-scanner = { group = "com.google.android.gms", name = "play-services-code-scanner", version.ref = "playServicesCodeScanner" } mifosPasscode = { group = "com.mifos.mobile", name = "mifos-passcode", version.ref = "mifosPasscode" } +#Detekt +detekt-gradlePlugin = { group = "io.gitlab.arturbosch.detekt", name="detekt-gradle-plugin", version.ref="detekt"} +detekt-formatting = { group = "io.gitlab.arturbosch.detekt", name="detekt-formatting", version.ref="detekt"} +twitter-detekt-compose = { group="com.twitter.compose.rules", name="detekt", version.ref="twitter-detekt-compose" } + # Dependencies of the included build-logic android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" } android-tools-common = { group = "com.android.tools", name = "common", version.ref = "androidTools" } @@ -195,6 +212,7 @@ ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"} room = { id = "androidx.room", version.ref = "room" } protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" } detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt"} +detekt-compiler = {id = "io.github.detekt.gradle.compiler-plugin", version.ref="detekt"} module-graph = { id = "com.jraska.module.graph.assertion", version.ref = "moduleGraph" } # Plugins defined by this project diff --git a/mifospay/build.gradle.kts b/mifospay/build.gradle.kts index dabbb910d..ab143a17b 100644 --- a/mifospay/build.gradle.kts +++ b/mifospay/build.gradle.kts @@ -67,9 +67,11 @@ dependencies { implementation(libs.androidx.core.ktx) implementation(libs.androidx.activity.ktx) implementation(libs.androidx.fragment.ktx) - implementation("androidx.vectordrawable:vectordrawable-animated:1.1.0") - implementation("androidx.media:media:1.6.0") - implementation("androidx.cardview:cardview:1.0.0") + implementation(libs.androidx.swiperefresh.layout) + +// implementation("androidx.vectordrawable:vectordrawable-animated:1.1.0") +// implementation("androidx.media:media:1.6.0") +// implementation("androidx.cardview:cardview:1.0.0") implementation("androidx.recyclerview:recyclerview:1.3.2") api("com.google.android.material:material:1.0.0") // update require alot of UI changes @@ -116,11 +118,13 @@ dependencies { implementation(libs.androidx.material.navigation) implementation(libs.accompanist.pager) + implementation(libs.mifosPasscode) + ksp(libs.hilt.compiler) // we need it for country picker library - implementation("androidx.compose.material:material:1.6.0") - implementation(libs.compose.country.code.picker) // remove after moving auth code to module +// implementation("androidx.compose.material:material:1.6.0") +// implementation(libs.compose.country.code.picker) // remove after moving auth code to module // Google Bar code scanner implementation(libs.google.play.services.code.scanner) @@ -133,57 +137,54 @@ dependencies { implementation(libs.androidx.lifecycle.ktx) implementation(libs.androidx.lifecycle.extensions) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - - implementation(libs.jakewharton.butterknife) - implementation(libs.jakewharton.compiler) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.android) // Splash API - implementation("androidx.core:core-splashscreen:1.0.1") + implementation(libs.androidx.core.splashscreen) runtimeOnly(libs.androidx.compose.runtime) debugImplementation(libs.androidx.compose.ui.tooling) - implementation(libs.squareup.retrofit2) { - // exclude Retrofit’s OkHttp peer-dependency module and define your own module import - exclude(module = "okhttp") - } - implementation(libs.squareup.retrofit.adapter.rxjava) - implementation(libs.squareup.retrofit.converter.gson) - implementation(libs.squareup.okhttp) - implementation(libs.squareup.logging.interceptor) - - implementation(libs.android.pdf.viewer) - - implementation(libs.reactivex.rxjava.android) - implementation(libs.reactivex.rxjava) - - implementation("io.michaelrocks:libphonenumber-android:8.11.0") - - implementation("me.dm7.barcodescanner:zxing:1.9.13") - implementation("com.journeyapps:zxing-android-embedded:4.2.0") +// implementation(libs.squareup.retrofit2) { +// // exclude Retrofit’s OkHttp peer-dependency module and define your own module import +// exclude(module = "okhttp") +// } +// implementation(libs.squareup.retrofit.adapter.rxjava) +// implementation(libs.squareup.retrofit.converter.gson) +// implementation(libs.squareup.okhttp) +// implementation(libs.squareup.logging.interceptor) +// +// implementation(libs.android.pdf.viewer) +// +// implementation(libs.reactivex.rxjava.android) +// implementation(libs.reactivex.rxjava) +// +// implementation("io.michaelrocks:libphonenumber-android:8.11.0") +// +// implementation("me.dm7.barcodescanner:zxing:1.9.13") +// implementation("com.journeyapps:zxing-android-embedded:4.2.0") implementation(libs.mifosPasscode) - // Coil - implementation("io.coil-kt:coil-compose:2.6.0") - - implementation("com.google.android.gms:play-services-auth:20.7.0") - - implementation("com.hbb20:ccp:2.2.0") - implementation("com.github.MdFarhanRaja:SearchableSpinner:1.9") - implementation("com.alimuzaffar.lib:pinentryedittext:1.3.1") - implementation("de.hdodenhof:circleimageview:3.1.0") - implementation("com.github.yalantis:ucrop:2.2.2") +// // Coil +// implementation("io.coil-kt:coil-compose:2.6.0") +// +// implementation("com.google.android.gms:play-services-auth:20.7.0") +// +// implementation("com.hbb20:ccp:2.2.0") +// implementation("com.github.MdFarhanRaja:SearchableSpinner:1.9") +// implementation("com.alimuzaffar.lib:pinentryedittext:1.3.1") +// implementation("de.hdodenhof:circleimageview:3.1.0") +// implementation("com.github.yalantis:ucrop:2.2.2") kspTest(libs.hilt.compiler) testImplementation(libs.junit) testImplementation(libs.hilt.android.testing) - androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1") - androidTestImplementation("androidx.test.ext:junit:1.1.5") + androidTestImplementation(libs.espresso.core) + androidTestImplementation(libs.androidx.test.ext.junit) androidTestImplementation(libs.hilt.android.testing) } diff --git a/mifospay/dependencies/prodReleaseRuntimeClasspath.txt b/mifospay/dependencies/prodReleaseRuntimeClasspath.txt index 2b6ed4567..96507c85a 100644 --- a/mifospay/dependencies/prodReleaseRuntimeClasspath.txt +++ b/mifospay/dependencies/prodReleaseRuntimeClasspath.txt @@ -75,8 +75,8 @@ androidx.coordinatorlayout:coordinatorlayout:1.1.0 androidx.core:core-ktx:1.12.0 androidx.core:core-splashscreen:1.0.1 androidx.core:core:1.12.0 -androidx.credentials:credentials-play-services-auth:1.2.1 -androidx.credentials:credentials:1.2.1 +androidx.credentials:credentials-play-services-auth:1.3.0-beta01 +androidx.credentials:credentials:1.3.0-beta01 androidx.cursoradapter:cursoradapter:1.0.0 androidx.customview:customview-poolingcontainer:1.0.0 androidx.customview:customview:1.1.0 @@ -119,9 +119,9 @@ androidx.lifecycle:lifecycle-viewmodel-compose:2.7.0 androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0 androidx.lifecycle:lifecycle-viewmodel-savedstate:2.7.0 androidx.lifecycle:lifecycle-viewmodel:2.7.0 -androidx.loader:loader:1.0.0 +androidx.loader:loader:1.1.0 androidx.localbroadcastmanager:localbroadcastmanager:1.0.0 -androidx.media:media:1.6.0 +androidx.media:media:1.0.0 androidx.metrics:metrics-performance:1.0.0-beta01 androidx.navigation:navigation-common-ktx:2.7.7 androidx.navigation:navigation-common:2.7.7 @@ -138,7 +138,7 @@ androidx.savedstate:savedstate-ktx:1.2.1 androidx.savedstate:savedstate:1.2.1 androidx.slidingpanelayout:slidingpanelayout:1.0.0 androidx.startup:startup-runtime:1.1.1 -androidx.swiperefreshlayout:swiperefreshlayout:1.0.0 +androidx.swiperefreshlayout:swiperefreshlayout:1.1.0 androidx.tracing:tracing-ktx:1.3.0-alpha02 androidx.tracing:tracing-perfetto:1.0.0 androidx.tracing:tracing:1.3.0-alpha02 @@ -152,27 +152,21 @@ androidx.window.extensions.core:core:1.0.0 androidx.window:window-core-android:1.3.0-alpha02 androidx.window:window-core:1.3.0-alpha02 androidx.window:window:1.3.0-alpha02 -com.alimuzaffar.lib:pinentryedittext:1.3.1 -com.futuremind.recyclerfastscroll:fastscroll:0.2.5 -com.github.MdFarhanRaja:SearchableSpinner:1.9 -com.github.barteksc:android-pdf-viewer:2.8.2 -com.github.barteksc:pdfium-android:1.7.1 com.github.jump-sdk:jetpack_compose_country_code_picker_emoji:2.2.8 -com.github.yalantis:ucrop:2.2.2 com.google.accompanist:accompanist-drawablepainter:0.32.0 com.google.accompanist:accompanist-pager:0.34.0 com.google.android.datatransport:transport-api:3.1.0 com.google.android.datatransport:transport-backend-cct:3.1.9 com.google.android.datatransport:transport-runtime:3.1.9 com.google.android.gms:play-services-ads-identifier:18.0.0 -com.google.android.gms:play-services-auth-api-phone:18.0.1 -com.google.android.gms:play-services-auth-base:18.0.4 -com.google.android.gms:play-services-auth:20.7.0 -com.google.android.gms:play-services-base:18.1.0 -com.google.android.gms:play-services-basement:18.2.0 +com.google.android.gms:play-services-auth-api-phone:18.0.2 +com.google.android.gms:play-services-auth-base:18.0.10 +com.google.android.gms:play-services-auth:21.2.0 +com.google.android.gms:play-services-base:18.3.0 +com.google.android.gms:play-services-basement:18.3.0 com.google.android.gms:play-services-cloud-messaging:17.1.0 com.google.android.gms:play-services-code-scanner:16.1.0 -com.google.android.gms:play-services-fido:20.1.0 +com.google.android.gms:play-services-fido:21.0.0 com.google.android.gms:play-services-measurement-api:21.5.1 com.google.android.gms:play-services-measurement-base:21.5.1 com.google.android.gms:play-services-measurement-impl:21.5.1 @@ -180,12 +174,11 @@ com.google.android.gms:play-services-measurement-sdk-api:21.5.1 com.google.android.gms:play-services-measurement-sdk:21.5.1 com.google.android.gms:play-services-measurement:21.5.1 com.google.android.gms:play-services-stats:17.0.2 -com.google.android.gms:play-services-tasks:18.0.2 -com.google.android.libraries.identity.googleid:googleid:1.1.0 +com.google.android.gms:play-services-tasks:18.1.0 +com.google.android.libraries.identity.googleid:googleid:1.1.1 com.google.android.material:material:1.11.0 com.google.android.odml:image:1.0.0-beta1 com.google.auto.value:auto-value-annotations:1.6.3 -com.google.auto:auto-common:0.10 com.google.code.findbugs:jsr305:3.0.2 com.google.code.gson:gson:2.8.5 com.google.dagger:dagger-lint-aar:2.51 @@ -228,14 +221,8 @@ com.google.mlkit:common:18.9.0 com.google.mlkit:vision-common:17.0.0 com.google.protobuf:protobuf-javalite:3.25.2 com.google.protobuf:protobuf-kotlin-lite:3.25.2 -com.google.zxing:core:3.4.0 -com.hbb20:ccp:2.2.0 +com.google.zxing:core:3.3.3 com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0 -com.jakewharton:butterknife-annotations:10.2.3 -com.jakewharton:butterknife-compiler:10.2.3 -com.jakewharton:butterknife-runtime:10.2.3 -com.jakewharton:butterknife:10.2.3 -com.journeyapps:zxing-android-embedded:4.2.0 com.maxkeppeler.sheets-compose-dialogs:calendar:1.3.0 com.maxkeppeler.sheets-compose-dialogs:core:1.3.0 com.mifos.mobile:mifos-passcode:0.3.0 @@ -246,8 +233,6 @@ com.squareup.okio:okio:3.8.0 com.squareup.retrofit2:adapter-rxjava:2.9.0 com.squareup.retrofit2:converter-gson:2.9.0 com.squareup.retrofit2:retrofit:2.9.0 -com.squareup:javapoet:1.10.0 -de.hdodenhof:circleimageview:3.1.0 dev.chrisbanes.snapper:snapper:0.3.0 io.coil-kt:coil-base:2.6.0 io.coil-kt:coil-compose-base:2.6.0 @@ -259,7 +244,6 @@ io.reactivex:rxjava:1.3.8 javax.inject:javax.inject:1 me.dm7.barcodescanner:core:1.9.13 me.dm7.barcodescanner:zxing:1.9.13 -net.ltgt.gradle.incap:incap:0.2 org.checkerframework:checker-qual:3.12.0 org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.9.22 org.jetbrains.kotlin:kotlin-bom:1.8.22 diff --git a/mifospay/src/main/java/org/mifospay/MainActivity.kt b/mifospay/src/main/java/org/mifospay/MainActivity.kt index cf8c7e4fa..73b9b545c 100644 --- a/mifospay/src/main/java/org/mifospay/MainActivity.kt +++ b/mifospay/src/main/java/org/mifospay/MainActivity.kt @@ -23,12 +23,12 @@ import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.flow.collect import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch -import org.mifospay.core.data.util.NetworkMonitor -import org.mifospay.core.data.util.TimeZoneMonitor import org.mifospay.MainActivityUiState.Loading import org.mifospay.MainActivityUiState.Success import org.mifospay.core.analytics.AnalyticsHelper import org.mifospay.core.analytics.LocalAnalyticsHelper +import org.mifospay.core.data.util.NetworkMonitor +import org.mifospay.core.data.util.TimeZoneMonitor import org.mifospay.core.designsystem.theme.MifosTheme import org.mifospay.core.ui.LocalTimeZone import org.mifospay.ui.MifosApp @@ -37,6 +37,7 @@ import javax.inject.Inject @OptIn(ExperimentalMaterial3WindowSizeClassApi::class) @AndroidEntryPoint +@Suppress("UnusedPrivateProperty") class MainActivity : ComponentActivity() { /** diff --git a/mifospay/src/main/java/org/mifospay/MifosPayApp.kt b/mifospay/src/main/java/org/mifospay/MifosPayApp.kt index 15eb94c5c..4b4802503 100644 --- a/mifospay/src/main/java/org/mifospay/MifosPayApp.kt +++ b/mifospay/src/main/java/org/mifospay/MifosPayApp.kt @@ -3,7 +3,6 @@ package org.mifospay import android.app.Application import android.content.Context import androidx.appcompat.app.AppCompatDelegate -import butterknife.ButterKnife import com.mifos.mobile.passcode.utils.ForegroundChecker import dagger.hilt.android.HiltAndroidApp @@ -17,7 +16,6 @@ class MifosPayApp : Application() { if (instance == null) { instance = this } - ButterKnife.setDebug(true) //Initialize ForegroundChecker ForegroundChecker.init(this) diff --git a/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt b/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt index 6b0e7d18d..c0e86f851 100644 --- a/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt +++ b/mifospay/src/main/java/org/mifospay/base/BaseFragment.kt @@ -66,7 +66,7 @@ open class BaseFragment : Fragment() { override fun onAttach(context: Context) { super.onAttach(context) - val activity = if (context is Activity) context else null + val activity = context as? Activity callback = try { activity as BaseActivityCallback? } catch (e: ClassCastException) { diff --git a/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt b/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt index 30a9e5d1f..2adacc792 100644 --- a/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt +++ b/mifospay/src/main/java/org/mifospay/common/ui/SearchActivity.kt @@ -3,7 +3,6 @@ package org.mifospay.common.ui import android.os.Bundle import androidx.activity.compose.setContent import dagger.hilt.android.AndroidEntryPoint -import org.mifospay.R import org.mifospay.base.BaseActivity import org.mifospay.core.designsystem.theme.MifosTheme @@ -14,7 +13,6 @@ import org.mifospay.core.designsystem.theme.MifosTheme class SearchActivity : BaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - setContentView(R.layout.activity_search) setContent { MifosTheme { SearchScreenRoute( diff --git a/mifospay/src/main/java/org/mifospay/common/ui/adapter/SearchAdapter.kt b/mifospay/src/main/java/org/mifospay/common/ui/adapter/SearchAdapter.kt deleted file mode 100644 index 6983d79fd..000000000 --- a/mifospay/src/main/java/org/mifospay/common/ui/adapter/SearchAdapter.kt +++ /dev/null @@ -1,61 +0,0 @@ -package org.mifospay.common.ui.adapter - -import androidx.recyclerview.widget.RecyclerView -import android.view.LayoutInflater -import android.view.View -import android.view.ViewGroup -import android.widget.TextView -import butterknife.BindView -import butterknife.ButterKnife -import com.mifospay.core.model.domain.SearchResult -import org.mifospay.R -import javax.inject.Inject - -/** - * Created by naman on 21/8/17. - */ -class SearchAdapter @Inject constructor() : RecyclerView.Adapter() { - private var results: MutableList? = null - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder { - val v = LayoutInflater.from(parent.context).inflate( - R.layout.item_search, parent, false - ) - return ViewHolder(v) - } - - override fun onBindViewHolder(holder: ViewHolder, position: Int) { - holder.tvSearchResult?.text = results?.get(position)?.resultName - } - - override fun getItemCount(): Int { - return results?.size ?: 0 - } - - fun setData(results: MutableList?) { - if (results != null) { - this.results = results - notifyItemChanged(results.size) - } - } - - fun clearData() { - results?.clear() - results?.let { notifyItemRemoved(it.size) } - } - - fun getResults(): List? { - return results - } - - inner class ViewHolder(v: View?) : RecyclerView.ViewHolder(v!!) { - @JvmField - @BindView(R.id.tv_search_result) - var tvSearchResult: TextView? = null - - init { - if (v != null) { - ButterKnife.bind(this, v) - } - } - } -} \ No newline at end of file diff --git a/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt b/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt index 35654307a..745b82509 100644 --- a/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt +++ b/mifospay/src/main/java/org/mifospay/data/firebase/api/services/MifosPayMessagingService.kt @@ -35,6 +35,7 @@ import org.mifospay.utils.NotificationUtils /** * Created by ankur on 20/June/2018 */ +@Suppress("UnusedParameter", "UnusedPrivateMember") class MifosPayMessagingService : FirebaseMessagingService() { /** * Called if InstanceID token is updated. This may occur if the security of diff --git a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt index a52dfbd0f..e5202ab1c 100644 --- a/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt +++ b/mifospay/src/main/java/org/mifospay/navigation/MifosNavHost.kt @@ -59,8 +59,8 @@ import org.mifospay.feature.specific.transactions.navigation.navigateToSpecificT import org.mifospay.feature.specific.transactions.navigation.specificTransactionsScreen import org.mifospay.feature.standing.instruction.navigateToNewSiScreen import org.mifospay.feature.standing.instruction.newSiScreen -import org.mifospay.feature.upi_setup.navigation.navigateToSetupUpiPin -import org.mifospay.feature.upi_setup.navigation.setupUpiPinScreen +import org.mifospay.feature.upiSetup.navigation.navigateToSetupUpiPin +import org.mifospay.feature.upiSetup.navigation.setupUpiPinScreen import java.io.File import java.util.Objects @@ -72,7 +72,7 @@ import java.util.Objects * within each route is handled using state and Back Handlers. */ @Composable -@Suppress("MaxLineLength") +@Suppress("MaxLineLength", "LongMethod", "UnusedParameter") fun MifosNavHost( navController: NavHostController, onShowSnackbar: suspend (String, String?) -> Boolean, diff --git a/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt b/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt index cb69d4080..c2eb30d44 100644 --- a/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt +++ b/mifospay/src/main/java/org/mifospay/ui/MifosApp.kt @@ -45,7 +45,6 @@ import androidx.compose.ui.composed import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.testTag import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics @@ -75,9 +74,10 @@ import org.mifospay.navigation.TopLevelDestination ExperimentalComposeUiApi::class, ) @Composable -fun MifosApp(appState: MifosAppState, bottomSheetNavigator: BottomSheetNavigator) { - val context = LocalContext.current - +fun MifosApp( + appState: MifosAppState, + bottomSheetNavigator: BottomSheetNavigator +) { val shouldShowGradientBackground = appState.currentTopLevelDestination == TopLevelDestination.HOME var showHomeMenuOption by rememberSaveable { mutableStateOf(false) } diff --git a/mifospay/src/main/java/org/mifospay/utils/FileUtils.kt b/mifospay/src/main/java/org/mifospay/utils/FileUtils.kt deleted file mode 100644 index a4501fbff..000000000 --- a/mifospay/src/main/java/org/mifospay/utils/FileUtils.kt +++ /dev/null @@ -1,239 +0,0 @@ -package org.mifospay.utils - -import android.content.ContentUris -import android.content.Context -import android.database.Cursor -import android.net.Uri -import android.os.Build -import android.os.Environment -import android.provider.DocumentsContract -import android.provider.MediaStore -import android.util.Base64 -import android.util.Log -import org.json.JSONObject -import org.mifospay.common.Constants -import org.mifospay.utils.DebugUtil.log -import java.io.BufferedOutputStream -import java.io.File -import java.io.FileNotFoundException -import java.io.FileOutputStream -import java.io.IOException -import java.io.InputStream -import java.io.OutputStream - -/** - * Created by ankur on 24/May/2018 - */ -object FileUtils { - private const val TAG = "FileUtils" - fun readJson(context: Context, file: String?): JSONObject? { - var jsonObject: JSONObject? = null - try { - val `is` = context.assets.open(file!!) - val size = `is`.available() - val buffer = ByteArray(size) - `is`.read(buffer) - `is`.close() - jsonObject = JSONObject(String(buffer, charset("UTF-8"))) - } catch (e: Exception) { - log(e.toString(), e.message!!) - } - return jsonObject - } - - /** - * Method for return file path of Gallery image/ Document / Video / Audio - * - * @return path of the selected image file from gallery - */ - fun getPath(context: Context, uri: Uri): String? { - // DocumentProvider - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { - if (DocumentsContract.isDocumentUri(context, uri)) { - - // ExternalStorageProvider - if (isExternalStorageDocument(uri)) { - val docId = DocumentsContract.getDocumentId(uri) - val split = - docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val type = split[0] - if ("primary".equals(type, ignoreCase = true)) { - return (Environment.getExternalStorageDirectory().toString() + "/" - + split[1]) - } - } else if (isDownloadsDocument(uri)) { // DownloadsProvider - val id = DocumentsContract.getDocumentId(uri) - val contentUri = ContentUris.withAppendedId( - Uri.parse("content://downloads/public_downloads"), id.toLong() - ) - return getDataColumn(context, contentUri, null, null) - } else if (isMediaDocument(uri)) { // MediaProvider - val docId = DocumentsContract.getDocumentId(uri) - val split = - docId.split(":".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val type = split[0] - var contentUri: Uri? = null - when (type) { - "image" -> { - contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI - } - "video" -> { - contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI - } - "audio" -> { - contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI - } - } - val selection = "_id=?" - val selectionArgs = arrayOf(split[1]) - return getDataColumn( - context, contentUri, selection, - selectionArgs - ) - } - } else if ("content".equals( - uri.scheme, - ignoreCase = true - ) - ) { // MediaStore (and general) - - // Return the remote address - return if (isGooglePhotosUri(uri)) { - uri.lastPathSegment - } else getDataColumn( - context, - uri, - null, - null - ) - } else if ("file".equals(uri.scheme, ignoreCase = true)) { // File - return uri.path - } - } - return null - } - - /** - * Get the value of the data column for this Uri. This is useful for - * MediaStore Uris, and other file-based ContentProviders. - * - * @param context The context. - * @param uri The Uri to query. - * @param selection (Optional) Filter used in the query. - * @param selectionArgs (Optional) Selection arguments used in the query. - * @return The value of the _data column, which is typically a file path. - */ - fun getDataColumn( - context: Context, uri: Uri?, - selection: String?, selectionArgs: Array? - ): String? { - var cursor: Cursor? = null - val column = "_data" - val projection = arrayOf(column) - try { - cursor = context.contentResolver.query( - uri!!, projection, - selection, selectionArgs, null - ) - if (cursor != null && cursor.moveToFirst()) { - val index = cursor.getColumnIndexOrThrow(column) - return cursor.getString(index) - } - } finally { - cursor?.close() - } - return null - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is ExternalStorageProvider. - */ - fun isExternalStorageDocument(uri: Uri): Boolean { - return "com.android.externalstorage.documents" == uri - .authority - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is DownloadsProvider. - */ - fun isDownloadsDocument(uri: Uri): Boolean { - return "com.android.providers.downloads.documents" == uri - .authority - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is MediaProvider. - */ - fun isMediaDocument(uri: Uri): Boolean { - return "com.android.providers.media.documents" == uri - .authority - } - - /** - * @param uri The Uri to check. - * @return Whether the Uri authority is Google Photos. - */ - fun isGooglePhotosUri(uri: Uri): Boolean { - return "com.google.android.apps.photos.content" == uri - .authority - } - - fun writeInputStreamDataToFile(`in`: InputStream, file: File?): Boolean { - return try { - val out: OutputStream = FileOutputStream(file) - val buf = ByteArray(1024) - var len: Int - while (`in`.read(buf).also { len = it } > 0) { - out.write(buf, 0, len) - } - out.close() - `in`.close() - true - } catch (e: Exception) { - false - } - } - - fun saveImage(context: Context?, imageData: String?): File? { - val imgBytesData = Base64.decode( - imageData, - Base64.DEFAULT - ) - var file: File? = null - try { - val mifosDirectory = File( - Environment.getExternalStorageDirectory(), - Constants.MIFOSPAY - ) - file = File(mifosDirectory, "kuch") - } catch (e: Exception) { - Log.e(TAG, "Unable to create file", e) - } - val fileOutputStream: FileOutputStream - fileOutputStream = try { - FileOutputStream(file) - } catch (e: FileNotFoundException) { - Log.e(TAG, "Unable to create output stream", e) - return null - } - val bufferedOutputStream = BufferedOutputStream( - fileOutputStream - ) - try { - bufferedOutputStream.write(imgBytesData) - } catch (e: IOException) { - Log.e(TAG, "Unable to write", e) - return null - } finally { - try { - bufferedOutputStream.close() - } catch (e: IOException) { - Log.e(TAG, "Unable to close the output stream", e) - } - } - return file - } -} \ No newline at end of file diff --git a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt index 6de0b3de3..7d530542e 100644 --- a/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt +++ b/mifospay/src/main/java/org/mifospay/utils/NotificationUtils.kt @@ -28,6 +28,7 @@ import java.text.SimpleDateFormat /** * Created by ankur on 23/July/2018 */ +@Suppress("NestedBlockDepth") class NotificationUtils(private val mContext: Context) { @JvmOverloads fun showNotificationMessage( diff --git a/mifospay/src/main/java/org/mifospay/utils/Toaster.kt b/mifospay/src/main/java/org/mifospay/utils/Toaster.kt deleted file mode 100644 index d495ad72d..000000000 --- a/mifospay/src/main/java/org/mifospay/utils/Toaster.kt +++ /dev/null @@ -1,52 +0,0 @@ -package org.mifospay.utils - -import android.content.Context -import android.graphics.Color -import android.view.View -import android.widget.TextView -import android.widget.Toast -import com.google.android.material.snackbar.Snackbar -import org.mifospay.MifosPayApp.Companion.context -import org.mifospay.R -import org.mifospay.common.Constants - -/** - * Created by ankur on 23/May/2018 - */ -object Toaster { - const val INDEFINITE = Snackbar.LENGTH_INDEFINITE - const val LONG = Snackbar.LENGTH_LONG - const val SHORT = Snackbar.LENGTH_SHORT - @JvmOverloads - fun show( - view: View?, - text: String?, - duration: Int = Snackbar.LENGTH_LONG, - actionText: String? = Constants.OK, - clickListener: View.OnClickListener? = View.OnClickListener { } - ) { - if (view != null) { - val snackbar = Snackbar.make(view, text!!, duration) - val sbView = snackbar.view - val textView = sbView.findViewById(R.id.snackbar_text) - textView.setTextColor(Color.WHITE) - textView.textSize = 12f - snackbar.setAction(actionText, clickListener) - snackbar.show() - } - } - - fun show(view: View?, res: Int, duration: Int) { - show(view, context!!.resources.getString(res), duration) - } - - fun show(view: View?, res: Int) { - show(view, context!!.resources.getString(res)) - } - - fun showToast(context: Context?, message: String?) { - if (context != null) { - Toast.makeText(context, message, Toast.LENGTH_LONG).show() - } - } -} diff --git a/mifospay/src/main/res/layout/activity_bank_account_detail.xml b/mifospay/src/main/res/layout/activity_bank_account_detail.xml deleted file mode 100644 index 79cee5064..000000000 --- a/mifospay/src/main/res/layout/activity_bank_account_detail.xml +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -