Exemple #1
0
        public RepositoryViewModel(RepositoryDatabase repositoryDatabase,
                                   GitHubAuthenticationService gitHubAuthenticationService,
                                   GitHubGraphQLApiService gitHubGraphQLApiService,
                                   IAnalyticsService analyticsService,
                                   SortingService sortingService,
                                   GitHubApiV3Service gitHubApiV3Service,
                                   NotificationService notificationService,
                                   IMainThread mainThread,
                                   GitHubUserService gitHubUserService) : base(analyticsService, mainThread)
        {
            _repositoryDatabase          = repositoryDatabase;
            _gitHubAuthenticationService = gitHubAuthenticationService;
            _gitHubGraphQLApiService     = gitHubGraphQLApiService;
            _sortingService     = sortingService;
            _gitHubApiV3Service = gitHubApiV3Service;
            _gitHubUserService  = gitHubUserService;

            RefreshState = RefreshState.Uninitialized;

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

            notificationService.SortingOptionRequested            += HandleSortingOptionRequested;
            gitHubAuthenticationService.LoggedOut                 += HandleGitHubAuthenticationServiceLoggedOut;
            gitHubAuthenticationService.AuthorizeSessionCompleted += HandleAuthorizeSessionCompleted;
            gitHubAuthenticationService.DemoUserActivated         += HandleDemoUserActivated;
        }
Exemple #2
0
        public ReferringSitesViewModel(IMainThread mainThread,
                                       ReviewService reviewService,
                                       FavIconService favIconService,
                                       IVersionTracking versionTracking,
                                       IAnalyticsService analyticsService,
                                       GitHubUserService gitHubUserService,
                                       GitHubApiV3Service gitHubApiV3Service,
                                       DeepLinkingService deepLinkingService,
                                       ReferringSitesDatabase referringSitesDatabase,
                                       GitHubAuthenticationService gitHubAuthenticationService) : base(analyticsService, mainThread)
        {
            ReviewService.ReviewRequested += HandleReviewRequested;
            ReviewService.ReviewCompleted += HandleReviewCompleted;

            _reviewService               = reviewService;
            _favIconService              = favIconService;
            _versionTracking             = versionTracking;
            _gitHubUserService           = gitHubUserService;
            _gitHubApiV3Service          = gitHubApiV3Service;
            _deepLinkingService          = deepLinkingService;
            _referringSitesDatabase      = referringSitesDatabase;
            _gitHubAuthenticationService = gitHubAuthenticationService;

            RefreshState = RefreshState.Uninitialized;

            RefreshCommand   = new AsyncCommand <(string Owner, string Repository, string RepositoryUrl, CancellationToken Token)>(tuple => ExecuteRefreshCommand(tuple.Owner, tuple.Repository, tuple.RepositoryUrl, tuple.Token));
            NoButtonCommand  = new Command(() => HandleReviewRequestButtonTapped(ReviewAction.NoButtonTapped));
            YesButtonCommand = new Command(() => HandleReviewRequestButtonTapped(ReviewAction.YesButtonTapped));

            UpdateStoreRatingRequestView();
        }
Exemple #3
0
        public TrendsViewModel(IMainThread mainThread,
                               IAnalyticsService analyticsService,
                               GitHubApiV3Service gitHubApiV3Service,
                               GitHubApiStatusService gitHubApiStatusService,
                               GitHubGraphQLApiService gitHubGraphQLApiService,
                               TrendsChartSettingsService trendsChartSettingsService) : base(analyticsService, mainThread)
        {
            _gitHubApiV3Service      = gitHubApiV3Service;
            _gitHubApiStatusService  = gitHubApiStatusService;
            _gitHubGraphQLApiService = gitHubGraphQLApiService;

            IsViewsSeriesVisible        = trendsChartSettingsService.ShouldShowViewsByDefault;
            IsUniqueViewsSeriesVisible  = trendsChartSettingsService.ShouldShowUniqueViewsByDefault;
            IsClonesSeriesVisible       = trendsChartSettingsService.ShouldShowClonesByDefault;
            IsUniqueClonesSeriesVisible = trendsChartSettingsService.ShouldShowUniqueClonesByDefault;

            ViewsCardTappedCommand        = new Command(() => IsViewsSeriesVisible = !IsViewsSeriesVisible);
            UniqueViewsCardTappedCommand  = new Command(() => IsUniqueViewsSeriesVisible = !IsUniqueViewsSeriesVisible);
            ClonesCardTappedCommand       = new Command(() => IsClonesSeriesVisible = !IsClonesSeriesVisible);
            UniqueClonesCardTappedCommand = new Command(() => IsUniqueClonesSeriesVisible = !IsUniqueClonesSeriesVisible);

            RefreshState = RefreshState.Uninitialized;

            FetchDataCommand = new AsyncCommand <(Repository Repository, CancellationToken CancellationToken)>(tuple => ExecuteFetchDataCommand(tuple.Repository, tuple.CancellationToken));
        }
