Пример #1
0
        public SelectProjectViewModel(
            ITogglDataSource dataSource,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider,
            IStopwatchProvider stopwatchProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));

            this.dataSource        = dataSource;
            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.schedulerProvider = schedulerProvider;
            this.stopwatchProvider = stopwatchProvider;

            CloseCommand                 = new MvxAsyncCommand(close);
            CreateProjectCommand         = new MvxAsyncCommand(createProject);
            SelectProjectCommand         = new MvxAsyncCommand <AutocompleteSuggestion>(selectProject);
            ToggleTaskSuggestionsCommand = new MvxCommand <ProjectSuggestion>(toggleTaskSuggestions);
        }
Пример #2
0
        public ProjectDefaultsToBillableInteractor(IInteractorFactory interactorFactory, long projectId)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.projectId         = projectId;
            this.interactorFactory = interactorFactory;
        }
Пример #3
0
        public SendFeedbackViewModel(
            INavigationService navigationService,
            IInteractorFactory interactorFactory,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;

            IsFeedbackEmpty = isEmptyObservable.DistinctUntilChanged().AsDriver(schedulerProvider);
            SendEnabled     = sendingIsEnabledObservable.DistinctUntilChanged().AsDriver(schedulerProvider);

            Close        = rxActionFactory.FromObservable(cancel);
            DismissError = rxActionFactory.FromAction(dismissError);
            Send         = rxActionFactory.FromObservable(sendFeedback, sendingIsEnabledObservable);

            IsLoading = isLoadingSubject.AsDriver(false, schedulerProvider);
            Error     = currentErrorSubject.AsDriver(default(Exception), schedulerProvider);
        }
        public SendFeedbackViewModel(
            IMvxNavigationService navigationService,
            IInteractorFactory interactorFactory,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;

            IsFeedbackEmpty = isEmptyObservable.DistinctUntilChanged().AsDriver(schedulerProvider);
            SendEnabled     = sendingIsEnabledObservable.DistinctUntilChanged().AsDriver(schedulerProvider);

            CloseButtonTapped = new UIAction(cancel);
            ErrorViewTapped   = new UIAction(dismissError);
            SendButtonTapped  = new UIAction(sendFeedback, sendingIsEnabledObservable);

            ErrorViewVisible = errorViewVisibleSubject.AsDriver(true, schedulerProvider);
            IsLoading        = isLoadingSubject.AsDriver(false, schedulerProvider);
        }
Пример #5
0
        public SelectProjectViewModel(
            ITogglDataSource dataSource,
            IRxActionFactory rxActionFactory,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IDialogService dialogService,
            ISchedulerProvider schedulerProvider,
            IStopwatchProvider stopwatchProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));

            this.dataSource        = dataSource;
            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.schedulerProvider = schedulerProvider;
            this.stopwatchProvider = stopwatchProvider;

            Close = rxActionFactory.FromAsync(close);
            ToggleTaskSuggestions = rxActionFactory.FromAction <ProjectSuggestion>(toggleTaskSuggestions);
            SelectProject         = rxActionFactory.FromAsync <AutocompleteSuggestion>(selectProject);

            IsEmpty         = dataSource.Projects.GetAll().Select(projects => projects.None());
            PlaceholderText = IsEmpty.Select(isEmpty => isEmpty ? Resources.EnterProject : Resources.AddFilterProjects);
        }
