Search in sources :

Example 1 with FirebaseInstallationsApi

use of com.google.firebase.installations.FirebaseInstallationsApi in project firebase-android-sdk by firebase.

the class FirebaseAppDistributionRegistrar method buildFirebaseAppDistribution.

private FirebaseAppDistribution buildFirebaseAppDistribution(ComponentContainer container) {
    FirebaseApp firebaseApp = container.get(FirebaseApp.class);
    Context context = firebaseApp.getApplicationContext();
    Provider<FirebaseInstallationsApi> firebaseInstallationsApiProvider = container.getProvider(FirebaseInstallationsApi.class);
    SignInStorage signInStorage = new SignInStorage(context);
    FirebaseAppDistributionTesterApiClient testerApiClient = new FirebaseAppDistributionTesterApiClient(firebaseApp, firebaseInstallationsApiProvider, new TesterApiHttpClient(firebaseApp));
    FirebaseAppDistributionLifecycleNotifier lifecycleNotifier = FirebaseAppDistributionLifecycleNotifier.getInstance();
    ApkHashExtractor apkHashExtractor = new ApkHashExtractor(firebaseApp.getApplicationContext());
    FirebaseAppDistribution appDistribution = new FirebaseAppDistributionImpl(firebaseApp, new TesterSignInManager(firebaseApp, firebaseInstallationsApiProvider, signInStorage), new NewReleaseFetcher(firebaseApp.getApplicationContext(), testerApiClient, apkHashExtractor), new ApkUpdater(firebaseApp, new ApkInstaller()), new AabUpdater(), signInStorage, lifecycleNotifier);
    if (context instanceof Application) {
        Application firebaseApplication = (Application) context;
        firebaseApplication.registerActivityLifecycleCallbacks(lifecycleNotifier);
    } else {
        LogWrapper.getInstance().e(TAG + "Context " + context + " was not an Application, can't register for lifecycle callbacks. SDK might not" + " function correctly.");
    }
    return appDistribution;
}
Also used : Context(android.content.Context) FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi) Application(android.app.Application) FirebaseApp(com.google.firebase.FirebaseApp) FirebaseAppDistribution(com.google.firebase.appdistribution.FirebaseAppDistribution)

Example 2 with FirebaseInstallationsApi

use of com.google.firebase.installations.FirebaseInstallationsApi in project firebase-android-sdk by firebase.

the class IdManagerTest method createIdManager.

private IdManager createIdManager(String instanceId, DataCollectionArbiter arbiter) {
    FirebaseInstallationsApi iid = mock(FirebaseInstallationsApi.class);
    when(iid.getId()).thenReturn(Tasks.forResult(instanceId));
    return new IdManager(getContext(), getContext().getPackageName(), iid, arbiter);
}
Also used : FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi)

Example 3 with FirebaseInstallationsApi

use of com.google.firebase.installations.FirebaseInstallationsApi in project firebase-android-sdk by firebase.

the class FirebaseInAppMessagingRegistrar method providesFirebaseInAppMessaging.

private FirebaseInAppMessaging providesFirebaseInAppMessaging(ComponentContainer container) {
    FirebaseApp firebaseApp = container.get(FirebaseApp.class);
    FirebaseInstallationsApi firebaseInstallations = container.get(FirebaseInstallationsApi.class);
    Deferred<AnalyticsConnector> analyticsConnector = container.getDeferred(AnalyticsConnector.class);
    Subscriber firebaseEventsSubscriber = container.get(Subscriber.class);
    Application application = (Application) firebaseApp.getApplicationContext();
    UniversalComponent universalComponent = DaggerUniversalComponent.builder().applicationModule(new ApplicationModule(application)).appMeasurementModule(new AppMeasurementModule(analyticsConnector, firebaseEventsSubscriber)).analyticsEventsModule(new AnalyticsEventsModule()).programmaticContextualTriggerFlowableModule(new ProgrammaticContextualTriggerFlowableModule(new ProgramaticContextualTriggers())).build();
    AppComponent instance = DaggerAppComponent.builder().abtIntegrationHelper(new AbtIntegrationHelper(container.get(AbtComponent.class).get(FirebaseABTesting.OriginService.INAPP_MESSAGING))).apiClientModule(new ApiClientModule(firebaseApp, firebaseInstallations, universalComponent.clock())).grpcClientModule(new GrpcClientModule(firebaseApp)).universalComponent(universalComponent).transportFactory(container.get(TransportFactory.class)).build();
    return instance.providesFirebaseInAppMessaging();
}
Also used : ProgrammaticContextualTriggerFlowableModule(com.google.firebase.inappmessaging.internal.injection.modules.ProgrammaticContextualTriggerFlowableModule) ProgramaticContextualTriggers(com.google.firebase.inappmessaging.internal.ProgramaticContextualTriggers) AnalyticsEventsModule(com.google.firebase.inappmessaging.internal.injection.modules.AnalyticsEventsModule) AppMeasurementModule(com.google.firebase.inappmessaging.internal.injection.modules.AppMeasurementModule) ApiClientModule(com.google.firebase.inappmessaging.internal.injection.modules.ApiClientModule) GrpcClientModule(com.google.firebase.inappmessaging.internal.injection.modules.GrpcClientModule) AnalyticsConnector(com.google.firebase.analytics.connector.AnalyticsConnector) ApplicationModule(com.google.firebase.inappmessaging.internal.injection.modules.ApplicationModule) Subscriber(com.google.firebase.events.Subscriber) AppComponent(com.google.firebase.inappmessaging.internal.injection.components.AppComponent) DaggerAppComponent(com.google.firebase.inappmessaging.internal.injection.components.DaggerAppComponent) AbtIntegrationHelper(com.google.firebase.inappmessaging.internal.AbtIntegrationHelper) FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi) Application(android.app.Application) DaggerUniversalComponent(com.google.firebase.inappmessaging.internal.injection.components.DaggerUniversalComponent) UniversalComponent(com.google.firebase.inappmessaging.internal.injection.components.UniversalComponent) FirebaseApp(com.google.firebase.FirebaseApp)