Exemple #4
0
        public ReferringSitesViewModel(GitHubApiV3Service gitHubApiV3Service, AnalyticsService analyticsService) : base(analyticsService)
        {
            _gitHubApiV3Service = gitHubApiV3Service;
            RefreshCommand      = new AsyncCommand <(string Owner, string Repository)>(repo => ExecuteRefreshCommand(repo.Owner, repo.Repository));

            //https://codetraveler.io/2019/09/11/using-observablecollection-in-a-multi-threaded-xamarin-forms-application/
            Xamarin.Forms.BindingBase.EnableCollectionSynchronization(ReferringSitesCollection, null, ObservableCollectionCallback);
        }
Exemple #5
0
 public TrendsViewModel(GitHubApiV3Service gitHubApiV3Service,
                        AnalyticsService analyticsService,
                        ReviewService reviewService) : base(analyticsService)
 {
     _reviewService      = reviewService;
     _gitHubApiV3Service = gitHubApiV3Service;
     FetchDataCommand    = new AsyncCommand <Repository>(repo => ExecuteFetchDataCommand(repo));
 }
 public GitTrendsStatisticsService(IPreferences preferences,
                                   IAnalyticsService analyticsService,
                                   GitHubApiV3Service gitHubApiV3Service,
                                   ImageCachingService imageCachingService)
 {
     _preferences         = preferences;
     _analyticsService    = analyticsService;
     _gitHubApiV3Service  = gitHubApiV3Service;
     _imageCachingService = imageCachingService;
 }
 public GitHubApiRepositoriesService(IAnalyticsService analyticsService,
                                     GitHubUserService gitHubUserService,
                                     GitHubApiV3Service gitHubApiV3Service,
                                     GitHubGraphQLApiService gitHubGraphQLApiService)
 {
     _analyticsService        = analyticsService;
     _gitHubUserService       = gitHubUserService;
     _gitHubApiV3Service      = gitHubApiV3Service;
     _gitHubGraphQLApiService = gitHubGraphQLApiService;
 }
Exemple #8
0
 public BackgroundFetchService(AnalyticsService analyticsService,
                               GitHubApiV3Service gitHubApiV3Service,
                               GitHubGraphQLApiService gitHubGraphQLApiService,
                               RepositoryDatabase repositoryDatabase,
                               NotificationService notificationService)
 {
     _analyticsService        = analyticsService;
     _gitHubApiV3Service      = gitHubApiV3Service;
     _gitHubGraphQLApiService = gitHubGraphQLApiService;
     _repositoryDatabase      = repositoryDatabase;
     _notificationService     = notificationService;
 }
 public LibrariesService(IPreferences preferences,
                         IAnalyticsService analyticsService,
                         GitHubApiV3Service gitHubApiV3Service,
                         ImageCachingService imageCachingService,
                         AzureFunctionsApiService azureFunctionsApiService)
 {
     _preferences              = preferences;
     _analyticsService         = analyticsService;
     _gitHubApiV3Service       = gitHubApiV3Service;
     _imageCachingService      = imageCachingService;
     _azureFunctionsApiService = azureFunctionsApiService;
 }
