mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Fixing sharing and comments and replying with new page controls.
This commit is contained in:
parent
0fb940a00e
commit
97e0881ccb
11 changed files with 69 additions and 43 deletions
|
@ -509,7 +509,10 @@ def mark_story_as_shared(request):
|
|||
story = stories[0]
|
||||
story['shared_comments'] = strip_tags(shared_story['comments'] or "")
|
||||
story['shared_by_user'] = True
|
||||
|
||||
shared_date = localtime_for_timezone(shared_story['shared_date'], request.user.profile.timezone)
|
||||
story['short_parsed_date'] = format_story_link_date__short(shared_date)
|
||||
story['long_parsed_date'] = format_story_link_date__long(shared_date)
|
||||
|
||||
if post_to_services:
|
||||
for service in post_to_services:
|
||||
if service not in shared_story.posted_to_services:
|
||||
|
|
|
@ -467,9 +467,9 @@
|
|||
[self setInFindingStoryMode:NO];
|
||||
}
|
||||
|
||||
[self setTryFeedStoryId:contentId];
|
||||
[self setActiveFeed:feed];
|
||||
[self setActiveFolder:nil];
|
||||
self.tryFeedStoryId = contentId;
|
||||
self.activeFeed = feed;
|
||||
self.activeFolder = nil;
|
||||
|
||||
[self loadFeedDetailView];
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ static const CGFloat kFolderTitleHeight = 28;
|
|||
- (void)finishLoadingFeedList:(ASIHTTPRequest *)request {
|
||||
if ([request responseStatusCode] == 403) {
|
||||
return [appDelegate showLogin];
|
||||
} else if ([request responseStatusCode] >= 500) {
|
||||
} else if ([request responseStatusCode] == 404 ||
|
||||
[request responseStatusCode] >= 500) {
|
||||
[pull finishedLoading];
|
||||
return [self informError:@"The server barfed!"];
|
||||
}
|
||||
|
|
|
@ -317,7 +317,6 @@
|
|||
[request setDidFailSelector:@selector(requestFailed:)];
|
||||
[request startAsynchronous];
|
||||
[appDelegate hideShareView:YES];
|
||||
[appDelegate.storyPageControl showShareHUD:@"Replying"];
|
||||
}
|
||||
|
||||
- (void)finishAddReply:(ASIHTTPRequest *)request {
|
||||
|
@ -343,7 +342,6 @@
|
|||
- (void)replaceStory:(NSDictionary *)newStory withReplyId:(NSString *)replyId {
|
||||
NSMutableDictionary *newStoryParsed = [newStory mutableCopy];
|
||||
[newStoryParsed setValue:[NSNumber numberWithInt:1] forKey:@"read_status"];
|
||||
[newStoryParsed setValue:[appDelegate.activeStory objectForKey:@"short_parsed_date"] forKey:@"short_parsed_date"] ;
|
||||
|
||||
// update the current story and the activeFeedStories
|
||||
appDelegate.activeStory = newStoryParsed;
|
||||
|
@ -364,7 +362,8 @@
|
|||
appDelegate.activeFeedStories = [NSArray arrayWithArray:newActiveFeedStories];
|
||||
|
||||
self.commentField.text = nil;
|
||||
[appDelegate.storyDetailViewController refreshComments:replyId];
|
||||
[appDelegate.storyPageControl refreshPages];
|
||||
[appDelegate.storyPageControl.currentPage refreshComments:replyId];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
- (void)scrolltoComment;
|
||||
- (void)changeWebViewWidth;
|
||||
- (void)showUserProfile:(NSString *)userId xCoordinate:(int)x yCoordinate:(int)y width:(int)width height:(int)height;
|
||||
- (void)checkTryFeedStory;
|
||||
- (void)setFontStyle:(NSString *)fontStyle;
|
||||
- (void)changeFontSize:(NSString *)fontSize;
|
||||
- (void)refreshComments:(NSString *)replyId;
|
||||
|
|
|
@ -767,7 +767,7 @@
|
|||
UIImageView *titleImageView = [[UIImageView alloc] initWithImage:titleImage];
|
||||
titleImageView.frame = CGRectMake(0.0, 2.0, 16.0, 16.0);
|
||||
titleImageView.hidden = YES;
|
||||
self.navigationItem.titleView = titleImageView;
|
||||
appDelegate.storyPageControl.navigationItem.titleView = titleImageView;
|
||||
titleImageView.hidden = NO;
|
||||
} else {
|
||||
|
||||
|
@ -778,7 +778,7 @@
|
|||
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
|
||||
imageView.frame = CGRectMake(0.0, 0.0, 28.0, 28.0);
|
||||
[imageView setImage:titleImage];
|
||||
self.navigationItem.titleView = imageView;
|
||||
appDelegate.storyPageControl.navigationItem.titleView = imageView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -920,12 +920,16 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
[self changeFontSize:[userPreferences stringForKey:@"fontSizing"]];
|
||||
}
|
||||
|
||||
[self checkTryFeedStory];
|
||||
}
|
||||
|
||||
- (void)checkTryFeedStory {
|
||||
// see if it's a tryfeed for animation
|
||||
if (!self.webView.hidden &&
|
||||
appDelegate.tryFeedCategory &&
|
||||
[[appDelegate.activeStory objectForKey:@"id"] isEqualToString:appDelegate.tryFeedStoryId]) {
|
||||
[MBProgressHUD hideHUDForView:appDelegate.storyPageControl.view animated:YES];
|
||||
|
||||
|
||||
if ([appDelegate.tryFeedCategory isEqualToString:@"comment_like"] ||
|
||||
[appDelegate.tryFeedCategory isEqualToString:@"comment_reply"]) {
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
|
@ -935,7 +939,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
NSString *blurblogUserId = [NSString stringWithFormat:@"%@", [self.activeStory objectForKey:@"social_user_id"]];
|
||||
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@', true);", blurblogUserId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
|
||||
|
||||
}
|
||||
appDelegate.tryFeedCategory = nil;
|
||||
}
|
||||
|
@ -1102,7 +1106,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
self.storyHUD.removeFromSuperViewOnHide = YES;
|
||||
self.storyHUD.labelText = @"Followed";
|
||||
[self.storyHUD hide:YES afterDelay:1];
|
||||
self.navigationItem.leftBarButtonItem = nil;
|
||||
appDelegate.storyPageControl.navigationItem.leftBarButtonItem = nil;
|
||||
[appDelegate reloadFeedsView:NO];
|
||||
// [appDelegate.feedDetailViewController resetFeedDetail];
|
||||
// [appDelegate.feedDetailViewController fetchFeedDetail:1 withCallback:nil];
|
||||
|
@ -1114,27 +1118,33 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
NSString *commentString = [self getComments];
|
||||
NSString *jsString = [[NSString alloc] initWithFormat:@
|
||||
"document.getElementById('NB-comments-wrapper').innerHTML = '%@';"
|
||||
"document.getElementById('NB-share-bar-wrapper').innerHTML = '%@';",
|
||||
"document.getElementById('NB-share-bar-wrapper').innerHTML = '<div>LALALALALA</div> %@';",
|
||||
commentString,
|
||||
shareBarString];
|
||||
NSString *shareType = appDelegate.activeShareType;
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
|
||||
if (!replyId) {
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@', true);", currentUserId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
} else if ([replyId isEqualToString:@"like"]) {
|
||||
|
||||
// HACK to make the scroll event happen after the replace innerHTML event above happens.
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .15 * NSEC_PER_SEC),
|
||||
dispatch_get_current_queue(), ^{
|
||||
if (!replyId) {
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@",
|
||||
[appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
NSString *jsFlashString = [[NSString alloc]
|
||||
initWithFormat:@"slideToComment('%@', true);", currentUserId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
} else if ([replyId isEqualToString:@"like"]) {
|
||||
|
||||
} else {
|
||||
NSString *jsFlashString = [[NSString alloc]
|
||||
initWithFormat:@"slideToComment('%@', true);", replyId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@', true);", replyId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
}
|
||||
|
||||
|
||||
// // adding in a simulated delay
|
||||
// sleep(4);
|
||||
// sleep(1);
|
||||
|
||||
self.storyHUD.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"37x-Checkmark.png"]];
|
||||
self.storyHUD.mode = MBProgressHUDModeCustomView;
|
||||
|
@ -1157,7 +1167,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
}
|
||||
|
||||
- (void)scrolltoComment {
|
||||
NSString *currentUserId = [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
NSString *currentUserId = YES ? @"50a2a61620abf55b0cb56b05" : [NSString stringWithFormat:@"%@", [appDelegate.dictUserProfile objectForKey:@"user_id"]];
|
||||
NSString *jsFlashString = [[NSString alloc] initWithFormat:@"slideToComment('%@', true);", currentUserId];
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsFlashString];
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
|
||||
- (void)transitionFromFeedDetail;
|
||||
- (void)resetPages;
|
||||
- (void)refreshPages;
|
||||
- (void)setStoryFromScroll;
|
||||
- (void)updatePageWithActiveStory:(int)location;
|
||||
- (void)changePage:(NSInteger)pageIndex;
|
||||
|
|
|
@ -154,13 +154,7 @@
|
|||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
[self resizeScrollView];
|
||||
[appDelegate adjustStoryDetailWebView];
|
||||
int pageIndex = currentPage.pageIndex;
|
||||
currentPage.pageIndex = -1;
|
||||
nextPage.pageIndex = -1;
|
||||
[self changePage:pageIndex animated:NO];
|
||||
// self.scrollView.contentOffset = CGPointMake(self.scrollView.frame.size.width * currentPage.pageIndex, 0);
|
||||
[self refreshPages];
|
||||
}
|
||||
|
||||
- (void)resetPages {
|
||||
|
@ -176,6 +170,17 @@
|
|||
self.scrollView.contentOffset = CGPointMake(0, 0);
|
||||
}
|
||||
|
||||
- (void)refreshPages {
|
||||
[self resizeScrollView];
|
||||
[appDelegate adjustStoryDetailWebView];
|
||||
int pageIndex = currentPage.pageIndex;
|
||||
currentPage.pageIndex = -1;
|
||||
nextPage.pageIndex = -1;
|
||||
[self changePage:pageIndex animated:NO];
|
||||
[MBProgressHUD hideHUDForView:self.view animated:YES];
|
||||
// self.scrollView.contentOffset = CGPointMake(self.scrollView.frame.size.width * currentPage.pageIndex, 0);
|
||||
}
|
||||
|
||||
- (void)resizeScrollView {
|
||||
NSInteger widthCount = self.appDelegate.storyCount;
|
||||
if (widthCount == 0) {
|
||||
|
@ -364,8 +369,14 @@
|
|||
nextPage = swapController;
|
||||
}
|
||||
|
||||
NSLog(@"setStoryFromScroll, currentPage index: %d -- %d", currentPage.pageIndex, nearestNumber);
|
||||
|
||||
if (currentPage.pageIndex == -1) return;
|
||||
|
||||
nextPage.webView.scrollView.scrollsToTop = NO;
|
||||
currentPage.webView.scrollView.scrollsToTop = YES;
|
||||
self.scrollView.scrollsToTop = NO;
|
||||
|
||||
int storyIndex = [appDelegate indexFromLocation:currentPage.pageIndex];
|
||||
appDelegate.activeStory = [appDelegate.activeFeedStories objectAtIndex:storyIndex];
|
||||
[self updatePageWithActiveStory:currentPage.pageIndex];
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Classes/StoryPageControl.m"
|
||||
timestampString = "374194739.032941"
|
||||
timestampString = "374530790.020931"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "784"
|
||||
endingLineNumber = "784"
|
||||
startingLineNumber = "795"
|
||||
endingLineNumber = "795"
|
||||
landmarkName = "-doNextStory"
|
||||
landmarkType = "5">
|
||||
</FileBreakpoint>
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
// #define BACKGROUND_REFRESH_SECONDS -5
|
||||
#define BACKGROUND_REFRESH_SECONDS -10*60
|
||||
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
#define NEWSBLUR_URL [NSString stringWithFormat:@"nb.local.com"]
|
||||
// #define NEWSBLUR_URL [NSString stringWithFormat:@"www.newsblur.com"]
|
||||
|
||||
#define NEWSBLUR_LINK_COLOR 0x405BA8
|
||||
#define NEWSBLUR_HIGHLIGHT_COLOR 0xd2e6fd
|
||||
|
|
|
@ -52,14 +52,14 @@ function slideToComment(commentId, highlight) {
|
|||
//Get comment
|
||||
var $comment = $('#' + commentString);
|
||||
if ($comment.length) {
|
||||
$.scroll($comment.offset().top - 32, 1000);
|
||||
$.scroll($comment.offset().top - 32, 1000, 'ease-in-out');
|
||||
} else {
|
||||
var $shareBar = $('#' + shareString);
|
||||
if ($shareBar.length) {
|
||||
$.scroll($shareBar.offset().top - 32, 1000);
|
||||
$.scroll($shareBar.offset().top - 32, 1000, 'ease-in-out');
|
||||
} else {
|
||||
var $shareButton =$("#NB-share-button-id");
|
||||
$.scroll($shareButton.offset().top - 32, 1000);
|
||||
$.scroll($shareButton.offset().top - 32, 1000, 'ease-in-out');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue