Esempio n. 1
0
        public async Task <ErrorBase> TrySearchCategories(string query, SearchType searchType)
        {
            if (!string.IsNullOrEmpty(query) && (query.Length == 1 || (query.Length == 2 && searchType == SearchType.People)) || string.IsNullOrEmpty(query) && searchType == SearchType.People)
            {
                if (searchType == SearchType.Tags)
                {
                    TagsPresenter.NotifySourceChanged(nameof(TrySearchCategories), true);
                }
                else
                {
                    UserFriendPresenter.NotifySourceChanged(nameof(TrySearchCategories), true);
                }

                return(null);
            }

            if (string.IsNullOrEmpty(query))
            {
                return(await TagsPresenter.TryGetTopTags());
            }

            if (searchType == SearchType.Tags)
            {
                return(await TagsPresenter.TryLoadNext(query));
            }

            return(await UserFriendPresenter.TryLoadNextSearchUser(query));
        }
        public async Task GetPostVotersTest(KnownChains apiName, string url)
        {
            var presenter = new UserFriendPresenter()
            {
                VotersType = VotersType.All
            };

            presenter.SetClient(Api[apiName]);
            Assert.IsTrue(presenter.Count == 0);
            var exception = await presenter.TryLoadNextPostVoters(url);

            Assert.IsTrue(exception == null);
            Assert.IsTrue(presenter.Count > 0);
        }
        public async Task GetPostVotersTest(KnownChains apiName, string url)
        {
            await BasePresenter.SwitchChain(apiName);

            var presenter = new UserFriendPresenter()
            {
                VotersType = VotersType.All
            };

            Assert.IsTrue(presenter.Count == 0);
            var error = await presenter.TryLoadNextPostVoters(url);

            Assert.IsTrue(error == null);
            Assert.IsTrue(presenter.Count > 0);
        }
Esempio n. 4
0
        public async Task <Exception> TrySearchCategories(string query, SearchType searchType)
        {
            try
            {
                if (!string.IsNullOrEmpty(query) && (query.Length == 1 || (query.Length == 2 && searchType == SearchType.People)) || string.IsNullOrEmpty(query) && searchType == SearchType.People)
                {
                    if (searchType == SearchType.Tags)
                    {
                        TagsPresenter.NotifySourceChanged(nameof(TrySearchCategories), true);
                        TagsPresenter.TasksCancel();
                    }
                    else
                    {
                        UserFriendPresenter.NotifySourceChanged(nameof(TrySearchCategories), true);
                        UserFriendPresenter.TasksCancel();
                    }

                    return(new ValidationException(LocalizationKeys.TagSearchWarning));
                }

                if (string.IsNullOrEmpty(query))
                {
                    return(await TagsPresenter.TryGetTopTags());
                }

                if (searchType == SearchType.Tags)
                {
                    return(await TagsPresenter.TryLoadNext(query));
                }

                return(await UserFriendPresenter.TryLoadNextSearchUser(query));
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
 public UserSearchTableViewSource(UserFriendPresenter presenter)
 {
     _presenter = presenter;
 }
Esempio n. 6
0
 public VotersTableViewSource(UserFriendPresenter presenter, UITableView table) : base(presenter, table)
 {
 }
Esempio n. 7
0
 public void TasksCancel(bool andDispose = false)
 {
     UserFriendPresenter.TasksCancel(andDispose);
     TagsPresenter.TasksCancel(andDispose);
 }
Esempio n. 8
0
 public SearchFacade()
 {
     UserFriendPresenter = new UserFriendPresenter();
     TagsPresenter       = new TagsPresenter();
 }
 public FollowTableViewSource(UserFriendPresenter presenter, UITableView table, bool hideFollowButton = false) : base(presenter, table)
 {
     _hideFollowButton = hideFollowButton;
 }
Esempio n. 10
0
 public void TasksCancel()
 {
     UserFriendPresenter.TasksCancel();
     TagsPresenter.TasksCancel();
 }
Esempio n. 11
0
 public void SetClient(SteepshotApiClient client)
 {
     UserFriendPresenter.SetClient(client);
     TagsPresenter.SetClient(client);
 }