Search in sources :

Example 1 with EdxDefaultModule

use of org.edx.mobile.core.EdxDefaultModule in project edx-app-android by edx.

the class BaseTestCase method glueInjections.

private void glueInjections() throws Exception {
    addBindings();
    if (!module.isEmpty()) {
        Injector injector = RoboGuice.getOrCreateBaseApplicationInjector(RuntimeEnvironment.application, RoboGuice.DEFAULT_STAGE, (Module) RoboGuice.newDefaultRoboModule(RuntimeEnvironment.application), Modules.override(new EdxDefaultModule(context)).with(module));
        inject(injector);
    }
}
Also used : Injector(com.google.inject.Injector) EdxDefaultModule(org.edx.mobile.core.EdxDefaultModule)

Example 2 with EdxDefaultModule

use of org.edx.mobile.core.EdxDefaultModule in project edx-app-android by edx.

the class MainApplication method init.

/**
 * Initializes the request manager, image cache,
 * all third party integrations and shared components.
 */
private void init() {
    application = this;
    injector = RoboGuice.getOrCreateBaseApplicationInjector((Application) this, RoboGuice.DEFAULT_STAGE, (Module) RoboGuice.newDefaultRoboModule(this), (Module) new EdxDefaultModule(this));
    injector.injectMembers(this);
    // initialize Fabric
    if (config.getFabricConfig().isEnabled() && !BuildConfig.DEBUG) {
        Fabric.with(this, config.getFabricConfig().getKitsConfig().getEnabledKits());
        if (config.getFabricConfig().getKitsConfig().isCrashlyticsEnabled()) {
            EventBus.getDefault().register(new CrashlyticsCrashReportObserver());
        }
        if (config.getFabricConfig().getKitsConfig().isAnswersEnabled()) {
            analyticsRegistry.addAnalyticsProvider(injector.getInstance(AnswersAnalytics.class));
        }
    }
    if (config.getNewRelicConfig().isEnabled()) {
        EventBus.getDefault().register(new NewRelicObserver());
    }
    // initialize NewRelic with crash reporting disabled
    if (config.getNewRelicConfig().isEnabled()) {
        // Crash reporting for new relic has been disabled
        NewRelic.withApplicationToken(config.getNewRelicConfig().getNewRelicKey()).withCrashReportingEnabled(false).start(this);
    }
    // Add Segment as an analytics provider if enabled in the config
    if (config.getSegmentConfig().isEnabled()) {
        analyticsRegistry.addAnalyticsProvider(injector.getInstance(SegmentAnalytics.class));
    }
    // Add Firebase as an analytics provider if enabled in the config
    if (config.isFirebaseEnabled()) {
        analyticsRegistry.addAnalyticsProvider(injector.getInstance(FirebaseAnalytics.class));
    }
    registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
    registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
    // initialize Facebook SDK
    boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext(), config);
    if (!isOnZeroRatedNetwork && config.getFacebookConfig().isEnabled()) {
        com.facebook.Settings.setApplicationId(config.getFacebookConfig().getFacebookAppId());
    }
    checkIfAppVersionUpgraded(this);
    // Register Font Awesome module in android-iconify library
    Iconify.with(new FontAwesomeModule());
    CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/OpenSans-Regular.ttf").setFontAttrId(R.attr.fontPath).build());
    // Init Branch
    if (Config.FabricBranchConfig.isBranchEnabled(config.getFabricConfig())) {
        Branch.getAutoInstance(this);
    }
}
Also used : IntentFilter(android.content.IntentFilter) EdxDefaultModule(org.edx.mobile.core.EdxDefaultModule) FirebaseAnalytics(org.edx.mobile.module.analytics.FirebaseAnalytics) FontAwesomeModule(com.joanzapata.iconify.fonts.FontAwesomeModule) Module(com.google.inject.Module) FontAwesomeModule(com.joanzapata.iconify.fonts.FontAwesomeModule) EdxDefaultModule(org.edx.mobile.core.EdxDefaultModule) MultiDexApplication(android.support.multidex.MultiDexApplication) Application(android.app.Application) AnswersAnalytics(org.edx.mobile.module.analytics.AnswersAnalytics) SegmentAnalytics(org.edx.mobile.module.analytics.SegmentAnalytics) NetworkConnectivityReceiver(org.edx.mobile.receivers.NetworkConnectivityReceiver)

Aggregations

EdxDefaultModule (org.edx.mobile.core.EdxDefaultModule)2 Application (android.app.Application)1 IntentFilter (android.content.IntentFilter)1 MultiDexApplication (android.support.multidex.MultiDexApplication)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1 FontAwesomeModule (com.joanzapata.iconify.fonts.FontAwesomeModule)1 AnswersAnalytics (org.edx.mobile.module.analytics.AnswersAnalytics)1 FirebaseAnalytics (org.edx.mobile.module.analytics.FirebaseAnalytics)1 SegmentAnalytics (org.edx.mobile.module.analytics.SegmentAnalytics)1 NetworkConnectivityReceiver (org.edx.mobile.receivers.NetworkConnectivityReceiver)1