public SendFeedbackInteractor( IFeedbackApi feedbackApi, ISingletonDataSource <IThreadSafeUser> userDataSource, IDataSource <IThreadSafeWorkspace, IDatabaseWorkspace> workspacesDataSource, IDataSource <IThreadSafeTimeEntry, IDatabaseTimeEntry> timeEntriesDataSource, IPlatformConstants platformConstants, IUserPreferences userPreferences, ILastTimeUsageStorage lastTimeUsageStorage, ITimeService timeService, UserAgent userAgent, string message) { Ensure.Argument.IsNotNull(feedbackApi, nameof(feedbackApi)); Ensure.Argument.IsNotNull(userDataSource, nameof(userDataSource)); Ensure.Argument.IsNotNull(workspacesDataSource, nameof(workspacesDataSource)); Ensure.Argument.IsNotNull(timeEntriesDataSource, nameof(timeEntriesDataSource)); Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants)); Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences)); Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(userAgent, nameof(userAgent)); Ensure.Argument.IsNotNull(message, nameof(message)); this.feedbackApi = feedbackApi; this.userDataSource = userDataSource; this.workspacesDataSource = workspacesDataSource; this.timeEntriesDataSource = timeEntriesDataSource; this.platformConstants = platformConstants; this.userPreferences = userPreferences; this.lastTimeUsageStorage = lastTimeUsageStorage; this.timeService = timeService; this.userAgent = userAgent; this.message = message; }
public InteractorFactory( IIdProvider idProvider, ITimeService timeService, ITogglDataSource dataSource, IUserPreferences userPreferences, IAnalyticsService analyticsService, IApplicationShortcutCreator shortcutCreator, ILastTimeUsageStorage lastTimeUsageStorage, IPlatformConstants platformConstants, UserAgent userAgent) { Ensure.Argument.IsNotNull(dataSource, nameof(dataSource)); Ensure.Argument.IsNotNull(idProvider, nameof(idProvider)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences)); Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage)); Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants)); Ensure.Argument.IsNotNull(userAgent, nameof(userAgent)); this.dataSource = dataSource; this.idProvider = idProvider; this.timeService = timeService; this.userPreferences = userPreferences; this.shortcutCreator = shortcutCreator; this.analyticsService = analyticsService; this.lastTimeUsageStorage = lastTimeUsageStorage; this.platformConstants = platformConstants; this.userAgent = userAgent; }
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 static Foundation Create( string clientName, string version, ITogglDatabase database, ITimeService timeService, IScheduler scheduler, IMailService mailService, IGoogleService googleService, ApiEnvironment apiEnvironment, ILicenseProvider licenseProvider, IAnalyticsService analyticsService, IPlatformConstants platformConstants, IApplicationShortcutCreator shortcutCreator, ISuggestionProviderContainer suggestionProviderContainer) { Ensure.Argument.IsNotNull(version, nameof(version)); Ensure.Argument.IsNotNull(database, nameof(database)); Ensure.Argument.IsNotNull(clientName, nameof(clientName)); Ensure.Argument.IsNotNull(timeService, nameof(timeService)); Ensure.Argument.IsNotNull(scheduler, nameof(scheduler)); Ensure.Argument.IsNotNull(mailService, nameof(mailService)); Ensure.Argument.IsNotNull(googleService, nameof(googleService)); Ensure.Argument.IsNotNull(licenseProvider, nameof(licenseProvider)); Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants)); Ensure.Argument.IsNotNull(suggestionProviderContainer, nameof(suggestionProviderContainer)); var userAgent = new UserAgent(clientName, version.ToString()); var foundation = new Foundation { Database = database, UserAgent = userAgent, TimeService = timeService, Scheduler = scheduler, MailService = mailService, GoogleService = googleService, ApiEnvironment = apiEnvironment, LicenseProvider = licenseProvider, Version = Version.Parse(version), ShortcutCreator = shortcutCreator, AnalyticsService = analyticsService, PlatformConstants = platformConstants, BackgroundService = new BackgroundService(timeService), ApiFactory = new ApiFactory(apiEnvironment, userAgent), SuggestionProviderContainer = suggestionProviderContainer }; return(foundation); }
public FeedbackService( UserAgent userAgent, IMailService mailService, IDialogService dialogService, IPlatformConstants platformConstants) { Ensure.Argument.IsNotNull(userAgent, nameof(userAgent)); Ensure.Argument.IsNotNull(mailService, nameof(mailService)); Ensure.Argument.IsNotNull(dialogService, nameof(dialogService)); Ensure.Argument.IsNotNull(platformConstants, nameof(platformConstants)); this.userAgent = userAgent; this.mailService = mailService; this.dialogService = dialogService; this.platformConstants = platformConstants; }
public SettingsViewModel( UserAgent userAgent, IMailService mailService, ITogglDataSource dataSource, IDialogService dialogService, IUserPreferences userPreferences, IFeedbackService feedbackService, IAnalyticsService analyticsService, IInteractorFactory interactorFactory, IPlatformConstants platformConstants, IOnboardingStorage onboardingStorage, 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(feedbackService, nameof(feedbackService)); Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService)); Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage)); 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.userPreferences = userPreferences; this.feedbackService = feedbackService; this.analyticsService = analyticsService; this.interactorFactory = interactorFactory; this.navigationService = navigationService; this.platformConstants = platformConstants; this.onboardingStorage = onboardingStorage; IsSynced = dataSource.SyncManager.ProgressObservable.SelectMany(checkSynced); IsRunningSync = dataSource.SyncManager .ProgressObservable .Select(isRunningSync); Name = dataSource.User.Current .Select(user => user.Fullname) .DistinctUntilChanged(); Email = dataSource.User.Current .Select(user => user.Email.ToString()) .DistinctUntilChanged(); IsManualModeEnabled = userPreferences.IsManualModeEnabledObservable; WorkspaceName = dataSource.User.Current .DistinctUntilChanged(user => user.DefaultWorkspaceId) .SelectMany(_ => interactorFactory.GetDefaultWorkspace().Execute()) .Select(workspace => workspace.Name); BeginningOfWeek = dataSource.User.Current .Select(user => user.BeginningOfWeek) .DistinctUntilChanged() .Select(beginningOfWeek => beginningOfWeek.ToString()); DateFormat = dataSource.Preferences.Current .Select(preferences => preferences.DateFormat.Localized) .DistinctUntilChanged(); DurationFormat = dataSource.Preferences.Current .Select(preferences => preferences.DurationFormat) .Select(DurationFormatToString.Convert) .DistinctUntilChanged(); UseTwentyFourHourFormat = dataSource.Preferences.Current .Select(preferences => preferences.TimeOfDayFormat.IsTwentyFourHoursFormat) .DistinctUntilChanged(); UserAvatar = dataSource.User.Current .Select(user => user.ImageUrl) .DistinctUntilChanged() .SelectMany(url => interactorFactory.GetUserAvatar(url).Execute()); Workspaces = dataSource.User.Current .DistinctUntilChanged(user => user.DefaultWorkspaceId) .SelectMany(user => interactorFactory .GetAllWorkspaces() .Execute() .Select(selectableWorkspacesFromWorkspaces(user)) ); LoggingOut = loggingOutSubject.AsObservable(); dataSource.User.Current .Subscribe(user => currentUser = user) .DisposedBy(disposeBag); dataSource.Preferences.Current .Subscribe(preferences => currentPreferences = preferences) .DisposedBy(disposeBag); IsRunningSync .Subscribe(isSyncing => this.isSyncing = isSyncing) .DisposedBy(disposeBag); IsFeedbackSuccessViewShowing = isFeedbackSuccessViewShowing.AsObservable(); }
public Builder WithPlatformConstants(IPlatformConstants platformConstants) { PlatformConstants = platformConstants; return(this); }