Skip to content

Commit

Permalink
Merge pull request #2191 from dhis2/hotfix/2.4.2
Browse files Browse the repository at this point in the history
build: 2.4.2 release
  • Loading branch information
Jaime Toca authored Jul 1, 2021
2 parents f2294d2 + 341bc8f commit bda6352
Show file tree
Hide file tree
Showing 31 changed files with 376 additions and 225 deletions.
43 changes: 12 additions & 31 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Android Capture App for DHIS 2 (v2.4.1) - Patch version
Android Capture App for DHIS 2 (v2.4.2) - Patch version
<table>
<tr>
<td>
Expand All @@ -13,37 +13,18 @@ It includes no functional improvements neither changes in the User Interface. It
<td colspan="2" bgcolor="white">

## Bugs fixed
* [ANDROAPP-4054](https://jira.dhis2.org/browse/ANDROAPP-4054) App crashes when searching by Age
* [ANDROAPP-4053](https://jira.dhis2.org/browse/ANDROAPP-4053) Static text from actions 'show warning' and 'show error' not shown for coordinate value type
* [ANDROAPP-4007](https://jira.dhis2.org/browse/ANDROAPP-4007) Vertical checkboxes render as horizontal
* [ANDROAPP-4005](https://jira.dhis2.org/browse/ANDROAPP-4005) Android app does not render TEA form names even when present
* [ANDROAPP-3983](https://jira.dhis2.org/browse/ANDROAPP-3983) Cannot use QR to read and populate the search form
* [ANDROAPP-3928](https://jira.dhis2.org/browse/ANDROAPP-3928) Date Data Element with Show Error Removes value, doesn't show error
* [ANDROAPP-3927](https://jira.dhis2.org/browse/ANDROAPP-3927) Impossible to add TEI when the program has zero search fields
* [ANDROAPP-3917](https://jira.dhis2.org/browse/ANDROAPP-3917) With translated DEs, Horizontal/Vertical Options not keeping values selected
* [ANDROAPP-3914](https://jira.dhis2.org/browse/ANDROAPP-3914) Map TEI view doesn't use the proper layer on the first load or after applying
* [ANDROAPP-3912](https://jira.dhis2.org/browse/ANDROAPP-3912) Event Scheduled to happen "Today" are not showing-up on Mobile
* [ANDROAPP-3910](https://jira.dhis2.org/browse/ANDROAPP-3910) Picture doesn't appear when adding on event form
* [ANDROAPP-3903](https://jira.dhis2.org/browse/ANDROAPP-3903) Crash PerformResumeActivity
* [ANDROAPP-3902](https://jira.dhis2.org/browse/ANDROAPP-3902) Warning on Complete does not evaluate expression
* [ANDROAPP-3896](https://jira.dhis2.org/browse/ANDROAPP-3896) Kujaku library exception
* [ANDROAPP-3895](https://jira.dhis2.org/browse/ANDROAPP-3895) IllegalArgumentException onMeasure
* [ANDROAPP-3894](https://jira.dhis2.org/browse/ANDROAPP-3894) CI Fix browserstack device status
* [ANDROAPP-3877](https://jira.dhis2.org/browse/ANDROAPP-3877) Crash when exiting an unfinisehd enrollment (delete and go back)
* [ANDROAPP-3858](https://jira.dhis2.org/browse/ANDROAPP-3858) In map view, bottom card panel disappears sometimes
* [ANDROAPP-3857](https://jira.dhis2.org/browse/ANDROAPP-3857) User does not receive a prompt if they submit an invalid co-ordinate
* [ANDROAPP-3842](https://jira.dhis2.org/browse/ANDROAPP-3842) Crash when switching between details and tables on data set instances
* [ANDROAPP-3801](https://jira.dhis2.org/browse/ANDROAPP-3801) Program Rules not preventing data reaching the database
* [ANDROAPP-3787](https://jira.dhis2.org/browse/ANDROAPP-3787) The basemaps are not completely covering the back of the bottom navigation bar
* [ANDROAPP-3719](https://jira.dhis2.org/browse/ANDROAPP-3719) Review 100% spinner when not supported value types.
* [ANDROAPP-3620](https://jira.dhis2.org/browse/ANDROAPP-3620) Description of due date always shows 'Due Date' instead of custom text
* [ANDROAPP-3567](https://jira.dhis2.org/browse/ANDROAPP-3567) Bug Changing the theme or the flag requires user to log out
* [ANDROAPP-3339](https://jira.dhis2.org/browse/ANDROAPP-3339) Improve the non supported value types feedback
* [ANDROAPP-2701](https://jira.dhis2.org/browse/ANDROAPP-2701) In relationships, the fav button has double buttons.
* [ANDROAPP-2667](https://jira.dhis2.org/browse/ANDROAPP-2667) Right-Left TEI Dashboard "+" button
* This patch release updates the [Android SDK](https://github.com/dhis2/dhis2-android-sdk) to version 1.4.
* [ANDROAPP-4093](https://jira.dhis2.org/browse/ANDROAPP-4093) Sync error message in dashboard and home
* [ANDROAPP-4089](https://jira.dhis2.org/browse/ANDROAPP-4089) Sync error message update
* [ANDROAPP-4088](https://jira.dhis2.org/browse/ANDROAPP-4088) Date filter not returning correct number of records
* [ANDROAPP-4086](https://jira.dhis2.org/browse/ANDROAPP-4086) Sync filter not returning correct records in tracker
* [ANDROAPP-4085](https://jira.dhis2.org/browse/ANDROAPP-4085) Option group rule actions not working for option set with more than 15 options
* [ANDROAPP-4084](https://jira.dhis2.org/browse/ANDROAPP-4084) Tracker Events sync fix
* [ANDROAPP-4076](https://jira.dhis2.org/browse/ANDROAPP-4076) Polygon field appears when the feature type is point for auto-generated events
* [ANDROAPP-4070](https://jira.dhis2.org/browse/ANDROAPP-4070) Autovalue null in form repository
* [ANDROAPP-4069](https://jira.dhis2.org/browse/ANDROAPP-4069) FormView RuntimeException
* This patch release updates the [Android SDK](https://github.com/dhis2/dhis2-android-sdk) to version 1.4.2.

You can find in Jira details on the [bugs fixed](https://jira.dhis2.org/issues/?filter=12067) in this version.
You can find in Jira details on the [bugs fixed](https://jira.dhis2.org/issues/?filter=12074) in this version.

Remember to check the [documentation](https://www.dhis2.org/android-documentation) for detailed
information of the features included in the App and how to configure DHIS2 to use it.
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/paperwork.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildTime":"2021-05-27 15:11","gitSha":"b69252dce"}
{"buildTime":"2021-06-30 13:27","gitSha":"78bc79bed"}
33 changes: 25 additions & 8 deletions app/src/main/java/org/dhis2/data/forms/dataentry/FormView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.LinearLayoutManager
Expand Down Expand Up @@ -53,7 +54,7 @@ import org.hisp.dhis.android.core.arch.helpers.GeometryHelper
import org.hisp.dhis.android.core.common.FeatureType
import timber.log.Timber

class FormView private constructor(
class FormView constructor(
formRepository: FormRepository,
private val onItemChangeListener: ((action: RowAction) -> Unit)?,
private val locationProvider: LocationProvider?,
Expand Down Expand Up @@ -391,6 +392,7 @@ class FormView private constructor(
}

class Builder {
private var fragmentManager: FragmentManager? = null
private var persistentRepository: FormRepository? = null
private var onItemChangeListener: ((action: RowAction) -> Unit)? = null
private var locationProvider: LocationProvider? = null
Expand Down Expand Up @@ -435,14 +437,29 @@ class FormView private constructor(
fun onLoadingListener(callback: (loading: Boolean) -> Unit) =
apply { this.onLoadingListener = callback }

/**
* Set a FragmentManager for instantiating the form view
* */
fun factory(manager: FragmentManager) =
apply { fragmentManager = manager }

fun build(): FormView {
return FormView(
formRepository = persistentRepository ?: FormRepositoryNonPersistenceImpl(),
locationProvider = locationProvider,
onItemChangeListener = onItemChangeListener,
needToForceUpdate = needToForceUpdate,
onLoadingListener = onLoadingListener
)
if (fragmentManager == null) {
throw Exception("You need to call factory method and pass a FragmentManager")
}
fragmentManager!!.fragmentFactory =
FormViewFragmentFactory(
persistentRepository ?: FormRepositoryNonPersistenceImpl(),
locationProvider,
onItemChangeListener,
needToForceUpdate,
onLoadingListener
)

return fragmentManager!!.fragmentFactory.instantiate(
this.javaClass.classLoader!!,
FormView::class.java.name
) as FormView
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.dhis2.data.forms.dataentry

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentFactory
import org.dhis2.data.location.LocationProvider
import org.dhis2.form.data.FormRepository
import org.dhis2.form.model.RowAction

class FormViewFragmentFactory(
val formRepository: FormRepository,
val locationProvider: LocationProvider?,
val onItemChangeListener: ((action: RowAction) -> Unit)?,
private val needToForceUpdate: Boolean = false,
val onLoadingListener: ((loading: Boolean) -> Unit)?
) : FragmentFactory() {
override fun instantiate(classLoader: ClassLoader, className: String): Fragment {
return when (className) {
FormView::class.java.name -> FormView(
formRepository,
onItemChangeListener,
locationProvider,
onLoadingListener,
needToForceUpdate
)
else -> super.instantiate(classLoader, className)
}
}
}
5 changes: 3 additions & 2 deletions app/src/main/java/org/dhis2/data/service/SyncDataWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,11 @@ public Result doWork() {
presenter.logTimeToFinish(System.currentTimeMillis() - init, DATA_TIME);

String lastDataSyncDate = DateUtils.dateTimeFormat().format(Calendar.getInstance().getTime());
boolean syncOk = presenter.checkSyncStatus();
SyncResult syncResult = presenter.checkSyncStatus();

prefs.setValue(Constants.LAST_DATA_SYNC, lastDataSyncDate);
prefs.setValue(Constants.LAST_DATA_SYNC_STATUS, isEventOk && isTeiOk && isDataValue && syncOk);
prefs.setValue(Constants.LAST_DATA_SYNC_STATUS, isEventOk && isTeiOk && isDataValue && syncResult == SyncResult.SYNC);
prefs.setValue(Constants.SYNC_RESULT, syncResult.name());

cancelNotification();

Expand Down
70 changes: 46 additions & 24 deletions app/src/main/java/org/dhis2/data/service/SyncGranularRxWorker.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,33 +54,11 @@ public Single<Result> createWork() {
})
.onErrorReturn(error -> Result.failure());
case TEI:
return Single.fromObservable(presenter.syncGranularTEI(uid)).map(d2Progress -> {
if (!presenter.checkSyncTEIStatus(uid)) {
List<TrackerImportConflict> trackerImportConflicts =
presenter.messageTrackerImportConflict(uid);
List<String> mergeDateConflicts = new ArrayList<>();
for (TrackerImportConflict conflict : trackerImportConflicts) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(conflict.created().getTime());
String date = DateUtils.databaseDateFormat().format(calendar.getTime());
mergeDateConflicts.add(
date + "/" + conflict.displayDescription());
}
Data data = new Data.Builder().putStringArray("conflict",
mergeDateConflicts.toArray(new String[mergeDateConflicts.size()])).build();
return Result.failure(data);
}
return Result.success();
})
return Single.fromObservable(presenter.syncGranularTEI(uid)).map(d2Progress -> checkTEISyncStatusResult(uid))
.onErrorReturn(error -> Result.failure());
case EVENT:
return Single.fromObservable(presenter.syncGranularEvent(uid))
.map(d2Progress -> {
if (!presenter.checkSyncEventStatus(uid))
return Result.failure();

return Result.success();
})
.map(d2Progress -> checkEventSyncStatusResult(uid))
.doOnError(Timber::e)
.onErrorReturn(error -> Result.failure());
case DATA_SET:
Expand All @@ -107,4 +85,48 @@ public Single<Result> createWork() {
}

}

private Result checkEventSyncStatusResult(String uid) {
switch (presenter.checkSyncEventStatus(uid)) {
case ERROR:
return Result.failure();
case INCOMPLETE:
Data data;
data = new Data.Builder().putStringArray(
"conflict",
new String[]{"INCOMPLETE"}
).build();
return Result.failure(data);
default:
return Result.success();
}
}

private Result checkTEISyncStatusResult(String uid) {
Data data;
switch (presenter.checkSyncTEIStatus(uid)) {
case ERROR:
List<TrackerImportConflict> trackerImportConflicts =
presenter.messageTrackerImportConflict(uid);
List<String> mergeDateConflicts = new ArrayList<>();
for (TrackerImportConflict conflict : trackerImportConflicts) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(conflict.created().getTime());
String date = DateUtils.databaseDateFormat().format(calendar.getTime());
mergeDateConflicts.add(
date + "/" + conflict.displayDescription());
}
data = new Data.Builder().putStringArray("conflict",
mergeDateConflicts.toArray(new String[mergeDateConflicts.size()])).build();
return Result.failure(data);
case INCOMPLETE:
data = new Data.Builder().putStringArray(
"conflict",
new String[]{"INCOMPLETE"}
).build();
return Result.failure(data);
default:
return Result.success();
}
}
}
6 changes: 3 additions & 3 deletions app/src/main/java/org/dhis2/data/service/SyncPresenter.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface SyncPresenter {

void syncReservedValues();

boolean checkSyncStatus();
SyncResult checkSyncStatus();

Observable<D2Progress> syncGranularEvent(String eventUid);

Expand All @@ -44,9 +44,9 @@ interface SyncPresenter {

Observable<D2Progress> syncGranularDataSetComplete(String dataSetUid);

boolean checkSyncEventStatus(String uid);
SyncResult checkSyncEventStatus(String uid);

boolean checkSyncTEIStatus(String uid);
SyncResult checkSyncTEIStatus(String uid);

boolean checkSyncDataValueStatus(String orgUnit, String attributeOptionCombo, String period);

Expand Down
Loading

0 comments on commit bda6352

Please sign in to comment.