starting to remove SBJSON

This commit is contained in:
Roy Yang 2012-07-27 16:10:13 -07:00
parent ba784e4356
commit ee4de77ab8
3 changed files with 18 additions and 15 deletions

View file

@ -9,7 +9,6 @@
#import <UIKit/UIKit.h>
@class NewsBlurAppDelegate;
@class ASIHTTPRequest;
@class InteractionsModule;
@class ActivityModule;
@class FeedbackModule;
@ -36,7 +35,5 @@
- (IBAction)doLogout:(id)sender;
- (void)refreshInteractions;
- (void)refreshActivity;
- (void)finishLoadActivities:(ASIHTTPRequest *)request;
- (IBAction)tapSegmentedButton:(id)sender;
- (void)requestFailed:(ASIHTTPRequest *)request;
@end

View file

@ -98,7 +98,7 @@
NSMutableArray * readStories;
NSDictionary * dictFolders;
NSDictionary * dictFeeds;
NSMutableDictionary * dictFeeds;
NSMutableDictionary * dictActiveFeeds;
NSDictionary * dictSocialFeeds;
NSDictionary * dictUserProfile;
@ -162,7 +162,7 @@
@property (readwrite) NSMutableArray * readStories;
@property (nonatomic) NSDictionary *dictFolders;
@property (nonatomic) NSDictionary *dictFeeds;
@property (nonatomic, strong) NSMutableDictionary *dictFeeds;
@property (nonatomic) NSMutableDictionary *dictActiveFeeds;
@property (nonatomic) NSDictionary *dictSocialFeeds;
@property (nonatomic) NSDictionary *dictUserProfile;

View file

@ -18,7 +18,6 @@
#import "PullToRefreshView.h"
#import "MBProgressHUD.h"
#import "Base64.h"
#import "JSON.h"
#import "Utilities.h"
@ -269,11 +268,14 @@
return [self informError:@"The server barfed!"];
}
NSString *responseString = [request responseString];
NSDictionary *results = [[NSDictionary alloc]
initWithDictionary:[responseString JSONValue]];
NSString *responseString = [request responseString];
NSData *responseData=[responseString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *results = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
[MBProgressHUD hideHUDForView:self.view animated:YES];
self.stillVisibleFeeds = [NSMutableDictionary dictionary];
self.visibleFeeds = [NSMutableDictionary dictionary];
@ -347,12 +349,12 @@
[self loadAvatars];
// set up dictFolders
NSMutableDictionary * allFolders = [results objectForKey:@"flat_folders"];
NSMutableDictionary * allFolders = [[results objectForKey:@"flat_folders"] mutableCopy];
[allFolders setValue:socialFolder forKey:@""];
appDelegate.dictFolders = allFolders;
// set up dictFeeds
appDelegate.dictFeeds = [results objectForKey:@"feeds"];
appDelegate.dictFeeds = [[results objectForKey:@"feeds"] mutableCopy];
// sort all the folders
appDelegate.dictFoldersArray = [NSMutableArray array];
@ -1093,13 +1095,17 @@
- (void)saveAndDrawFavicons:(ASIHTTPRequest *)request {
NSString *responseString = [request responseString];
NSDictionary *results = [[NSDictionary alloc]
initWithDictionary:[responseString JSONValue]];
NSData *responseData=[responseString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
NSDictionary *results = [NSJSONSerialization
JSONObjectWithData:responseData
options:kNilOptions
error:&error];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul);
dispatch_async(queue, ^{
for (id feed_id in results) {
NSDictionary *feed = [appDelegate.dictFeeds objectForKey:feed_id];
NSMutableDictionary *feed = [[appDelegate.dictFeeds objectForKey:feed_id] mutableCopy];
[feed setValue:[results objectForKey:feed_id] forKey:@"favicon"];
[appDelegate.dictFeeds setValue:feed forKey:feed_id];