Skip to content
Snippets Groups Projects
BriarApplication.java 1.56 KiB
Newer Older
  • Learn to ignore specific revisions
  • package org.briarproject.android;
    
    import android.app.Application;
    import android.content.Context;
    
    
    str4d's avatar
    str4d committed
    import org.acra.ACRA;
    import org.acra.ReportingInteractionMode;
    import org.acra.annotation.ReportsCrashes;
    
    str4d's avatar
    str4d committed
    import org.briarproject.R;
    import org.briarproject.android.util.BriarReportPrimer;
    
    import org.briarproject.android.util.BriarReportSenderFactory;
    
    import java.util.logging.Logger;
    
    
    str4d's avatar
    str4d committed
    @ReportsCrashes(
    		reportPrimerClass = BriarReportPrimer.class,
    		logcatArguments = {"-d", "-v", "time", "*:I"},
    
    		reportSenderFactoryClasses = {BriarReportSenderFactory.class},
    
    str4d's avatar
    str4d committed
    		mode = ReportingInteractionMode.DIALOG,
    
    str4d's avatar
    str4d committed
    		reportDialogClass = DevReportActivity.class,
    		resDialogOkToast = R.string.dev_report_saved,
    
    		deleteOldUnsentReportsOnApplicationStart = false
    
    str4d's avatar
    str4d committed
    )
    
    public class BriarApplication extends Application {
    
    	private static final Logger LOG =
    			Logger.getLogger(BriarApplication.class.getName());
    
    
    	private AndroidComponent applicationComponent;
    
    
    str4d's avatar
    str4d committed
    	@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))
    
    		// We need to load the eager singletons directly after making the
    		// dependency graphs
    
    		CoreModule.initEagerSingletons(applicationComponent);
    
    		AndroidEagerSingletons.initEagerSingletons(applicationComponent);
    
    	}
    
    	public AndroidComponent getApplicationComponent() {
    		return applicationComponent;