Пример #1
0
        public ForgotPasswordViewModel(
            ITimeService timeService,
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            IMvxNavigationService navigationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService       = timeService;
            this.userAccessManager = userAccessManager;
            this.analyticsService  = analyticsService;
            this.navigationService = navigationService;
            this.rxActionFactory   = rxActionFactory;

            Reset = rxActionFactory.FromObservable(reset, Email.Select(email => email.IsValid));
            Close = rxActionFactory.FromAction(returnEmail, Reset.Executing.Invert());

            ErrorMessage = Reset.Errors
                           .Select(toErrorString)
                           .StartWith("");

            PasswordResetSuccessful = Reset.Elements
                                      .Select(_ => true)
                                      .StartWith(false);
        }
Пример #2
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);
        }
        public UpcomingEventsNotificationSettingsViewModel(
            IMvxNavigationService navigationService,
            IUserPreferences userPreferences,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.rxActionFactory   = rxActionFactory;

            this.AvailableOptions = new List <CalendarNotificationsOption>
            {
                CalendarNotificationsOption.Disabled,
                CalendarNotificationsOption.WhenEventStarts,
                CalendarNotificationsOption.FiveMinutes,
                CalendarNotificationsOption.TenMinutes,
                CalendarNotificationsOption.FifteenMinutes,
                CalendarNotificationsOption.ThirtyMinutes,
                CalendarNotificationsOption.OneHour
            };

            SelectOption = rxActionFactory.FromAction <CalendarNotificationsOption>(onSelectOption);
            Close        = rxActionFactory.FromAsync(() => navigationService.Close(this, Unit.Default));
        }
        public UpcomingEventsNotificationSettingsViewModel(
            INavigationService navigationService,
            IUserPreferences userPreferences,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService = navigationService;
            this.userPreferences   = userPreferences;
            this.rxActionFactory   = rxActionFactory;

            var options = new[] {
                CalendarNotificationsOption.Disabled,
                CalendarNotificationsOption.WhenEventStarts,
                CalendarNotificationsOption.FiveMinutes,
                CalendarNotificationsOption.TenMinutes,
                CalendarNotificationsOption.FifteenMinutes,
                CalendarNotificationsOption.ThirtyMinutes,
                CalendarNotificationsOption.OneHour
            };

            AvailableOptions = options.Select(toSelectableOption).ToList();

            SelectOption = rxActionFactory.FromAction <SelectableCalendarNotificationsOptionViewModel>(onSelectOption);
            Close        = rxActionFactory.FromAsync(close);
        }
Пример #5
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);
        }
Пример #6
0
        public ReportsCalendarViewModel(
            ITimeService timeService,
            IDialogService dialogService,
            ITogglDataSource dataSource,
            IIntentDonationService intentDonationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService           = timeService;
            this.dialogService         = dialogService;
            this.dataSource            = dataSource;
            this.intentDonationService = intentDonationService;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject
                                    .StartWith(MonthsToShow - 1)
                                    .DistinctUntilChanged();
        }
        public NotificationSettingsViewModel(
            INavigationService navigationService,
            IBackgroundService backgroundService,
            IPermissionsChecker permissionsChecker,
            IUserPreferences userPreferences,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(permissionsChecker, nameof(permissionsChecker));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            PermissionGranted = backgroundService.AppResumedFromBackground
                                .SelectUnit()
                                .StartWith(Unit.Default)
                                .SelectMany(_ => permissionsChecker.NotificationPermissionGranted)
                                .DistinctUntilChanged()
                                .AsDriver(schedulerProvider);

            UpcomingEvents = userPreferences.CalendarNotificationsSettings()
                             .Select(s => s.Title())
                             .DistinctUntilChanged()
                             .AsDriver(schedulerProvider);

            RequestAccess      = rxActionFactory.FromAction(requestAccess);
            OpenUpcomingEvents = rxActionFactory.FromAsync(openUpcomingEvents);
        }
        public SelectCountryViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            SelectCountry = rxActionFactory.FromAction<SelectableCountryViewModel>(selectCountry);
        }