Example 4 with FirebaseInstallationsApi

use of com.google.firebase.installations.FirebaseInstallationsApi in project firebase-android-sdk by firebase.

the class CLSUUIDTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    FirebaseInstallationsApi installationsApiMock = mock(FirebaseInstallationsApi.class);
    when(installationsApiMock.getId()).thenReturn(Tasks.forResult("instanceId"));
    idManager = new IdManager(getContext(), getContext().getPackageName(), installationsApiMock, DataCollectionArbiterTest.MOCK_ARBITER_ENABLED);
    uuid = new CLSUUID(idManager);
}
Also used : FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi)

Example 5 with FirebaseInstallationsApi

use of com.google.firebase.installations.FirebaseInstallationsApi in project firebase-android-sdk by firebase.

the class CrashlyticsControllerTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    testContext = getContext();
    FirebaseInstallationsApi installationsApiMock = mock(FirebaseInstallationsApi.class);
    when(installationsApiMock.getId()).thenReturn(Tasks.forResult("instanceId"));
    idManager = new IdManager(testContext, testContext.getPackageName(), installationsApiMock, DataCollectionArbiterTest.MOCK_ARBITER_ENABLED);
    testFileStore = new FileStore(testContext);
    Settings testSettings = new TestSettings(3);
    mockSessionReportingCoordinator = mock(SessionReportingCoordinator.class);
    mockDataCollectionArbiter = mock(DataCollectionArbiter.class);
    when(mockDataCollectionArbiter.isAutomaticDataCollectionEnabled()).thenReturn(true);
    testSettingsProvider = mock(SettingsProvider.class);
    when(testSettingsProvider.getSettingsSync()).thenReturn(testSettings);
    when(testSettingsProvider.getSettingsAsync()).thenReturn(Tasks.forResult(testSettings));
}
Also used : SettingsProvider(com.google.firebase.crashlytics.internal.settings.SettingsProvider) FileStore(com.google.firebase.crashlytics.internal.persistence.FileStore) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) FirebaseInstallationsApi(com.google.firebase.installations.FirebaseInstallationsApi) TestSettings(com.google.firebase.crashlytics.internal.settings.TestSettings) Settings(com.google.firebase.crashlytics.internal.settings.Settings)

Aggregations

FirebaseInstallationsApi (com.google.firebase.installations.FirebaseInstallationsApi)7 FirebaseApp (com.google.firebase.FirebaseApp)3 Application (android.app.Application)2 AnalyticsConnector (com.google.firebase.analytics.connector.AnalyticsConnector)2 Context (android.content.Context)1 FirebaseAppDistribution (com.google.firebase.appdistribution.FirebaseAppDistribution)1 CrashlyticsNativeComponent (com.google.firebase.crashlytics.internal.CrashlyticsNativeComponent)1 FileStore (com.google.firebase.crashlytics.internal.persistence.FileStore)1 Settings (com.google.firebase.crashlytics.internal.settings.Settings)1 SettingsProvider (com.google.firebase.crashlytics.internal.settings.SettingsProvider)1 TestSettings (com.google.firebase.crashlytics.internal.settings.TestSettings)1 Subscriber (com.google.firebase.events.Subscriber)1 AbtIntegrationHelper (com.google.firebase.inappmessaging.internal.AbtIntegrationHelper)1 ProgramaticContextualTriggers (com.google.firebase.inappmessaging.internal.ProgramaticContextualTriggers)1 AppComponent (com.google.firebase.inappmessaging.internal.injection.components.AppComponent)1 DaggerAppComponent (com.google.firebase.inappmessaging.internal.injection.components.DaggerAppComponent)1 DaggerUniversalComponent (com.google.firebase.inappmessaging.internal.injection.components.DaggerUniversalComponent)1 UniversalComponent (com.google.firebase.inappmessaging.internal.injection.components.UniversalComponent)1 AnalyticsEventsModule (com.google.firebase.inappmessaging.internal.injection.modules.AnalyticsEventsModule)1 ApiClientModule (com.google.firebase.inappmessaging.internal.injection.modules.ApiClientModule)1