Beispiel #1
0
        public LoginViewModel(INetworkActivityService networkActivity)
        {
            LoginCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var account = new Account();

                var connection = new Octokit.Connection(new Octokit.ProductHeaderValue("RepoStumble"));
                var client     = new Octokit.OauthClient(connection);
                var token      = await client.CreateAccessToken(new Octokit.OauthTokenRequest(ClientId, ClientSecret, LoginCode));

                connection.Credentials = new Octokit.Credentials(token.AccessToken);
                var githubClient       = new Octokit.GitHubClient(connection);
                var info          = await githubClient.User.Current();
                account.AvatarUrl = info.AvatarUrl;
                account.Username  = info.Login;
                account.Fullname  = info.Name;
                account.OAuth     = token.AccessToken;
                account.Save();

                DismissCommand.ExecuteIfCan();
            });

            LoginCommand.IsExecuting.Skip(1).Where(x => x).Subscribe(x => networkActivity.PushNetworkActive());
            LoginCommand.IsExecuting.Skip(1).Where(x => !x).Subscribe(x => networkActivity.PopNetworkActive());
        }
Beispiel #2
0
        public ShowcaseViewModel(INetworkActivityService networkActivity, ShowcaseRepository showcaseRepository)
        {
            Title = "Showcase";

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType <Octokit.Repository>().Subscribe(x =>
            {
                var vm = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner.Login, x.Name);
                ShowViewModel(vm);
            });

            var repositories = new ReactiveList <Octokit.Repository>();

            Repositories = repositories;
            LoadCommand  = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var showcaseRepos = await showcaseRepository.GetShowcaseRepositories(ShowcaseSlug);
                Title             = showcaseRepos.Name;
                Showcase          = new Showcase {
                    Slug = showcaseRepos.Slug, Description = showcaseRepos.Description, Name = showcaseRepos.Name
                };
                repositories.Reset(showcaseRepos.Repositories);
            });
            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public LanguagesViewModel(IJsonSerializationService jsonSerializationService, INetworkActivityService networkActivity)
        {
            var languages = new ReactiveList<LanguageModel>();

            Languages = languages.CreateDerivedCollection(
                x => new LanguageItemViewModel(x.Name, x.Slug), 
                x => x.Name.StartsWith(SearchKeyword ?? string.Empty, StringComparison.OrdinalIgnoreCase), 
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            Languages
                .Changed.Select(_ => Unit.Default)
                .Merge(this.WhenAnyValue(x => x.SelectedLanguage).Select(_ => Unit.Default))
                .Select(_ => SelectedLanguage)
                .Where(x => x != null)
                .Subscribe(x =>
                {
                    foreach (var l in Languages)
                        l.Selected = l.Slug == x.Slug;
                });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var trendingData = await BlobCache.LocalMachine.DownloadUrl(LanguagesUrl, absoluteExpiration: DateTimeOffset.Now.AddDays(1));
                var langs = jsonSerializationService.Deserialize<List<LanguageModel>>(System.Text.Encoding.UTF8.GetString(trendingData));
                langs.Insert(0, DefaultLanguage);
                languages.Reset(langs);
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
            LoadCommand.ExecuteIfCan();
        }
Beispiel #4
0
 public UpgradesView(IFeaturesService featuresService, INetworkActivityService networkActivityService, IAlertDialogService alertDialogService)
     : base(style: MonoTouch.UIKit.UITableViewStyle.Plain)
 {
     _featuresService        = featuresService;
     _networkActivityService = networkActivityService;
     _alertDialogService     = alertDialogService;
 }
        public LoginViewModel(INetworkActivityService networkActivity)
        {
            LoginCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var account = new Account();

                var connection = new Octokit.Connection(new Octokit.ProductHeaderValue("RepoStumble"));
                var client = new Octokit.OauthClient(connection);
                var token = await client.CreateAccessToken(new Octokit.OauthTokenRequest(ClientId, ClientSecret, LoginCode));

                connection.Credentials = new Octokit.Credentials(token.AccessToken);
                var githubClient = new Octokit.GitHubClient(connection);
                var info = await githubClient.User.Current();
                account.AvatarUrl = info.AvatarUrl;
                account.Username = info.Login;
                account.Fullname = info.Name;
                account.OAuth = token.AccessToken;
                account.Save();

                DismissCommand.ExecuteIfCan();
            });

            LoginCommand.IsExecuting.Skip(1).Where(x => x).Subscribe(x => networkActivity.PushNetworkActive());
            LoginCommand.IsExecuting.Skip(1).Where(x => !x).Subscribe(x => networkActivity.PopNetworkActive());
        }
 public static IDisposable TriggerNetworkActivity(this IReactiveCommand @this, INetworkActivityService networkActivity)
 {
     return @this.IsExecuting.Skip(1).Subscribe(x =>
         {
             if (x) networkActivity.PushNetworkActive();
             else networkActivity.PopNetworkActive();
         });
 }
        public RepositoriesTrendingViewModel(IApplicationService applicationService,
                                             IJsonHttpClientService jsonHttpClient, INetworkActivityService networkActivityService)
        {
            _applicationService = applicationService;
            _jsonHttpClient     = jsonHttpClient;

            Title = "Trending";

            var defaultLanguage = LanguagesViewModel.DefaultLanguage;

            SelectedLanguage = new LanguageItemViewModel(defaultLanguage.Name, defaultLanguage.Slug);

            GoToLanguages = ReactiveCommand.Create().WithSubscription(_ =>
            {
                var vm = CreateViewModel <LanguagesViewModel>();
                vm.SelectedLanguage = SelectedLanguage;
                vm.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(x =>
                {
                    SelectedLanguage = x;
                    vm.DismissCommand.ExecuteIfCan();
                });
                ShowViewModel(vm);
            });

            var gotoRepository = new Action <RepositoryItemViewModel>(x =>
            {
                var vm             = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName  = x.Name;
                ShowViewModel(vm);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                var requests = _times.Select(t =>
                {
                    var query = "?since=" + t.Slug;
                    if (SelectedLanguage != null && SelectedLanguage.Slug != null)
                    {
                        query += string.Format("&language={0}", SelectedLanguage.Slug);
                    }
                    return(new { Time = t, Query = _jsonHttpClient.Get <List <TrendingRepositoryModel> >(TrendingUrl + query) });
                }).ToArray();

                await Task.WhenAll(requests.Select(x => x.Query));

                Repositories = requests.Select(r =>
                {
                    var transformedRepos = r.Query.Result.Select(x =>
                                                                 new RepositoryItemViewModel(x.Name, x.Owner, x.AvatarUrl, x.Description, x.Stars, x.Forks, true, gotoRepository));
                    return(new GroupedCollection <RepositoryItemViewModel>(r.Time.Name, new ReactiveList <RepositoryItemViewModel>(transformedRepos)));
                }).ToList();
            });

            LoadCommand.TriggerNetworkActivity(networkActivityService);
            this.WhenAnyValue(x => x.SelectedLanguage).Subscribe(_ => LoadCommand.ExecuteIfCan());
        }
