Example #1
0
 private void GoToRepository()
 => this.PushViewController(RepositoryViewController.CreateCodeHubViewController());
Example #2
0
 public void Setup()
 {
     m_view       = A.Fake <IRepositoryView>();
     m_repository = A.Fake <IGitRepository>();
     m_controller = new RepositoryViewController(m_view, m_repository, A.Fake <ILogger>());
 }
Example #3
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);
        }