Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Migrated Finance Module to KMP #1792

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ that can be used as a dependency in any other wallet based project. It is develo
| :feature:profile | Done | ✅ | ✅ | ❔ | ✅ | ❔ |
| :feature:settings | Done | ✅ | ✅ | ❔ | ✅ | ❔ |
| :feature:payments | Done | ✅ | ✅ | ✅ | ✅ | ❔ |
| :feature:account | Not started | ❌ | | | | |
| :feature:finance | Not started | ❌ | ❌ | ❌ | ❌ | ❌ |
| :feature:finance | Done | ✅ | | | | |
| :feature:account | Not started | ❌ | ❌ | ❌ | ❌ | ❌ |
| :feature:invoices | Not started | ❌ | ❌ | ❌ | ❌ | ❌ |
| :feature:kyc | Not started | ❌ | ❌ | ❌ | ❌ | ❌ |
| :feature:make-transfer | Not started | ❌ | ❌ | ❌ | ❌ | ❌ |
Expand Down
16 changes: 12 additions & 4 deletions feature/finance/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@
* See https://github.com/openMF/mobile-wallet/blob/master/LICENSE.md
*/
plugins {
alias(libs.plugins.mifospay.android.feature)
alias(libs.plugins.mifospay.android.library.compose)
alias(libs.plugins.mifospay.cmp.feature)
alias(libs.plugins.kotlin.parcelize)
}

android {
namespace = "org.mifospay.feature.finance"
}

dependencies {
implementation(libs.accompanist.pager)
kotlin {
sourceSets {
commonMain.dependencies {
implementation(compose.ui)
implementation(compose.foundation)
implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)
}
}
}
Empty file removed feature/finance/consumer-rules.pro
Empty file.
21 changes: 0 additions & 21 deletions feature/finance/proguard-rules.pro

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ package org.mifospay.feature.finance

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.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 org.jetbrains.compose.ui.tooling.preview.Preview
import org.mifospay.core.ui.MifosScrollableTabRow
import org.mifospay.core.ui.utility.TabContent

Expand All @@ -23,7 +23,7 @@ internal fun FinanceRoute(
tabContents: List<TabContent>,
modifier: Modifier = Modifier,
) {
val pagerState = rememberPagerState(initialPage = 0)
val pagerState = rememberPagerState(pageCount = { tabContents.size })

Column(modifier = modifier.fillMaxSize()) {
MifosScrollableTabRow(
Expand All @@ -40,7 +40,7 @@ enum class FinanceScreenContents {
KYC,
}

@Preview(showBackground = true)
@Preview
@Composable
private fun FinanceScreenPreview() {
FinanceRoute(
Expand Down
3 changes: 0 additions & 3 deletions feature/payments/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ kotlin {
implementation(compose.material3)
implementation(compose.components.resources)
implementation(compose.components.uiToolingPreview)

implementation(libs.koin.compose.viewmodel)
implementation(libs.koin.compose)
}
}
}
31 changes: 31 additions & 0 deletions mifospay-android/dependencies/prodReleaseRuntimeClasspath.tree.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2161,6 +2161,37 @@
| | +--- org.jetbrains.compose.components:components-resources:1.7.0-rc01 (*)
| | +--- org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01 (*)
| | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:2.0.20 (*)
| +--- project :feature:finance
| | +--- androidx.lifecycle:lifecycle-runtime-compose:2.8.6 (*)
| | +--- androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6 (*)
| | +--- androidx.tracing:tracing-ktx:1.3.0-alpha02 (*)
| | +--- io.insert-koin:koin-bom:4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-android:4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-androidx-compose:4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-androidx-navigation:4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-core-viewmodel:4.0.0-RC2 (*)
| | +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.20 (*)
| | +--- io.insert-koin:koin-core:4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-annotations:1.4.0-RC4 (*)
| | +--- project :core:ui (*)
| | +--- project :core:designsystem (*)
| | +--- project :core:data (*)
| | +--- io.insert-koin:koin-compose:1.2.0-Beta4 -> 4.0.0-RC2 (*)
| | +--- io.insert-koin:koin-compose-viewmodel:1.2.0-Beta4 -> 4.0.0-RC2 (*)
| | +--- org.jetbrains.compose.runtime:runtime:1.7.0-rc01 (*)
| | +--- org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-compose:2.8.2 (*)
| | +--- org.jetbrains.androidx.lifecycle:lifecycle-viewmodel:2.8.2 -> 2.8.3-rc01 (*)
| | +--- org.jetbrains.androidx.lifecycle:lifecycle-viewmodel-savedstate:2.8.2 (*)
| | +--- org.jetbrains.androidx.savedstate:savedstate:1.2.2 (*)
| | +--- org.jetbrains.androidx.core:core-bundle:1.0.1 (*)
| | +--- org.jetbrains.androidx.navigation:navigation-compose:2.8.0-alpha10 (*)
| | +--- org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.8 (*)
| | +--- org.jetbrains.compose.ui:ui:1.7.0-rc01 (*)
| | +--- org.jetbrains.compose.foundation:foundation:1.7.0-rc01 (*)
| | +--- org.jetbrains.compose.material3:material3:1.7.0-rc01 (*)
| | +--- org.jetbrains.compose.components:components-resources:1.7.0-rc01 (*)
| | +--- org.jetbrains.compose.components:components-ui-tooling-preview:1.7.0-rc01 (*)
| | \--- org.jetbrains.kotlin:kotlin-parcelize-runtime:2.0.20 (*)
| +--- org.jetbrains.kotlin:kotlin-stdlib:2.0.20 (*)
| +--- io.insert-koin:koin-annotations:1.4.0-RC4 (*)
| +--- project :core:ui (*)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
:feature:auth
:feature:editpassword
:feature:faq
:feature:finance
:feature:history
:feature:home
:feature:payments
Expand Down
1 change: 1 addition & 0 deletions mifospay-shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ kotlin {
api(projects.feature.profile)
api(projects.feature.history)
api(projects.feature.payments)
api(projects.feature.finance)
}

desktopMain.dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,20 @@
*/
package org.mifospay.shared.navigation

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.navigation.compose.NavHost
import org.mifospay.core.ui.utility.TabContent
import org.mifospay.feature.editpassword.navigation.editPasswordScreen
import org.mifospay.feature.editpassword.navigation.navigateToEditPassword
import org.mifospay.feature.faq.navigation.faqScreen
import org.mifospay.feature.faq.navigation.navigateToFAQ
import org.mifospay.feature.finance.FinanceScreenContents
import org.mifospay.feature.finance.navigation.financeScreen
import org.mifospay.feature.history.HistoryScreen
import org.mifospay.feature.history.navigation.historyNavigation
import org.mifospay.feature.history.navigation.navigateToSpecificTransaction
Expand Down Expand Up @@ -57,6 +63,29 @@ internal fun MifosNavHost(
},
)

val tabContents = listOf(
TabContent(FinanceScreenContents.ACCOUNTS.name) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("Accounts Screen || TODO", modifier = Modifier.align(Alignment.Center))
}
},
TabContent(FinanceScreenContents.CARDS.name) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("Cards Screen || TODO", modifier = Modifier.align(Alignment.Center))
}
},
TabContent(FinanceScreenContents.MERCHANTS.name) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("Merchants Screen || TODO", modifier = Modifier.align(Alignment.Center))
}
},
TabContent(FinanceScreenContents.KYC.name) {
Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) {
Text("KYC Screen || TODO", modifier = Modifier.align(Alignment.Center))
}
},
)

