Skip to content

Commit

Permalink
Merge branch 'master' into fix/payment-details-button-text
Browse files Browse the repository at this point in the history
  • Loading branch information
TanishMoral11 authored Dec 27, 2024
2 parents 7c899ea + 5f44c46 commit 4b79df1
Show file tree
Hide file tree
Showing 406 changed files with 3,385 additions and 14,051 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

# Upload APK
- name: Upload APK
uses: actions/upload-artifact@v2.2.0
uses: actions/upload-artifact@v4
with:
# Artifact name
name: android-client-app
Expand Down
83 changes: 83 additions & 0 deletions .github/workflows/pr-check-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
## Overview
#
# This reusable GitHub Actions workflow provides a comprehensive Continuous Integration (CI) pipeline
# for multi-platform mobile and desktop applications, specifically designed for projects using Gradle and Java/Kotlin.
#
### Key Features
# - Automated code quality checks
# - Dependency management and verification
# - Cross-platform desktop application builds (Windows, Linux, MacOS)
# - Android APK build generation
# - Artifact generation and storage
#
### Workflow Jobs
# 1. **Setup**: Prepares the build environment
# - Checks out repository code
# - Sets up Java 17
# - Configures Gradle
# - Manages dependency caching
#
# 2. **Code Quality Checks**:
# - Build logic verification
# - Code formatting checks (Spotless)
# - Static code analysis (Detekt)
#
# 3. **Dependency Guard**:
# - Verifies dependencies against baseline
# - Prevents unauthorized dependency changes
# - Supports automatic baseline updates
#
# 4. **Android App Build**:
# - Builds debug APK for demo flavor
# - Uploads APK artifacts
#
### Prerequisites
# - Java 17
# - Gradle
# - Configured build scripts for:
# - Android module
# - Desktop module
# - Installed Gradle plugins:
# - Spotless
# - Detekt
# - Dependency Guard
#
### Configuration Parameters
# The workflow requires two input parameters:
#
# | Parameter | Description | Type | Required |
# |------------------------|------------------------------------|--------|----------|
# | `android_package_name` | Name of the Android project module | String | Yes |
#

# https://github.com/openMF/mifos-mobile-github-actions/blob/main/.github/workflows/pr-check-android.yaml

# ##############################################################################
# DON'T EDIT THIS FILE UNLESS NECESSARY #
# ##############################################################################


name: PR Checks

# Trigger conditions for the workflow
on:
push:
branches: [ dev ] # Runs on pushes to dev branch
pull_request: # Runs on all pull requests
workflow_dispatch: # Allows manual triggering of the workflow

# Concurrency settings to prevent multiple simultaneous workflow runs
concurrency:
group: pr-${{ github.ref }}
cancel-in-progress: true # Cancels previous runs if a new one is triggered

permissions:
contents: write

jobs:
pr_checks:
name: PR Checks
uses: openMF/mifos-mobile-github-actions/.github/workflows/pr-check-android.yaml@main
secrets: inherit
with:
android_package_name: 'mifosng-android' # <-- Change Your Android Package Name
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.configurationcache.extensions.capitalized
import org.gradle.internal.extensions.stdlib.capitalized
import org.gradle.kotlin.dsl.register
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.process.ExecOperations
Expand Down
2 changes: 1 addition & 1 deletion config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ complexity:
LongParameterList:
active: true
# Updating Common values based on current scenario
functionThreshold: 20 #6
functionThreshold: 30 #6
constructorThreshold: 30 #7
ignoreDefaultParameters: false
ignoreDataClasses: true
Expand Down
6 changes: 3 additions & 3 deletions core/data/src/main/java/com/mifos/core/data/di/DataModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,18 @@ import com.mifos.core.data.repository.SearchRepository
import com.mifos.core.data.repository.SignatureRepository
import com.mifos.core.data.repository.SurveyListRepository
import com.mifos.core.data.repository.SurveySubmitRepository
import com.mifos.core.data.repositoryImp.ActivateRepositoryImp
import com.mifos.core.data.repositoryImp.CenterDetailsRepositoryImp
import com.mifos.core.data.repositoryImp.CenterListRepositoryImp
import com.mifos.core.data.repositoryImp.ChargeDialogRepositoryImp
import com.mifos.core.data.repositoryImp.CheckerInboxRepositoryImp
import com.mifos.core.data.repositoryImp.CheckerInboxTasksRepositoryImp
import com.mifos.core.data.repositoryImp.ClientChargeRepositoryImp
import com.mifos.core.data.repositoryImp.ClientIdentifierDialogRepositoryImp
import com.mifos.core.data.repositoryImp.ClientIdentifiersRepositoryImp
import com.mifos.core.data.repositoryImp.CreateNewCenterRepositoryImp
import com.mifos.core.data.repositoryImp.CreateNewGroupRepositoryImp
import com.mifos.core.data.repositoryImp.DataTableDataRepositoryImp
import com.mifos.core.data.repositoryImp.DataTableListRepositoryImp
import com.mifos.core.data.repositoryImp.DataTableRepositoryImp
import com.mifos.core.data.repositoryImp.DataTableRowDialogRepositoryImp
Expand Down Expand Up @@ -86,9 +89,6 @@ import com.mifos.core.data.repositoryImp.SearchRepositoryImp
import com.mifos.core.data.repositoryImp.SignatureRepositoryImp
import com.mifos.core.data.repositoryImp.SurveyListRepositoryImp
import com.mifos.core.data.repositoryImp.SurveySubmitRepositoryImp
import com.mifos.core.data.repository_imp.ActivateRepositoryImp
import com.mifos.core.data.repository_imp.ClientIdentifiersRepositoryImp
import com.mifos.core.data.repository_imp.DataTableDataRepositoryImp
import dagger.Binds
import dagger.Module
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.pagingSource

