From 663d25e5160e97eefed1444bac0b4ac964f3368e Mon Sep 17 00:00:00 2001 From: matt handler Date: Sun, 24 Apr 2011 21:00:46 -0400 Subject: still a bit off from a solid state... added fmdatabase, updated acidcow parser with a formate, added some standard stuff to piccast app delegate, created a section dictionary, did some serializing to/from db for topics, added a bunch of logic to topic view controller, added db table --- Classes/PicCastAppDelegate.m | 45 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'Classes/PicCastAppDelegate.m') diff --git a/Classes/PicCastAppDelegate.m b/Classes/PicCastAppDelegate.m index ab242ec..f44c6eb 100644 --- a/Classes/PicCastAppDelegate.m +++ b/Classes/PicCastAppDelegate.m @@ -32,6 +32,16 @@ @synthesize navigationController; +//- (void)initialize { +// [[NSUserDefaults standardUserDefaults] +// registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys: +// NULL, @"facebookToken", +// NULL, @"facebookExpirationDate", +// NULL, @"twitterToken", +// [NSNumber numberWithBool:NO], @"haveSearched", +// nil]]; +//} + #pragma mark - #pragma mark Application lifecycle @@ -110,6 +120,41 @@ */ } +#pragma mark - +#pragma mark CustomSheeyit + +//+ (void) prompt:(NSString *)title withMessage:(NSString *)message andButtonTitle:(NSString *)buttonTitle withDelegate:(id)delegate { +// UIAlertView *prompt = [UIAlertView alloc]; +// prompt = [prompt initWithTitle:title message:message delegate:delegate cancelButtonTitle:buttonTitle otherButtonTitles:nil]; +// [prompt show]; +// [prompt release]; +//} +// +//+ (void) prompt:(NSString *)title withMessage:(NSString *)message andButtonTitle:(NSString *)buttonTitle { +// [self prompt:title withMessage:message andButtonTitle:buttonTitle withDelegate:self]; +//} +// +//- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { +// return [facebook handleOpenURL:url]; +//} + ++ (NSString *) getDatabasePath { + NSString *databaseName = @"PicCastSqlTable.db"; + + NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDir = [documentPaths objectAtIndex:0]; + NSString *databasePath = [documentsDir stringByAppendingPathComponent:databaseName]; + + NSFileManager *fileManager = [NSFileManager defaultManager]; + + if(![fileManager fileExistsAtPath:databasePath]) { + NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName]; + [fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil]; + } + + return databasePath; +} + #pragma mark - #pragma mark UITabBarControllerDelegate methods -- cgit v1.2.3