#import "Constants.h" #import "QSThingsAppSectionsParser.h" #import "SQLHelper.h" @implementation QSThingsAppSectionsParser - (BOOL)validParserForPath:(NSString *)path { return [[path lastPathComponent] isEqualToString:@"main.sqlite"]; } // This is not really a parser, but having the sqlite helps us // confirm that this makes sense. - (NSArray *)objectsFromPath:(NSString *)path withSettings:(NSDictionary *)settings { NSMutableArray *objects = [NSMutableArray array]; NSDictionary *dictionary = @{@"path": path}; // Inbox QSObject *inbox = [QSObject makeObjectWithIdentifier: ThingsAppSectionKeyInbox]; [inbox setName:@"Inbox"]; [inbox setPrimaryType:kAppSectionType]; [inbox setObject:[dictionary copy] forType:kAppSectionType]; [objects addObject:inbox]; // Today QSObject *today = [QSObject makeObjectWithIdentifier: ThingsAppSectionKeyToday]; [today setName:@"Today"]; [today setPrimaryType:kAppSectionType]; [today setObject:[dictionary copy] forType:kAppSectionType]; [objects addObject:today]; // Upcoming QSObject *upcoming = [QSObject makeObjectWithIdentifier: ThingsAppSectionKeyUpcoming]; [upcoming setName:@"Upcoming"]; [upcoming setPrimaryType:kAppSectionType]; [upcoming setObject:[dictionary copy] forType:kAppSectionType]; [objects addObject:upcoming]; // Anytime QSObject *anytime = [QSObject makeObjectWithIdentifier: ThingsAppSectionKeyAnytime]; [anytime setName:@"Anytime"]; [anytime setPrimaryType:kAppSectionType]; [anytime setObject:[dictionary copy] forType:kAppSectionType]; [objects addObject:anytime]; // Anytime QSObject *someday = [QSObject makeObjectWithIdentifier: ThingsAppSectionKeySomeday]; [someday setName:@"Someday"]; [someday setPrimaryType:kAppSectionType]; [someday setObject:[dictionary copy] forType:kAppSectionType]; [objects addObject:someday]; return objects; } @end