mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-11-01 09:09:51 +00:00
Showing saved/shared story status at bottom on ios.
This commit is contained in:
parent
255a010dfb
commit
3ef7a7776d
8 changed files with 81 additions and 39 deletions
|
|
@ -581,6 +581,16 @@ def mark_story_as_shared(request):
|
|||
stories, profiles = MSharedStory.stories_with_comments_and_profiles([story], relative_user_id,
|
||||
check_all=check_all)
|
||||
story = stories[0]
|
||||
starred_stories = MStarredStory.objects(user_id=request.user.pk,
|
||||
story_feed_id=story['story_feed_id'],
|
||||
story_hash=story['story_hash'])\
|
||||
.only('story_hash', 'starred_date', 'user_tags').limit(1)
|
||||
if starred_stories:
|
||||
story['user_tags'] = starred_stories[0]['user_tags']
|
||||
story['starred'] = True
|
||||
starred_date = localtime_for_timezone(starred_stories[0]['starred_date'],
|
||||
request.user.profile.timezone)
|
||||
story['starred_date'] = format_story_link_date__long(starred_date, now)
|
||||
story['shared_comments'] = strip_tags(shared_story['comments'] or "")
|
||||
story['shared_by_user'] = True
|
||||
story['shared'] = True
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ static UIFont *textFont = nil;
|
|||
backgroundColor = cell.highlighted || cell.selected ?
|
||||
UIColorFromRGB(0xFFFFD2) :
|
||||
cell.isSocial ? UIColorFromRGB(0xE6ECE8) :
|
||||
cell.isSaved ? UIColorFromRGB(0xE9EBEE) :
|
||||
UIColorFromRGB(0xF7F8F5);
|
||||
|
||||
[backgroundColor set];
|
||||
|
|
|
|||
|
|
@ -460,7 +460,8 @@
|
|||
|
||||
// update the current story and the activeFeedStories
|
||||
appDelegate.activeStory = newStoryParsed;
|
||||
|
||||
[appDelegate.storyPageControl.currentPage setActiveStoryAtIndex:-1];
|
||||
|
||||
NSMutableArray *newActiveFeedStories = [[NSMutableArray alloc] init];
|
||||
|
||||
for (int i = 0; i < appDelegate.storiesCollection.activeFeedStories.count; i++) {
|
||||
|
|
@ -477,7 +478,6 @@
|
|||
appDelegate.storiesCollection.activeFeedStories = [NSArray arrayWithArray:newActiveFeedStories];
|
||||
|
||||
self.commentField.text = nil;
|
||||
[appDelegate.storyPageControl.currentPage setActiveStoryAtIndex:-1];
|
||||
[appDelegate.storyPageControl.currentPage refreshComments:replyId];
|
||||
[appDelegate changeActiveFeedDetailRow];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@
|
|||
- (NSString *)getReplies:(NSArray *)replies forUserId:(NSString *)commentUserId;
|
||||
- (NSString *)getAvatars:(NSString *)key;
|
||||
- (void)refreshHeader;
|
||||
- (void)refreshSideoptions;
|
||||
|
||||
- (void)fetchTextView;
|
||||
- (void)finishFetchTextView:(ASIHTTPRequest *)request;
|
||||
|
|
|
|||
|
|
@ -256,25 +256,7 @@
|
|||
"<script src=\"storyDetailView.js\"></script>"
|
||||
"<script src=\"fastTouch.js\"></script>"];
|
||||
|
||||
sharingHtmlString = [NSString stringWithFormat:@
|
||||
"<div class='NB-share-header'></div>"
|
||||
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-train-button NB-button'>"
|
||||
" <a href=\"http://ios.newsblur.com/train\"><div>"
|
||||
" <span class=\"NB-icon\"></span> Train"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-button'>"
|
||||
" <a href=\"http://ios.newsblur.com/share\"><div>"
|
||||
" <span class=\"NB-icon\"></span> Share"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-save-button NB-button'>"
|
||||
" <a href=\"http://ios.newsblur.com/save\"><div>"
|
||||
" <span class=\"NB-icon\"></span> Save"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
"</div></div>"];
|
||||
sharingHtmlString = [self getSideoptions];
|
||||
|
||||
NSString *storyHeader = [self getHeader];
|
||||
NSString *htmlString = [NSString stringWithFormat:@
|
||||
|
|
@ -285,14 +267,13 @@
|
|||
" <div class=\"%@\" id=\"NB-font-size\">"
|
||||
" <div class=\"%@\" id=\"NB-line-spacing\">"
|
||||
" <div id=\"NB-header-container\">%@</div>" // storyHeader
|
||||
" %@" // shareBar
|
||||
" <div id=\"NB-story\" class=\"NB-story\">%@</div>"
|
||||
" %@" // share
|
||||
" <div id=\"NB-comments-wrapper\">"
|
||||
" %@" // friends comments
|
||||
" </div>"
|
||||
" %@"
|
||||
" </div>" // storyHeader
|
||||
" %@" // shareBar
|
||||
" <div id=\"NB-story\" class=\"NB-story\">%@</div>"
|
||||
" <div id=\"NB-sideoptions-container\">%@</div>"
|
||||
" <div id=\"NB-comments-wrapper\">"
|
||||
" %@" // friends comments
|
||||
" </div>"
|
||||
" %@"
|
||||
" </div>" // line-spacing
|
||||
" </div>" // font-size
|
||||
" </div>" // font-style
|
||||
|
|
@ -469,6 +450,39 @@
|
|||
return storyHeader;
|
||||
}
|
||||
|
||||
- (NSString *)getSideoptions {
|
||||
BOOL isSaved = [[self.activeStory objectForKey:@"starred"] boolValue];
|
||||
BOOL isShared = [[self.activeStory objectForKey:@"shared"] boolValue];
|
||||
|
||||
NSString *sideoptions = [NSString stringWithFormat:@
|
||||
"<div class='NB-sideoptions'>"
|
||||
"<div class='NB-share-header'></div>"
|
||||
"<div class='NB-share-wrapper'><div class='NB-share-inner-wrapper'>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-train-button NB-button'>"
|
||||
" <a href=\"http://ios.newsblur.com/train\"><div>"
|
||||
" <span class=\"NB-icon\"></span> Train"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-button %@'>"
|
||||
" <a href=\"http://ios.newsblur.com/share\"><div>"
|
||||
" <span class=\"NB-icon\"></span> %@"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
" <div id=\"NB-share-button-id\" class='NB-share-button NB-save-button NB-button %@'>"
|
||||
" <a href=\"http://ios.newsblur.com/save\"><div>"
|
||||
" <span class=\"NB-icon\"></span> %@"
|
||||
" </div></a>"
|
||||
" </div>"
|
||||
"</div></div></div>",
|
||||
isShared ? @"NB-button-active" : @"",
|
||||
isShared ? @"Shared" : @"Share",
|
||||
isSaved ? @"NB-button-active" : @"",
|
||||
isSaved ? @"Saved" : @"Save"
|
||||
];
|
||||
|
||||
return sideoptions;
|
||||
}
|
||||
|
||||
- (NSString *)getAvatars:(NSString *)key {
|
||||
NSString *avatarString = @"";
|
||||
NSArray *shareUserIds = [self.activeStory objectForKey:key];
|
||||
|
|
@ -1096,11 +1110,8 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
width:[[urlComponents objectAtIndex:4] intValue]
|
||||
height:[[urlComponents objectAtIndex:5] intValue]];
|
||||
return NO;
|
||||
} else if ([action isEqualToString:@"save"] && [urlComponents count] > 5) {
|
||||
[self openTrainingDialog:[[urlComponents objectAtIndex:2] intValue]
|
||||
yCoordinate:[[urlComponents objectAtIndex:3] intValue]
|
||||
width:[[urlComponents objectAtIndex:4] intValue]
|
||||
height:[[urlComponents objectAtIndex:5] intValue]];
|
||||
} else if ([action isEqualToString:@"save"]) {
|
||||
[appDelegate.storiesCollection toggleStorySaved:self.activeStory];
|
||||
return NO;
|
||||
} else if ([action isEqualToString:@"classify-author"]) {
|
||||
NSString *author = [NSString stringWithFormat:@"%@", [urlComponents objectAtIndex:2]];
|
||||
|
|
@ -1488,6 +1499,7 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
// sleep(1);
|
||||
|
||||
[self flashCheckmarkHud:shareType];
|
||||
[self refreshSideoptions];
|
||||
}
|
||||
|
||||
- (void)flashCheckmarkHud:(NSString *)messageType {
|
||||
|
|
@ -1563,10 +1575,21 @@ shouldStartLoadWithRequest:(NSURLRequest *)request
|
|||
|
||||
- (void)refreshHeader {
|
||||
NSString *headerString = [[[self getHeader] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\'"]
|
||||
stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
|
||||
stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
|
||||
NSString *jsString = [NSString stringWithFormat:@"document.getElementById('NB-header-container').innerHTML = '%@';",
|
||||
headerString];
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:@"attachFastClick();"];
|
||||
}
|
||||
|
||||
- (void)refreshSideoptions {
|
||||
NSString *sideoptionsString = [[[self getSideoptions] stringByReplacingOccurrencesOfString:@"\'" withString:@"\\'"]
|
||||
stringByReplacingOccurrencesOfString:@"\n" withString:@" "];
|
||||
NSString *jsString = [NSString stringWithFormat:@"document.getElementById('NB-sideoptions-container').innerHTML = '%@';",
|
||||
sideoptionsString];
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
|
||||
|
||||
[self.webView stringByEvaluatingJavaScriptFromString:@"attachFastClick();"];
|
||||
|
|
|
|||
|
|
@ -403,6 +403,10 @@
|
|||
[currentPage refreshHeader];
|
||||
[nextPage refreshHeader];
|
||||
[previousPage refreshHeader];
|
||||
|
||||
[currentPage refreshSideoptions];
|
||||
[nextPage refreshSideoptions];
|
||||
[previousPage refreshSideoptions];
|
||||
}
|
||||
- (void)resizeScrollView {
|
||||
NSInteger widthCount = appDelegate.storiesCollection.storyLocationsCount;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
|
||||
//#define DEBUG 1
|
||||
#define DEBUG 1
|
||||
//#define PROD_DEBUG 1
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
|
|||
|
|
@ -607,7 +607,8 @@ a.NB-show-profile {
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.NB-button.active a {
|
||||
.NB-button.active a,
|
||||
.NB-button.NB-button-active a {
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
|
|
@ -631,7 +632,8 @@ a.NB-show-profile {
|
|||
text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.NB-button:active div {
|
||||
.NB-button:active div,
|
||||
.NB-button.NB-button-active div {
|
||||
background: -webkit-gradient(
|
||||
linear, left top, left bottom,
|
||||
from(#6C6D69),
|
||||
|
|
@ -645,7 +647,8 @@ a.NB-show-profile {
|
|||
box-shadow: none;
|
||||
}
|
||||
|
||||
.NB-button.NB-share-button:active div {
|
||||
.NB-button.NB-share-button:active div,
|
||||
.NB-button.NB-share-button.NB-button-active div {
|
||||
color: darkgrey;
|
||||
text-shadow: 0 1px 0 rgba(0, 0, 0, .2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue