mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
finishing next story functionality
This commit is contained in:
parent
3edfaa3c6c
commit
e7ef5da019
4 changed files with 50 additions and 24 deletions
|
@ -170,6 +170,7 @@
|
|||
- (BOOL)isSocialFeed:(NSString *)feedIdStr;
|
||||
|
||||
|
||||
- (int)indexOfNextUnreadStory;
|
||||
- (int)indexOfNextStory;
|
||||
- (int)indexOfPreviousStory;
|
||||
- (int)indexOfActiveStory;
|
||||
|
|
|
@ -529,7 +529,7 @@
|
|||
[originalStoryViewController dismissModalViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
- (int)indexOfNextStory {
|
||||
- (int)indexOfNextUnreadStory {
|
||||
int activeLocation = [self locationOfActiveStory];
|
||||
int readStatus = -1;
|
||||
for (int i=activeLocation+1; i < [self.activeFeedStoryLocations count]; i++) {
|
||||
|
@ -553,6 +553,16 @@
|
|||
return -1;
|
||||
}
|
||||
|
||||
- (int)indexOfNextStory {
|
||||
int activeLocation = [self locationOfActiveStory];
|
||||
int nextStoryLocation = activeLocation + 1;
|
||||
if (nextStoryLocation < [self.activeFeedStoryLocations count]) {
|
||||
int location = [[self.activeFeedStoryLocations objectAtIndex:nextStoryLocation] intValue];
|
||||
return location;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
- (int)indexOfPreviousStory {
|
||||
NSInteger activeIndex = [self indexOfActiveStory];
|
||||
return MAX(-1, activeIndex-1);
|
||||
|
|
|
@ -265,7 +265,7 @@
|
|||
|
||||
- (void)showStory {
|
||||
int activeLocation = appDelegate.locationOfActiveStory;
|
||||
if (activeLocation >= ([appDelegate.activeFeedStories count] - 1)) {
|
||||
if (activeLocation >= ([appDelegate.activeFeedStoryLocations count] - 1)) {
|
||||
self.buttonNextStory.enabled = NO;
|
||||
} else {
|
||||
self.buttonNextStory.enabled = YES;
|
||||
|
@ -317,7 +317,7 @@
|
|||
"<div class='NB-share-header'></div>"
|
||||
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
|
||||
"<div class='NB-share-button'><span class='NB-share-icon'></span>Post to Blurblog</div>"
|
||||
"<div class='NB-save-button'><span class='NB-save-icon'></span>Save this story</div>"
|
||||
//"<div class='NB-save-button'><span class='NB-save-icon'></span>Save this story</div>"
|
||||
"</div></div>"];
|
||||
NSString *story_author = @"";
|
||||
if ([appDelegate.activeStory objectForKey:@"story_authors"]) {
|
||||
|
@ -483,7 +483,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
#pragma mark Actions
|
||||
|
||||
- (void)setNextPreviousButtons {
|
||||
int nextIndex = [appDelegate indexOfNextStory];
|
||||
int nextIndex = [appDelegate indexOfNextUnreadStory];
|
||||
int unreadCount = [appDelegate unreadCount];
|
||||
if (nextIndex == -1 && unreadCount > 0) {
|
||||
[buttonNext setStyle:UIBarButtonItemStyleBordered];
|
||||
|
@ -550,7 +550,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (IBAction)doNextUnreadStory {
|
||||
int nextIndex = [appDelegate indexOfNextStory];
|
||||
int nextIndex = [appDelegate indexOfNextUnreadStory];
|
||||
int unreadCount = [appDelegate unreadCount];
|
||||
[self.loadingIndicator stopAnimating];
|
||||
|
||||
|
@ -594,16 +594,12 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (IBAction)doNextStory {
|
||||
int activeLocation = appDelegate.locationOfActiveStory;
|
||||
NSLog(@"activeLocation is %i", activeLocation);
|
||||
|
||||
NSLog(@"[appDelegate.activeFeedStories count] is %i", [appDelegate.activeFeedStories count]);
|
||||
int nextIndex = [appDelegate indexOfNextStory];
|
||||
|
||||
if (activeLocation >= ([appDelegate.activeFeedStories count] - 1)) {
|
||||
if (nextIndex == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int nextIndex = activeLocation + 1;
|
||||
|
||||
[self.loadingIndicator stopAnimating];
|
||||
|
||||
if (self.appDelegate.feedDetailViewController.pageFetching) {
|
||||
|
@ -618,6 +614,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
[self markStoryAsRead];
|
||||
[self setNextPreviousButtons];
|
||||
[appDelegate changeActiveFeedDetailRow];
|
||||
|
||||
[UIView beginAnimations:nil context:nil];
|
||||
[UIView setAnimationDuration:.5];
|
||||
[UIView setAnimationBeginsFromCurrentState:NO];
|
||||
|
@ -660,7 +657,6 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)changeWebViewWidth:(int)width {
|
||||
|
||||
int contentWidth = self.view.frame.size.width;
|
||||
NSString *contentWidthClass;
|
||||
|
||||
|
@ -680,7 +676,6 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
[contentWidthClass release];
|
||||
[jsString release];
|
||||
|
||||
}
|
||||
|
||||
- (IBAction)toggleFontSize:(id)sender {
|
||||
|
|
|
@ -4480,7 +4480,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<object class="NSMutableArray" key="IBUIItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBUIBarButtonItem" id="542821156">
|
||||
<string key="IBUITitle">←</string>
|
||||
<string key="IBUITitle">Previous</string>
|
||||
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
|
||||
<float key="IBUIWidth">86</float>
|
||||
<int key="IBUIStyle">1</int>
|
||||
|
@ -4502,6 +4502,11 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<reference key="IBUIToolbar" ref="155973878"/>
|
||||
<int key="IBUISystemItemIdentifier">5</int>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="397639374">
|
||||
<string key="targetRuntimeIdentifier">IBIPadFramework</string>
|
||||
<float key="IBUIWidth">20</float>
|
||||
<reference key="IBUIToolbar" ref="155973878"/>
|
||||
</object>
|
||||
<object class="IBUIBarButtonItem" id="672699755">
|
||||
<object class="NSCustomResource" key="IBUIImage">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
|
@ -4589,14 +4594,6 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
</object>
|
||||
<int key="connectionID">59</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">activity</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="672699755"/>
|
||||
</object>
|
||||
<int key="connectionID">65</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">webView</string>
|
||||
|
@ -4613,6 +4610,14 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
</object>
|
||||
<int key="connectionID">79</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">activity</string>
|
||||
<reference key="source" ref="372490531"/>
|
||||
<reference key="destination" ref="397639374"/>
|
||||
</object>
|
||||
<int key="connectionID">81</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBCocoaTouchOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
|
@ -4689,6 +4694,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<reference ref="812131495"/>
|
||||
<reference ref="284060761"/>
|
||||
<reference ref="672699755"/>
|
||||
<reference ref="397639374"/>
|
||||
</object>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
|
@ -4736,6 +4742,11 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<reference key="object" ref="506862915"/>
|
||||
<reference key="parent" ref="191373211"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">80</int>
|
||||
<reference key="object" ref="397639374"/>
|
||||
<reference key="parent" ref="155973878"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
|
@ -4757,6 +4768,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string>47.IBPluginDependency</string>
|
||||
<string>48.IBPluginDependency</string>
|
||||
<string>63.IBPluginDependency</string>
|
||||
<string>80.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
|
@ -4778,6 +4790,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
|
@ -4792,7 +4805,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">79</int>
|
||||
<int key="maxID">81</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
|
@ -6574,6 +6587,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string>appDelegate</string>
|
||||
<string>buttonAction</string>
|
||||
<string>buttonNext</string>
|
||||
<string>buttonNextStory</string>
|
||||
<string>buttonPrevious</string>
|
||||
<string>feedTitleGradient</string>
|
||||
<string>popoverController</string>
|
||||
|
@ -6588,6 +6602,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIBarButtonItem</string>
|
||||
<string>UIView</string>
|
||||
<string>UIPopoverController</string>
|
||||
<string>UIProgressView</string>
|
||||
|
@ -6603,6 +6618,7 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string>appDelegate</string>
|
||||
<string>buttonAction</string>
|
||||
<string>buttonNext</string>
|
||||
<string>buttonNextStory</string>
|
||||
<string>buttonPrevious</string>
|
||||
<string>feedTitleGradient</string>
|
||||
<string>popoverController</string>
|
||||
|
@ -6628,6 +6644,10 @@ AAgAAAAIAAIACAACAAAAAgAAAAEAAQABAAE</bytes>
|
|||
<string key="name">buttonNext</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">buttonNextStory</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">buttonPrevious</string>
|
||||
<string key="candidateClassName">UIBarButtonItem</string>
|
||||
|
|
Loading…
Add table
Reference in a new issue