private void TellMeMore()
 {
     var view = new UpgradeViewController();
     view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem { Image = Images.Buttons.CancelButton };
     view.NavigationItem.LeftBarButtonItem.GetClickedObservable().Subscribe(_ => DismissViewController(true, null));
     PresentViewController(new ThemedNavigationController(view), true, null);
 }
Exemple #2
0
        private async Task RegisterPushNotifications(bool enabled)
        {
            if (!_featuresService.IsProEnabled)
            {
                var response = await _alertDialogService.PromptYesNo(
                    "Requires Activation",
                    "Push notifications require activation. Would you like to go there now to activate push notifications?");

                if (response)
                {
                    UpgradeViewController.Present(this);
                }

                return;
            }

            if (enabled)
            {
                await _pushNotificationsService.Register();
            }
            else
            {
                await _pushNotificationsService.Deregister();
            }

            _applicationService.Account.IsPushNotificationsEnabled = enabled;
            await _applicationService.UpdateActiveAccount();
        }
        private void TellMeMore()
        {
            var view = new UpgradeViewController();

            view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel);
            view.NavigationItem.LeftBarButtonItem.GetClickedObservable().Subscribe(_ => DismissViewController(true, null));
            PresentViewController(new ThemedNavigationController(view), true, null);
        }
        private void TellMeMore()
        {
            var view = new UpgradeViewController();

            view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem {
                Image = Images.Cancel
            };
            view.OnActivation(d => d(view.NavigationItem.LeftBarButtonItem.GetClickedObservable()
                                     .Subscribe(_ => view.DismissViewController(true, null))));
            PresentViewController(new ThemedNavigationController(view), true, null);
        }
 private void EnterpriseButtonTouch()
 {
     if (_featuresService.IsProEnabled)
     {
         NavigationController.PushViewController(new AddAccountViewController(), true);
     }
     else
     {
         UpgradeViewController.Present(this);
     }
 }
Exemple #6
0
        private void EnterpriseButtonTouch()
        {
            var features = Mvx.Resolve <IFeaturesService>();

            if (features.IsProEnabled)
            {
                NavigationController.PushViewController(new AddAccountViewController(), true);
            }
            else
            {
                UpgradeViewController.Present(this);
            }
        }
Exemple #7
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TellMeMoreButton.BackgroundColor = UIColor.FromRGB(0x27, 0xae, 0x60);
            TellMeMoreButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            TellMeMoreButton.Layer.CornerRadius = 6f;
            TellMeMoreButton.TouchUpInside     += (_, __) => {
                var view = new UpgradeViewController();
                view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Done,
                                                                            (s, e) => DismissViewController(true, null));
                PresentViewController(new ThemedNavigationController(view), true, null);
            };
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            Button.BackgroundColor = UIColor.FromRGB(0x27, 0xae, 0x60);
            Button.SetTitleColor(UIColor.White, UIControlState.Normal);
            Button.Layer.CornerRadius = 6f;

            OnActivation(d =>
            {
                d(Button.GetClickedObservable()
                  .Subscribe(_ => UpgradeViewController.Present(this)));
            });
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            TellMeMoreButton.BackgroundColor = UIColor.FromRGB(0x27, 0xae, 0x60);
            TellMeMoreButton.SetTitleColor(UIColor.White, UIControlState.Normal);
            TellMeMoreButton.Layer.CornerRadius = 6f;
            TellMeMoreButton.TouchUpInside     += (_, __) => {
                var view = new UpgradeViewController();
                view.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Done,
                                                                            (s, e) => DismissViewController(true, null));
                PresentViewController(new ThemedNavigationController(view), true, null);
            };

            var appDelegate = UIApplication.SharedApplication.Delegate as AppDelegate;
            var isPro       = appDelegate?.IsPro ?? false;

            if (isPro)
            {
                TitleLabel.Text       = "Pro Enabled!";
                DescriptionLabel.Text = "Thanks for your continued support! The following Pro features have been activated for your device:\n\n• Private Repositories\n• Enterprise Support\n• Push Notifications";
            }
        }
