Ejemplo n.º 1
0
        public LogoutInteractor(
            IAnalyticsService analyticsService,
            INotificationService notificationService,
            IApplicationShortcutCreator shortcutCreator,
            ISyncManager syncManager,
            ITogglDatabase database,
            IUserPreferences userPreferences,
            IPrivateSharedStorageService privateSharedStorageService,
            IUserAccessManager userAccessManager,
            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.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.source = source;
        }
Ejemplo n.º 2
0
        public LoginManager(
            IApiFactory apiFactory,
            ITogglDatabase database,
            IGoogleService googleService,
            IApplicationShortcutCreator shortcutCreator,
            IAccessRestrictionStorage accessRestrictionStorage,
            IAnalyticsService analyticsService,
            IPrivateSharedStorageService privateSharedStorageService,
            Func <ITogglApi, ITogglDataSource> createDataSource,
            IScheduler scheduler
            )
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(googleService, nameof(googleService));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(createDataSource, nameof(createDataSource));
            Ensure.Argument.IsNotNull(scheduler, nameof(scheduler));

            this.database   = database;
            this.apiFactory = apiFactory;
            this.accessRestrictionStorage    = accessRestrictionStorage;
            this.googleService               = googleService;
            this.analyticsService            = analyticsService;
            this.privateSharedStorageService = privateSharedStorageService;
            this.shortcutCreator             = shortcutCreator;
            this.createDataSource            = createDataSource;
            this.scheduler = scheduler;
        }
Ejemplo n.º 3
0
 internal FoundationMvvmCross(
     IApiFactory apiFactory,
     ITogglDatabase database,
     ITimeService timeService,
     IScheduler scheduler,
     IAnalyticsService analyticsService,
     IGoogleService googleService,
     IApplicationShortcutCreator shortcutCreator,
     IBackgroundService backgroundService,
     IOnboardingStorage onboardingStorage,
     IAccessRestrictionStorage accessRestrictionStorage,
     IMvxNavigationService navigationService,
     IApiErrorHandlingService apiErrorHandlingService)
 {
     Database                 = database;
     ApiFactory               = apiFactory;
     TimeService              = timeService;
     Scheduler                = scheduler;
     AnalyticsService         = analyticsService;
     GoogleService            = googleService;
     ShortcutCreator          = shortcutCreator;
     BackgroundService        = backgroundService;
     OnboardingStorage        = onboardingStorage;
     AccessRestrictionStorage = accessRestrictionStorage;
     NavigationService        = navigationService;
     ApiErrorHandlingService  = apiErrorHandlingService;
 }
        public InteractorFactory(
            IIdProvider idProvider,
            ITogglDatabase database,
            ITimeService timeService,
            ITogglDataSource dataSource,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IApplicationShortcutCreator shortcutCreator)
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            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));

            this.database         = database;
            this.dataSource       = dataSource;
            this.idProvider       = idProvider;
            this.timeService      = timeService;
            this.userPreferences  = userPreferences;
            this.shortcutCreator  = shortcutCreator;
            this.analyticsService = analyticsService;
        }
        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 InteractorFactory(
            IIdProvider idProvider,
            ITimeService timeService,
            ITogglDataSource dataSource,
            ITogglApi api,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            INotificationService notificationService,
            IIntentDonationService intentDonationService,
            IApplicationShortcutCreator shortcutCreator,
            ILastTimeUsageStorage lastTimeUsageStorage,
            IPlatformInfo platformInfo,
            UserAgent userAgent,
            ICalendarService calendarService,
            ISyncManager syncManager,
            IStopwatchProvider stopwatchProvider,
            ITogglDatabase database,
            IPrivateSharedStorageService privateSharedStorageService,
            IUserAccessManager userAccessManager)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(api, nameof(api));
            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(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));
            Ensure.Argument.IsNotNull(userAgent, nameof(userAgent));
            Ensure.Argument.IsNotNull(calendarService, nameof(calendarService));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));

            this.dataSource                  = dataSource;
            this.api                         = api;
            this.idProvider                  = idProvider;
            this.timeService                 = timeService;
            this.userPreferences             = userPreferences;
            this.shortcutCreator             = shortcutCreator;
            this.analyticsService            = analyticsService;
            this.notificationService         = notificationService;
            this.intentDonationService       = intentDonationService;
            this.lastTimeUsageStorage        = lastTimeUsageStorage;
            this.platformInfo                = platformInfo;
            this.userAgent                   = userAgent;
            this.calendarService             = calendarService;
            this.syncManager                 = syncManager;
            this.stopwatchProvider           = stopwatchProvider;
            this.database                    = database;
            this.privateSharedStorageService = privateSharedStorageService;
            this.userAccessManager           = userAccessManager;
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        public TogglDataSource(
            ITogglApi api,
            ITogglDatabase database,
            ITimeService timeService,
            IErrorHandlingService errorHandlingService,
            IBackgroundService backgroundService,
            Func <ITogglDataSource, ISyncManager> createSyncManager,
            TimeSpan minimumTimeInBackgroundForFullSync,
            INotificationService notificationService,
            IApplicationShortcutCreator shortcutCreator,
            IAnalyticsService analyticsService)
        {
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(errorHandlingService, nameof(errorHandlingService));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(createSyncManager, nameof(createSyncManager));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.database             = database;
            this.timeService          = timeService;
            this.shortcutCreator      = shortcutCreator;
            this.backgroundService    = backgroundService;
            this.notificationService  = notificationService;
            this.errorHandlingService = errorHandlingService;
            this.minimumTimeInBackgroundForFullSync = minimumTimeInBackgroundForFullSync;

            User              = new UserDataSource(database.User);
            Tags              = new TagsDataSource(database.Tags);
            Tasks             = new TasksDataSource(database.Tasks);
            Clients           = new ClientsDataSource(database.Clients);
            Projects          = new ProjectsDataSource(database.Projects);
            Workspaces        = new WorkspacesDataSource(database.Workspaces);
            Preferences       = new PreferencesDataSource(database.Preferences);
            WorkspaceFeatures = new WorkspaceFeaturesDataSource(database.WorkspaceFeatures);
            TimeEntries       = new TimeEntriesDataSource(database.TimeEntries, timeService, analyticsService);

            this.createSyncManager = createSyncManager;
            CreateNewSyncManager();

            ReportsProvider = new ReportsProvider(api, database);

            FeedbackApi = api.Feedback;

            isLoggedIn = true;
        }
Ejemplo n.º 9
0
        public TogglDataSource(
            ITogglApi api,
            ITogglDatabase database,
            ITimeService timeService,
            IApiErrorHandlingService apiErrorHandlingService,
            IBackgroundService backgroundService,
            Func <ITogglDataSource, ISyncManager> createSyncManager,
            TimeSpan minimumTimeInBackgroundForFullSync,
            IApplicationShortcutCreator shortcutCreator)
        {
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(apiErrorHandlingService, nameof(apiErrorHandlingService));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(createSyncManager, nameof(createSyncManager));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));

            this.database = database;
            this.apiErrorHandlingService = apiErrorHandlingService;
            this.backgroundService       = backgroundService;
            this.shortcutCreator         = shortcutCreator;

            this.minimumTimeInBackgroundForFullSync = minimumTimeInBackgroundForFullSync;

            User              = new UserDataSource(database.User, timeService);
            Tags              = new TagsDataSource(database.IdProvider, database.Tags, timeService);
            Tasks             = new TasksDataSource(database.Tasks);
            Clients           = new ClientsDataSource(database.IdProvider, database.Clients, timeService);
            Preferences       = new PreferencesDataSource(database.Preferences);
            Projects          = new ProjectsDataSource(database.IdProvider, database.Projects, timeService);
            TimeEntries       = new TimeEntriesDataSource(database.TimeEntries, timeService);
            Workspaces        = new WorkspacesDataSource(database.Workspaces);
            WorkspaceFeatures = new WorkspaceFeaturesDataSource(database.WorkspaceFeatures);

            SyncManager = createSyncManager(this);

            ReportsProvider = new ReportsProvider(api, database);

            errorHandlingDisposable = SyncManager.ProgressObservable.Subscribe(onSyncError);
            isLoggedIn = true;
        }
Ejemplo n.º 10
0
        public TogglDataSource(
            ITogglApi api,
            ITogglDatabase database,
            ITimeService timeService,
            Func <ITogglDataSource, ISyncManager> createSyncManager,
            INotificationService notificationService,
            IApplicationShortcutCreator shortcutCreator,
            IAnalyticsService analyticsService)
        {
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(notificationService, nameof(notificationService));
            Ensure.Argument.IsNotNull(createSyncManager, nameof(createSyncManager));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.database            = database;
            this.shortcutCreator     = shortcutCreator;
            this.notificationService = notificationService;

            User              = new UserDataSource(database.User);
            Tags              = new TagsDataSource(database.Tags);
            Tasks             = new TasksDataSource(database.Tasks);
            Clients           = new ClientsDataSource(database.Clients);
            Projects          = new ProjectsDataSource(database.Projects);
            Workspaces        = new WorkspacesDataSource(database.Workspaces);
            Preferences       = new PreferencesDataSource(database.Preferences);
            WorkspaceFeatures = new WorkspaceFeaturesDataSource(database.WorkspaceFeatures);
            TimeEntries       = new TimeEntriesDataSource(database.TimeEntries, timeService, analyticsService);

            SyncManager = createSyncManager(this);

            ReportsProvider = new ReportsProvider(api, database);

            FeedbackApi = api.Feedback;

            isLoggedIn = true;
        }
Ejemplo n.º 11
0
        public LoginManager(
            IApiFactory apiFactory,
            ITogglDatabase database,
            IGoogleService googleService,
            IApplicationShortcutCreator shortcutCreator,
            IAccessRestrictionStorage accessRestrictionStorage,
            Func <ITogglApi, ITogglDataSource> createDataSource)
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(googleService, nameof(googleService));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(createDataSource, nameof(createDataSource));

            this.database   = database;
            this.apiFactory = apiFactory;
            this.accessRestrictionStorage = accessRestrictionStorage;
            this.googleService            = googleService;
            this.shortcutCreator          = shortcutCreator;
            this.createDataSource         = createDataSource;
        }
Ejemplo n.º 12
0
        public UserAccessManager(
            IApiFactory apiFactory,
            ITogglDatabase database,
            IGoogleService googleService,
            IApplicationShortcutCreator shortcutCreator,
            IPrivateSharedStorageService privateSharedStorageService,
            Func <ITogglApi, ITogglDataSource> createDataSource
            )
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(googleService, nameof(googleService));
            Ensure.Argument.IsNotNull(shortcutCreator, nameof(shortcutCreator));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(createDataSource, nameof(createDataSource));

            this.database      = database;
            this.apiFactory    = apiFactory;
            this.googleService = googleService;
            this.privateSharedStorageService = privateSharedStorageService;
            this.shortcutCreator             = shortcutCreator;
            this.createDataSource            = createDataSource;
        }
Ejemplo n.º 13
0
 public Builder WithApplicationShortcutCreator(IApplicationShortcutCreator shortcutCreator)
 {
     ShortcutCreator = shortcutCreator;
     return(this);
 }