Пример #6
0
        public SendFeedbackInteractor(
            IFeedbackApi feedbackApi,
            ISingletonDataSource <IThreadSafeUser> userDataSource,
            IDataSource <IThreadSafeWorkspace, IDatabaseWorkspace> workspacesDataSource,
            IDataSource <IThreadSafeTimeEntry, IDatabaseTimeEntry> timeEntriesDataSource,
            IPlatformInfo platformInfo,
            IUserPreferences userPreferences,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            IInteractorFactory interactorFactory,
            string message)
        {
            Ensure.Argument.IsNotNull(message, nameof(message));
            Ensure.Argument.IsNotNull(feedbackApi, nameof(feedbackApi));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(userDataSource, nameof(userDataSource));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(workspacesDataSource, nameof(workspacesDataSource));
            Ensure.Argument.IsNotNull(timeEntriesDataSource, nameof(timeEntriesDataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.message               = message;
            this.feedbackApi           = feedbackApi;
            this.timeService           = timeService;
            this.platformInfo          = platformInfo;
            this.userDataSource        = userDataSource;
            this.userPreferences       = userPreferences;
            this.workspacesDataSource  = workspacesDataSource;
            this.timeEntriesDataSource = timeEntriesDataSource;
            this.lastTimeUsageStorage  = lastTimeUsageStorage;
            this.interactorFactory     = interactorFactory;
        }
Пример #7
0
        public NoWorkspaceViewModel(
            ISyncManager syncManager,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IAccessRestrictionStorage accessRestrictionStorage,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.syncManager = syncManager;
            this.accessRestrictionStorage = accessRestrictionStorage;
            this.interactorFactory        = interactorFactory;
            this.rxActionFactory          = rxActionFactory;

            CreateWorkspaceWithDefaultName = rxActionFactory.FromObservable(createWorkspaceWithDefaultName);
            TryAgain  = rxActionFactory.FromAsync(tryAgain);
            IsLoading = Observable.CombineLatest(
                CreateWorkspaceWithDefaultName.Executing,
                TryAgain.Executing,
                CommonFunctions.Or);
        }
Пример #8
0
        public SiriShortcutsSelectReportPeriodViewModel(
            ITogglDataSource dataSource,
            IInteractorFactory interactorFactory,
            IRxActionFactory rxActionFactory,
            ISchedulerProvider schedulerProvider,
            INavigationService navigationService) : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.interactorFactory = interactorFactory;

            PickWorkspace = rxActionFactory.FromAsync(pickWorkspace);

            var reportPeriods = Enum.GetValues(typeof(ReportPeriod))
                                .Cast <ReportPeriod>()
                                .Where(p => p != ReportPeriod.Unknown)
                                .ToImmutableList();

            ReportPeriods = SelectReportPeriod
                            .Select(selectedPeriod => reportPeriods.Select(p => new SelectableReportPeriodViewModel(p, p == selectedPeriod)).ToImmutableList())
                            .AsDriver(ImmutableList <SelectableReportPeriodViewModel> .Empty, schedulerProvider);

            WorkspaceName = SelectedWorkspace
                            .Where(ws => ws != null)
                            .Select(workspace => workspace.Name)
                            .AsDriver(schedulerProvider);
        }
Пример #9
0
        public SyncFailuresViewModel(IInteractorFactory interactorFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.interactorFactory = interactorFactory;
        }
Пример #10
0
        public TimeEntriesLogViewModel(ITimeService timeService,
                                       ITogglDataSource dataSource,
                                       IInteractorFactory interactorFactory,
                                       IOnboardingStorage onboardingStorage,
                                       IAnalyticsService analyticsService,
                                       IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.onboardingStorage = onboardingStorage;
            this.analyticsService  = analyticsService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;

            EditCommand              = new MvxAsyncCommand <TimeEntryViewModel>(edit);
            DeleteCommand            = new MvxAsyncCommand <TimeEntryViewModel>(delete);
            ContinueTimeEntryCommand = new MvxAsyncCommand <TimeEntryViewModel>(continueTimeEntry, _ => areContineButtonsEnabled);
        }
        protected SelectUserCalendarsViewModelBase(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory,
            IOnboardingStorage onboardingStorage,
            IAnalyticsService analyticsService,
            INavigationService navigationService,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            UserPreferences        = userPreferences;
            this.interactorFactory = interactorFactory;
            OnboardingStorage      = onboardingStorage;
            AnalyticsService       = analyticsService;

            Save           = rxActionFactory.FromAction(Done, doneEnabledSubject.AsObservable());
            SelectCalendar = rxActionFactory.FromAction <SelectableUserCalendarViewModel>(toggleCalendarSelection);

            Calendars = calendarsSubject.AsObservable().DistinctUntilChanged();
        }
Пример #12
0
        public TimeEntriesViewModel(ITogglDataSource dataSource,
                                    IInteractorFactory interactorFactory,
                                    IAnalyticsService analyticsService,
                                    ISchedulerProvider schedulerProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.dataSource        = dataSource;
            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;

            TimeEntries = new ObservableGroupedOrderedCollection <TimeEntryViewModel>(
                indexKey: t => t.Id,
                orderingKey: t => t.StartTime,
                groupingKey: t => t.StartTime.LocalDateTime.Date,
                descending: true
                );

            DelayDeleteTimeEntry  = new InputAction <TimeEntryViewModel>(delayDeleteTimeEntry);
            CancelDeleteTimeEntry = new UIAction(cancelDeleteTimeEntry);
        }
Пример #13
0
        public LogoutInteractor(
            IAnalyticsService analyticsService,
            INotificationService notificationService,
            IApplicationShortcutCreator shortcutCreator,
            ISyncManager syncManager,
            ITogglDatabase database,
            IUserPreferences userPreferences,
            IPrivateSharedStorageService privateSharedStorageService,
            IUserAccessManager userAccessManager,
            IInteractorFactory interactorFactory,
            LogoutSource source)
        {
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsADefinedEnumValue(source, nameof(source));

            this.analyticsService            = analyticsService;
            this.shortcutCreator             = shortcutCreator;
            this.notificationService         = notificationService;
            this.syncManager                 = syncManager;
            this.database                    = database;
            this.userPreferences             = userPreferences;
            this.privateSharedStorageService = privateSharedStorageService;
            this.userAccessManager           = userAccessManager;
            this.interactorFactory           = interactorFactory;
            this.source = source;
        }
Пример #14
0
        public MainViewModel(
            IScheduler scheduler,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IUserPreferences userPreferences,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(scheduler, nameof(scheduler));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.scheduler         = scheduler;
            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.userPreferences   = userPreferences;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.onboardingStorage = onboardingStorage;

            RefreshCommand        = new MvxCommand(refresh);
            OpenReportsCommand    = new MvxAsyncCommand(openReports);
            OpenSettingsCommand   = new MvxAsyncCommand(openSettings);
            EditTimeEntryCommand  = new MvxAsyncCommand(editTimeEntry, () => CurrentTimeEntryId.HasValue);
            StopTimeEntryCommand  = new MvxAsyncCommand(stopTimeEntry, () => isStopButtonEnabled);
            StartTimeEntryCommand = new MvxAsyncCommand(startTimeEntry, () => CurrentTimeEntryId.HasValue == false);
        }
Пример #15
0
        public TimeEntriesViewModel(ITogglDataSource dataSource,
                                    IInteractorFactory interactorFactory,
                                    IAnalyticsService analyticsService,
                                    ISchedulerProvider schedulerProvider,
                                    IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.dataSource        = dataSource;
            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;
            this.rxActionFactory   = rxActionFactory;

            TimeEntries = new ObservableGroupedOrderedCollection <TimeEntryViewModel>(
                indexKey: t => t.Id,
                orderingKey: t => t.StartTime,
                groupingKey: t => t.StartTime.LocalDateTime.Date,
                descending: true
                );

            DelayDeleteTimeEntry  = rxActionFactory.FromAction <TimeEntryViewModel>(delayDeleteTimeEntry);
            CancelDeleteTimeEntry = rxActionFactory.FromAction(cancelDeleteTimeEntry);

            ShouldShowUndo = showUndoSubject.AsObservable().AsDriver(schedulerProvider);
        }
Пример #16
0
        public EditProjectViewModel(
            ITogglDataSource dataSource,
            IDialogService dialogService,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService,
            IStopwatchProvider stopwatchProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));

            this.dataSource        = dataSource;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;
            this.stopwatchProvider = stopwatchProvider;
            this.interactorFactory = interactorFactory;

            DoneCommand                 = new MvxAsyncCommand(done);
            CloseCommand                = new MvxAsyncCommand(close);
            PickColorCommand            = new MvxAsyncCommand(pickColor);
            PickClientCommand           = new MvxAsyncCommand(pickClient);
            PickWorkspaceCommand        = new MvxAsyncCommand(pickWorkspace);
            TogglePrivateProjectCommand = new MvxCommand(togglePrivateProject);
        }