Exemple #10
0
        private void CreateTable()
        {
            var currentAccount = _applicationService.Account;
            var accountSection = new Section("Account");

            var showOrganizationsInEvents = new BooleanElement("Show Organizations in Events", currentAccount.ShowOrganizationsInEvents);

            showOrganizationsInEvents.Changed.Subscribe(x => {
                currentAccount.ShowOrganizationsInEvents = x;
                _applicationService.UpdateActiveAccount().ToBackground();
            });

            var showOrganizations = new BooleanElement("List Organizations in Menu", currentAccount.ExpandOrganizations);

            showOrganizations.Changed.Subscribe(x => {
                currentAccount.ExpandOrganizations = x;
                _applicationService.UpdateActiveAccount().ToBackground();
            });

            var repoDescriptions = new BooleanElement("Show Repo Descriptions", currentAccount.ShowRepositoryDescriptionInList);

            repoDescriptions.Changed.Subscribe(x => {
                currentAccount.ShowRepositoryDescriptionInList = x;
                _applicationService.UpdateActiveAccount().ToBackground();
            });

            var startupView = new StringElement(
                "Startup View", _applicationService.Account.DefaultStartupView, UITableViewCellStyle.Value1)
            {
                Accessory = UITableViewCellAccessory.DisclosureIndicator,
            };

            startupView.Clicked.Subscribe(_ =>
            {
                var viewController = new DefaultStartupViewController(
                    () => NavigationController.PopToViewController(this, true));
                NavigationController.PushViewController(viewController, true);
            });

            var syntaxHighlighter = new ButtonElement(
                "Syntax Highlighter",
                _applicationService.Account.CodeEditTheme?.Humanize(LetterCasing.Title) ?? "Default");

            syntaxHighlighter
            .Clicked
            .Select(_ => new SyntaxHighlighterViewController())
            .Subscribe(vc => this.PushViewController(vc));

            var pushNotifications = new BooleanElement(
                "Push Notifications",
                _applicationService.Account.IsPushNotificationsEnabled == true);

            pushNotifications
            .Changed
            .InvokeReactiveCommand(_registerPushNotifications);

            accountSection.Add(pushNotifications);

            var source = new StringElement("Source Code");

            source
            .Clicked
            .Select(_ => RepositoryViewController.CreateCodeHubViewController())
            .Subscribe(vc => this.PushViewController(vc));

            var follow = new StringElement("Follow On Twitter");

            follow
            .Clicked
            .Select(_ => new NSUrl("https://twitter.com/CodeHubapp"))
            .Subscribe(url => UIApplication.SharedApplication.OpenUrl(url));

            var rate = new StringElement("Rate This App");

            rate
            .Clicked
            .Select(_ => new NSUrl("https://itunes.apple.com/us/app/codehub-github-for-ios/id707173885?mt=8"))
            .Subscribe(url => UIApplication.SharedApplication.OpenUrl(url));

            var aboutSection = new Section("About", "Thank you for downloading. Enjoy!")
            {
                source,
                follow,
                rate
            };

            if (_featuresService.IsProEnabled)
            {
                var upgrades = new StringElement("Upgrades");
                upgrades.Clicked.Subscribe(_ => UpgradeViewController.Present(this));
                aboutSection.Add(upgrades);
            }

            var appVersion = new StringElement("App Version", UIApplication.SharedApplication.GetVersion())
            {
                Accessory      = UITableViewCellAccessory.None,
                SelectionStyle = UITableViewCellSelectionStyle.None
            };

            aboutSection.Add(appVersion);

            var appearanceSection = new Section("Appearance")
            {
                showOrganizationsInEvents,
                showOrganizations,
                repoDescriptions,
                startupView,
                syntaxHighlighter
            };

            Root.Reset(accountSection, appearanceSection, aboutSection);
        }