Пример #9
0
        public ReportsCalendarViewModel(
            ITimeService timeService,
            IDialogService dialogService,
            ITogglDataSource dataSource,
            IIntentDonationService intentDonationService,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService           = timeService;
            this.dialogService         = dialogService;
            this.dataSource            = dataSource;
            this.intentDonationService = intentDonationService;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject.AsObservable();

            SelectedDateRangeObservable = selectedDateRangeSubject
                                          .ShareReplay(1);

            HighlightedDateRangeObservable = highlightedDateRangeSubject
                                             .ShareReplay(1);
        }
Пример #10
0
        public BrowserViewModel(IMvxNavigationService navigationService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            Close = rxActionFactory.FromAsync(() => navigationService.Close(this));
        }
        public ReportsCalendarViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            IRxActionFactory rxActionFactory,
            INavigationService navigationService,
            ISchedulerProvider schedulerProvider)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.schedulerProvider = schedulerProvider;

            SelectDay      = rxActionFactory.FromAsync <ReportsCalendarDayViewModel>(calendarDayTapped);
            SelectShortcut = rxActionFactory.FromAction <ReportsCalendarBaseQuickSelectShortcut>(quickSelect);

            CurrentPageObservable = currentPageSubject
                                    .AsObservable()
                                    .DistinctUntilChanged();

            SelectedDateRangeObservable = selectedDateRangeSubject
                                          .ShareReplay(1);

            HighlightedDateRangeObservable = highlightedDateRangeSubject
                                             .ShareReplay(1);
        }
Пример #12
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);
        }
Пример #13
0
        public SelectColorViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.rxActionFactory = rxActionFactory;

            // Public properties
            Hue        = hue.AsObservable();
            Saturation = saturation.AsObservable();
            Value      = value.AsObservable();

            Save          = rxActionFactory.FromAction(save);
            SetHue        = rxActionFactory.FromAction <float>(hue.OnNext);
            SetSaturation = rxActionFactory.FromAction <float>(saturation.OnNext);
            SetValue      = rxActionFactory.FromAction <float>(value.OnNext);
            SelectColor   = rxActionFactory.FromAction <Color>(selectColor);

            customColor = Observable
                          .CombineLatest(hue, saturation, value, Colors.FromHSV)
                          .Do(selectedColor.OnNext);

            var availableColors = Observable.Return(Colors.DefaultProjectColors)
                                  .CombineLatest(customColor, combineAllColors);

            SelectableColors = availableColors
                               .CombineLatest(selectedColor, updateSelectableColors);
        }
Пример #14
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);
        }
Пример #15
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);
        }
        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();
        }
Пример #17
0
        public ForgotPasswordViewModel(
            ITimeService timeService,
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            INavigationService navigationService,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService       = timeService;
            this.userAccessManager = userAccessManager;
            this.analyticsService  = analyticsService;
            this.rxActionFactory   = rxActionFactory;

            Reset = rxActionFactory.FromObservable(reset, Email.Select(email => email.IsValid));

            var resetActionStartedObservable = Reset
                                               .Executing
                                               .Where(executing => executing)
                                               .Select(_ => (Exception)null);

            ErrorMessage = Reset.Errors
                           .Merge(resetActionStartedObservable)
                           .Select(toErrorString)
                           .StartWith("")
                           .DistinctUntilChanged();

            PasswordResetSuccessful = Reset.Elements
                                      .Select(_ => true)
                                      .StartWith(false);
        }
Пример #18
0
        public SelectDateTimeViewModel(IRxActionFactory rxActionFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            Save = rxActionFactory.FromAction(save);
        }
Пример #19
0
        public SelectColorViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory, ISchedulerProvider schedulerProvider)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));

            // Public properties
            Hue        = hue.AsDriver(schedulerProvider);
            Saturation = saturation.AsDriver(schedulerProvider);
            Value      = value.AsDriver(schedulerProvider);

            Save          = rxActionFactory.FromAction(save);
            SetHue        = rxActionFactory.FromAction <float>(hue.OnNext);
            SetSaturation = rxActionFactory.FromAction <float>(saturation.OnNext);
            SetValue      = rxActionFactory.FromAction <float>(value.OnNext);
            SelectColor   = rxActionFactory.FromAction <Color>(selectColor);

            customColor = Observable.CombineLatest(hue, saturation, value, Colors.FromHSV)
                          .SkipUntil(startCustomColorEmitting)
                          .Throttle(TimeSpan.FromMilliseconds(100), schedulerProvider.DefaultScheduler)
                          .Do(selectedColor.OnNext);

            var firstCustomColor = Colors.FromHSV(hue.Value, saturation.Value, value.Value);

            var availableColors = Observable.Return(Colors.DefaultProjectColors)
                                  .CombineLatest(customColor.StartWith(firstCustomColor), combineAllColors);

            SelectableColors = availableColors
                               .CombineLatest(selectedColor, updateSelectableColors)
                               .Do(_ => startCustomColorEmitting.OnNext(Unit.Default));
        }
