Skip to content
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

Restructure forceCloseDialogAfterToast to alsoReportToAndroidFramework #438

Merged
merged 2 commits into from
Apr 28, 2016
Merged
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
2 changes: 1 addition & 1 deletion src/main/java/org/acra/ACRAConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private ACRAConstants(){}
*/
public static final String NULL_VALUE = "ACRA-NULL-STRING";

public static final boolean DEFAULT_FORCE_CLOSE_DIALOG_AFTER_TOAST = false;
public static final boolean DEFAULT_REPORT_TO_ANDROID_FRAMEWORK = false;

public static final int DEFAULT_SOCKET_TIMEOUT = 8000;

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/acra/annotation/ReportsCrashes.java
Original file line number Diff line number Diff line change
Expand Up @@ -455,12 +455,12 @@
int socketTimeout() default ACRAConstants.DEFAULT_SOCKET_TIMEOUT;

/**
* In {@link ReportingInteractionMode#TOAST} mode, set this to true if you
* prefer displaying the native Force Close dialog after the Toast.
* set this to true if you prefer displaying the native force close dialog after the ACRA is done.
* Recommended: Keep this set to false in {@link ReportingInteractionMode#DIALOG}
*
* @return true if the Force Close dialog has to be displayed.
* @return true if the force close dialog has to be displayed.
*/
boolean forceCloseDialogAfterToast() default ACRAConstants.DEFAULT_FORCE_CLOSE_DIALOG_AFTER_TOAST;
boolean alsoReportToAndroidFramework() default ACRAConstants.DEFAULT_REPORT_TO_ANDROID_FRAMEWORK;

