public RepositoryViewModel(IMainThread mainThread,
                                   IAnalyticsService analyticsService,
                                   GitHubUserService gitHubUserService,
                                   MobileSortingService sortingService,
                                   RepositoryDatabase repositoryDatabase,
                                   GitHubApiV3Service gitHubApiV3Service,
                                   GitHubGraphQLApiService gitHubGraphQLApiService,
                                   GitHubAuthenticationService gitHubAuthenticationService,
                                   GitHubApiRepositoriesService gitHubApiRepositoriesService) : base(analyticsService, mainThread)
        {
            LanguageService.PreferredLanguageChanged += HandlePreferredLanguageChanged;

            SetTitleText();

            _gitHubUserService            = gitHubUserService;
            _mobileSortingService         = sortingService;
            _repositoryDatabase           = repositoryDatabase;
            _gitHubApiV3Service           = gitHubApiV3Service;
            _gitHubGraphQLApiService      = gitHubGraphQLApiService;
            _gitHubAuthenticationService  = gitHubAuthenticationService;
            _gitHubApiRepositoriesService = gitHubApiRepositoriesService;

            RefreshState = RefreshState.Uninitialized;

            PullToRefreshCommand      = new AsyncCommand(() => ExecutePullToRefreshCommand(gitHubUserService.Alias));
            FilterRepositoriesCommand = new Command <string>(SetSearchBarText);
            SortRepositoriesCommand   = new Command <SortingOption>(ExecuteSortRepositoriesCommand);

            NotificationService.SortingOptionRequested += HandleSortingOptionRequested;

            GitHubAuthenticationService.DemoUserActivated         += HandleDemoUserActivated;
            GitHubAuthenticationService.LoggedOut                 += HandleGitHubAuthenticationServiceLoggedOut;
            GitHubAuthenticationService.AuthorizeSessionCompleted += HandleAuthorizeSessionCompleted;
        }
Esempio n. 2
0
        public BackgroundFetchService(IAppInfo appInfo,
                                      GitHubUserService gitHubUserService,
                                      IAnalyticsService analyticsService,
                                      GitHubApiV3Service gitHubApiV3Service,
                                      RepositoryDatabase repositoryDatabase,
                                      NotificationService notificationService,
                                      ReferringSitesDatabase referringSitesDatabase,
                                      GitHubGraphQLApiService gitHubGraphQLApiService,
                                      GitHubApiRepositoriesService gitHubApiRepositoriesService)
        {
            _analyticsService             = analyticsService;
            _gitHubUserService            = gitHubUserService;
            _gitHubApiV3Service           = gitHubApiV3Service;
            _repositoryDatabase           = repositoryDatabase;
            _notificationService          = notificationService;
            _referringSitesDatabase       = referringSitesDatabase;
            _gitHubGraphQLApiService      = gitHubGraphQLApiService;
            _gitHubApiRepositoriesService = gitHubApiRepositoriesService;

            CleanUpDatabaseIdentifier            = $"{appInfo.PackageName}.{nameof(CleanUpDatabase)}";
            NotifyTrendingRepositoriesIdentifier = $"{appInfo.PackageName}.{nameof(NotifyTrendingRepositories)}";
        }