mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Correctly showing text or story view for stories based on story feed, not folder.
This commit is contained in:
parent
9806ed08f1
commit
b1d9cc9e92
7 changed files with 67 additions and 34 deletions
|
@ -369,8 +369,6 @@
|
|||
[self.searchBar setShowsCancelButton:NO animated:YES];
|
||||
}
|
||||
|
||||
appDelegate.inTextView = [appDelegate.storiesCollection.activeStoryView isEqualToString:@"text"];
|
||||
|
||||
// [self testForTryFeed];
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ SFSafariViewControllerDelegate> {
|
|||
BOOL popoverHasFeedView;
|
||||
BOOL inFeedDetail;
|
||||
BOOL inStoryDetail;
|
||||
BOOL inTextView;
|
||||
BOOL inFindingStoryMode;
|
||||
BOOL hasLoadedFeedDetail;
|
||||
BOOL hasQueuedReadStories;
|
||||
|
@ -131,6 +130,7 @@ SFSafariViewControllerDelegate> {
|
|||
NSDictionary * dictUserProfile;
|
||||
NSDictionary * dictSocialServices;
|
||||
NSMutableDictionary * dictUnreadCounts;
|
||||
NSMutableDictionary * dictTextFeeds;
|
||||
NSArray * userInteractionsArray;
|
||||
NSArray * userActivitiesArray;
|
||||
NSMutableArray * dictFoldersArray;
|
||||
|
@ -200,7 +200,6 @@ SFSafariViewControllerDelegate> {
|
|||
@property (nonatomic, readwrite) BOOL popoverHasFeedView;
|
||||
@property (nonatomic, readwrite) BOOL inFeedDetail;
|
||||
@property (nonatomic, readwrite) BOOL inStoryDetail;
|
||||
@property (nonatomic, readwrite) BOOL inTextView;
|
||||
@property (nonatomic, readwrite) BOOL isPresentingActivities;
|
||||
@property (readwrite) NSDictionary * activeStory;
|
||||
@property (readwrite) NSURL * activeOriginalStoryURL;
|
||||
|
@ -234,6 +233,7 @@ SFSafariViewControllerDelegate> {
|
|||
@property (nonatomic) NSDictionary *dictUserProfile;
|
||||
@property (nonatomic) NSDictionary *dictSocialServices;
|
||||
@property (nonatomic, strong) NSMutableDictionary *dictUnreadCounts;
|
||||
@property (nonatomic, strong) NSMutableDictionary *dictTextFeeds;
|
||||
@property (nonatomic) NSArray *userInteractionsArray;
|
||||
@property (nonatomic) NSArray *userActivitiesArray;
|
||||
@property (nonatomic) NSMutableArray *dictFoldersArray;
|
||||
|
@ -307,6 +307,10 @@ SFSafariViewControllerDelegate> {
|
|||
- (void)refreshUserProfile:(void(^)())callback;
|
||||
- (void)refreshFeedCount:(id)feedId;
|
||||
|
||||
- (void)populateDictTextFeeds;
|
||||
- (BOOL)isFeedInTextView:(id)feedId;
|
||||
- (void)toggleFeedTextView:(id)feedId;
|
||||
|
||||
- (void)populateDictUnreadCounts;
|
||||
- (NSInteger)unreadCount;
|
||||
- (NSInteger)allUnreadCount;
|
||||
|
|
|
@ -118,7 +118,6 @@
|
|||
@synthesize popoverHasFeedView;
|
||||
@synthesize inFeedDetail;
|
||||
@synthesize inStoryDetail;
|
||||
@synthesize inTextView;
|
||||
@synthesize isPresentingActivities;
|
||||
@synthesize activeComment;
|
||||
@synthesize activeShareType;
|
||||
|
@ -147,6 +146,7 @@
|
|||
@synthesize dictUserProfile;
|
||||
@synthesize dictSocialServices;
|
||||
@synthesize dictUnreadCounts;
|
||||
@synthesize dictTextFeeds;
|
||||
@synthesize userInteractionsArray;
|
||||
@synthesize userActivitiesArray;
|
||||
@synthesize dictFoldersArray;
|
||||
|
@ -640,6 +640,7 @@
|
|||
self.userActivitiesArray = nil;
|
||||
self.userInteractionsArray = nil;
|
||||
self.dictUnreadCounts = nil;
|
||||
self.dictTextFeeds = nil;
|
||||
|
||||
[self.feedsViewController.feedTitlesTable reloadData];
|
||||
[self.feedsViewController resetToolbar];
|
||||
|
@ -1379,6 +1380,35 @@
|
|||
}
|
||||
}
|
||||
|
||||
#pragma mark - Text View
|
||||
|
||||
- (void)populateDictTextFeeds {
|
||||
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
||||
NSDictionary *textFeeds = [preferences dictionaryForKey:@"feeds:text"];
|
||||
if (!textFeeds) {
|
||||
self.dictTextFeeds = [[NSMutableDictionary alloc] init];
|
||||
} else {
|
||||
self.dictTextFeeds = [textFeeds mutableCopy];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (BOOL)isFeedInTextView:(id)feedId {
|
||||
return [self.dictTextFeeds objectForKey:feedId];
|
||||
}
|
||||
|
||||
- (void)toggleFeedTextView:(id)feedId {
|
||||
NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
|
||||
if ([self.dictTextFeeds objectForKey:feedId]) {
|
||||
[self.dictTextFeeds removeObjectForKey:feedId];
|
||||
} else {
|
||||
[self.dictTextFeeds setObject:[NSNumber numberWithBool:YES] forKey:feedId];
|
||||
}
|
||||
|
||||
[preferences setObject:self.dictTextFeeds forKey:@"feeds:text"];
|
||||
[preferences synchronize];
|
||||
}
|
||||
|
||||
#pragma mark - Unread Counts
|
||||
|
||||
- (void)populateDictUnreadCounts {
|
||||
|
|
|
@ -595,6 +595,7 @@ static UIFont *userLabelFont;
|
|||
// set up dictFeeds
|
||||
appDelegate.dictFeeds = [[results objectForKey:@"feeds"] mutableCopy];
|
||||
[appDelegate populateDictUnreadCounts];
|
||||
[appDelegate populateDictTextFeeds];
|
||||
|
||||
// sort all the folders
|
||||
appDelegate.dictFoldersArray = [NSMutableArray array];
|
||||
|
|
|
@ -89,6 +89,7 @@ UIActionSheetDelegate> {
|
|||
|
||||
- (CGPoint)pointForGesture:(UIGestureRecognizer *)gestureRecognizer;
|
||||
|
||||
- (void)showTextOrStoryView;
|
||||
- (void)showStoryView;
|
||||
- (void)fetchTextView;
|
||||
- (void)finishFetchTextView:(ASIHTTPRequest *)request;
|
||||
|
|
|
@ -259,10 +259,13 @@
|
|||
#pragma mark Story setup
|
||||
|
||||
- (void)initStory {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@",
|
||||
[self.activeStory
|
||||
objectForKey:@"story_feed_id"]];
|
||||
appDelegate.inStoryDetail = YES;
|
||||
self.noStoryMessage.hidden = YES;
|
||||
self.webView.hidden = NO;
|
||||
self.inTextView = appDelegate.inTextView;
|
||||
self.inTextView = NO;
|
||||
|
||||
[appDelegate hideShareView:NO];
|
||||
}
|
||||
|
@ -1995,8 +1998,8 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)changeWebViewWidth {
|
||||
[webView setNeedsLayout];
|
||||
[webView layoutIfNeeded];
|
||||
// [webView setNeedsLayout];
|
||||
// [webView layoutIfNeeded];
|
||||
|
||||
NSLog(@"changeWebViewWidth: %@ / %@ / %@", NSStringFromCGSize(self.view.bounds.size), NSStringFromCGSize(webView.scrollView.bounds.size), NSStringFromCGSize(webView.scrollView.contentSize));
|
||||
|
||||
|
@ -2059,6 +2062,20 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
#pragma mark -
|
||||
#pragma mark Text view
|
||||
|
||||
- (void)showTextOrStoryView {
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@",
|
||||
[self.activeStory objectForKey:@"story_feed_id"]];
|
||||
if ([appDelegate isFeedInTextView:feedIdStr]) {
|
||||
if (!self.inTextView) {
|
||||
[self fetchTextView];
|
||||
}
|
||||
} else {
|
||||
if (self.inTextView) {
|
||||
[self showStoryView];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showStoryView {
|
||||
self.inTextView = NO;
|
||||
[MBProgressHUD hideHUDForView:self.webView animated:YES];
|
||||
|
|
|
@ -290,7 +290,7 @@
|
|||
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
[self reorientPages];
|
||||
// [self reorientPages];
|
||||
}
|
||||
|
||||
- (void)viewDidDisappear:(BOOL)animated {
|
||||
|
@ -556,10 +556,7 @@
|
|||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
|
||||
[pageController initStory];
|
||||
[pageController drawStory];
|
||||
// NSLog(@"In text view render? %d", appDelegate.inTextView);
|
||||
if (appDelegate.inTextView) {
|
||||
[pageController fetchTextView];
|
||||
}
|
||||
[pageController showTextOrStoryView];
|
||||
});
|
||||
} else {
|
||||
// [pageController clearStory];
|
||||
|
@ -996,28 +993,13 @@
|
|||
|
||||
- (IBAction)toggleTextView:(id)sender {
|
||||
[self endTouchDown:sender];
|
||||
NSUserDefaults *userPreferences = [NSUserDefaults standardUserDefaults];
|
||||
BOOL failedText = [appDelegate.storiesCollection.activeStoryView isEqualToString:@"text"] &&
|
||||
!currentPage.inTextView;
|
||||
NSString *feedIdStr = [NSString stringWithFormat:@"%@",
|
||||
[appDelegate.activeStory objectForKey:@"story_feed_id"]];
|
||||
[appDelegate toggleFeedTextView:feedIdStr];
|
||||
|
||||
if (!currentPage.inTextView) {
|
||||
if (!failedText) {
|
||||
// Only lock in Text view if not a failed text fetch
|
||||
[userPreferences setObject:@"text" forKey:[appDelegate.storiesCollection storyViewKey]];
|
||||
}
|
||||
appDelegate.inTextView = YES;
|
||||
[self.currentPage fetchTextView];
|
||||
[self.nextPage fetchTextView];
|
||||
[self.previousPage fetchTextView];
|
||||
} else {
|
||||
[userPreferences setObject:@"story" forKey:[appDelegate.storiesCollection storyViewKey]];
|
||||
appDelegate.inTextView = NO;
|
||||
[self.currentPage showStoryView];
|
||||
[self.nextPage showStoryView];
|
||||
[self.previousPage showStoryView];
|
||||
}
|
||||
|
||||
[userPreferences synchronize];
|
||||
[self.currentPage showTextOrStoryView];
|
||||
[self.nextPage showTextOrStoryView];
|
||||
[self.previousPage showTextOrStoryView];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
|
Loading…
Add table
Reference in a new issue