Ejemplo n.º 1
0
 public TrendsChartSettingsService(AnalyticsService analyticsService) => _analyticsService = analyticsService;
Ejemplo n.º 2
0
 protected BaseOnboardingContentPage(AnalyticsService analyticsService, in Color backgroundColor, in string nextButtonText, in int carouselPositionIndex) : base(analyticsService)
Ejemplo n.º 3
0
 public NotificationService(AnalyticsService analyticsService, DeepLinkingService deepLinkingService) =>
 (_analyticsService, _deepLinkingService) = (analyticsService, deepLinkingService);
Ejemplo n.º 4
0
        public ReferringSitesPage(DeepLinkingService deepLinkingService,
                                  ReferringSitesViewModel referringSitesViewModel,
                                  Repository repository,
                                  AnalyticsService analyticsService,
                                  ThemeService themeService,
                                  ReviewService reviewService) : base(referringSitesViewModel, analyticsService, PageTitles.ReferringSitesPage)
        {
            _deepLinkingService = deepLinkingService;
            _reviewService      = reviewService;

            ViewModel.PullToRefreshFailed += HandlePullToRefreshFailed;
            reviewService.ReviewCompleted += HandleReviewCompleted;

            var collectionView = new CollectionView
            {
                AutomationId    = ReferringSitesPageAutomationIds.CollectionView,
                BackgroundColor = Color.Transparent,
                ItemTemplate    = new ReferringSitesDataTemplate(),
                SelectionMode   = SelectionMode.Single,
                ItemsLayout     = new LinearItemsLayout(ItemsLayoutOrientation.Vertical),
                //Set iOS Header to `new BoxView { HeightRequest = titleRowHeight + titleTopMargin }` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879
                Header = Device.RuntimePlatform is Device.Android ? new BoxView {
                    HeightRequest = ReferringSitesDataTemplate.BottomPadding
                } : null,
                Footer = Device.RuntimePlatform is Device.Android ? new BoxView {
                    HeightRequest = ReferringSitesDataTemplate.TopPadding
                } : null,
                EmptyView = new EmptyDataView("EmptyReferringSitesList", ReferringSitesPageAutomationIds.EmptyDataView)
                            .Bind(IsVisibleProperty, nameof(ReferringSitesViewModel.IsEmptyDataViewEnabled))
                            .Bind(EmptyDataView.TextProperty, nameof(ReferringSitesViewModel.EmptyDataViewText))
            };

            collectionView.SelectionChanged += HandleCollectionViewSelectionChanged;
            collectionView.SetBinding(CollectionView.ItemsSourceProperty, nameof(ReferringSitesViewModel.MobileReferringSitesList));

            _refreshView = new RefreshView
            {
                AutomationId     = ReferringSitesPageAutomationIds.RefreshView,
                CommandParameter = (repository.OwnerLogin, repository.Name, repository.Url, _refreshViewCancelltionTokenSource.Token),
                Content          = collectionView
            };
            _refreshView.SetDynamicResource(RefreshView.RefreshColorProperty, nameof(BaseTheme.PullToRefreshColor));
            _refreshView.SetBinding(RefreshView.CommandProperty, nameof(ReferringSitesViewModel.RefreshCommand));
            _refreshView.SetBinding(RefreshView.IsRefreshingProperty, nameof(ReferringSitesViewModel.IsRefreshing));

            var relativeLayout = new RelativeLayout();

            //Add Title and Close Button to UIModalPresentationStyle.FormSheet
            if (Device.RuntimePlatform is Device.iOS)
            {
                const int titleTopMargin = 10;
                const int titleRowHeight = 50;

                var closeButton = new Button
                {
                    Text              = "Close",
                    FontFamily        = FontFamilyConstants.RobotoRegular,
                    HeightRequest     = titleRowHeight * 3 / 5,
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                    AutomationId      = ReferringSitesPageAutomationIds.CloseButton,
                    Padding           = new Thickness(5, 0),
                };
                closeButton.Clicked += HandleCloseButtonClicked;
                closeButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.NavigationBarTextColor));
                closeButton.SetDynamicResource(Button.BorderColorProperty, nameof(BaseTheme.BorderButtonBorderColor));
                closeButton.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.NavigationBarBackgroundColor));

                var titleLabel = new Label
                {
                    FontSize   = 30,
                    Text       = PageTitles.ReferringSitesPage,
                    FontFamily = FontFamilyConstants.RobotoMedium,
                }.Center().TextCenterVertical();
                titleLabel.SetDynamicResource(Label.TextColorProperty, nameof(BaseTheme.TextColor));

                closeButton.Margin = titleLabel.Margin = new Thickness(0, titleTopMargin, 0, 0);

                var titleShadow = new BoxView();
                titleShadow.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.PageBackgroundColor));

                if (isLightTheme(themeService.Preference))
                {
                    titleShadow.On <iOS>().SetIsShadowEnabled(true)
                    .SetShadowColor(Color.Gray)
                    .SetShadowOffset(new Size(0, 1))
                    .SetShadowOpacity(0.5)
                    .SetShadowRadius(4);
                }


                relativeLayout.Children.Add(_refreshView,
                                            Constraint.Constant(0),
                                            Constraint.Constant(titleRowHeight),                                    //Set to `0` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879
                                            Constraint.RelativeToParent(parent => parent.Width),
                                            Constraint.RelativeToParent(parent => parent.Height - titleRowHeight)); //Set to `parent => parent.Height` following this bug fix: https://github.com/xamarin/Xamarin.Forms/issues/9879

                relativeLayout.Children.Add(titleShadow,
                                            Constraint.Constant(0),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => parent.Width),
                                            Constraint.Constant(titleRowHeight));

                relativeLayout.Children.Add(titleLabel,
                                            Constraint.Constant(10),
                                            Constraint.Constant(0));

                relativeLayout.Children.Add(closeButton,
                                            Constraint.RelativeToParent(parent => parent.Width - closeButton.GetWidth(parent) - 10),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => closeButton.GetWidth(parent)));
            }
            else
            {
                relativeLayout.Children.Add(_refreshView,
                                            Constraint.Constant(0),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => parent.Width),
                                            Constraint.RelativeToParent(parent => parent.Height));
            }

            relativeLayout.Children.Add(_storeRatingRequestView,
                                        Constraint.Constant(0),
                                        Constraint.RelativeToParent(parent => parent.Height - _storeRatingRequestView.GetHeight(parent)),
                                        Constraint.RelativeToParent(parent => parent.Width));

            Content = relativeLayout;
