Skip to content

Commit 3bcbd16

Browse files
authored
Merge pull request #108 from mngoe/feature-33539
add glitchip configurations
2 parents a9a0428 + a3f5500 commit 3bcbd16

File tree

8 files changed

+40
-2
lines changed

8 files changed

+40
-2
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,16 @@ fastlane/readme.md
7676

7777
# Visual Studio Code
7878
.vscode/
79+
./.DS_Store
80+
./.git/.DS_Store
81+
*.DS_Store
7982

8083

8184
# Custom product flavours
8285
*custom-flavours.gradle
8386
.DS_Store
8487

88+
.DS_Store
89+
*.properties
90+
./gradle
8591
*.DS_Store

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ private String _Domain = "http://132.148.151.32/";
3939
```
4040

4141
For demo purposes, the default Web Services domain is set to the openIMIS
42-
demo server: demo.openimis.org (IP: 132.148.151.32).
42+
demo server: demo.openimis.org (IP: 132.148.151.32).
43+
44+
If you want to receive error and exception events in sentry
45+
you can set `sentry_dsn` in build.gradle file
4346

4447
### Running the app
4548

claimManagement/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ android {
6262
buildConfigField "String", "RAR_PASSWORD", '")(#$1HsD"'
6363
buildConfigField "String", "API_VERSION", '"3"'
6464
resValue "string", "release_tag", "release/25.04"
65+
resValue "string", "sentry_dsn", ""
6566
}
6667

6768
productFlavors {
@@ -237,5 +238,6 @@ dependencies {
237238
androidTestImplementation 'androidx.test:core:1.5.0'
238239
implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.71828'
239240
implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '1.2.7'
241+
implementation 'io.sentry:sentry-android:8.25.0'
240242

241243
}

claimManagement/src/main/AndroidManifest.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
android:resource="@xml/paths" />
5858
</provider>
5959

60+
<meta-data
61+
android:name="io.sentry.dsn"
62+
android:value="@string/sentry_dsn" />
63+
6064
<activity
6165
android:name=".MainActivity"
6266
android:exported="true"

claimManagement/src/main/java/org/openimis/imisclaims/MainActivity.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
import java.util.ArrayList;
6060
import java.util.List;
6161

62+
import io.sentry.Sentry;
63+
import io.sentry.android.core.SentryAndroid;
64+
6265

6366
public class MainActivity extends ImisActivity {
6467
private static final int REQUEST_PERMISSIONS_CODE = 1;
@@ -284,6 +287,7 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten
284287
(d, i) -> finish());
285288
}
286289
} catch (Exception e) {
290+
Sentry.captureException(e);
287291
Log.e(LOG_TAG, "Error while copying master data.", e);
288292
}
289293
}
@@ -304,6 +308,7 @@ public void PickMasterDataFileDialog() {
304308
try {
305309
startActivityForResult(intent, REQUEST_PICK_MD_FILE);
306310
} catch (ActivityNotFoundException e) {
311+
Sentry.captureException(e);
307312
Toast.makeText(getApplicationContext(), getResources().getString(R.string.NoFileExporerInstalled), Toast.LENGTH_SHORT).show();
308313
}
309314
}).setNegativeButton(getResources().getString(R.string.No),
@@ -320,6 +325,7 @@ public AlertDialog confirmRefreshMap() {
320325
try {
321326
doLoggedIn(() -> DownLoadDiagnosesServicesItems(global.getOfficerCode()));
322327
} catch (Exception e) {
328+
Sentry.captureException(e);
323329
e.printStackTrace();
324330
}
325331
},
@@ -410,6 +416,7 @@ public AlertDialog DownloadMasterDialog() {
410416
}
411417
} catch (Exception e) {
412418
e.printStackTrace();
419+
Sentry.captureException(e);
413420
DownloadMasterDialog();
414421
}
415422
} else {
@@ -443,6 +450,7 @@ private void checkForUpdates() {
443450
try {
444451
mNotificationManager.notify(SIMPLE_NOTIFICATION_ID, builder.build());
445452
} catch (Exception e) {
453+
Sentry.captureException(e);
446454
e.printStackTrace();
447455
}
448456

@@ -480,6 +488,7 @@ public void run() {
480488
});
481489
} catch (Exception e) {
482490
e.printStackTrace();
491+
Sentry.captureException(e);
483492
runOnUiThread(() -> {
484493
progressDialog.dismiss();
485494
ErrorDialogBox(e.getMessage());
@@ -520,6 +529,7 @@ public void getClaimAdmins() {
520529
});
521530
} catch (Exception e) {
522531
e.printStackTrace();
532+
Sentry.captureException(e);
523533
runOnUiThread(() -> progressDialog.dismiss());
524534
}
525535
});
@@ -555,6 +565,7 @@ public void validateClaimAdminCode(final String claimAdminCode) {
555565
progressDialog.dismiss();
556566
doLoggedIn(() -> CheckHealthFacility(claimAdminCode, HealthFacilityName));
557567
} catch (Exception e) {
568+
Sentry.captureException(e);
558569
e.printStackTrace();
559570
}
560571
}
@@ -671,6 +682,7 @@ public void run() {
671682
});
672683
} catch (Exception e) {
673684
e.printStackTrace();
685+
Sentry.captureException(e);
674686
runOnUiThread(() -> {
675687
progressDialog.dismiss();
676688
Toast.makeText(MainActivity.this, e.getMessage() + "-" + getResources().getString(R.string.SomethingWentWrongServer), Toast.LENGTH_LONG).show();
@@ -715,6 +727,7 @@ public void run() {
715727
});
716728
} catch (Exception e) {
717729
e.printStackTrace();
730+
Sentry.captureException(e);
718731
runOnUiThread(() -> {
719732
progressDialog.dismiss();
720733
Toast.makeText(MainActivity.this, e.getMessage() + "-" + getResources().getString(R.string.AccessDenied), Toast.LENGTH_LONG).show();

claimManagement/src/main/java/org/openimis/imisclaims/SynchronizeActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
import java.net.URL;
3737
import java.util.ArrayList;
3838

39+
import io.sentry.Sentry;
40+
3941
public class SynchronizeActivity extends ImisActivity {
4042
private static final String LOG_TAG = "SYNCACTIVITY";
4143
private static final int PICK_FILE_REQUEST_CODE = 1;
@@ -129,6 +131,7 @@ protected void onBroadcastReceived(Context context, Intent intent) {
129131
showDialog(getResources().getString(R.string.BulkUpload));
130132
}
131133
} catch (JSONException e) {
134+
Sentry.captureException(e);
132135
Log.e(LOG_TAG, "Error while processing claim response", e);
133136
}
134137
break;
@@ -296,6 +299,7 @@ public void CheckUpdate(){
296299
Toast.LENGTH_SHORT).show();
297300
});
298301
} catch (Exception e) {
302+
Sentry.captureException(e);
299303
runOnUiThread(() -> {
300304
pd.dismiss();
301305
Toast.makeText(this,
@@ -327,6 +331,7 @@ public void downloadUpdate(String lastVersion, String tagName) {
327331

328332
} catch (Exception e) {
329333
Toast.makeText(this, getResources().getString(R.string.downloadUpdateFail), Toast.LENGTH_SHORT).show();
334+
Sentry.captureException(e);
330335
Log.e("DownloadUpdate", "Erreur: ", e);
331336
}
332337
}

claimManagement/src/main/java/org/openimis/imisclaims/SynchronizeService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import java.util.List;
3232
import java.util.Locale;
3333

34+
import io.sentry.Sentry;
35+
3436
public class SynchronizeService extends JobIntentService {
3537
private static final int JOB_ID = 6541259; //Random unique Job id
3638
private static final String LOG_TAG = "SYNCSERVICE";
@@ -114,6 +116,7 @@ private void handleUploadClaims() {
114116
broadcastSyncSuccess(claimStatus);
115117
} catch (Exception e) {
116118
e.printStackTrace();
119+
Sentry.captureException(e);
117120
broadcastError(getResources().getString(R.string.ErrorOccurred) + ": " + e.getMessage(), ACTION_UPLOAD_CLAIMS);
118121
}
119122
}
@@ -195,6 +198,7 @@ private void handleExportClaims() {
195198
AppInformation.DateTimeInfo.getDefaultIsoDatetimeFormatter().format(new Date()),
196199
SQLHandler.CLAIM_UPLOAD_STATUS_EXPORTED, null);
197200
} catch (JSONException e) {
201+
Sentry.captureException(e);
198202
Log.e(LOG_TAG, "Exception while exporting claims", e);
199203
}
200204
}
@@ -219,6 +223,7 @@ private File createClaimFile(JSONObject details) {
219223
String filename = "Claim_" + details.getString("HFCode") + "_" + details.getString("ClaimCode") + "_" + d + ".xml";
220224
return storageManager.createTempFile("exports/claim/" + filename);
221225
} catch (JSONException e) {
226+
Sentry.captureException(e);
222227
Log.e(LOG_TAG, "Parsing claim JSON failed", e);
223228
}
224229
return null;

claimManagement/src/main/java/org/openimis/imisclaims/domain/entity/Claim.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ public List<Medication> getMedications() {
392392
return medications;
393393
}
394394

395-
public static final Creator<Claim> CREATOR = new Creator<Claim>() {
395+
public static final Creator<Claim> CREATOR = new Creator<>() {
396396
@Override
397397
public Claim createFromParcel(Parcel in) {
398398
return new Claim(in);

0 commit comments

Comments
 (0)