public BackgroundService(ITimeService timeService, IAnalyticsService analyticsService, IUpdateRemoteConfigCacheService updateRemoteConfigCacheService)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(updateRemoteConfigCacheService, nameof(updateRemoteConfigCacheService));

            this.timeService      = timeService;
            this.analyticsService = analyticsService;
            this.updateRemoteConfigCacheService = updateRemoteConfigCacheService;

            appBecameActiveSubject = new Subject <TimeSpan>();
            lastEnteredBackground  = null;

            AppResumedFromBackground = appBecameActiveSubject.AsObservable();
            AppIsInBackground        = false;
        }
        public RatingViewExperiment(
            ITimeService timeService,
            ITogglDataSource dataSource,
            IOnboardingStorage onboardingStorage,
            IRemoteConfigService remoteConfigService,
            IUpdateRemoteConfigCacheService updateRemoteConfigCacheService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(updateRemoteConfigCacheService, nameof(updateRemoteConfigCacheService));

            this.dataSource                     = dataSource;
            this.timeService                    = timeService;
            this.onboardingStorage              = onboardingStorage;
            this.remoteConfigService            = remoteConfigService;
            this.updateRemoteConfigCacheService = updateRemoteConfigCacheService;
        }
 public BackgroundServiceTest()
 {
     TimeService      = Substitute.For <ITimeService>();
     AnalyticsService = Substitute.For <IAnalyticsService>();
     UpdateRemoteConfigCacheService = Substitute.For <IUpdateRemoteConfigCacheService>();
 }
        public MainTabBarViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            ISyncManager syncManager,
            IRatingService ratingService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IBackgroundService backgroundService,
            IInteractorFactory interactorFactory,
            IOnboardingStorage onboardingStorage,
            ISchedulerProvider schedulerProvider,
            IPermissionsChecker permissionsChecker,
            INavigationService navigationService,
            IRemoteConfigService remoteConfigService,
            IAccessibilityService accessibilityService,
            IUpdateRemoteConfigCacheService updateRemoteConfigCacheService,
            IAccessRestrictionStorage accessRestrictionStorage,
            IRxActionFactory rxActionFactory,
            IUserAccessManager userAccessManager,
            IPrivateSharedStorageService privateSharedStorageService,
            IPlatformInfo platformInfo)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(ratingService, nameof(ratingService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(accessibilityService, nameof(accessibilityService));
            Ensure.Argument.IsNotNull(updateRemoteConfigCacheService, nameof(updateRemoteConfigCacheService));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));

            this.remoteConfigService = remoteConfigService;
            this.platformInfo        = platformInfo;

            mainViewModel = new MainViewModel(
                dataSource,
                syncManager,
                timeService,
                ratingService,
                userPreferences,
                analyticsService,
                onboardingStorage,
                interactorFactory,
                navigationService,
                remoteConfigService,
                accessibilityService,
                updateRemoteConfigCacheService,
                accessRestrictionStorage,
                schedulerProvider,
                rxActionFactory,
                permissionsChecker,
                backgroundService,
                platformInfo);

            reportsViewModel = new ReportsViewModel(
                dataSource,
                timeService,
                navigationService,
                interactorFactory,
                analyticsService,
                schedulerProvider,
                rxActionFactory);

            calendarViewModel = new CalendarViewModel(
                dataSource,
                timeService,
                userPreferences,
                analyticsService,
                backgroundService,
                interactorFactory,
                onboardingStorage,
                schedulerProvider,
                permissionsChecker,
                navigationService,
                rxActionFactory);

            settingsViewModel = new SettingsViewModel(
                dataSource,
                syncManager,
                platformInfo,
                userPreferences,
                analyticsService,
                interactorFactory,
                onboardingStorage,
                navigationService,
                rxActionFactory,
                permissionsChecker,
                schedulerProvider);

            Tabs = getViewModels().ToList();
        }
Exemple #5
0
        public MainViewModel(
            ITogglDataSource dataSource,
            ISyncManager syncManager,
            ITimeService timeService,
            IRatingService ratingService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IRemoteConfigService remoteConfigService,
            IAccessibilityService accessibilityService,
            IUpdateRemoteConfigCacheService updateRemoteConfigCacheService,
            IAccessRestrictionStorage accessRestrictionStorage,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            IPermissionsChecker permissionsChecker,
            IBackgroundService backgroundService,
            IPlatformInfo platformInfo,
            IWidgetsService widgetsService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(ratingService, nameof(ratingService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(accessibilityService, nameof(accessibilityService));
            Ensure.Argument.IsNotNull(updateRemoteConfigCacheService, nameof(updateRemoteConfigCacheService));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(widgetsService, nameof(widgetsService));

            this.dataSource               = dataSource;
            this.syncManager              = syncManager;
            this.platformInfo             = platformInfo;
            this.userPreferences          = userPreferences;
            this.rxActionFactory          = rxActionFactory;
            this.analyticsService         = analyticsService;
            this.interactorFactory        = interactorFactory;
            this.schedulerProvider        = schedulerProvider;
            this.accessibilityService     = accessibilityService;
            this.accessRestrictionStorage = accessRestrictionStorage;
            this.widgetsService           = widgetsService;

            TimeService       = timeService;
            OnboardingStorage = onboardingStorage;

            SuggestionsViewModel = new SuggestionsViewModel(interactorFactory, OnboardingStorage, schedulerProvider, rxActionFactory, analyticsService, timeService, permissionsChecker, navigationService, backgroundService, userPreferences, syncManager, widgetsService);
            RatingViewModel      = new RatingViewModel(timeService, ratingService, analyticsService, OnboardingStorage, navigationService, schedulerProvider, rxActionFactory);
            TimeEntriesViewModel = new TimeEntriesViewModel(dataSource, interactorFactory, analyticsService, schedulerProvider, rxActionFactory, timeService);

            TimeEntries = TimeEntriesViewModel.TimeEntries
                          .Throttle(TimeSpan.FromSeconds(throttlePeriodInSeconds))
                          .AsDriver(ImmutableList <MainLogSection> .Empty, schedulerProvider);

            LogEmpty         = TimeEntriesViewModel.Empty.AsDriver(schedulerProvider);
            TimeEntriesCount = TimeEntriesViewModel.Count.AsDriver(schedulerProvider);

            ratingViewExperiment = new RatingViewExperiment(timeService, dataSource, onboardingStorage, remoteConfigService, updateRemoteConfigCacheService);

            SwipeActionsEnabled = userPreferences.SwipeActionsEnabled.AsDriver(schedulerProvider);
        }