Ejemplo n.º 5
0
 public GitHubApiV3Service(AnalyticsService analyticsService) : base(analyticsService)
 {
 }
Ejemplo n.º 6
0
        async void HandleInitializationComplete(object sender, InitializationCompleteEventArgs e)
        {
            _animationCancellationToken?.Cancel();
#if DEBUG
            await ChangeLabelText(new FormattedString
            {
                Spans =
                {
                    new Span
                    {
                        FontAttributes = FontAttributes.Bold,
                        Text           = "Preview Mode"
                    },
                    new Span
                    {
                        Text = "\nCertain license warnings may appear"
                    }
                }
            });

            //Display Text
            await Task.Delay(500);

            await NavigateToRepositoryPage();
#else
            if (e.IsInitializationSuccessful)
            {
                await ChangeLabelText("Let's go!");

                await NavigateToRepositoryPage();
            }
            else
            {
                await ChangeLabelText(new FormattedString
                {
                    Spans =
                    {
                        new Span
                        {
                            FontAttributes = FontAttributes.Bold,
                            Text           = "Initialization Failed"
                        },
                        new Span
                        {
                            Text = "\nPlease Ensure Internet Connection Is Available"
                        }
                    }
                });

                AnalyticsService.Track("Initialization Failed");
            }
#endif

            Task NavigateToRepositoryPage()
            {
                return(MainThread.InvokeOnMainThreadAsync(async() =>
                {
                    //Explode & Fade Everything
                    var explodeImageTask = Task.WhenAll(Content.ScaleTo(100, 250, Easing.CubicOut), Content.FadeTo(0, 250, Easing.CubicIn));
                    BackgroundColor = (Color)Application.Current.Resources[nameof(BaseTheme.PageBackgroundColor)];

                    await explodeImageTask;

                    using var scope = ContainerService.Container.BeginLifetimeScope();
                    Application.Current.MainPage = new BaseNavigationPage(scope.Resolve <RepositoryPage>());
                }));
            }
        }
 public ConnectToGitHubOnboardingPage(GitHubAuthenticationService gitHubAuthenticationService, AnalyticsService analyticsService)
     : base(analyticsService, Color.FromHex(BaseTheme.CoralColorHex), OnboardingConstants.TryDemoText, 3)
 {
     gitHubAuthenticationService.AuthorizeSessionCompleted += HandleAuthorizeSessionCompleted;
 }