Beispiel #8
0
        public LoginView(IAlertDialogService alertDialogService, INetworkActivityService networkActivityService)
            : base(networkActivityService)
        {
            _alertDialogService = alertDialogService;

            NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Action, (s, e) =>
                                                                    ViewModel.ShowLoginOptionsCommand.ExecuteIfCan());

            this.WhenViewModel(x => x.Title).IsNotNull().Subscribe(x => Title = x);
            this.WhenViewModel(x => x.LoginUrl).IsNotNull().Subscribe(LoadRequest);
        }
        protected ReactiveWebViewController(INetworkActivityService networkActivityService)
        {
            _networkActivityService = networkActivityService;

            Web = new UIWebView {
                ScalesPageToFit = true
            };
            Web.LoadFinished   += OnLoadFinished;
            Web.LoadStarted    += OnLoadStarted;
            Web.LoadError      += OnLoadError;
            Web.ShouldStartLoad = (w, r, n) => ShouldStartLoad(r, n);
        }
        public RepositoriesTrendingViewModel(IApplicationService applicationService, 
            IJsonHttpClientService jsonHttpClient, INetworkActivityService networkActivityService)
        {
            _applicationService = applicationService;
            _jsonHttpClient = jsonHttpClient;

            var defaultLanguage = LanguagesViewModel.DefaultLanguage;
            SelectedLanguage = new LanguageItemViewModel(defaultLanguage.Name, defaultLanguage.Slug);

            GoToLanguages = ReactiveCommand.Create().WithSubscription(_ =>
            {
                var vm = CreateViewModel<LanguagesViewModel>();
                vm.SelectedLanguage = SelectedLanguage;
                vm.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(x => 
                {
                    SelectedLanguage = x;
                    vm.DismissCommand.ExecuteIfCan();
                });
                ShowViewModel(vm);
            });

            var gotoRepository = new Action<RepositoryItemViewModel>(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName = x.Name;
                ShowViewModel(vm);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                var requests = _times.Select(t =>
                {
                    var query = "?since=" + t.Slug;
                    if (SelectedLanguage != null && SelectedLanguage.Slug != null)
                        query += string.Format("&language={0}", SelectedLanguage.Slug);
                    return new { Time = t, Query = _jsonHttpClient.Get<List<TrendingRepositoryModel>>(TrendingUrl + query) };
                }).ToArray();

                await Task.WhenAll(requests.Select(x => x.Query));

                Repositories = requests.Select(r =>
                {
                    var transformedRepos = r.Query.Result.Select(x => 
                        new RepositoryItemViewModel(x.Name, x.Owner, x.AvatarUrl, x.Description, x.Stars, x.Forks, true, gotoRepository));
                    return new GroupedCollection<RepositoryItemViewModel>(r.Time.Name, new ReactiveList<RepositoryItemViewModel>(transformedRepos));
                }).ToList();
            });

            LoadCommand.TriggerNetworkActivity(networkActivityService);
            this.WhenAnyValue(x => x.SelectedLanguage).Subscribe(_ => LoadCommand.ExecuteIfCan());
        }
Beispiel #11
0
        public ReadmeView(INetworkActivityService networkActivityService)
            : base(networkActivityService)
        {
            Web.ScalesPageToFit = true;

            this.WhenViewModel(x => x.ContentText).IsNotNull().Subscribe(x =>
                                                                         LoadContent(new ReadmeRazorView {
                Model = x
            }.GenerateString()));

            this.WhenViewModel(x => x.ShowMenuCommand).Subscribe(x =>
                                                                 NavigationItem.RightBarButtonItem = x.ToBarButtonItem(UIBarButtonSystemItem.Action));
        }
Beispiel #12
0
        public RepositoriesExploreViewModel(IApplicationService applicationService, INetworkActivityService networkActivityService)
        {
            ShowRepositoryDescription = applicationService.Account.ShowRepositoryDescriptionInList;

            Title = "Explore";

            var gotoRepository = new Action <RepositoryItemViewModel>(x =>
            {
                var vm             = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName  = x.Name;
                ShowViewModel(vm);
            });

            var repositories = new ReactiveList <Octokit.Repository>();

            Repositories = repositories.CreateDerivedCollection(x =>
                                                                new RepositoryItemViewModel(x.Name, x.Owner.Login, x.Owner.AvatarUrl,
                                                                                            x.Description, x.StargazersCount, x.ForksCount,
                                                                                            true, gotoRepository));

            SearchCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.SearchText).Select(x => !string.IsNullOrEmpty(x)),
                async t =>
            {
                repositories.Clear();

                try
                {
                    var request  = new Octokit.SearchRepositoriesRequest(SearchText);
                    var response = await applicationService.GitHubClient.Search.SearchRepo(request);
                    repositories.Reset(response.Items);
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to search for repositories. Please try again.", e);
                }
            });

            SearchCommand.IsExecuting.Skip(1).Subscribe(x =>
            {
                if (x)
                {
                    networkActivityService.PushNetworkActive();
                }
                else
                {
                    networkActivityService.PopNetworkActive();
                }
            });
        }