NavHost(
route = MifosNavGraph.MAIN_GRAPH,
startDestination = HOME_ROUTE,
Expand Down Expand Up @@ -97,9 +126,9 @@ internal fun MifosNavHost(
viewTransactionDetail = navController::navigateToTransactionDetail,
)

paymentsScreen(
tabContents = paymentsTabContents,
)
paymentsScreen(tabContents = paymentsTabContents)

financeScreen(tabContents = tabContents)

specificTransactionsScreen(
navigateBack = navController::navigateUp,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import kotlinx.coroutines.flow.stateIn
import kotlinx.datetime.TimeZone
import org.mifospay.core.data.util.NetworkMonitor
import org.mifospay.core.data.util.TimeZoneMonitor
import org.mifospay.feature.finance.navigation.FINANCE_ROUTE
import org.mifospay.feature.finance.navigation.navigateToFinance
import org.mifospay.feature.home.navigation.HOME_ROUTE
import org.mifospay.feature.home.navigation.navigateToHome
import org.mifospay.feature.payments.PAYMENTS_ROUTE
Expand Down Expand Up @@ -81,7 +83,7 @@ internal class MifosAppState(
@Composable get() = when (currentDestination?.route) {
HOME_ROUTE -> TopLevelDestination.HOME
PAYMENTS_ROUTE -> TopLevelDestination.PAYMENTS
// FINANCE_ROUTE -> TopLevelDestination.FINANCE
FINANCE_ROUTE -> TopLevelDestination.FINANCE
PROFILE_ROUTE -> TopLevelDestination.PROFILE
else -> null
}
Expand Down Expand Up @@ -128,9 +130,8 @@ internal class MifosAppState(
when (topLevelDestination) {
TopLevelDestination.HOME -> navController.navigateToHome(topLevelNavOptions)
TopLevelDestination.PAYMENTS -> navController.navigateToPayments(topLevelNavOptions)
// TopLevelDestination.FINANCE -> navController.navigateToFinance(topLevelNavOptions)
TopLevelDestination.FINANCE -> navController.navigateToFinance(topLevelNavOptions)
TopLevelDestination.PROFILE -> navController.navigateToProfile(topLevelNavOptions)
else -> Unit
}
}
}
Expand Down
Loading