Esempio n. 1
0
        async void HandleContributorSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var collectionView = (CollectionView)sender;

            collectionView.SelectedItem = null;

            if (e.CurrentSelection.FirstOrDefault() is Contributor contributor)
            {
                AnalyticsService.Track("Contributor Tapped", nameof(Contributor.Login), contributor.Login);

                await _deepLinkingService.OpenBrowser(contributor.GitHubUrl);
            }
        }
Esempio n. 2
0
        public AboutViewModel(IMainThread mainThread,
                              LibrariesService librariesService,
                              IAnalyticsService analyticsService,
                              DeepLinkingService deepLinkingService,
                              GitTrendsStatisticsService gitTrendsStatisticsService) : base(analyticsService, mainThread)
        {
            if (gitTrendsStatisticsService.Stars.HasValue)
            {
                Stars = gitTrendsStatisticsService.Stars.Value;
            }

            if (gitTrendsStatisticsService.Watchers.HasValue)
            {
                Watchers = gitTrendsStatisticsService.Watchers.Value;
            }

            if (gitTrendsStatisticsService.Forks.HasValue)
            {
                Forks = gitTrendsStatisticsService.Forks.Value;
            }

            InstalledLibraries    = librariesService.InstalledLibraries;
            GitTrendsContributors = gitTrendsStatisticsService.Contributors.OrderByDescending(x => x.ContributionCount).ToList();

            ViewOnGitHubCommand = new AsyncCommand(() =>
            {
                if (gitTrendsStatisticsService?.GitHubUri is null)
                {
                    return(Task.CompletedTask);
                }

                AnalyticsService.Track("View On GitHub Tapped");

                return(deepLinkingService.OpenBrowser(gitTrendsStatisticsService.GitHubUri));
            });

            RequestFeatureCommand = new AsyncCommand(() =>
            {
                if (gitTrendsStatisticsService?.GitHubUri is null)
                {
                    return(Task.CompletedTask);
                }

                AnalyticsService.Track("Request Feature Tapped");

                return(deepLinkingService.OpenBrowser(gitTrendsStatisticsService.GitHubUri + "/issues/new?template=feature_request.md"));
            });
        }
        async void HandleCollectionViewSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var collectionView = (CollectionView)sender;

            collectionView.SelectedItem = null;

            if (e?.CurrentSelection.FirstOrDefault() is ReferringSiteModel referingSite &&
                referingSite.IsReferrerUriValid &&
                referingSite.ReferrerUri != null)
            {
                AnalyticsService.Track("Referring Site Tapped", new Dictionary <string, string>
                {
                    { nameof(ReferringSiteModel) + nameof(ReferringSiteModel.Referrer), referingSite.Referrer },
                    { nameof(ReferringSiteModel) + nameof(ReferringSiteModel.ReferrerUri), referingSite.ReferrerUri.ToString() }
                });

                await deepLinkingService.OpenBrowser(referingSite.ReferrerUri);
            }
        }