Beispiel #13
0
        public GistFileView(INetworkActivityService networkActivityService)
            : base(networkActivityService)
        {
            this.WhenViewModel(x => x.GistFile).IsNotNull().Subscribe(x =>
                                                                      NavigationItem.RightBarButtonItem = ViewModel.ShowMenuCommand.ToBarButtonItem(UIBarButtonSystemItem.Action));

            this.WhenViewModel(x => x.OpenWithCommand)
            .Switch()
            .Subscribe(_ =>
            {
                UIDocumentInteractionController ctrl = UIDocumentInteractionController.FromUrl(new NSUrl(ViewModel.SourceItem.FileUri.AbsoluteUri));
                ctrl.Delegate = new UIDocumentInteractionControllerDelegate();
                ctrl.PresentOpenInMenu(this.View.Frame, this.View, true);
            });
        }
        public RepositoriesExploreViewModel(IApplicationService applicationService, INetworkActivityService networkActivityService)
        {
            _applicationService = applicationService;

            var gotoRepository = new Action <RepositoryItemViewModel>(x =>
            {
                var vm             = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName  = x.Name;
                ShowViewModel(vm);
            });

            var repositories = new ReactiveList <RepositorySearchModel.RepositoryModel>();

            Repositories = repositories.CreateDerivedCollection(x =>
                                                                new RepositoryItemViewModel(x.Name, x.Owner.Login, x.Owner.AvatarUrl,
                                                                                            x.Description, x.StargazersCount, x.ForksCount,
                                                                                            true, gotoRepository));

            SearchCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.SearchText).Select(x => !string.IsNullOrEmpty(x)),
                async t =>
            {
                try
                {
                    var request      = applicationService.Client.Repositories.SearchRepositories(new[] { SearchText }, new string[] { });
                    request.UseCache = false;
                    var response     = await applicationService.Client.ExecuteAsync(request);
                    repositories.Reset(response.Data.Items);
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to search for repositories. Please try again.", e);
                }
            });

            SearchCommand.IsExecuting.Skip(1).Subscribe(x =>
            {
                if (x)
                {
                    networkActivityService.PushNetworkActive();
                }
                else
                {
                    networkActivityService.PopNetworkActive();
                }
            });
        }
        public TrendingViewModel(INetworkActivityService networkActivity, TrendingRepository trendingRepository)
        {
            SelectedLanguage = _defaultLanguage;

            var repositories = new ReactiveList <TrendingRepositoryViewModel>();

            Repositories = repositories.CreateDerivedCollection(x => x);

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType <Octokit.Repository>().Subscribe(x =>
            {
                var vm = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner.Login, x.Name);
                ShowViewModel(vm);
            });

            GoToLanguages = ReactiveCommand.Create();
            GoToLanguages.Subscribe(_ =>
            {
                var vm = CreateViewModel <LanguagesViewModel>();
                vm.ExtraLanguages.Add(_defaultLanguage);
                vm.SelectedLanguage = SelectedLanguage;
                vm.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(x =>
                {
                    SelectedLanguage = x;
                    vm.DismissCommand.ExecuteIfCan();
                });
                ShowViewModel(vm);
            });

            this.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(_ => LoadCommand.ExecuteIfCan());

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                var tempRepos = new List <TrendingRepositoryViewModel>();
                foreach (var t in _times)
                {
                    var language = SelectedLanguage == null ? null : SelectedLanguage.Slug;
                    var repos    = await trendingRepository.GetTrendingRepositories(t.Slug, language);
                    tempRepos.AddRange(repos.Select(x => new TrendingRepositoryViewModel {
                        Repository = x, Time = t.Name
                    }));
                }
                repositories.Reset(tempRepos);
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
Beispiel #16
0
        public UpgradeView(INetworkActivityService networkActivityService)
        {
            _featuresService = Locator.Current.GetService<IFeaturesService>();
            _inAppPurchaseService = Locator.Current.GetService<IInAppPurchaseService>();

            _web = new UIWebView { ScalesPageToFit = true, AutoresizingMask = UIViewAutoresizing.All };
            _web.LoadFinished += (sender, e) => networkActivityService.PopNetworkActive();
            _web.LoadStarted += (sender, e) => networkActivityService.PushNetworkActive();
            _web.LoadError += (sender, e) => networkActivityService.PopNetworkActive();
            _web.ShouldStartLoad = (w, r, n) => ShouldStartLoad(r, n);

            _activityView = new UIActivityIndicatorView
            {
                Color = Theme.PrimaryNavigationBarColor,
                AutoresizingMask = UIViewAutoresizing.FlexibleWidth,
            };
        }
        public TrendingViewModel(INetworkActivityService networkActivity, TrendingRepository trendingRepository)
        {
            SelectedLanguage = _defaultLanguage;

            var repositories = new ReactiveList<TrendingRepositoryViewModel>();
            Repositories = repositories.CreateDerivedCollection(x => x);

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType<Octokit.Repository>().Subscribe(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner.Login, x.Name);
                ShowViewModel(vm);
            });

            GoToLanguages = ReactiveCommand.Create();
            GoToLanguages.Subscribe(_ =>
            {
                var vm = CreateViewModel<LanguagesViewModel>();
                vm.ExtraLanguages.Add(_defaultLanguage);
                vm.SelectedLanguage = SelectedLanguage;
                vm.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(x =>
                {
                    SelectedLanguage = x;
                    vm.DismissCommand.ExecuteIfCan();
                });
                ShowViewModel(vm);
            });

            this.WhenAnyValue(x => x.SelectedLanguage).Skip(1).Subscribe(_ => LoadCommand.ExecuteIfCan());

            LoadCommand = ReactiveCommand.CreateAsyncTask(async _ =>
            {
                var tempRepos = new List<TrendingRepositoryViewModel>();
                foreach (var t in _times)
                {
                    var language = SelectedLanguage == null ? null : SelectedLanguage.Slug;
                    var repos = await trendingRepository.GetTrendingRepositories(t.Slug, language);
                    tempRepos.AddRange(repos.Select(x => new TrendingRepositoryViewModel { Repository = x, Time = t.Name } ));
                }
                repositories.Reset(tempRepos);
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public LanguagesViewModel(INetworkActivityService networkActivity, LanguageRepository languageRepository)
        {
            ExtraLanguages = new List<Language>();

            Languages = _languages.CreateDerivedCollection(
                x => x,
                x => x.Name.StartsWith(SearchKeyword ?? string.Empty, StringComparison.OrdinalIgnoreCase),
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var langs = await languageRepository.GetLanguages();
                langs.InsertRange(0, ExtraLanguages);
                _languages.Reset(langs);
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public ShowcasesViewModel(INetworkActivityService networkActivity, ShowcaseRepository showcaseRepository)
        {
            GoToShowcaseCommand = ReactiveCommand.Create();
            GoToShowcaseCommand.OfType<Showcase>().Subscribe(x =>
            {
                var vm = CreateViewModel<ShowcaseViewModel>();
                vm.ShowcaseSlug = x.Slug;
                vm.Title = x.Name;
                ShowViewModel(vm);
            });

            var showcases = new ReactiveList<Showcase>();
            Showcases = showcases;

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
                showcases.Reset(await showcaseRepository.GetShowcases()));
            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
Beispiel #20
0
        public ReleaseView(INetworkActivityService networkActivityService)
            : base(networkActivityService)
        {
            Web.ScalesPageToFit = true;

            this.WhenViewModel(x => x.ShowMenuCommand)
            .Subscribe(x => NavigationItem.RightBarButtonItem = x.ToBarButtonItem(UIBarButtonSystemItem.Action));

            this.WhenViewModel(x => x.ContentText).IsNotNull().Subscribe(contentText =>
            {
                var model = new ReleaseRazorViewModel {
                    Body = contentText, Release = ViewModel.ReleaseModel
                };
                LoadContent(new ReleaseRazorView {
                    Model = model
                }.GenerateString());
            });
        }
        public LanguagesViewModel(INetworkActivityService networkActivity, LanguageRepository languageRepository)
        {
            ExtraLanguages = new List <Language>();

            Languages = _languages.CreateDerivedCollection(
                x => x,
                x => x.Name.StartsWith(SearchKeyword ?? string.Empty, StringComparison.OrdinalIgnoreCase),
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var langs = await languageRepository.GetLanguages();
                langs.InsertRange(0, ExtraLanguages);
                _languages.Reset(langs);
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public ShowcasesViewModel(INetworkActivityService networkActivity, ShowcaseRepository showcaseRepository)
        {
            GoToShowcaseCommand = ReactiveCommand.Create();
            GoToShowcaseCommand.OfType <Showcase>().Subscribe(x =>
            {
                var vm          = CreateViewModel <ShowcaseViewModel>();
                vm.ShowcaseSlug = x.Slug;
                vm.Title        = x.Name;
                ShowViewModel(vm);
            });

            var showcases = new ReactiveList <Showcase>();

            Showcases = showcases;

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
                                                          showcases.Reset(await showcaseRepository.GetShowcases()));
            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public RepositoriesExploreViewModel(IApplicationService applicationService, INetworkActivityService networkActivityService)
        {
            _applicationService = applicationService;

            var gotoRepository = new Action<RepositoryItemViewModel>(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner;
                vm.RepositoryName = x.Name;
                ShowViewModel(vm);
            });

            var repositories = new ReactiveList<RepositorySearchModel.RepositoryModel>();
            Repositories = repositories.CreateDerivedCollection(x => 
                new RepositoryItemViewModel(x.Name, x.Owner.Login, x.Owner.AvatarUrl, 
                                            x.Description, x.StargazersCount, x.ForksCount,
                                            true, gotoRepository));

            SearchCommand = ReactiveCommand.CreateAsyncTask(
                this.WhenAnyValue(x => x.SearchText).Select(x => !string.IsNullOrEmpty(x)),
                async t =>
            {
                try
                {
                    var request = applicationService.Client.Repositories.SearchRepositories(new[] { SearchText }, new string[] { });
                    request.UseCache = false;
                    var response = await applicationService.Client.ExecuteAsync(request);
                    repositories.Reset(response.Data.Items);
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to search for repositories. Please try again.", e);
                }
            });
            
            SearchCommand.IsExecuting.Skip(1).Subscribe(x => 
            {
                if (x)
                    networkActivityService.PushNetworkActive();
                else
                    networkActivityService.PopNetworkActive();
            });
        }
Beispiel #24
0
        public PullRequestDiffViewController(
            string username,
            string repository,
            int pullRequestId,
            string path,
            string patch,
            string commit,
            IApplicationService applicationService         = null,
            INetworkActivityService networkActivityService = null,
            IMarkdownService markdownService = null)
            : base(false)
        {
            _applicationService     = applicationService ?? Locator.Current.GetService <IApplicationService>();
            _networkActivityService = networkActivityService ?? Locator.Current.GetService <INetworkActivityService>();
            _markdownService        = markdownService ?? Locator.Current.GetService <IMarkdownService>();
            _username      = username;
            _repository    = repository;
            _pullRequestId = pullRequestId;
            _path          = path;
            _patch         = patch;
            _commit        = commit;

            Title = string.IsNullOrEmpty(_path) ? "Diff" : System.IO.Path.GetFileName(_path);

            var loadComments = ReactiveCommand.CreateFromTask(
                _ => _applicationService.GitHubClient.PullRequest.ReviewComment.GetAll(_username, _repository, _pullRequestId));

            loadComments
            .ThrownExceptions
            .Select(error => new UserError("Unable to load comments.", error))
            .SelectMany(Interactions.Errors.Handle)
            .Subscribe();

            loadComments
            .Subscribe(comments => _comments.Reset(comments));

            var loadAll = ReactiveCommand.CreateCombined(new[] { loadComments });

            Appearing
            .Take(1)
            .Select(_ => Unit.Default)
            .InvokeReactiveCommand(loadAll);
        }
        public ShowcaseViewModel(INetworkActivityService networkActivity, ShowcaseRepository showcaseRepository)
        {
            Title = "Showcase";

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType<Octokit.Repository>().Subscribe(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner.Login, x.Name);
                ShowViewModel(vm);
            });

            var repositories = new ReactiveList<Octokit.Repository>();
            Repositories = repositories;
            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var showcaseRepos = await showcaseRepository.GetShowcaseRepositories(ShowcaseSlug);
                Title = showcaseRepos.Name;
                Showcase = new Showcase {Slug = showcaseRepos.Slug, Description = showcaseRepos.Description, Name = showcaseRepos.Name};
                repositories.Reset(showcaseRepos.Repositories);
            });
            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public RepositoriesExploreViewModel(IApplicationService applicationService, INetworkActivityService networkActivityService)
        {
            _applicationService = applicationService;
            Repositories = new ReactiveCollection<RepositorySearchModel.RepositoryModel>();

            SearchCommand = new ReactiveCommand(this.WhenAnyValue(x => x.SearchText, x => !string.IsNullOrEmpty(x)));
            SearchCommand.IsExecuting.Skip(1).Subscribe(x => 
            {
                if (x)
                    networkActivityService.PushNetworkActive();
                else
                    networkActivityService.PopNetworkActive();
            });
            SearchCommand.RegisterAsyncTask(async t =>
            {
                try
                {
                    var request = applicationService.Client.Repositories.SearchRepositories(new[] { SearchText }, new string[] { });
                    request.UseCache = false;
                    var response = await applicationService.Client.ExecuteAsync(request);
                    Repositories.Reset(response.Data.Items);
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to search for repositories. Please try again.", e);
                }
            });

            GoToRepositoryCommand = new ReactiveCommand();
            GoToRepositoryCommand.OfType<RepositorySearchModel.RepositoryModel>().Subscribe(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryOwner = x.Owner.Login;
                vm.RepositoryName = x.Name;
                ShowViewModel(vm);
            });
        }
        public StumbleViewModel(IApplicationService applicationService, INetworkActivityService networkActivity, 
                                IFeaturesService featuresService, IDefaultValueService defaultValues)
            : base(applicationService, networkActivity)
        {
            this._applicationService = applicationService;

            var localStumbleCount = 0;

            GoToPurchaseCommand = ReactiveCommand.Create();
            GoToPurchaseCommand.Subscribe(_ => CreateAndShowViewModel<PurchaseProViewModel>());

            StumbleCommand = ReactiveCommand.CreateAsyncTask(LoadCommand.IsExecuting.Select(x => !x), x => StumbleRepository());
            StumbleCommand.Subscribe(x =>
            {
                if (!featuresService.ProEditionEnabled)
                {
                    var stumbleTimes = defaultValues.Get<nint>(StumbleKey) + 1;
                    defaultValues.Set(StumbleKey, stumbleTimes);

                    if (localStumbleCount > 0 && stumbleTimes % 50 == 0)
                    {
                        GoToPurchaseCommand.ExecuteIfCan();
                    }
                }

                localStumbleCount++;

                Reset();
                RepositoryIdentifier = new RepositoryIdentifierModel(x.Repository.Owner, x.Repository.Name);
                LoadCommand.ExecuteIfCan();
            });
            StumbleCommand.TriggerNetworkActivity(networkActivity);

            DislikeCommand.Subscribe(_ => StumbleCommand.ExecuteIfCan());
            LikeCommand.Subscribe(_ => StumbleCommand.ExecuteIfCan());
        }
        public StumbleViewModel(IApplicationService applicationService, INetworkActivityService networkActivity,
                                IFeaturesService featuresService, IDefaultValueService defaultValues)
            : base(applicationService, networkActivity)
        {
            this._applicationService = applicationService;

            var localStumbleCount = 0;

            GoToPurchaseCommand = ReactiveCommand.Create();
            GoToPurchaseCommand.Subscribe(_ => CreateAndShowViewModel <PurchaseProViewModel>());

            StumbleCommand = ReactiveCommand.CreateAsyncTask(LoadCommand.IsExecuting.Select(x => !x), x => StumbleRepository());
            StumbleCommand.Subscribe(x =>
            {
                if (!featuresService.ProEditionEnabled)
                {
                    var stumbleTimes = defaultValues.Get <nint>(StumbleKey) + 1;
                    defaultValues.Set(StumbleKey, stumbleTimes);

                    if (localStumbleCount > 0 && stumbleTimes % 50 == 0)
                    {
                        GoToPurchaseCommand.ExecuteIfCan();
                    }
                }

                localStumbleCount++;

                Reset();
                RepositoryIdentifier = new RepositoryIdentifierModel(x.Repository.Owner, x.Repository.Name);
                LoadCommand.ExecuteIfCan();
            });
            StumbleCommand.TriggerNetworkActivity(networkActivity);

            DislikeCommand.Subscribe(_ => StumbleCommand.ExecuteIfCan());
            LikeCommand.Subscribe(_ => StumbleCommand.ExecuteIfCan());
        }
Beispiel #29
0
 public static IDisposable ActivateNetwork(this INetworkActivityService @this)
 {
     @this.PushNetworkActive();
     return(Disposable.Create(@this.PopNetworkActive));
 }
Beispiel #30
0
 public OctokitNetworkClient(IHttpClient httpClient, INetworkActivityService networkActivity)
 {
     _httpClient = httpClient;
     _networkActivity = networkActivity;
 }
        public ProfileViewModel(IApplicationService applicationService, INetworkActivityService networkActivity, IFeaturesService featuresService)
        {
            StumbleHistory       = new ReactiveList <StumbledRepository>();
            GoToInterestsCommand = ReactiveCommand.Create();
            Username             = applicationService.Account.Username;

            Action updateStumbled = () =>
            {
                var stumbledRepositories = applicationService.Account.StumbledRepositories.Count();
                Interests      = applicationService.Account.Interests.Count();
                Likes          = applicationService.Account.StumbledRepositories.LikedRepositories();
                Dislikes       = applicationService.Account.StumbledRepositories.DislikedRepositories();
                HasMoreHistory = stumbledRepositories > 30;
                if (stumbledRepositories != StumbledRepositories)
                {
                    StumbledRepositories = stumbledRepositories;
                    StumbleHistory.Reset(applicationService.Account.StumbledRepositories.Query.OrderByDescending(x => x.CreatedAt).Take(30));
                }
            };

            this.WhenActivated(d =>
            {
                if (applicationService.Account != null)
                {
                    updateStumbled();

                    d(applicationService.RepositoryAdded
                      .Buffer(TimeSpan.FromSeconds(5))
                      .Where(x => x.Count > 0)
                      .ObserveOn(SynchronizationContext.Current)
                      .Subscribe(x => updateStumbled()));
                }

                CanPurchase = !featuresService.ProEditionEnabled;
            });

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType <StumbledRepository>().Subscribe(x =>
            {
                var vm = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner, x.Name);
                ShowViewModel(vm);
            });

            GoToPurchaseCommand = ReactiveCommand.Create();
            GoToPurchaseCommand.Subscribe(_ => CreateAndShowViewModel <PurchaseProViewModel>());

            GoToHistoryCommand = ReactiveCommand.Create();
            GoToHistoryCommand.Subscribe(_ => CreateAndShowViewModel <HistoryViewModel>());

            GoToLikesCommand = ReactiveCommand.Create();
            GoToLikesCommand.Subscribe(_ => CreateAndShowViewModel <LikedRepositoriesViewModel>());

            GoToDislikesCommand = ReactiveCommand.Create();
            GoToDislikesCommand.Subscribe(_ => CreateAndShowViewModel <DislikedRepositoriesViewModel>());

            GoToSettingsCommand = ReactiveCommand.Create();
            GoToSettingsCommand.Subscribe(_ => CreateAndShowViewModel <SettingsViewModel>());


            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                User = await applicationService.Client.User.Current();
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
Beispiel #32
0
 public UpgradeViewController()
 {
     _featuresService = Locator.Current.GetService<IFeaturesService>();
     _networkActivityService = Locator.Current.GetService<INetworkActivityService>();
     _inAppPurchaseService = Locator.Current.GetService<IInAppPurchaseService>();
 }
Beispiel #33
0
 public SourceView(INetworkActivityService networkActivityService)
     : base(networkActivityService)
 {
 }
Beispiel #34
0
 public RepositoryViewModel(IApplicationService applicationService, INetworkActivityService networkActivity)
     : base(applicationService, networkActivity)
 {
 }
        protected BaseRepositoryViewModel(IApplicationService applicationService, INetworkActivityService networkActivity)
        {
            LikeCommand = ReactiveCommand.Create();
            LikeCommand.Subscribe(_ =>
            {
                if (StumbledRepository == null)
                {
                    var repo   = CreateStumbledRepository();
                    repo.Liked = true;
                    applicationService.Account.StumbledRepositories.Insert(repo);
                    StumbledRepository = repo;
                }
                else
                {
                    StumbledRepository.Liked       = true;
                    StumbledRepository.Description = Repository.Description;
                    StumbledRepository.Forks       = Repository.ForksCount;
                    StumbledRepository.Stars       = Repository.WatchersCount;
                    StumbledRepository.ImageUrl    = Repository.Owner.AvatarUrl;
                    applicationService.Account.StumbledRepositories.Update(StumbledRepository);
                }

                if (applicationService.Account.SyncWithGitHub)
                {
                    applicationService.Client.Activity.Starring.StarRepo(Repository.Owner.Login, Repository.Name);
                }

                Liked = true;
            });

            DislikeCommand = ReactiveCommand.Create();
            DislikeCommand.Subscribe(_ =>
            {
                if (StumbledRepository == null)
                {
                    var repo   = CreateStumbledRepository();
                    repo.Liked = false;
                    applicationService.Account.StumbledRepositories.Insert(repo);
                    StumbledRepository = repo;
                }
                else
                {
                    StumbledRepository.Liked       = false;
                    StumbledRepository.Description = Repository.Description;
                    StumbledRepository.Forks       = Repository.ForksCount;
                    StumbledRepository.Stars       = Repository.WatchersCount;
                    StumbledRepository.ImageUrl    = Repository.Owner.AvatarUrl;
                    applicationService.Account.StumbledRepositories.Update(StumbledRepository);
                }

                if (applicationService.Account.SyncWithGitHub)
                {
                    applicationService.Client.Activity.Starring.RemoveStarFromRepo(Repository.Owner.Login, Repository.Name);
                }

                Liked = false;
            });

            this.WhenAnyValue(x => x.RepositoryIdentifier)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                StumbledRepository = applicationService.Account.StumbledRepositories.FindByFullname(x.Owner, x.Name);
            });

            this.WhenAnyValue(x => x.StumbledRepository)
            .Where(x => x != null)
            .Subscribe(x => Liked = x.Liked);

            GoToGitHubCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.Repository).Select(x => x != null));
            GoToGitHubCommand.Subscribe(_ => GoToUrlCommand.ExecuteIfCan(Repository.HtmlUrl));

            LoadCommand = ReactiveCommand.CreateAsyncTask(this.WhenAnyValue(x => x.RepositoryIdentifier).Select(x => x != null), async t =>
            {
                Repository       = (await applicationService.Client.Repository.Get(RepositoryIdentifier.Owner, RepositoryIdentifier.Name));
                ContributorCount = (await applicationService.Client.Repository.GetAllContributors(RepositoryIdentifier.Owner, RepositoryIdentifier.Name)).Count;

                try
                {
                    Readme = await applicationService.Client.Repository.GetReadmeHtml(RepositoryIdentifier.Owner, RepositoryIdentifier.Name);
                }
                catch (Exception e)
                {
                    Readme = "<center>There is no readme for this repository :(</center>";
                    Debug.WriteLine(e.Message + " for " + RepositoryIdentifier.Owner + "/" + RepositoryIdentifier.Name);
                }
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
        public ProfileViewModel(IApplicationService applicationService, INetworkActivityService networkActivity, IFeaturesService featuresService)
        {
            StumbleHistory = new ReactiveList<StumbledRepository>();
            GoToInterestsCommand = ReactiveCommand.Create();
            Username = applicationService.Account.Username;

            Action updateStumbled = () =>
            {
                var stumbledRepositories = applicationService.Account.StumbledRepositories.Count();
                Interests = applicationService.Account.Interests.Count();
                Likes = applicationService.Account.StumbledRepositories.LikedRepositories();
                Dislikes = applicationService.Account.StumbledRepositories.DislikedRepositories();
                HasMoreHistory = stumbledRepositories > 30;
                if (stumbledRepositories != StumbledRepositories)
                {
                    StumbledRepositories = stumbledRepositories;
                    StumbleHistory.Reset(applicationService.Account.StumbledRepositories.Query.OrderByDescending(x => x.CreatedAt).Take(30));
                }
            };

            this.WhenActivated(d =>
            {
                if (applicationService.Account != null)
                {
                    updateStumbled();

                    d(applicationService.RepositoryAdded
                        .Buffer(TimeSpan.FromSeconds(5))
                        .Where(x => x.Count > 0)
                        .ObserveOn(SynchronizationContext.Current)
                        .Subscribe(x => updateStumbled()));
                }

                CanPurchase = !featuresService.ProEditionEnabled;
            });

            GoToRepositoryCommand = ReactiveCommand.Create();
            GoToRepositoryCommand.OfType<StumbledRepository>().Subscribe(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel(x.Owner, x.Name);
                ShowViewModel(vm);
            });

            GoToPurchaseCommand = ReactiveCommand.Create();
            GoToPurchaseCommand.Subscribe(_ => CreateAndShowViewModel<PurchaseProViewModel>());

            GoToHistoryCommand = ReactiveCommand.Create();
            GoToHistoryCommand.Subscribe(_ => CreateAndShowViewModel<HistoryViewModel>());

            GoToLikesCommand = ReactiveCommand.Create();
            GoToLikesCommand.Subscribe(_ => CreateAndShowViewModel<LikedRepositoriesViewModel>());

            GoToDislikesCommand = ReactiveCommand.Create();
            GoToDislikesCommand.Subscribe(_ => CreateAndShowViewModel<DislikedRepositoriesViewModel>());

            GoToSettingsCommand = ReactiveCommand.Create();
            GoToSettingsCommand.Subscribe(_ => CreateAndShowViewModel<SettingsViewModel>());

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                User = await applicationService.Client.User.Current();
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
Beispiel #37
0
 public ChangesetDiffView(INetworkActivityService networkActivityService)
     : base(networkActivityService)
 {
 }
Beispiel #38
0
 public OctokitNetworkClient(IHttpClient httpClient, INetworkActivityService networkActivity)
 {
     _httpClient      = httpClient;
     _networkActivity = networkActivity;
 }
Beispiel #39
0
 public UpgradesView(IFeaturesService featuresService, INetworkActivityService networkActivityService, IAlertDialogFactory alertDialogService)
 {
     _featuresService        = featuresService;
     _networkActivityService = networkActivityService;
     _alertDialogService     = alertDialogService;
 }
Beispiel #40
0
        public LanguagesViewModel(IJsonSerializationService jsonSerializationService, INetworkActivityService networkActivity)
        {
            var languages = new ReactiveList <LanguageModel>();

            Languages = languages.CreateDerivedCollection(
                x => new LanguageItemViewModel(x.Name, x.Slug),
                x => x.Name.StartsWith(SearchKeyword ?? string.Empty, StringComparison.OrdinalIgnoreCase),
                signalReset: this.WhenAnyValue(x => x.SearchKeyword));

            Languages
            .Changed.Select(_ => Unit.Default)
            .Merge(this.WhenAnyValue(x => x.SelectedLanguage).Select(_ => Unit.Default))
            .Select(_ => SelectedLanguage)
            .Where(x => x != null)
            .Subscribe(x =>
            {
                foreach (var l in Languages)
                {
                    l.Selected = l.Slug == x.Slug;
                }
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(async t =>
            {
                var trendingData = await BlobCache.LocalMachine.DownloadUrl(LanguagesUrl, absoluteExpiration: DateTimeOffset.Now.AddDays(1));
                var langs        = jsonSerializationService.Deserialize <List <LanguageModel> >(System.Text.Encoding.UTF8.GetString(trendingData));
                langs.Insert(0, DefaultLanguage);
                languages.Reset(langs);
            });
        }
 public InAppPurchaseNetworkDecorator(IInAppPurchaseService inAppPurcahseService, INetworkActivityService networkActivity)
 {
     _inAppPurcahseService = inAppPurcahseService;
     _networkActivity = networkActivity;
 }
        protected BaseRepositoryViewModel(IApplicationService applicationService, INetworkActivityService networkActivity)
        {
            LikeCommand = ReactiveCommand.Create();
            LikeCommand.Subscribe(_ =>
            {
                if (StumbledRepository == null)
                {
                    var repo = CreateStumbledRepository();
                    repo.Liked = true;
                    applicationService.Account.StumbledRepositories.Insert(repo);
                    StumbledRepository = repo;
                }
                else
                {
                    StumbledRepository.Liked = true;
                    StumbledRepository.Description = Repository.Description;
                    StumbledRepository.Forks = Repository.ForksCount;
                    StumbledRepository.Stars = Repository.StargazersCount;
                    StumbledRepository.ImageUrl = Repository.Owner.AvatarUrl;
                    applicationService.Account.StumbledRepositories.Update(StumbledRepository);
                }

                if (applicationService.Account.SyncWithGitHub)
                    applicationService.Client.Activity.Starring.StarRepo(Repository.Owner.Login, Repository.Name);

                Liked = true;
            });

            DislikeCommand = ReactiveCommand.Create();
            DislikeCommand.Subscribe(_ =>
            {
                if (StumbledRepository == null)
                {
                    var repo = CreateStumbledRepository();
                    repo.Liked = false;
                    applicationService.Account.StumbledRepositories.Insert(repo);
                    StumbledRepository = repo;
                }
                else
                {
                    StumbledRepository.Liked = false;
                    StumbledRepository.Description = Repository.Description;
                    StumbledRepository.Forks = Repository.ForksCount;
                    StumbledRepository.Stars = Repository.StargazersCount;
                    StumbledRepository.ImageUrl = Repository.Owner.AvatarUrl;
                    applicationService.Account.StumbledRepositories.Update(StumbledRepository);
                }

                if (applicationService.Account.SyncWithGitHub)
                    applicationService.Client.Activity.Starring.RemoveStarFromRepo(Repository.Owner.Login, Repository.Name);

                Liked = false;
            });

            this.WhenAnyValue(x => x.RepositoryIdentifier)
                .Where(x => x != null)
                .Subscribe(x =>
                {
                    StumbledRepository = applicationService.Account.StumbledRepositories.FindByFullname(x.Owner, x.Name);
                });

            this.WhenAnyValue(x => x.StumbledRepository)
                .Where(x => x != null)
                .Subscribe(x => Liked = x.Liked);

            GoToGitHubCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.Repository).Select(x => x != null));
            GoToGitHubCommand.Subscribe(_ => GoToUrlCommand.ExecuteIfCan(Repository.HtmlUrl));

            LoadCommand = ReactiveCommand.CreateAsyncTask(this.WhenAnyValue(x => x.RepositoryIdentifier).Select(x => x != null), async t =>
            {
                Repository = (await applicationService.Client.Repository.Get(RepositoryIdentifier.Owner, RepositoryIdentifier.Name));
                ContributorCount = (await applicationService.Client.Repository.GetAllContributors(RepositoryIdentifier.Owner, RepositoryIdentifier.Name)).Count;

                try
                {
                    Readme = await applicationService.Client.Repository.Content.GetReadmeHtml(RepositoryIdentifier.Owner, RepositoryIdentifier.Name);
                }
                catch (Exception e)
                {
                    Readme = "<center>There is no readme for this repository :(</center>";
                    Debug.WriteLine(e.Message + " for " + RepositoryIdentifier.Owner + "/" + RepositoryIdentifier.Name);
                }
            });

            LoadCommand.TriggerNetworkActivity(networkActivity);
        }
Beispiel #43
0
 public InAppPurchaseNetworkDecorator(IInAppPurchaseService inAppPurcahseService, INetworkActivityService networkActivity)
 {
     _inAppPurcahseService = inAppPurcahseService;
     _networkActivity      = networkActivity;
 }
Beispiel #44
0
 protected FileSourceView(INetworkActivityService networkActivityService)
     : base(networkActivityService)
 {
 }
 public StumbledRepositoryViewModel(IApplicationService applicationService, INetworkActivityService networkActivity)
     : base(applicationService, networkActivity)
 {
 }
Beispiel #46
0
 public WebBrowserView(INetworkActivityService networkActivityService)
     : this(true, true)
 {
     _networkActivityService = networkActivityService;
 }
 public static IDisposable TriggerNetworkActivity(this IReactiveCommand @this, INetworkActivityService networkActivity)
 {
     return(@this.IsExecuting.Skip(1).Subscribe(x =>
     {
         if (x)
         {
             networkActivity.PushNetworkActive();
         }
         else
         {
             networkActivity.PopNetworkActive();
         }
     }));
 }
Beispiel #48
0
 public UpgradeViewController()
 {
     _featuresService        = Locator.Current.GetService <IFeaturesService>();
     _networkActivityService = Locator.Current.GetService <INetworkActivityService>();
     _inAppPurchaseService   = Locator.Current.GetService <IInAppPurchaseService>();
 }