Skip to content

Commit

Permalink
Fix formUtils method calls in FormConfigurationJsonFormActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
ekigamba committed Jul 1, 2020
1 parent 30fde2a commit 5cf3a28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.client.utils.contract.ClientFormContract;
import org.smartregister.client.utils.contract.JsonSubFormAndRulesLoader;

import java.io.BufferedReader;
Expand All @@ -28,12 +29,15 @@
/**
* Created by Ephraim Kigamba - [email protected] on 29-06-2020.
*/
public class FormConfigurationJsonFormActivity extends JsonFormActivity implements JsonSubFormAndRulesLoader {
public class FormConfigurationJsonFormActivity extends JsonFormActivity implements ClientFormContract.View {

private FormUtils formUtils;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

formUtils = new FormUtils();
JSONObject jsonObject = getmJSONObject();
checkIfFormUpdate(jsonObject);
}
Expand Down Expand Up @@ -84,7 +88,7 @@ public void run() {
@Override
public BufferedReader getRules(@NonNull Context context, @NonNull String fileName) throws IOException {
try {
BufferedReader bufferedReader = FormUtils.getRulesFromRepository(context, NativeFormLibrary.getInstance().getClientFormDao(), fileName);
BufferedReader bufferedReader = formUtils.getRulesFromRepository(context, NativeFormLibrary.getInstance().getClientFormDao(), fileName);
if (bufferedReader != null) {
return bufferedReader;
}
Expand All @@ -100,7 +104,7 @@ public BufferedReader getRules(@NonNull Context context, @NonNull String fileNam
public JSONObject getSubForm(String formIdentity, String subFormsLocation, Context context, boolean translateSubForm) throws Exception {
JSONObject dbForm = null;
try {
dbForm = FormUtils.getSubFormJsonFromRepository(context, NativeFormLibrary.getInstance().getClientFormDao(), formIdentity, subFormsLocation, translateSubForm);
dbForm = formUtils.getSubFormJsonFromRepository(context, NativeFormLibrary.getInstance().getClientFormDao(), formIdentity, subFormsLocation, translateSubForm);

} catch (JSONException ex) {
Timber.e(ex);
Expand All @@ -117,7 +121,7 @@ public JSONObject getSubForm(String formIdentity, String subFormsLocation, Conte

@Override
public void handleFormError(boolean isRulesFile, @NonNull String formIdentifier) {
FormUtils.handleJsonFormOrRulesError(this, NativeFormLibrary.getInstance().getClientFormDao(), isRulesFile, formIdentifier, new OnFormFetchedCallback<String>() {
formUtils.handleJsonFormOrRulesError(this, NativeFormLibrary.getInstance().getClientFormDao(), isRulesFile, formIdentifier, new OnFormFetchedCallback<String>() {
@Override
public void onFormFetched(@Nullable String form) {
if (form != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.smartregister.client.utils.contract.ClientFormDao;
import org.smartregister.client.utils.contract.JsonSubFormAndRulesLoader;

import java.io.BufferedReader;
Expand Down

0 comments on commit 5cf3a28

Please sign in to comment.