2015-09-24 11:27:43 -04:00
|
|
|
package eu.kanade.mangafeed;
|
|
|
|
|
|
|
|
import android.app.Application;
|
|
|
|
import android.content.Context;
|
|
|
|
|
2015-10-05 06:47:10 -04:00
|
|
|
import org.acra.annotation.ReportsCrashes;
|
|
|
|
|
2015-10-21 15:04:10 -04:00
|
|
|
import eu.kanade.mangafeed.injection.ComponentReflectionInjector;
|
2015-10-22 19:40:27 -04:00
|
|
|
import eu.kanade.mangafeed.injection.component.AppComponent;
|
2015-10-21 15:04:10 -04:00
|
|
|
import eu.kanade.mangafeed.injection.component.DaggerAppComponent;
|
2015-10-22 19:40:27 -04:00
|
|
|
import eu.kanade.mangafeed.injection.module.AppModule;
|
2015-09-24 11:27:43 -04:00
|
|
|
import timber.log.Timber;
|
|
|
|
|
2015-10-05 06:47:10 -04:00
|
|
|
@ReportsCrashes(
|
|
|
|
formUri = "http://couch.kanade.eu/acra-manga/_design/acra-storage/_update/report",
|
|
|
|
reportType = org.acra.sender.HttpSender.Type.JSON,
|
|
|
|
httpMethod = org.acra.sender.HttpSender.Method.PUT,
|
|
|
|
formUriBasicAuthLogin="test",
|
|
|
|
formUriBasicAuthPassword="test"
|
|
|
|
)
|
2015-09-24 11:27:43 -04:00
|
|
|
public class App extends Application {
|
|
|
|
|
|
|
|
AppComponent mApplicationComponent;
|
2015-10-16 13:31:18 -04:00
|
|
|
ComponentReflectionInjector<AppComponent> mComponentInjector;
|
2015-09-24 11:27:43 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onCreate() {
|
|
|
|
super.onCreate();
|
|
|
|
if (BuildConfig.DEBUG) Timber.plant(new Timber.DebugTree());
|
|
|
|
|
|
|
|
mApplicationComponent = DaggerAppComponent.builder()
|
|
|
|
.appModule(new AppModule(this))
|
|
|
|
.build();
|
2015-10-05 06:47:10 -04:00
|
|
|
|
2015-10-16 13:31:18 -04:00
|
|
|
mComponentInjector =
|
|
|
|
new ComponentReflectionInjector<>(AppComponent.class, mApplicationComponent);
|
|
|
|
|
2015-10-06 13:44:30 -04:00
|
|
|
//ACRA.init(this);
|
2015-09-24 11:27:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public static App get(Context context) {
|
|
|
|
return (App) context.getApplicationContext();
|
|
|
|
}
|
|
|
|
|
|
|
|
public AppComponent getComponent() {
|
|
|
|
return mApplicationComponent;
|
|
|
|
}
|
|
|
|
|
2015-10-16 13:31:18 -04:00
|
|
|
public ComponentReflectionInjector<AppComponent> getComponentReflection() {
|
|
|
|
return mComponentInjector;
|
|
|
|
}
|
|
|
|
|
2015-09-24 11:27:43 -04:00
|
|
|
// Needed to replace the component with a test specific one
|
|
|
|
public void setComponent(AppComponent applicationComponent) {
|
|
|
|
mApplicationComponent = applicationComponent;
|
|
|
|
}
|
|
|
|
}
|