Skip to content

Commit

Permalink
Merge branch 'master' into Group-Sync-Issue-Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkeye14 authored Jan 3, 2025
2 parents ee9d005 + 5f44c46 commit 1bd866f
Show file tree
Hide file tree
Showing 427 changed files with 3,575 additions and 14,728 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,10 @@ class CenterListPagingSource(private val dataManagerCenter: DataManagerCenter) :
}
}

private suspend fun getCenterList(position: Int): Pair<List<Center>, Int> =
suspendCoroutine { continuation ->
try {
dataManagerCenter.getCenters(true, position, 10)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Subscriber<Page<Center>>() {
override fun onCompleted() {
}

override fun onError(exception: Throwable) {
continuation.resumeWithException(exception)
}

override fun onNext(center: Page<Center>) {
continuation.resume(
Pair(
center.pageItems,
center.totalFilteredRecords,
),
)
}
})
} catch (exception: Exception) {
continuation.resumeWithException(exception)
}
}
private suspend fun getCenterList(position: Int): Pair<List<Center>, Int> {
val pagedClient = dataManagerCenter.getCenters(true, position, 10)
return Pair(pagedClient.pageItems, pagedClient.totalFilteredRecords)
}

private suspend fun getCenterDbList(): List<Center> = suspendCoroutine { continuation ->
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import androidx.paging.PagingState
import com.mifos.core.network.datamanager.DataManagerClient
import com.mifos.core.objects.client.Client
import com.mifos.core.objects.client.Page
import kotlinx.coroutines.suspendCancellableCoroutine
import rx.Subscriber
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
Expand Down Expand Up @@ -57,23 +56,8 @@ class ClientListPagingSource(
}

private suspend fun getClientList(position: Int): Pair<List<Client>, Int> {
return suspendCancellableCoroutine { continuation ->
dataManagerClient.getAllClients(offset = position, 10)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(object : Subscriber<Page<Client>>() {
override fun onCompleted() {
}

override fun onError(e: Throwable) {
continuation.resumeWithException(e)
}

override fun onNext(t: Page<Client>) {
continuation.resume(Pair(t.pageItems, t.totalFilteredRecords))
}
})
}
val response = dataManagerClient.getAllClients(position, 10)
return Pair(response.pageItems, response.totalFilteredRecords)
}

private suspend fun getClientDbList(): List<Client> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ package com.mifos.core.data.repository

import com.mifos.core.network.GenericResponse
import com.mifos.core.objects.client.ActivatePayload
import org.apache.fineract.client.models.PostCentersCenterIdResponse
import org.apache.fineract.client.models.PostClientsClientIdResponse
import org.openapitools.client.models.PostCentersCenterIdResponse
import org.openapitools.client.models.PostClientsClientIdResponse
import rx.Observable

/**
Expand All @@ -21,15 +21,15 @@ import rx.Observable

interface ActivateRepository {

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

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

fun activateGroup(
groupId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface ClientDetailsRepository {

fun deleteClientImage(clientId: Int): Observable<ResponseBody>

fun getClientAccounts(clientId: Int): Observable<ClientAccounts>
suspend fun getClientAccounts(clientId: Int): ClientAccounts

fun getClient(clientId: Int): Observable<Client>
suspend fun getClient(clientId: Int): Client
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ package com.mifos.core.data.repository
import com.mifos.core.objects.noncore.IdentifierCreationResponse
import com.mifos.core.objects.noncore.IdentifierPayload
import com.mifos.core.objects.noncore.IdentifierTemplate
import rx.Observable

/**
* Created by Aditya Gupta on 16/08/23.
*/
interface ClientIdentifierDialogRepository {

fun getClientIdentifierTemplate(clientId: Int): Observable<IdentifierTemplate>
suspend fun getClientIdentifierTemplate(clientId: Int): IdentifierTemplate

suspend fun createClientIdentifier(
clientId: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
package com.mifos.core.data.repository

import com.mifos.core.objects.noncore.Identifier
import org.apache.fineract.client.models.DeleteClientsClientIdIdentifiersIdentifierIdResponse
import rx.Observable
import org.openapitools.client.models.DeleteClientsClientIdIdentifiersIdentifierIdResponse

/**
* Created by Aditya Gupta on 08/08/23.
*/
interface ClientIdentifiersRepository {

fun getClientIdentifiers(clientId: Int): Observable<List<Identifier>>
suspend fun getClientIdentifiers(clientId: Int): List<Identifier>

fun deleteClientIdentifier(
suspend fun deleteClientIdentifier(
clientId: Int,
identifierId: Int,
): Observable<DeleteClientsClientIdIdentifiersIdentifierIdResponse>
): DeleteClientsClientIdIdentifiersIdentifierIdResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ interface CreateNewClientRepository {

fun clientTemplate(): Observable<ClientsTemplate>

fun offices(): Observable<List<Office>>
suspend fun offices(): List<Office>

fun getStaffInOffice(officeId: Int): Observable<List<Staff>>
suspend fun getStaffInOffice(officeId: Int): List<Staff>

fun createClient(clientPayload: ClientPayload): Observable<Client>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import rx.Observable
*/
interface CreateNewGroupRepository {

fun offices(): Observable<List<Office>>
suspend fun offices(): List<Office>

fun createGroup(groupPayload: GroupPayload): Observable<SaveResponse>
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
package com.mifos.core.data.repository

import com.google.gson.JsonArray
import org.apache.fineract.client.models.DeleteDataTablesDatatableAppTableIdDatatableIdResponse
import rx.Observable
import org.openapitools.client.models.DeleteDataTablesDatatableAppTableIdDatatableIdResponse

/**
* Created by Aditya Gupta on 10/08/23.
Expand All @@ -20,9 +19,9 @@ interface DataTableDataRepository {

suspend fun getDataTableInfo(table: String, entityId: Int): JsonArray

fun deleteDataTableEntry(
table: String?,
suspend fun deleteDataTableEntry(
table: String,
entity: Int,
rowId: Int,
): Observable<DeleteDataTablesDatatableAppTableIdDatatableIdResponse>
): DeleteDataTablesDatatableAppTableIdDatatableIdResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
package com.mifos.core.data.repository

import com.mifos.core.objects.noncore.DataTable
import rx.Observable

/**
* Created by Aditya Gupta on 08/08/23.
*/
interface DataTableRepository {

fun getDataTable(tableName: String?): Observable<List<DataTable>>
suspend fun getDataTable(tableName: String?): List<DataTable>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@
*/
package com.mifos.core.data.repository

import org.apache.fineract.client.models.PostAuthenticationResponse
import rx.Observable
import org.openapitools.client.models.PostAuthenticationResponse

/**
* Created by Aditya Gupta on 06/08/23.
*/

interface LoginRepository {

fun login(username: String, password: String): Observable<PostAuthenticationResponse>
suspend fun login(username: String, password: String): PostAuthenticationResponse
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface SyncCentersDialogRepository {

fun syncGroupAccounts(groupId: Int): Observable<GroupAccounts>

fun syncClientAccounts(clientId: Int): Observable<ClientAccounts>
suspend fun syncClientAccounts(clientId: Int): ClientAccounts

fun syncGroupInDatabase(group: Group): Observable<Group>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import rx.Observable
*/
interface SyncClientsDialogRepository {

fun syncClientAccounts(clientId: Int): Observable<ClientAccounts>
suspend fun syncClientAccounts(clientId: Int): ClientAccounts

fun syncLoanById(loanId: Int): Observable<LoanWithAssociations>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ interface SyncGroupsDialogRepository {

fun syncClientInDatabase(client: Client): Observable<Client>

fun syncClientAccounts(clientId: Int): Observable<ClientAccounts>
suspend fun syncClientAccounts(clientId: Int): ClientAccounts

fun syncGroupInDatabase(group: Group): Observable<Group>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import com.mifos.core.network.datamanager.DataManagerCenter
import com.mifos.core.network.datamanager.DataManagerClient
import com.mifos.core.network.datamanager.DataManagerGroups
import com.mifos.core.objects.client.ActivatePayload
import org.apache.fineract.client.models.PostCentersCenterIdResponse
import org.apache.fineract.client.models.PostClientsClientIdResponse
import org.openapitools.client.models.PostCentersCenterIdResponse
import org.openapitools.client.models.PostClientsClientIdResponse
import rx.Observable
import javax.inject.Inject

Expand All @@ -29,17 +29,17 @@ class ActivateRepositoryImp @Inject constructor(
private val dataManagerGroups: DataManagerGroups,
) : ActivateRepository {

override fun activateClient(
override suspend fun activateClient(
clientId: Int,
clientActivate: ActivatePayload?,
): Observable<PostClientsClientIdResponse> {
): PostClientsClientIdResponse {
return dataManagerClient.activateClient(clientId, clientActivate)
}

override fun activateCenter(
override suspend fun activateCenter(
centerId: Int,
activatePayload: ActivatePayload?,
): Observable<PostCentersCenterIdResponse> {
): PostCentersCenterIdResponse {
return dataManagerCenter.activateCenter(centerId, activatePayload)
}

Expand Down
Loading

0 comments on commit 1bd866f

Please sign in to comment.