Ejemplo n.º 8
0
 public SyncFusionService(AzureFunctionsApiService azureFunctionsApiService, AnalyticsService analyticsService) =>
 (_azureFunctionsApiService, _analyticsService) = (azureFunctionsApiService, analyticsService);
Ejemplo n.º 9
0
        public ThemeService(AnalyticsService analyticsService)
        {
            _analyticsService = analyticsService;

            Application.Current.RequestedThemeChanged += HandleRequestedThemeChanged;
        }
Ejemplo n.º 10
0
        public SplashScreenViewModel(SyncFusionService syncfusionService, AnalyticsService analyticsService) : base(analyticsService)
        {
            _syncFusionService = syncfusionService;

            InitializeAppCommand = new AsyncCommand(ExecuteInitializeAppCommand);
        }
Ejemplo n.º 11
0
 protected BaseMobileApiService(AnalyticsService analyticsService) => AnalyticsService = analyticsService;
Ejemplo n.º 12
0
 public ReferringSitesViewModel(GitHubApiV3Service gitHubApiV3Service, AnalyticsService analyticsService) : base(analyticsService)
 {
     _gitHubApiV3Service = gitHubApiV3Service;
     RefreshCommand      = new AsyncCommand <(string Owner, string Repository)>(repo => ExecuteRefreshCommand(repo.Owner, repo.Repository));
 }
Ejemplo n.º 13
0
 public GitTrendsOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.LightTealColorHex), OnboardingConstants.SkipText, 0)
 {
 }
Ejemplo n.º 14
0
        void HandleSkipButtonTapped(object sender, EventArgs e)
        {
            AnalyticsService.Track("Skip Button Tapped");

            MainThread.BeginInvokeOnMainThread(() => CurrentPage = Children.Last());
        }
Ejemplo n.º 15
0
 public NotificationsOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.LightTealColorHex), OnboardingConstants.SkipText, 2)
 {
 }
Ejemplo n.º 16
0
 public BaseViewModel(AnalyticsService analyticsService) => AnalyticsService = analyticsService;
Ejemplo n.º 17
0
 public GitHubGraphQLApiService(AnalyticsService analyticsService) : base(analyticsService)
 {
 }
Ejemplo n.º 18
0
 public ChartOnboardingPage(AnalyticsService analyticsService) : base(analyticsService, Color.FromHex(BaseTheme.CoralColorHex), OnboardingConstants.SkipText, 1)
 {
 }
Ejemplo n.º 19
0
 Task CreatedByLabelTapped()
 {
     AnalyticsService.Track("CreatedBy Label Tapped");
     return(_deepLinkingService.OpenApp("twitter://user?id=3418408341", "https://twitter.com/intent/user?user_id=3418408341"));
 }
