Skip to content

Commit

Permalink
Release 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Balcan authored Feb 5, 2019
2 parents e398972 + 46454b3 commit d743d64
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public FormViewHolder(ViewDataBinding binding) {
new CustomDialog(
itemView.getContext(),
label.toString(),
descriptionText != null ? descriptionText : "No info for this field",
descriptionText != null ? descriptionText : itemView.getContext().getString(R.string.empty_description),
itemView.getContext().getString(R.string.action_accept),
null,
Constants.DESCRIPTION_DIALOG,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ private List<FieldViewModel> applyEffects(

//Reset effects
sectionsToHide.clear();
completeMessage = null;
canComplete = true;

Map<String, FieldViewModel> fieldViewModels = toMap(viewModels);
rulesUtils.applyRuleEffects(fieldViewModels, calcResult, this);
Expand Down Expand Up @@ -550,7 +552,7 @@ public void setShowError(@NonNull RuleActionShowError showError, FieldViewModel

@Override
public void unsupportedRuleAction() {
view.displayMessage("There is one program rule which is not supported. Please check the documentation");
view.displayMessage(view.getContext().getString(R.string.unsupported_program_rule));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import com.google.android.gms.location.LocationServices;

import org.dhis2.Bindings.Bindings;
import org.dhis2.R;
import org.dhis2.data.forms.dataentry.fields.FieldViewModel;
import org.dhis2.data.forms.dataentry.fields.edittext.EditTextViewModel;
import org.dhis2.data.metadata.MetadataRepository;
Expand Down Expand Up @@ -219,7 +220,7 @@ public void deleteEvent(String trackedEntityInstance) {
eventInitialRepository.deleteEvent(eventId, trackedEntityInstance);
view.showEventWasDeleted();
} else
view.displayMessage("This event has not been created yet");
view.displayMessage(view.getContext().getString(R.string.delete_event_error));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public void checkSecuredCredentials() {
binding.userPassEdit.setText(SecurePreferences.getStringValue(Constants.SECURE_PASS, null));
showLoginProgress(true);
} else
showInfoDialog("Empty Credentials", "To be able to log in using the fingerprint scanner you first need to use the default way");
showInfoDialog(getString(R.string.biometrics_dialog_title), getString(R.string.biometrics_first_use_text));
}

@Override
Expand Down Expand Up @@ -289,8 +289,8 @@ public void saveUsersData() {
binding.serverUrlEdit.getText().toString(),
binding.userNameEdit.getText().toString(),
binding.userPassEdit.getText().toString()))) {
showInfoDialog("Biometric Security",
"Use your fingerprint to log in with this user?",
showInfoDialog(getString(R.string.biometrics_security_title),
getString(R.string.biometrics_security_text),
new OnDialogClickListener() {
@Override
public void onPossitiveClick(AlertDialog alertDialog) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,27 @@ private ProgramEventViewModel transformIntoEventViewModel(EventModel eventModel)

String orgUnitName = getOrgUnitName(eventModel.organisationUnit());
List<Pair<String, String>> data = getData(eventModel.uid());
boolean hasExpired = false /*= isExpired(eventModel.uid())*/;
boolean hasExpired = isExpired(eventModel);

return ProgramEventViewModel.create(eventModel.uid(), eventModel.organisationUnit(), orgUnitName, eventModel.state(), data, eventModel.status(), hasExpired);
}

private boolean isExpired(EventModel eventModel) {
boolean hasExpired = false;
Cursor programCursor = briteDatabase.query("SELECT * FROM Program WHERE uid = ?", eventModel.program());
if (programCursor != null) {
if (programCursor.moveToFirst()) {
ProgramModel program = ProgramModel.create(programCursor);
if (eventModel.status() == EventStatus.ACTIVE)
hasExpired = DateUtils.getInstance().hasExpired(eventModel, program.expiryDays(), program.completeEventsExpiryDays(), program.expiryPeriodType());
if (eventModel.status() == EventStatus.COMPLETED)
hasExpired = DateUtils.getInstance().isEventExpired(null, eventModel.completedDate(), program.completeEventsExpiryDays());
}
programCursor.close();
}
return hasExpired;
}

private String getOrgUnitName(String orgUnitUid) {
String orgUrgUnitName = "";
Cursor orgUnitCursor = briteDatabase.query("SELECT displayName FROM OrganisationUnit WHERE uid = ?", orgUnitUid);
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,5 +399,12 @@
<string name="event_was_skipped">The event was marked as skipped</string>
<string name="no_intructions">There is no information for this screen</string>
<string name="event_overdue">Overdue</string>
<string name="unsupported_program_rule">There is one program rule which is not supported. Please check the documentation</string>
<string name="delete_event_error">This event has not been created yet</string>
<string name="empty_description">No info for this field</string>
<string name="biometrics_dialog_title">Empty Credentials</string>
<string name="biometrics_first_use_text">To be able to log in using the fingerprint scanner you first need to use the default way</string>
<string name="biometrics_security_title">Biometric Security</string>
<string name="biometrics_security_text">Use your fingerprint to log in with this user?</string>

</resources>
2 changes: 1 addition & 1 deletion buildsystem/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ext {
sdk : 28,
tools : "28.0.3",
minSdk: 19,
vCode: 35,
vCode: 39,
vName: "1.1.0"
]

Expand Down

0 comments on commit d743d64

Please sign in to comment.