Skip to content
Open
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: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- '*'
# tags:
# - '!v*'
pull_request:
branches:
- '*'
types: [opened, synchronize, reopened]

jobs:
build:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ proguard/
# Log Files
*.log

# Java heap dump files
*.hprof

# Android Studio Navigation editor temp files
.navigation/

Expand Down
19 changes: 18 additions & 1 deletion claimManagement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@ android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}

testOptions {
unitTests {
includeAndroidResources = true
}
}
}

apollo {
Expand All @@ -193,6 +199,13 @@ apollo {
]
}

tasks.withType(Test).configureEach {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
showStandardStreams = false
}
}

// Apply custom flavours
if(file('custom-flavours.gradle').exists()){
Expand All @@ -215,9 +228,13 @@ dependencies {
implementation ('com.apollographql.apollo:apollo-android-support:2.5.14'){
because("Apollo 3+ only works with Kotlin coroutines")
}
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.5.0'
testImplementation 'org.robolectric:robolectric:4.11.1'
testImplementation 'androidx.test:core:1.5.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test:core:1.5.0'
implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.71828'
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.2.7'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
}

private boolean isValidData() {
protected boolean isValidData() {

if (etHealthFacility.getText().length() == 0) {
showValidationDialog(etHealthFacility, getResources().getString(R.string.MissingHealthFacility));
Expand Down Expand Up @@ -793,7 +793,7 @@ private boolean isValidData() {
return true;
}

private boolean isValidInsureeNumber() {
protected boolean isValidInsureeNumber() {
Escape escape = new Escape();
return escape.CheckCHFID(etInsureeNumber.getText().toString());
}
Expand All @@ -811,7 +811,7 @@ protected void confirmNewDialog(String msg) {
runOnUiThread(() -> showDialog(msg, (dialog, which) -> ClearForm(), (dialog, which) -> dialog.dismiss()));
}

private boolean saveClaim() {
protected boolean saveClaim() {
Intent intent = getIntent();
String claimUUID;
if (intent.hasExtra(EXTRA_CLAIM_UUID)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public class SynchronizeService extends JobIntentService {

private static final String claimResponseLine = "[%s] %s";

private Global global;
private SQLHandler sqlHandler;
private StorageManager storageManager;
protected Global global;
protected SQLHandler sqlHandler;
protected StorageManager storageManager;
protected PostNewClaims postNewClaims;

@Override
public void onCreate() {
Expand All @@ -66,6 +67,10 @@ public void onCreate() {
storageManager = StorageManager.of(this);
}

public void setPostNewClaims(PostNewClaims postNewClaims) {
this.postNewClaims = postNewClaims;
}

public static void uploadClaims(Context context) {
Intent intent = new Intent();
intent.setAction(ACTION_UPLOAD_CLAIMS);
Expand Down Expand Up @@ -96,7 +101,7 @@ protected void onHandleWork(@NonNull Intent intent) {
}
}

private void handleUploadClaims() {
protected void handleUploadClaims() {
if (!global.isNetworkAvailable()) {
broadcastError(getResources().getString(R.string.CheckInternet), ACTION_UPLOAD_CLAIMS);
return;
Expand All @@ -109,7 +114,10 @@ private void handleUploadClaims() {
}

try {
List<PostNewClaims.Result> results = new PostNewClaims().execute(PendingClaim.fromJson(claims));
if (postNewClaims == null) {
postNewClaims = new PostNewClaims();
}
List<PostNewClaims.Result> results = postNewClaims.execute(PendingClaim.fromJson(claims));
JSONArray claimStatus = processClaimResponse(results);
broadcastSyncSuccess(claimStatus);
} catch (Exception e) {
Expand All @@ -118,7 +126,7 @@ private void handleUploadClaims() {
}
}

private JSONArray processClaimResponse(List<PostNewClaims.Result> results) {
protected JSONArray processClaimResponse(List<PostNewClaims.Result> results) {
JSONArray jsonResults = new JSONArray();
String date = AppInformation.DateTimeInfo.getDefaultIsoDatetimeFormatter().format(new Date());
for (PostNewClaims.Result result : results) {
Expand Down Expand Up @@ -252,7 +260,7 @@ private Uri createClaimExportZip(ArrayList<File> exportedClaims) {
zipFile);
}

private void handleGetClaimCount() {
protected void handleGetClaimCount() {
JSONObject counts = sqlHandler.getClaimCounts();

int enteredCount = counts.optInt(SQLHandler.CLAIM_UPLOAD_STATUS_ENTERED, 0);
Expand Down
Loading