Пример #17
0
        public TokenResetViewModel(
            IUserAccessManager userAccessManager,
            ITogglDataSource dataSource,
            IDialogService dialogService,
            IMvxNavigationService navigationService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            IInteractorFactory interactorFactory
            )
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.dataSource        = dataSource;
            this.userAccessManager = userAccessManager;
            this.dialogService     = dialogService;
            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;
            this.rxActionFactory   = rxActionFactory;
            this.interactorFactory = interactorFactory;

            Email = emailSubject
                    .DistinctUntilChanged()
                    .AsDriver(schedulerProvider);

            IsPasswordMasked = isPasswordMaskedSubject
                               .DistinctUntilChanged()
                               .AsDriver(schedulerProvider);

            TogglePasswordVisibility = rxActionFactory.FromAction(togglePasswordVisibility);

            Done    = rxActionFactory.FromObservable(done);
            SignOut = rxActionFactory.FromAsync(signout);

            Error = Done.Errors
                    .Select(transformException);

            HasError = Error
                       .Select(error => !string.IsNullOrEmpty(error))
                       .DistinctUntilChanged()
                       .AsDriver(schedulerProvider);

            NextIsEnabled = Password
                            .Select(Multivac.Password.From)
                            .CombineLatest(Done.Executing, (password, isExecuting) => password.IsValid && !isExecuting)
                            .DistinctUntilChanged()
                            .AsDriver(schedulerProvider);
        }
        public GetAutocompleteSuggestions(IInteractorFactory interactorFactory, QueryInfo queryInfo)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(queryInfo, nameof(queryInfo));

            this.interactorFactory = interactorFactory;
            this.queryInfo         = queryInfo;
        }
 public MockSelectUserCalendarsViewModel(
     IUserPreferences userPreferences,
     IInteractorFactory interactorFactory,
     INavigationService navigationService,
     IRxActionFactory rxActionFactory)
     : base(userPreferences, interactorFactory, navigationService, rxActionFactory)
 {
 }
