This commit is contained in:
Ernir Erlingsson
2016-05-06 11:01:59 +02:00
parent f855c9ea28
commit 64d1e25ad7
25 changed files with 132 additions and 1615 deletions

View File

@@ -1,56 +1,10 @@
package org.briarproject.android;
import android.app.Application;
import android.content.Context;
/**
* This exists so that the Application object will not necessarily be cast
* directly to the Briar application object.
*/
public interface BriarApplication {
import org.acra.ACRA;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.briarproject.CoreModule;
import org.briarproject.R;
import org.briarproject.android.util.BriarReportPrimer;
import org.briarproject.android.util.BriarReportSenderFactory;
import java.util.logging.Logger;
@ReportsCrashes(
reportPrimerClass = BriarReportPrimer.class,
logcatArguments = {"-d", "-v", "time", "*:I"},
reportSenderFactoryClasses = {BriarReportSenderFactory.class},
mode = ReportingInteractionMode.DIALOG,
reportDialogClass = DevReportActivity.class,
resDialogOkToast = R.string.dev_report_saved,
deleteOldUnsentReportsOnApplicationStart = false
)
public class BriarApplication extends Application {
private static final Logger LOG =
Logger.getLogger(BriarApplication.class.getName());
private AndroidComponent applicationComponent;
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(this);
}
@Override
public void onCreate() {
super.onCreate();
LOG.info("Created");
applicationComponent = DaggerAndroidComponent.builder()
.appModule(new AppModule(this))
.build();
// We need to load the eager singletons directly after making the
// dependency graphs
CoreModule.initEagerSingletons(applicationComponent);
AndroidEagerSingletons.initEagerSingletons(applicationComponent);
}
public AndroidComponent getApplicationComponent() {
return applicationComponent;
}
AndroidComponent getApplicationComponent();
}