protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app) { const string clientName = "Giskard"; var packageInfo = ApplicationContext.PackageManager.GetPackageInfo(ApplicationContext.PackageName, 0); var version = packageInfo.VersionName; var sharedPreferences = ApplicationContext.GetSharedPreferences(clientName, FileCreationMode.Private); var database = new Database(); var scheduler = Scheduler.Default; var timeService = new TimeService(scheduler); var suggestionProviderContainer = new SuggestionProviderContainer( new MostUsedTimeEntrySuggestionProvider(database, timeService, maxNumberOfSuggestions) ); var appVersion = Version.Parse(version); var userAgent = new UserAgent(clientName, version); var mailService = new MailService(ApplicationContext); var dialogService = new DialogService(); var platformConstants = new PlatformConstants(); var keyValueStorage = new SharedPreferencesStorage(sharedPreferences); var settingsStorage = new SettingsStorage(appVersion, keyValueStorage); var feedbackService = new FeedbackService(userAgent, mailService, dialogService, platformConstants); var schedulerProvider = new AndroidSchedulerProvider(); var foundation = TogglFoundation .ForClient(userAgent, appVersion) .WithDatabase(database) .WithScheduler(scheduler) .WithTimeService(timeService) .WithMailService(mailService) .WithApiEnvironment(environment) .WithGoogleService <GoogleService>() .WithRatingService <RatingService>() .WithLicenseProvider <LicenseProvider>() .WithAnalyticsService(analyticsService) .WithSchedulerProvider(schedulerProvider) .WithPlatformConstants(platformConstants) .WithRemoteConfigService <RemoteConfigService>() .WithApiFactory(new ApiFactory(environment, userAgent)) .WithBackgroundService(new BackgroundService(timeService)) .WithSuggestionProviderContainer(suggestionProviderContainer) .WithApplicationShortcutCreator(new ApplicationShortcutCreator(ApplicationContext)) .StartRegisteringPlatformServices() .WithDialogService(dialogService) .WithFeedbackService(feedbackService) .WithLastTimeUsageStorage(settingsStorage) .WithBrowserService <BrowserService>() .WithKeyValueStorage(keyValueStorage) .WithUserPreferences(settingsStorage) .WithOnboardingStorage(settingsStorage) .WithNavigationService(navigationService) .WithAccessRestrictionStorage(settingsStorage) .WithErrorHandlingService(new ErrorHandlingService(navigationService, settingsStorage)) .Build(); foundation.RevokeNewUserIfNeeded().Initialize(); base.InitializeApp(pluginManager, app); }
protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app) { const string clientName = "Giskard"; var packageInfo = ApplicationContext.PackageManager.GetPackageInfo(ApplicationContext.PackageName, 0); var version = packageInfo.VersionName; var sharedPreferences = ApplicationContext.GetSharedPreferences(clientName, FileCreationMode.Private); var database = new Database(); var scheduler = Scheduler.Default; var timeService = new TimeService(scheduler); var backgroundService = new BackgroundService(timeService, analyticsService); var suggestionProviderContainer = new SuggestionProviderContainer( new MostUsedTimeEntrySuggestionProvider(database, timeService, maxNumberOfSuggestions) ); var appVersion = Version.Parse(version); var userAgent = new UserAgent(clientName, version); var dialogService = new DialogServiceAndroid(); var platformInfo = new PlatformInfoAndroid(); var keyValueStorage = new SharedPreferencesStorageAndroid(sharedPreferences); var settingsStorage = new SettingsStorage(appVersion, keyValueStorage); var schedulerProvider = new AndroidSchedulerProvider(); var permissionsService = new PermissionsServiceAndroid(); var calendarService = new CalendarServiceAndroid(permissionsService); var automaticSyncingService = new AutomaticSyncingService(backgroundService, timeService); var errorHandlingService = new ErrorHandlingService(navigationService, settingsStorage); ApplicationContext.RegisterReceiver(new TimezoneChangedBroadcastReceiver(timeService), new IntentFilter(Intent.ActionTimezoneChanged)); var dataSource = new TogglDataSource( database, timeService, analyticsService); var foundation = TogglFoundation .ForClient(userAgent, appVersion) .WithDatabase(database) .WithDataSource(dataSource) .WithScheduler(scheduler) .WithTimeService(timeService) .WithApiEnvironment(environment) .WithGoogleService <GoogleServiceAndroid>() .WithRatingService(new RatingServiceAndroid(ApplicationContext)) .WithLicenseProvider <LicenseProviderAndroid>() .WithAnalyticsService(analyticsService) .WithSchedulerProvider(schedulerProvider) .WithPlatformInfo(platformInfo) .WithNotificationService <NotificationServiceAndroid>() .WithRemoteConfigService <RemoteConfigServiceAndroid>() .WithApiFactory(new ApiFactory(environment, userAgent)) .WithBackgroundService(backgroundService) .WithAutomaticSyncingService(automaticSyncingService) .WithSuggestionProviderContainer(suggestionProviderContainer) .WithApplicationShortcutCreator(new ApplicationShortcutCreator(ApplicationContext)) .WithStopwatchProvider <FirebaseStopwatchProviderAndroid>() .WithIntentDonationService(new NoopIntentDonationServiceAndroid()) .WithPrivateSharedStorageService(new NoopPrivateSharedStorageServiceAndroid()) .WithBackgroundSyncService <BackgroundSyncServiceAndroid>() .StartRegisteringPlatformServices() .WithDialogService(dialogService) .WithLastTimeUsageStorage(settingsStorage) .WithBrowserService <BrowserServiceAndroid>() .WithCalendarService(calendarService) .WithKeyValueStorage(keyValueStorage) .WithUserPreferences(settingsStorage) .WithOnboardingStorage(settingsStorage) .WithNavigationService(navigationService) .WithPermissionsService(permissionsService) .WithAccessRestrictionStorage(settingsStorage) .WithErrorHandlingService(errorHandlingService) .WithSyncErrorHandlingService(new SyncErrorHandlingService(errorHandlingService)) .WithRxActionFactory(new RxActionFactory(schedulerProvider)) .Build(); foundation.RevokeNewUserIfNeeded().Initialize(); ensureDataSourceInitializationIfLoggedIn(); createApplicationLifecycleObserver(backgroundService); base.InitializeApp(pluginManager, app); }