Permalink
Browse files

misc fixes

  • Loading branch information...
1 parent c280ccb commit c47f6a2a385a37482b2fd26648a1718085c73fc6 @arg0s committed Sep 14, 2012
Showing with 32 additions and 28 deletions.
  1. +2 −0 Amul/Amul.h
  2. +8 −0 Amul/LLAppDelegate.m
  3. +19 −8 Amul/LLCartoonsTableVC.m
  4. +2 −0 Podfile
  5. +1 −20 README.md
View
@@ -14,5 +14,7 @@
#import "LLCartoonTableCell.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import <LRResty/LRResty.h>
+#import <BlockAlertsAnd-ActionSheets/BlockAlertView.h>
+#import <iRate.h>
#endif
@@ -9,6 +9,7 @@
#import "LLAppDelegate.h"
#import "LLAmulSHKConfigurator.h"
#import "SHKConfiguration.h"
+#import "Amul.h"
@implementation LLAppDelegate
@@ -20,4 +21,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
return YES;
}
++ (void)initialize
+{
+ //configure iRate
+ [iRate sharedInstance].daysUntilPrompt = 5;
+ [iRate sharedInstance].usesUntilPrompt = 15;
+}
+
@end
@@ -8,6 +8,7 @@
#import "LLCartoonsTableVC.h"
#import <QuartzCore/QuartzCore.h>
+#import "Amul.h"
@interface LLCartoonsTableVC ()
@@ -18,7 +19,7 @@ @implementation LLCartoonsTableVC
@synthesize data;
@synthesize picker;
-#define AMUL_S3_JSON @"http://akiaiwzoruprm2wjp2jq-amul-bucket.s3.amazonaws.com/amul.json"
+#define AMUL_S3_JSON @"http://d1832ahxutkhx9.cloudfront.net/amul.json"
- (id)initWithStyle:(UITableViewStyle)style
{
@@ -32,13 +33,23 @@ - (id)initWithStyle:(UITableViewStyle)style
- (void) loadModel{
[[LRResty client] get:AMUL_S3_JSON withBlock:^(LRRestyResponse *response) {
- NSError* error;
- id responseObj = [NSJSONSerialization JSONObjectWithData:[[response asString] dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
- NSLog(@"Sections: %i", [responseObj count]);
- self.data = responseObj;
- [[self tableView] reloadData];
- [[self picker] reloadAllComponents];
- [[self tableView] scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
+ if ([response status] == 200){
+ NSError* error;
+ id responseObj = [NSJSONSerialization JSONObjectWithData:[[response asString] dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
+ NSLog(@"Sections: %i", [responseObj count]);
+ self.data = responseObj;
+ [[self tableView] reloadData];
+ [[self picker] reloadAllComponents];
+ [[self tableView] scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
+ }
+ else{
+ NSLog(@"Unable to load data feed");
+ BlockAlertView* alert = [[BlockAlertView alloc] initWithTitle:@"Network Error" message:@"Unable to load cartoon ads. Please try again later!"];
+ [alert addButtonWithTitle:@"OK" block:^(void){
+ exit(1);
+ }];
+ [alert show];
+ }
}];
}
View
@@ -5,3 +5,5 @@ pod 'LRResty', '~> 0.11.0'
pod 'NSLogger', '~> 1.1'
pod 'SDWebImage', '~> 2.6'
pod 'ShareKit/Facebook', '~> 2.0'
+pod 'BlockAlertsAnd-ActionSheets', '~> 1.0.0'
+pod 'iRate', '~> 1.4.7'
View
@@ -1,20 +1 @@
-Overview
---------
-
-Simple app that displays Amul 'topical' cartoons over the years, that was first built over a weekend in early 2010 while I was learning Obj-C. The app was downloaded far more times that I'd expected - several thousands every month, but I didnt get a chance to update it until now. This is a dedication to Dr Kurien of Amul, who passed away in September 2012. I'm opening up the code so that other contributors who like the Amul cartoon ads can join in to help enhance it.
-
-Scraper
-=======
-Worker task that scrapes the image and caption data off the Amul site, and dumps it in a JSON feed. Workers currently run off Heroku, and dump the feed on S3. Uses BeautifulSoup to parse the content & work through a linked list of pages to propagate data upwards.
-
-The scraper code is located in a separate repo here: https://github.com/arg0s/amulet.git
-
-
-App
-===
-iOS app that lets you browse the cartoons, and provides a nifty picker to go back and forth across the years all the way back to 1976.
-
-TODO
-----
-* Wire the greatest hits to the Google Analytics feed and key off top content
-* Offer a random cartoon of the day, and an ability to personalize/share with friends
+Please visit the project page: http://arg0s.github.com/amulios/ for more information

0 comments on commit c47f6a2

Please sign in to comment.