/**
* Add here your {@link SharedPreferences} identifier Strings if you use
Expand Down
7 changes: 1 addition & 6 deletions src/main/java/org/acra/builder/ReportExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,7 @@ private void dialogAndEnd(@NonNull ReportBuilder reportBuilder, @NonNull File re
* End the application.
*/
private void endApplication(@Nullable Thread uncaughtExceptionThread, Throwable th) {
// TODO It would be better to create an explicit config attribute #letDefaultHandlerEndApplication
// as the intent is clearer and would allows you to switch it off for SILENT.
final boolean letDefaultHandlerEndApplication = (
config.mode() == ReportingInteractionMode.SILENT ||
(config.mode() == ReportingInteractionMode.TOAST && config.forceCloseDialogAfterToast())
);
final boolean letDefaultHandlerEndApplication = config.alsoReportToAndroidFramework();

final boolean handlingUncaughtException = uncaughtExceptionThread != null;
if (handlingUncaughtException && letDefaultHandlerEndApplication && (defaultExceptionHandler != null)) {
Expand Down
15 changes: 6 additions & 9 deletions src/main/java/org/acra/config/ACRAConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import android.support.annotation.StringRes;
import android.support.annotation.StyleRes;

import org.acra.ACRA;
import org.acra.ACRAConstants;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
Expand All @@ -50,8 +49,6 @@
import java.util.Map;
import java.util.Set;

import static org.acra.ACRA.LOG_TAG;

/**
* Represents the configuration that ACRA will use when handling crash reports.
*
Expand All @@ -75,7 +72,7 @@ public final class ACRAConfiguration implements Serializable {
private boolean deleteUnapprovedReportsOnApplicationStart;
private boolean deleteOldUnsentReportsOnApplicationStart;
private int dropboxCollectionMinutes;
private boolean forceCloseDialogAfterToast;
private boolean alsoReportToAndroidFramework;
private String formUri;
private String formUriBasicAuthLogin;
private String formUriBasicAuthPassword;
Expand Down Expand Up @@ -156,7 +153,7 @@ public final class ACRAConfiguration implements Serializable {
deleteUnapprovedReportsOnApplicationStart = builder.deleteUnapprovedReportsOnApplicationStart();
deleteOldUnsentReportsOnApplicationStart = builder.deleteOldUnsentReportsOnApplicationStart();
dropboxCollectionMinutes = builder.dropboxCollectionMinutes();
forceCloseDialogAfterToast = builder.forceCloseDialogAfterToast();
alsoReportToAndroidFramework = builder.alsoReportToAndroidFramework();
formUri = builder.formUri();
formUriBasicAuthLogin = builder.formUriBasicAuthLogin();
formUriBasicAuthPassword = builder.formUriBasicAuthPassword();
Expand Down Expand Up @@ -320,13 +317,13 @@ public ACRAConfiguration setDropboxCollectionMinutes(int dropboxCollectionMinute
}

/**
* @param forceCloseDialogAfterToast the forceCloseDialogAfterToast to set
* @param forceCloseDialogAfterToast the alsoReportToAndroidFramework to set
* @return The updated ACRA configuration
* @deprecated since 4.8.1 - configure using {@link ConfigurationBuilder} instead. ACRAConfiguration will become immutable in the near future.
*/
@NonNull
public ACRAConfiguration setForceCloseDialogAfterToast(boolean forceCloseDialogAfterToast) {
this.forceCloseDialogAfterToast = forceCloseDialogAfterToast;
this.alsoReportToAndroidFramework = forceCloseDialogAfterToast;
return this;
}

Expand Down Expand Up @@ -830,8 +827,8 @@ public int dropboxCollectionMinutes() {
return dropboxCollectionMinutes;
}

public boolean forceCloseDialogAfterToast() {
return forceCloseDialogAfterToast;
public boolean alsoReportToAndroidFramework() {
return alsoReportToAndroidFramework;
}

@Nullable
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/org/acra/config/ConfigurationBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public final class ConfigurationBuilder {
private Boolean deleteUnapprovedReportsOnApplicationStart;
private Boolean deleteOldUnsentReportsOnApplicationStart;
private Integer dropboxCollectionMinutes;
private Boolean forceCloseDialogAfterToast;
private Boolean alsoReportToAndroidFramework;
private String formUri;
private String formUriBasicAuthLogin;
private String formUriBasicAuthPassword;
Expand Down Expand Up @@ -139,7 +139,7 @@ public ConfigurationBuilder(@NonNull Application app) {
deleteUnapprovedReportsOnApplicationStart = annotationConfig.deleteUnapprovedReportsOnApplicationStart();
deleteOldUnsentReportsOnApplicationStart = annotationConfig.deleteOldUnsentReportsOnApplicationStart();
dropboxCollectionMinutes = annotationConfig.dropboxCollectionMinutes();
forceCloseDialogAfterToast = annotationConfig.forceCloseDialogAfterToast();
alsoReportToAndroidFramework = annotationConfig.alsoReportToAndroidFramework();
formUri = annotationConfig.formUri();
formUriBasicAuthLogin = annotationConfig.formUriBasicAuthLogin();
formUriBasicAuthPassword = annotationConfig.formUriBasicAuthPassword();
Expand Down Expand Up @@ -291,12 +291,12 @@ public ConfigurationBuilder setDropboxCollectionMinutes(int dropboxCollectionMin
}

/**
* @param forceCloseDialogAfterToast the forceCloseDialogAfterToast to set
* @param alsoReportToAndroidFramework the alsoReportToAndroidFramework to set
* @return this instance
*/
@NonNull
public ConfigurationBuilder setForceCloseDialogAfterToast(boolean forceCloseDialogAfterToast) {
this.forceCloseDialogAfterToast = forceCloseDialogAfterToast;
public ConfigurationBuilder setAlsoReportToAndroidFramework(boolean alsoReportToAndroidFramework) {
this.alsoReportToAndroidFramework = alsoReportToAndroidFramework;
return this;
}

Expand Down Expand Up @@ -839,11 +839,11 @@ int dropboxCollectionMinutes() {
return DEFAULT_DROPBOX_COLLECTION_MINUTES;
}

boolean forceCloseDialogAfterToast() {
if (forceCloseDialogAfterToast != null) {
return forceCloseDialogAfterToast;
boolean alsoReportToAndroidFramework() {
if (alsoReportToAndroidFramework != null) {
return alsoReportToAndroidFramework;
}
return DEFAULT_FORCE_CLOSE_DIALOG_AFTER_TOAST;
return DEFAULT_REPORT_TO_ANDROID_FRAMEWORK;
}

@NonNull
Expand Down