Skip to content

Commit

Permalink
Brand crash dialog, add crash trigger if debug
Browse files Browse the repository at this point in the history
Previously I've been relying on a personal collection of
crash bugs to test the crash dialog, but that's a poor testing
experience - now we have an advanced preference area to just crash

During the ACRA upgrade some branding was already broken, and
the rest was lost, when I finally saw the dialog again with
fresh eyes it was terrible so this puts the icon and title back
  • Loading branch information
mikehardy authored and timrae committed Sep 20, 2018
1 parent ffd3bb2 commit da1f19c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion AnkiDroid/src/main/java/com/ichi2/anki/AnkiDroidApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
resCommentPrompt = R.string.empty_string,
resTitle = R.string.feedback_title,
resText = R.string.feedback_default_text,
resPositiveButtonText = R.string.feedback_report
resPositiveButtonText = R.string.feedback_report,

This comment has been minimized.

Copy link
@timrae

timrae Oct 11, 2018

Member

Is that a comma at the end of the line?

This comment has been minimized.

Copy link
@mikehardy

mikehardy Oct 11, 2018

Author Member

Yes, it's an annotation and it's comma delimited

This comment has been minimized.

Copy link
@timrae

timrae Oct 11, 2018

Member

Sorry had just woken up and looking at one line of a diff in isolation lol

resIcon = R.drawable.logo_star_144dp
)
@AcraHttpSender(
httpMethod = HttpSender.Method.PUT,
Expand Down
13 changes: 13 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,19 @@ private void initSubscreen(String action, PreferenceContext listener) {
startActivity(i);
return true;
});
// Make it possible to test crash reporting, but only for DEBUG builds
if (BuildConfig.DEBUG) {
Timber.i("Debug mode, allowing for test crashes");
Preference triggerTestCrashPreference = new Preference(this);
triggerTestCrashPreference.setKey("trigger_crash_preference");
triggerTestCrashPreference.setTitle("Trigger test crash");
triggerTestCrashPreference.setSummary("Touch here for an immediate test crash");
triggerTestCrashPreference.setOnPreferenceClickListener(preference -> {
Timber.w("Crash triggered on purpose from advanced preferences in debug mode");
throw new RuntimeException("This is a test crash");
});
screen.addPreference(triggerTestCrashPreference);
}
// Force full sync option
Preference fullSyncPreference = screen.findPreference("force_full_sync");
fullSyncPreference.setOnPreferenceClickListener(preference -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ protected void init(Bundle savedInstanceState) {
DialogConfiguration dialogConfig =
(DialogConfiguration)builder.getPluginConfigurationBuilder((DialogConfigurationBuilder.class)).build();

dialogBuilder.setIcon(dialogConfig.resIcon());
dialogBuilder.setTitle(dialogConfig.title());
dialogBuilder.setPositiveButton(dialogConfig.positiveButtonText(), AnkiDroidCrashReportDialog.this);
dialogBuilder.setNegativeButton(dialogConfig.negativeButtonText(), AnkiDroidCrashReportDialog.this);
}
Expand Down
2 changes: 1 addition & 1 deletion AnkiDroid/src/main/res/values/05-feedback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<string name="empty_string"/>
<string name="error_reporting_choice">Error reporting mode</string>
<string name="feedback_disclaimer">Disclaimer: We don’t collect any personal information such as your email address, phone number, or your phone IMEI. We do collect some information about your device such as the manufacturer, model and version of Android, as well as the nature of reported errors themselves and the steps which led up to them occurring.</string>
<string name="feedback_title">Feedback</string>
<string name="feedback_title">AnkiDroid Feedback</string>
<string name="feedback_default_text">Enter your feedback or information about the nature of any errors you’re reporting.</string>
<string name="feedback_auto_toast_text">AnkiDroid has encountered a problem; a report is being sent to the developers…</string>
<string name="feedback_manual_toast_text">AnkiDroid has encountered a problem; a report is being generated…</string>
Expand Down

4 comments on commit da1f19c

@mikehardy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@timrae forgot this follow-on to the acra work, which just went in to 2.8. I'm working on a crash bug on that branch right now and the non-branded dialog popped up. What do you think about cherry-picking this one over there? I think we're going to need a beta2 anyway because #5011 is not resolved and I'm still working on it

@mikehardy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACRA is working though (on 2.8)

@timrae
Copy link
Member

@timrae timrae commented on da1f19c Oct 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is really hotfix material, but if you really want it then I guess it doesn't hurt

@mikehardy
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, I'll do hotfix stuff with enthusiasm, you have the battle scars so you're intuition is worth it

Please sign in to comment.