use of com.google.firebase.inappmessaging.internal.injection.modules.AppMeasurementModule in project firebase-android-sdk by firebase.
the class FirebaseInAppMessagingFlowableTest method setUp.
@Before
public void setUp() {
initMocks(this);
callbacksHashMap = new HashMap<>();
clearProtoDiskCache(InstrumentationRegistry.getTargetContext());
application = spy((Application) InstrumentationRegistry.getTargetContext().getApplicationContext());
when(firebaseInstallations.getId()).thenReturn(Tasks.forResult(INSTALLATION_ID));
when(firebaseInstallations.getToken(false)).thenReturn(Tasks.forResult(INSTALLATION_TOKEN_RESULT));
when(testDeviceHelper.isAppInstallFresh()).thenReturn(false);
when(testDeviceHelper.isDeviceInTestMode()).thenReturn(false);
if (Looper.myLooper() == null) {
Looper.prepare();
}
foregroundNotifier = new TestForegroundNotifier();
universalComponentBuilder = DaggerTestUniversalComponent.builder().testGrpcModule(new TestGrpcModule(grpcServerRule.getChannel())).testForegroundFlowableModule(new TestForegroundFlowableModule(foregroundNotifier)).applicationModule(new ApplicationModule(application)).appMeasurementModule(new AppMeasurementModule(p -> p.handle(() -> analyticsConnector), firebaseEventSubscriber)).testSystemClockModule(new TestSystemClockModule(NOW)).programmaticContextualTriggerFlowableModule(new ProgrammaticContextualTriggerFlowableModule(new ProgramaticContextualTriggers()));
TestUniversalComponent universalComponent = universalComponentBuilder.build();
appComponentBuilder = DaggerTestAppComponent.builder().universalComponent(universalComponent).testAbTestingModule(new TestAbTestingModule(abtIntegrationHelper)).testEngagementMetricsLoggerClientModule(new TestEngagementMetricsLoggerClientModule(app, engagementMetricsLoggerInterface)).grpcClientModule(new GrpcClientModule(app)).testApiClientModule(new TestApiClientModule(app, firebaseInstallations, testDeviceHelper, universalComponent.clock()));
TestAppComponent appComponent = appComponentBuilder.build();
instance = appComponent.providesFirebaseInAppMessaging();
displayCallbacksFactory = appComponent.displayCallbacksFactory();
programaticContextualTriggers = universalComponent.programmaticContextualTriggers();
grpcServerRule.getServiceRegistry().addService(new GoodFiamService(eligibleCampaigns));
subscriber = listenerToFlowable(instance);
}
use of com.google.firebase.inappmessaging.internal.injection.modules.AppMeasurementModule 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();
}
Aggregations