Stubbing in story's containing folders, used for saved story tagging.

This commit is contained in:
Samuel Clay 2014-10-30 18:05:34 -07:00
parent 6c134a1d0e
commit b5f2b43a50
4 changed files with 25 additions and 1 deletions

View file

@ -328,6 +328,7 @@
+ (int)computeStoryScore:(NSDictionary *)intelligence;
- (NSString *)extractFolderName:(NSString *)folderName;
- (NSString *)extractParentFolderName:(NSString *)folderName;
- (NSArray *)parentFoldersForFeed:(NSString *)feedId;
- (NSDictionary *)getFeed:(NSString *)feedId;
- (NSDictionary *)getStory:(NSString *)storyHash;

View file

@ -2003,6 +2003,28 @@
return folderName;
}
- (NSArray *)parentFoldersForFeed:(NSString *)feedId {
NSMutableArray *folderNames = [[NSMutableArray alloc] init];
for (NSString *folderName in self.dictFoldersArray) {
NSArray *folder = [self.dictFolders objectForKey:folderName];
if ([folder containsObject:feedId]) {
[folderNames addObject:[self extractFolderName:folderName]];
[folderNames addObject:[self extractParentFolderName:folderName]];
}
}
NSMutableArray *uniqueFolderNames = [[NSMutableArray alloc] init];
for (NSString *folderName in folderNames) {
if ([uniqueFolderNames containsObject:folderName]) continue;
if ([folderName containsString:@"Top Level"]) continue;
if ([folderName length] < 1) continue;
[uniqueFolderNames addObject:folderName];
}
return uniqueFolderNames;
}
- (NSDictionary *)getFeed:(NSString *)feedId {
NSDictionary *feed;
if (storiesCollection.isSocialView ||

View file

@ -636,6 +636,7 @@
}
- (void)markStory:(NSDictionary *)story asSaved:(BOOL)saved {
NSLog(@"Saving in folders: %@", [appDelegate parentFoldersForFeed:[story objectForKey:@"story_feed_id"]]);
NSMutableDictionary *newStory = [[appDelegate getStory:[story objectForKey:@"story_hash"]] mutableCopy];
[newStory setValue:[NSNumber numberWithBool:saved] forKey:@"starred"];
if (saved) {

View file

@ -5,7 +5,7 @@
#import <SystemConfiguration/SystemConfiguration.h>
#import <MobileCoreServices/MobileCoreServices.h>
//#define DEBUG 1
#define DEBUG 1
//#define PROD_DEBUG 1
#ifdef DEBUG