private async Task <Listing> UncachedLoad(Dictionary <object, object> state) { Listing resultListing = null; var user = await _userService.GetUser(); if (user != null && user.Me != null) { resultListing = await _redditService.GetSubscribedSubredditListing(); } else { resultListing = await _redditService.GetDefaultSubreddits(); } if (resultListing != null && resultListing.Data != null && resultListing.Data.Children != null) { state["SubscribedSubreddits"] = HashifyListing(resultListing.Data.Children); await _offlineService.StoreOrderedThings("sublist:" + (await _userService.GetUser()).Username, resultListing.Data.Children); } else { state["SubscribedSubreddits"] = new HashSet <string>(); } var subreddits = await _redditService.GetSubreddits(null); subreddits.Data.Children.Insert(0, GetFrontPageThing()); await _offlineService.StoreOrderedThings("reddits:", subreddits.Data.Children.Take(20)); return(subreddits); }
private async Task <Listing> GetUncachedListing() { var resultListing = await _redditService.GetPostsBySubreddit(_subreddit, null); //doesnt need to be awaited let it run in the background if (resultListing != null && resultListing.Data.Children != null && resultListing.Data.Children.Count > 0) { await _offlineService.StoreOrderedThings("links:" + _subreddit, resultListing.Data.Children); } return(resultListing); }
private async Task <Listing> UncachedLoad() { Listing resultListing = null; var user = await _userService.GetUser(); if (user != null && user.Me != null) { resultListing = await _redditService.GetSubscribedSubredditListing(); } else { resultListing = await _redditService.GetDefaultSubreddits(); } await _offlineService.StoreOrderedThings("sublist:" + (await _userService.GetUser()).Username, resultListing.Data.Children); return(resultListing); }
public async Task SaveSubreddits() { await _offlineService.StoreOrderedThings("pivotsubreddits", Subreddits); }