Exemple #10
0
        public TrendsViewModel(GitHubApiV3Service gitHubApiV3Service,
                               AnalyticsService analyticsService,
                               TrendsChartSettingsService trendsChartSettingsService) : base(analyticsService)
        {
            _gitHubApiV3Service = gitHubApiV3Service;

            IsViewsSeriesVisible        = trendsChartSettingsService.ShouldShowViewsByDefault;
            IsUniqueViewsSeriesVisible  = trendsChartSettingsService.ShouldShowUniqueViewsByDefault;
            IsClonesSeriesVisible       = trendsChartSettingsService.ShouldShowClonesByDefault;
            IsUniqueClonesSeriesVisible = trendsChartSettingsService.ShouldShowUniqueClonesByDefault;

            ViewsCardTappedCommand        = new Command(() => IsViewsSeriesVisible = !IsViewsSeriesVisible);
            UniqueViewsCardTappedCommand  = new Command(() => IsUniqueViewsSeriesVisible = !IsUniqueViewsSeriesVisible);
            ClonesCardTappedCommand       = new Command(() => IsClonesSeriesVisible = !IsClonesSeriesVisible);
            UniqueClonesCardTappedCommand = new Command(() => IsUniqueClonesSeriesVisible = !IsUniqueClonesSeriesVisible);

            FetchDataCommand = new AsyncCommand <(Repository Repository, CancellationToken CancellationToken)>(tuple => ExecuteFetchDataCommand(tuple.Repository, tuple.CancellationToken));
        }
        public RepositoryViewModel(RepositoryDatabase repositoryDatabase,
                                   GitHubAuthenticationService gitHubAuthenticationService,
                                   GitHubGraphQLApiService gitHubGraphQLApiService,
                                   AnalyticsService analyticsService,
                                   SortingService sortingService,
                                   GitHubApiV3Service gitHubApiV3Service) : base(analyticsService)
        {
            _repositoryDatabase          = repositoryDatabase;
            _gitHubAuthenticationService = gitHubAuthenticationService;
            _gitHubGraphQLApiService     = gitHubGraphQLApiService;
            _sortingService     = sortingService;
            _gitHubApiV3Service = gitHubApiV3Service;

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

            _gitHubAuthenticationService.LoggedOut += HandleGitHubAuthenticationServiceLoggedOut;
        }
Exemple #12
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)}";
        }
Exemple #13
0
        public RepositoryViewModel(IMainThread mainThread,
                                   ImageCachingService imageService,
                                   IAnalyticsService analyticsService,
                                   GitHubUserService gitHubUserService,
                                   MobileSortingService sortingService,
                                   RepositoryDatabase repositoryDatabase,
                                   GitHubApiV3Service gitHubApiV3Service,
                                   GitHubGraphQLApiService gitHubGraphQLApiService,
                                   GitHubApiExceptionService gitHubApiExceptionService,
                                   GitHubAuthenticationService gitHubAuthenticationService,
                                   GitHubApiRepositoriesService gitHubApiRepositoriesService) : base(analyticsService, mainThread)
        {
            LanguageService.PreferredLanguageChanged += HandlePreferredLanguageChanged;

            SetTitleText();

            _imageService                 = imageService;
            _gitHubUserService            = gitHubUserService;
            _mobileSortingService         = sortingService;
            _repositoryDatabase           = repositoryDatabase;
            _gitHubApiV3Service           = gitHubApiV3Service;
            _gitHubGraphQLApiService      = gitHubGraphQLApiService;
            _gitHubApiExceptionService    = gitHubApiExceptionService;
            _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;
        }
 public ReferringSitesViewModel(GitHubApiV3Service gitHubApiV3Service, AnalyticsService analyticsService) : base(analyticsService)
 {
     _gitHubApiV3Service = gitHubApiV3Service;
     RefreshCommand      = new AsyncCommand <(string Owner, string Repository)>(repo => ExecuteRefreshCommand(repo.Owner, repo.Repository));
 }
Exemple #15
0
 public TrendsViewModel(GitHubApiV3Service gitHubApiV3Service, AnalyticsService analyticsService) : base(analyticsService)
 {
     _gitHubApiV3Service = gitHubApiV3Service;
     FetchDataCommand    = new AsyncCommand <(string Owner, string Repository)>(repo => ExecuteFetchDataCommand(repo.Owner, repo.Repository));
 }