Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ fastlane/test_output
fastlane/readme.md

app/release/output.json
.DS_Store

# Custom product flavours

*custom-flavours.gradle
*.aab

#DS_Store files
*.DS_Store
.DS_Store
./.DS_Store
./.git/.DS_Store
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Parameters:
* ```RAR_PASSWORD``` represents the password to be used for the offline extract.
* ```SHOW_CONTROL_NUMBER_MENU``` allow to show or hide the Control Number menu item in case the implementation does not implement the ePayment module.
* ```app_name_policies``` is a resource string allowing to change the name of the application.
* ```sentry_dsn``` allow to define the sentry dsn of your project where error and exception events from your application will be sent

Escape procedures can be configured and language resource files can be changed. Please follow the ```sourceSets``` record. Look in ```app\src\demo``` folder for an example.

Expand Down
6 changes: 4 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ android {
buildConfigField "boolean", "IS_PAYMENT_ENABLED", 'false'
resValue "string", "app_name_policies", "Policies"
resValue "string", "ReleaseDateValue", getDate()
resValue "string", "sentry_dsn", ""
}
buildTypes {
release {
Expand Down Expand Up @@ -192,8 +193,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

packagingOptions {
Expand Down Expand Up @@ -245,4 +246,5 @@ dependencies {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.13.2'
implementation 'io.sentry:sentry-android:4.2.0'
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
android:resource="@xml/paths" />
</provider>

<meta-data android:name="io.sentry.dsn" android:value="@string/sentry_dsn" />

<activity
android:name=".MainActivity"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|locale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
import javax.crypto.spec.SecretKeySpec;
import javax.net.ssl.HttpsURLConnection;

import io.sentry.Sentry;

public class ClientAndroidInterface {
private static final String LOG_TAG_RENEWAL = "RENEWAL";
public static String filePath = null;
Expand Down Expand Up @@ -778,6 +780,7 @@ public int SaveFamily(String FamilyData, String InsureeData) {
return FamilyId;

} catch (UserException e) {
Sentry.captureException(e);
e.printStackTrace();
if (InsureeId != 0)
sqlHandler.deleteData("tblInsuree", "InsureeId = ?", new String[]{String.valueOf(InsureeId)});
Expand Down Expand Up @@ -1037,6 +1040,7 @@ else if (ExceedThreshold == 0)
);
}
} catch (NumberFormatException | UserException e) {
Sentry.captureException(e);
e.printStackTrace();
throw new Exception(e.getMessage());
}
Expand Down Expand Up @@ -1691,8 +1695,10 @@ public int SavePolicy(String PolicyData, int FamilyId, int PolicyId) throws Exce
}
inProgress = false;
} catch (NumberFormatException e) {
Sentry.captureException(e);
e.printStackTrace();
} catch (UserException e) {
Sentry.captureException(e);
e.printStackTrace();
throw new Exception(e.getMessage());
}
Expand Down Expand Up @@ -1883,8 +1889,10 @@ public int SavePremiums(String PremiumData, int PolicyId, int PremiumId, int Fam
}
inProgress = false;
} catch (NumberFormatException e) {
Sentry.captureException(e);
e.printStackTrace();
} catch (UserException e) {
Sentry.captureException(e);
e.printStackTrace();
throw new Exception(e.getMessage());
}
Expand Down Expand Up @@ -3145,6 +3153,7 @@ private int uploadEnrols(
List<Family.Policy> policies = familyPolicyFromJSONObject(family.getUuid(), policiesArray);
new UpdateFamily().execute(family, policies);
} catch (Exception e) {
Sentry.captureException(e);
e.printStackTrace();
enrolMessages.add(Objects.requireNonNullElse(e.getMessage(), "Something went wrong updating the family"));
return -400;
Expand Down Expand Up @@ -3571,8 +3580,8 @@ protected void onPostExecute(Boolean aBoolean) {
}

private void DeleteUploadedData(final int FamilyId, ArrayList<String> FamilyIDs, int CallerId) {
if (FamilyIDs.size() == 0) {
FamilyIDs = new ArrayList<>() {{
if (FamilyIDs.isEmpty()) {
FamilyIDs = new ArrayList<String>() {{
add(String.valueOf(FamilyId));
}};
}
Expand Down Expand Up @@ -3663,6 +3672,7 @@ public void uploadFeedbacks() {
MoveFile(xmlFiles[i], 1);
MoveFile(jsonFiles[i], 1);
} catch (Exception e) {
Sentry.captureException(e);
e.printStackTrace();
if (
e instanceof HttpException &&
Expand Down Expand Up @@ -3901,6 +3911,7 @@ public void downloadMasterData() {
((MainActivity) activity).ShowEnrolmentOfficerDialog();
});
} catch (JSONException e) {
Sentry.captureException(e);
Log.e("MASTERDATA", "Error while parsing master data", e);
} catch (UserException e) {
Log.e("MASTERDATA", "Error while downloading master data", e);
Expand All @@ -3923,6 +3934,7 @@ public void importMasterData(String data) throws JSONException, UserException {
try {
processOldFormat(new JSONArray(data));
} catch (JSONException e) {
Sentry.captureException(e);
try {
processNewFormat(new JSONObject(data));
} catch (JSONException e2) {
Expand All @@ -3937,6 +3949,7 @@ public void startDownloadingMasterData() throws JSONException, UserException, Us
try {
importMasterData(new FetchMasterData().execute());
} catch (Exception e) {
Sentry.captureException(e);
if (e instanceof UserNotAuthenticatedException) {
throw (UserNotAuthenticatedException) e;
}
Expand Down Expand Up @@ -4054,6 +4067,7 @@ private void processOldFormat(@NonNull JSONArray masterData) throws UserExceptio
insertPhoneDefaults(PhoneDefaults);
insertGenders(Genders);
} catch (JSONException e) {
Sentry.captureException(e);
e.printStackTrace();
throw new UserException(activity.getResources().getString(R.string.DownloadMasterDataFailed), e);
}
Expand Down Expand Up @@ -4561,6 +4575,7 @@ public void SaveInsureePolicy(int InsureId, int FamilyId, Boolean Activate, int
ExpiryDate = PolicyObject2.getString("ExpiryDate");
EnrollDate = PolicyObject2.getString("EnrollDate");
} catch (JSONException e) {
Sentry.captureException(e);
e.printStackTrace();
}
values.put("InsureePolicyId", MaxInsureePolicyId);
Expand Down
Loading