Ejemplo n.º 20
0
        public ReferringSitesPage(ReferringSitesViewModel referringSitesViewModel,
                                  Repository repository,
                                  AnalyticsService analyticsService) : base(PageTitles.ReferringSitesPage, referringSitesViewModel, analyticsService)
        {
            const int titleRowHeight = 50;
            const int titleTopMargin = 15;

            var collectionView = new CollectionView
            {
                AutomationId  = ReferringSitesPageAutomationIds.CollectionView,
                ItemTemplate  = new ReferringSitesDataTemplateSelector(),
                SelectionMode = SelectionMode.Single
            };

            collectionView.SelectionChanged += HandleCollectionViewSelectionChanged;
            collectionView.SetBinding(CollectionView.ItemsSourceProperty, nameof(ReferringSitesViewModel.MobileReferringSitesList));

            _refreshView = new RefreshView
            {
                AutomationId     = ReferringSitesPageAutomationIds.RefreshView,
                CommandParameter = (repository.OwnerLogin, repository.Name),
                Content          = collectionView
            };
            _refreshView.SetDynamicResource(RefreshView.RefreshColorProperty, nameof(BaseTheme.RefreshControlColor));
            _refreshView.SetBinding(RefreshView.CommandProperty, nameof(ReferringSitesViewModel.RefreshCommand));
            _refreshView.SetBinding(RefreshView.IsRefreshingProperty, nameof(ReferringSitesViewModel.IsRefreshing));

            //Add Title and Back Button to UIModalPresentationStyle.FormSheet
            if (Device.RuntimePlatform is Device.iOS)
            {
                var closeButton = new Button
                {
                    AutomationId      = ReferringSitesPageAutomationIds.CloseButton,
                    Text              = "Close",
                    HorizontalOptions = LayoutOptions.End,
                    VerticalOptions   = LayoutOptions.Center,
                    HeightRequest     = titleRowHeight * 3 / 5,
                    Padding           = new Thickness(5, 0)
                };
                closeButton.Clicked += HandleCloseButtonClicked;
                closeButton.SetDynamicResource(Button.TextColorProperty, nameof(BaseTheme.NavigationBarTextColor));
                closeButton.SetDynamicResource(Button.BorderColorProperty, nameof(BaseTheme.TrendsChartSettingsBorderColor));
                closeButton.SetDynamicResource(Button.BackgroundColorProperty, nameof(BaseTheme.NavigationBarBackgroundColor));


                var titleRowBlurView = new BoxView {
                    Opacity = 0.5
                };
                titleRowBlurView.SetDynamicResource(BackgroundColorProperty, nameof(BaseTheme.PageBackgroundColor));

                collectionView.Header = new BoxView {
                    HeightRequest = titleRowHeight + titleTopMargin
                };

                var titleLabel = new Label
                {
                    FontAttributes = FontAttributes.Bold,
                    Text           = PageTitles.ReferringSitesPage,
                    FontSize       = 30
                };
                titleLabel.SetDynamicResource(Label.TextColorProperty, nameof(BaseTheme.TextColor));

                closeButton.Margin = titleLabel.Margin = new Thickness(0, titleTopMargin, 0, 0);

                var activityIndicator = new ActivityIndicator
                {
                    AutomationId = ReferringSitesPageAutomationIds.ActivityIndicator,
                };
                activityIndicator.SetDynamicResource(ActivityIndicator.ColorProperty, nameof(BaseTheme.RefreshControlColor));
                activityIndicator.SetBinding(IsVisibleProperty, nameof(ReferringSitesViewModel.IsActivityIndicatorVisible));
                activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, nameof(ReferringSitesViewModel.IsActivityIndicatorVisible));

                var relativeLayout = new RelativeLayout();

                relativeLayout.Children.Add(_refreshView,
                                            Constraint.Constant(0),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => parent.Width),
                                            Constraint.RelativeToParent(parent => parent.Height));

                relativeLayout.Children.Add(titleRowBlurView,
                                            Constraint.Constant(0),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => parent.Width),
                                            Constraint.Constant(titleRowHeight));

                relativeLayout.Children.Add(titleLabel,
                                            Constraint.Constant(10),
                                            Constraint.Constant(0));

                relativeLayout.Children.Add(closeButton,
                                            Constraint.RelativeToParent(parent => parent.Width - GetWidth(parent, closeButton) - 10),
                                            Constraint.Constant(0),
                                            Constraint.RelativeToParent(parent => GetWidth(parent, closeButton)));

                relativeLayout.Children.Add(activityIndicator,
                                            Constraint.RelativeToParent(parent => parent.Width / 2 - GetWidth(parent, activityIndicator) / 2),
                                            Constraint.RelativeToParent(parent => parent.Height / 2 - GetHeight(parent, activityIndicator) / 2));

                Content = relativeLayout;
            }
            else
            {
                Content = _refreshView;
            }
        }
Ejemplo n.º 21
0
 public DeepLinkingService(AnalyticsService analyticsService) => _analyticsService = analyticsService;