Пример #20
0
        public MainViewModel(
            ITogglDataSource dataSource,
            ITimeService timeService,
            IRatingService ratingService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService,
            IRemoteConfigService remoteConfigService,
            ISuggestionProviderContainer suggestionProviders,
            ISchedulerProvider schedulerProvider)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            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(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(suggestionProviders, nameof(suggestionProviders));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.userPreferences   = userPreferences;
            this.analyticsService  = analyticsService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.onboardingStorage = onboardingStorage;
            this.schedulerProvider = schedulerProvider;

            SuggestionsViewModel    = new SuggestionsViewModel(dataSource, interactorFactory, onboardingStorage, suggestionProviders);
            RatingViewModel         = new RatingViewModel(timeService, dataSource, ratingService, analyticsService, onboardingStorage, navigationService, this.schedulerProvider);
            TimeEntriesLogViewModel = new TimeEntriesLogViewModel(timeService, dataSource, interactorFactory, onboardingStorage, analyticsService, navigationService);
            timeEntriesViewModel    = new TimeEntriesViewModel(dataSource, interactorFactory);

            LogEmpty         = timeEntriesViewModel.Empty.AsDriver(this.schedulerProvider);
            TimeEntriesCount = timeEntriesViewModel.Count.AsDriver(this.schedulerProvider);

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

            RefreshCommand                   = new MvxCommand(Refresh);
            OpenReportsCommand               = new MvxAsyncCommand(openReports);
            OpenSettingsCommand              = new MvxAsyncCommand(openSettings);
            OpenSyncFailuresCommand          = new MvxAsyncCommand(openSyncFailures);
            EditTimeEntryCommand             = new MvxAsyncCommand(editTimeEntry, canExecuteEditTimeEntryCommand);
            StopTimeEntryCommand             = new MvxAsyncCommand(stopTimeEntry, () => isStopButtonEnabled);
            StartTimeEntryCommand            = new MvxAsyncCommand(startTimeEntry, () => CurrentTimeEntryId.HasValue == false);
            AlternativeStartTimeEntryCommand = new MvxAsyncCommand(alternativeStartTimeEntry, () => CurrentTimeEntryId.HasValue == false);

            ContinueTimeEntry = new InputAction <TimeEntryViewModel>(continueTimeEntry);
            DeleteTimeEntry   = new InputAction <TimeEntryViewModel>(deleteTimeEntry);
            SelectTimeEntry   = new InputAction <TimeEntryViewModel>(timeEntrySelected);
            RefreshAction     = new UIAction(refresh);
        }