import androidx.paging.PagingSource
Expand All @@ -18,7 +27,7 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
override fun getRefreshKey(state: PagingState<Int, Center>): Int? {
return state.anchorPosition?.let { position ->
state.closestPageToPosition(position)?.prevKey?.plus(10) ?: state.closestPageToPosition(
position
position,
)?.nextKey?.minus(10)
}
}
Expand All @@ -34,7 +43,7 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
LoadResult.Page(
data = centerListWithSync,
prevKey = if (position <= 0) null else position - 10,
nextKey = if (position >= totalCenters) null else position + 10
nextKey = if (position >= totalCenters) null else position + 10,
)
} catch (e: Exception) {
LoadResult.Error(e)
Expand All @@ -48,7 +57,6 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :

private suspend fun getCenterDbList(): List<Center> = suspendCoroutine { continuation ->
try {

dataManagerCenter.allDatabaseCenters
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
Expand All @@ -69,10 +77,9 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
}
}


private fun getCenterListWithSync(
centerList: List<Center>,
centerDbList: List<Center>
centerDbList: List<Center>,
): List<Center> {
if (centerDbList.isNotEmpty()) {
centerList.forEach { center ->
Expand All @@ -85,4 +92,4 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
}
return centerList
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.pagingSource

import androidx.paging.PagingSource
Expand All @@ -17,13 +26,13 @@ import kotlin.coroutines.suspendCoroutine
*/

class ClientListPagingSource(
private val dataManagerClient: DataManagerClient
private val dataManagerClient: DataManagerClient,
) : PagingSource<Int, Client>() {

override fun getRefreshKey(state: PagingState<Int, Client>): Int? {
return state.anchorPosition?.let { position ->
state.closestPageToPosition(position)?.prevKey?.plus(10) ?: state.closestPageToPosition(
position
position,
)?.nextKey?.minus(10)
}
}
Expand All @@ -39,7 +48,7 @@ class ClientListPagingSource(
LoadResult.Page(
data = clientListWithSync,
prevKey = if (position <= 0) null else position - 10,
nextKey = if (position >= totalClients) null else position + 10
nextKey = if (position >= totalClients) null else position + 10,
)
} catch (e: Exception) {
LoadResult.Error(e)
Expand Down Expand Up @@ -73,7 +82,7 @@ class ClientListPagingSource(

private fun getClientListWithSync(
clientList: List<Client>,
clientDbList: List<Client>
clientDbList: List<Client>,
): List<Client> {
if (clientDbList.isNotEmpty()) {
clientList.forEach { client ->
Expand All @@ -86,4 +95,4 @@ class ClientListPagingSource(
}
return clientList
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.mifos.core.network.GenericResponse
Expand All @@ -14,17 +23,16 @@ interface ActivateRepository {

suspend fun activateClient(
clientId: Int,
clientActivate: ActivatePayload?
clientActivate: ActivatePayload?,
): PostClientsClientIdResponse

suspend fun activateCenter(
centerId: Int,
activatePayload: ActivatePayload?
activatePayload: ActivatePayload?,
): PostCentersCenterIdResponse

fun activateGroup(
groupId: Int,
activatePayload: ActivatePayload?
activatePayload: ActivatePayload?,
): Observable<GenericResponse>

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.mifos.core.objects.accounts.ClientAccounts
Expand All @@ -18,5 +27,4 @@ interface ClientDetailsRepository {
suspend fun getClientAccounts(clientId: Int): ClientAccounts

suspend fun getClient(clientId: Int): Client

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.mifos.core.objects.noncore.Identifier
Expand All @@ -12,6 +21,6 @@ interface ClientIdentifiersRepository {

suspend fun deleteClientIdentifier(
clientId: Int,
identifierId: Int
identifierId: Int,
): DeleteClientsClientIdIdentifiersIdentifierIdResponse
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.google.gson.JsonArray
Expand All @@ -13,7 +22,6 @@ interface DataTableDataRepository {
suspend fun deleteDataTableEntry(
table: String,
entity: Int,
rowId: Int
rowId: Int,
): DeleteDataTablesDatatableAppTableIdDatatableIdResponse

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import com.mifos.core.objects.noncore.DataTable
Expand All @@ -8,5 +17,4 @@ import com.mifos.core.objects.noncore.DataTable
interface DataTableRepository {

suspend fun getDataTable(tableName: String?): List<DataTable>

}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright 2024 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* See https://github.com/openMF/android-client/blob/master/LICENSE.md
*/
package com.mifos.core.data.repository

import org.openapitools.client.models.PostAuthenticationResponse
Expand All @@ -9,5 +18,4 @@ import org.openapitools.client.models.PostAuthenticationResponse
interface LoginRepository {

suspend fun login(username: String, password: String): PostAuthenticationResponse

}
}
Loading

0 comments on commit 4b79df1

Please sign in to comment.