Skip to content

Commit 8efb3f3

Browse files
committed
fix crash app
1 parent 34e2b33 commit 8efb3f3

4 files changed

Lines changed: 20 additions & 11 deletions

File tree

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ android {
8989
}
9090
demoRelease {
9191
applicationId = "org.openimis.imispolicies.demoRelease"
92-
buildConfigField "String", "API_BASE_URL", '"https://release.openimis.org/"'
92+
buildConfigField "String", "API_BASE_URL", '"http://192.168.171.213:3000/"'
9393
resValue "string", "app_name_policies", "Policies Release"
9494
dimension = 'std'
9595
}

app/src/main/java/org/openimis/imispolicies/ClientAndroidInterface.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4887,7 +4887,7 @@ private JSONObject toPolicyJSONObject (Family.Policy policy) throws JSONExceptio
48874887
policyObject.put("FamilyId",policy.getFamilyId());
48884888
policyObject.put("EnrollDate",policy.getEnrollDate());
48894889
policyObject.put("StartDate",DateUtils.toDateString(Objects.requireNonNull(policy.getStartDate())));
4890-
policyObject.put("EffectiveDate", DateUtils.toDateString(Objects.requireNonNull(policy.getEffectiveDate())));
4890+
policyObject.put("EffectiveDate", policy.getEffectiveDate() != null ? DateUtils.toDateString(policy.getEffectiveDate()): "");
48914891
policyObject.put("ExpiryDate", DateUtils.toDateString(Objects.requireNonNull(policy.getExpiryDate())));
48924892
policyObject.put("PolicyStatus",policy.getStatus());
48934893
policyObject.put("PolicyValue",policy.getValue());

app/src/main/java/org/openimis/imispolicies/MainActivity.java

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ protected void onCreate(Bundle savedInstanceState) {
314314
if (ca.isMasterDataAvailable() > 0) {
315315
loadLanguages();
316316
}
317+
navigationView.setCheckedItem(R.id.nav_home);
318+
if (checkRequirements()) {
319+
onAllRequirementsMet();
320+
}
317321
} catch (Exception e) {
318322
Sentry.captureException(e);
319323
}
@@ -728,9 +732,13 @@ public boolean onNavigationItemSelected(MenuItem item) {
728732
}
729733

730734
} else if (id == R.id.nav_renewal) {
731-
Intent i = new Intent(this, RenewList.class);
732-
startActivity(i);
733-
735+
String officerCode = global.getOfficerCode();
736+
if (officerCode == null) {
737+
ShowEnrolmentOfficerDialog();
738+
} else {
739+
Intent i = new Intent(this, RenewList.class);
740+
startActivity(i);
741+
}
734742
} else if (id == R.id.nav_reports) {
735743
Global global = (Global) getApplicationContext();
736744
if (global.isLoggedIn()) {
@@ -819,10 +827,12 @@ public MasterDataAsync(@NonNull MainActivity context) {
819827
@Override
820828
protected void onPreExecute() {
821829
Context context = activity.get();
822-
if (context == null) {
823-
return;
824-
}
825-
pd = new WeakReference<>(AndroidUtils.showProgressDialog(context, R.string.Sync, R.string.DownloadingMasterData));
830+
if (context == null) return;
831+
((Activity) context).runOnUiThread(() -> {
832+
pd = new WeakReference<>(
833+
AndroidUtils.showProgressDialog(context, R.string.Sync, R.string.DownloadingMasterData)
834+
);
835+
});
826836
}
827837

828838
@Override

app/src/main/res/layout/list_item_insuree.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<LinearLayout
2020
android:layout_width="match_parent"
2121
android:layout_height="wrap_content"
22-
android:padding="12dp"
22+
android:padding="8dp"
2323
android:layout_weight="1"
2424
android:orientation="vertical">
2525

@@ -30,7 +30,6 @@
3030
android:textColor="@color/colorAccent"
3131
android:text="insuree CHFID"
3232
android:textStyle="bold"
33-
android:textSize="18sp"
3433
android:layout_alignParentStart="true"
3534
android:layout_marginBottom="5dp"/>
3635

0 commit comments

Comments
 (0)