Пример #21
0
        public MainViewModel(
            ITogglDataSource dataSource,
            ITimeService timeService,
            IRatingService ratingService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService,
            IRemoteConfigService remoteConfigService,
            ISuggestionProviderContainer suggestionProviders,
            IIntentDonationService intentDonationService,
            IAccessRestrictionStorage accessRestrictionStorage,
            ISchedulerProvider schedulerProvider,
            IStopwatchProvider stopwatchProvider,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            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(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(suggestionProviders, nameof(suggestionProviders));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.dataSource               = dataSource;
            this.userPreferences          = userPreferences;
            this.analyticsService         = analyticsService;
            this.interactorFactory        = interactorFactory;
            this.navigationService        = navigationService;
            this.onboardingStorage        = onboardingStorage;
            this.SchedulerProvider        = schedulerProvider;
            this.intentDonationService    = intentDonationService;
            this.accessRestrictionStorage = accessRestrictionStorage;
            this.stopwatchProvider        = stopwatchProvider;
            this.rxActionFactory          = rxActionFactory;

            TimeService = timeService;

            SuggestionsViewModel = new SuggestionsViewModel(dataSource, interactorFactory, onboardingStorage, suggestionProviders, schedulerProvider, rxActionFactory);
            RatingViewModel      = new RatingViewModel(timeService, dataSource, ratingService, analyticsService, onboardingStorage, navigationService, SchedulerProvider, rxActionFactory);
            TimeEntriesViewModel = new TimeEntriesViewModel(dataSource, interactorFactory, analyticsService, SchedulerProvider, rxActionFactory);

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

            ratingViewExperiment = new RatingViewExperiment(timeService, dataSource, onboardingStorage, remoteConfigService);
        }
 public MockSelectUserCalendarsViewModel(
     IUserPreferences userPreferences,
     IInteractorFactory interactorFactory,
     IOnboardingStorage onboardingStorage,
     IAnalyticsService analyticsService,
     INavigationService navigationService,
     IRxActionFactory rxActionFactory)
     : base(userPreferences, interactorFactory, onboardingStorage, analyticsService, navigationService, rxActionFactory)
 {
 }
        public SelectUserCalendarsViewModel(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory,
            IMvxNavigationService navigationService)
            : base(userPreferences, interactorFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;
        }
        public GetSuggestionsInteractor(
            int suggestionCount,
            IInteractorFactory interactorFactory)
        {
            Ensure.Argument.IsInClosedRange(suggestionCount, 1, 9, nameof(suggestionCount));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.getSuggestionProvidersInteractor = interactorFactory.GetSuggestionProviders(suggestionCount);
            this.suggestionCount = suggestionCount;
        }
Пример #25
0
        public SettingsViewModel(
            UserAgent userAgent,
            IMailService mailService,
            ITogglDataSource dataSource,
            IDialogService dialogService,
            IInteractorFactory interactorFactory,
            IPlatformConstants platformConstants,
            IUserPreferences userPreferences,
            IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(userAgent, nameof(userAgent));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(mailService, nameof(mailService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants));

            this.userAgent         = userAgent;
            this.dataSource        = dataSource;
            this.mailService       = mailService;
            this.dialogService     = dialogService;
            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;
            this.platformConstants = platformConstants;
            this.userPreferences   = userPreferences;

            disposeBag.Add(dataSource.SyncManager
                           .ProgressObservable
                           .Subscribe(async progress =>
            {
                IsRunningSync = IsLoggingOut == false && progress == SyncProgress.Syncing;
                IsSynced      = IsLoggingOut == false && progress == SyncProgress.Synced && await isSynced();
            })
                           );

            RateCommand                         = new MvxCommand(rate);
            HelpCommand                         = new MvxCommand(help);
            UpdateCommand                       = new MvxCommand(update);
            BackCommand                         = new MvxAsyncCommand(back);
            LogoutCommand                       = new MvxAsyncCommand(maybeLogout);
            EditProfileCommand                  = new MvxCommand(editProfile);
            EditSubscriptionCommand             = new MvxCommand(editSubscription);
            ToggleManualModeCommand             = new MvxCommand(toggleManualMode);
            SubmitFeedbackCommand               = new MvxAsyncCommand(submitFeedback);
            AboutCommand                        = new MvxAsyncCommand(openAboutPage);
            ToggleAddMobileTagCommand           = new MvxCommand(toggleAddMobileTag);
            SelectDateFormatCommand             = new MvxAsyncCommand(selectDateFormat);
            SelectDurationFormatCommand         = new MvxAsyncCommand(selectDurationFormat);
            SelectBeginningOfWeekCommand        = new MvxAsyncCommand(selectBeginningOfWeek);
            PickWorkspaceCommand                = new MvxAsyncCommand(pickDefaultWorkspace);
            ToggleUseTwentyFourHourClockCommand = new MvxAsyncCommand(toggleUseTwentyFourHourClock);
            SelectDefaultWorkspaceCommand       = new MvxAsyncCommand <SelectableWorkspaceViewModel>(selectDefaultWorkspace);
        }
        public SelectWorkspaceViewModel(IInteractorFactory interactorFactory, IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.interactorFactory = interactorFactory;
            this.navigationService = navigationService;

            CloseCommand           = new MvxAsyncCommand(close);
            SelectWorkspaceCommand = new MvxAsyncCommand <SelectableWorkspaceViewModel>(selectWorkspace);
        }
Пример #27
0
 protected BaseInteractorTests()
 {
     InteractorFactory = new InteractorFactory(
         IdProvider,
         TimeService,
         DataSource,
         UserPreferences,
         AnalyticsService,
         ApplicationShortcutCreator
         );
 }
 public SoftDeleteMultipleTimeEntriesInteractor(
     IDataSource <IThreadSafeTimeEntry, IDatabaseTimeEntry> dataSource,
     ISyncManager syncManager,
     IInteractorFactory interactorFactory,
     long[] ids)
 {
     this.interactorFactory = interactorFactory;
     this.dataSource        = dataSource;
     this.syncManager       = syncManager;
     this.ids = ids;
 }
Пример #29
0
        public GetDefaultWorkspaceInteractor(
            ITogglDataSource dataSource,
            IInteractorFactory interactorFactory,
            IAnalyticsService analyticsService) : base(analyticsService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.dataSource        = dataSource;
            this.interactorFactory = interactorFactory;
        }
        protected SelectUserCalendarsViewModelBase(
            IUserPreferences userPreferences,
            IInteractorFactory interactorFactory)
        {
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));

            this.userPreferences = userPreferences;
            InteractorFactory    = interactorFactory;

            SelectCalendarAction = new InputAction <SelectableUserCalendarViewModel>(selectCalendar);
        }