Пример #20
0
        public RatingViewModel(
            ITimeService timeService,
            IRatingService ratingService,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            INavigationService navigationService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(ratingService, nameof(ratingService));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService       = timeService;
            this.ratingService     = ratingService;
            this.analyticsService  = analyticsService;
            this.onboardingStorage = onboardingStorage;
            this.schedulerProvider = schedulerProvider;

            Impression = impressionSubject.AsDriver(this.schedulerProvider);

            IsFeedbackSuccessViewShowing = isFeedbackSuccessViewShowing.AsDriver(this.schedulerProvider);

            HideRatingView = hideRatingView.AsDriver(this.schedulerProvider);

            PerformMainAction = rxActionFactory.FromAsync(performMainAction);
        }
Пример #21
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);
        }
Пример #22
0
        public TermsOfServiceViewModel(IRxActionFactory rxActionFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            ViewPrivacyPolicy  = rxActionFactory.FromAsync(openPrivacyPolicy);
            ViewTermsOfService = rxActionFactory.FromAsync(openTermsOfService);
        }
 public MockSelectUserCalendarsViewModel(
     IUserPreferences userPreferences,
     IInteractorFactory interactorFactory,
     INavigationService navigationService,
     IRxActionFactory rxActionFactory)
     : base(userPreferences, interactorFactory, navigationService, rxActionFactory)
 {
 }
Пример #24
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 SelectDateTimeViewModel(IRxActionFactory rxActionFactory, IMvxNavigationService navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.navigationService = navigationService;

            SaveCommand  = rxActionFactory.FromAsync(save);
            CloseCommand = rxActionFactory.FromAsync(close);
        }
 public MockSelectUserCalendarsViewModel(
     IUserPreferences userPreferences,
     IInteractorFactory interactorFactory,
     IOnboardingStorage onboardingStorage,
     IAnalyticsService analyticsService,
     INavigationService navigationService,
     IRxActionFactory rxActionFactory)
     : base(userPreferences, interactorFactory, onboardingStorage, analyticsService, navigationService, rxActionFactory)
 {
 }
Пример #27
0
        public OutdatedAppViewModel(IBrowserService browserService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(browserService, nameof(browserService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.browserService  = browserService;
            this.rxActionFactory = rxActionFactory;

            UpdateApp   = rxActionFactory.FromAction(updateApp);
            OpenWebsite = rxActionFactory.FromAction(openWebsite);
        }
Пример #28
0
        public SelectCountryViewModel(INavigationService navigationService, IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.navigationService = navigationService;
            this.rxActionFactory   = rxActionFactory;

            SelectCountry = rxActionFactory.FromAsync <SelectableCountryViewModel>(selectCountry);
            Close         = rxActionFactory.FromAsync(close);
        }
Пример #29
0
        public OutdatedAppViewModel(IPlatformInfo platformInfo, IRxActionFactory rxActionFactory, INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            storeUrl = platformInfo.StoreUrl;

            UpdateApp   = rxActionFactory.FromAsync(updateApp);
            OpenWebsite = rxActionFactory.FromAsync(openWebsite);
        }
Пример #30
0
        public AboutViewModel(
            IRxActionFactory rxActionFactory,
            INavigationService navigationService)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            OpenLicensesView       = rxActionFactory.FromAsync(openLicensesView);
            OpenPrivacyPolicyView  = rxActionFactory.FromAsync(openPrivacyPolicyView);
            OpenTermsOfServiceView = rxActionFactory.FromAsync(openTermsOfServiceView);
        }