-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix formUtils method calls in FormConfigurationJsonFormActivity
- Loading branch information
Showing
2 changed files
with
8 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -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); | ||
} | ||
|
@@ -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; | ||
} | ||
|
@@ -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); | ||
|
@@ -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) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters