Example #1
0
        public TogglDataSource(
            ITogglApi api,
            ITogglDatabase database,
            ITimeService timeService,
            Func <ITogglDataSource, ISyncManager> createSyncManager,
            IAnalyticsService analyticsService)
        {
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(createSyncManager, nameof(createSyncManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.database = database;

            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;
        }
        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;
        }
        public TogglDataSource(ITogglDatabase database, ITogglApi api, ITimeService timeService, IScheduler scheduler)
        {
            Ensure.Argument.IsNotNull(api, nameof(api));
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(scheduler, nameof(scheduler));

            this.database = database;

            User        = new UserDataSource(database.User);
            Tags        = new TagsDataSource(database.Tags);
            Tasks       = new TasksDataSource(database.Tasks);
            Workspaces  = new WorkspacesDataSource(database);
            Projects    = new ProjectsDataSource(database.Projects);
            TimeEntries = new TimeEntriesDataSource(database.IdProvider, database.TimeEntries, timeService);

            AutocompleteProvider = new AutocompleteProvider(database);
            SyncManager          = TogglSyncManager.CreateSyncManager(database, api, this, timeService, scheduler);
        }
Example #4
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;
        }
Example #5
0
        public TogglDataSource(
            ITogglDatabase database,
            ITimeService timeService,
            IAnalyticsService analyticsService)
        {
            Ensure.Argument.IsNotNull(database, nameof(database));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));

            this.database = database;

            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);
        }