Skip to content

[WIP] Integrate ACRA crash reporter, with a prompt to send an email. #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions document-viewer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apply plugin: 'com.android.application'
dependencies {
compile 'jcifs:jcifs:1.3.17'
compile 'com.android.support:support-v4:24.1.1'
compile 'ch.acra:acra:4.9.0'
}

import java.util.regex.Pattern
Expand Down
15 changes: 15 additions & 0 deletions document-viewer/src/main/java/org/ebookdroid/EBookDroidApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package org.ebookdroid;

import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.ebookdroid.common.bitmaps.BitmapManager;
import org.ebookdroid.common.bitmaps.ByteBufferManager;
import org.ebookdroid.common.cache.CacheManager;
Expand Down Expand Up @@ -27,6 +30,11 @@
import org.emdev.utils.concurrent.Flag;
import org.sufficientlysecure.viewer.R;

@ReportsCrashes(mailTo = "fixme",
mode = ReportingInteractionMode.DIALOG,
resDialogCommentPrompt = R.string.crash_dialog_comment_prompt,
resDialogText = R.string.crash_dialog_text,
resDialogTitle = R.string.crash_dialog_title)
public class EBookDroidApp extends BaseDroidApp implements IAppSettingsChangeListener, IBackupSettingsChangeListener,
ILibSettingsChangeListener {

Expand Down Expand Up @@ -159,4 +167,11 @@ private static Object preallocateHeap(final int size) {
return null;
}

@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);

// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
6 changes: 6 additions & 0 deletions document-viewer/src/main/res/values/strings_common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,10 @@
<string name="cache_moving_progress">Moving cached files %1$d/%2$d</string>

<string name="error_invalid_view_mode">This action is only available in view mode %1$s</string>

<string name="crash_dialog_title">Document Viewer has crashed</string>
<string name="crash_dialog_text">An unexpected error occurred
forcing the application to stop. Would you like to e-mail the
details to help fix the issue?</string>
<string name="crash_dialog_comment_prompt">You can add extra information and comments here:</string>
</resources>