Skip to content

Commit e07ad8f

Browse files
author
Joey Lorich
committed
Merge in merge branch
2 parents e70018a + fc38e78 commit e07ad8f

27 files changed

Lines changed: 1138 additions & 905 deletions

EasyReader.xcodeproj/project.pbxproj

Lines changed: 66 additions & 22 deletions
Large diffs are not rendered by default.

EasyReader/Application/Api/CSFakedDataRequestor.m

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,21 @@ - (NSDictionary *) feedItemsResponse
149149
@"created_at": @"2014-03-05T22:32:41+00:00",
150150
@"updated_at": @"2014-03-05T22:32:41+00:00",
151151
@"published_at": @"2014-03-04T19:52:21+00:00"}, nil];
152-
153-
NSRange subarrayRange;
154-
if ( !self.requestCounter ) self.requestCounter = 1;
155-
if ( self.requestCounter == 1 ){
156-
subarrayRange = NSMakeRange(0,4);
157-
} else {
158-
subarrayRange = NSMakeRange(self.requestCounter*2,2);
159-
}
160-
self.requestCounter++;
161-
162-
return @{@"feed_items": [items subarrayWithRange:subarrayRange]};
152+
153+
NSRange subarrayRange;
154+
if ( !self.requestCounter ) self.requestCounter = 1;
155+
if ( self.requestCounter == 1 ){
156+
subarrayRange = NSMakeRange(0,4);
157+
} else {
158+
if( self.requestCounter*2 < [items count]){
159+
subarrayRange = NSMakeRange(self.requestCounter*2,2);
160+
} else {
161+
subarrayRange = NSMakeRange(8,2);
162+
}
163+
}
164+
self.requestCounter++;
165+
166+
return @{@"feed_items": [items subarrayWithRange:subarrayRange]};
163167
}
164168

165169

EasyReader/Application/Api/CSFeedItemUpdater.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ - (void) start
3232
[myInvocation setTarget:self];
3333
[myInvocation setSelector:@selector(requestFiveMinutesOfFeedItems:)];
3434

35-
int interval = 60 * 1;
35+
int interval = 120 * 1;
3636
[NSTimer scheduledTimerWithTimeInterval:interval invocation:myInvocation repeats:YES];
3737
}
3838

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// CSFeedSearcher.h
3+
// EasyReader
4+
//
5+
// Created by Michael Beattie on 3/20/14.
6+
// Copyright (c) 2014 Cloudspace. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
@interface CSFeedSearcher : NSObject
12+
13+
/**
14+
* API requestor for feeds similar to user input
15+
*/
16+
- (void)feedsLike:(NSString *)name;
17+
18+
@end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//
2+
// CSFeedSearcher.m
3+
// EasyReader
4+
//
5+
// Created by Michael Beattie on 3/20/14.
6+
// Copyright (c) 2014 Cloudspace. All rights reserved.
7+
//
8+
9+
#import "CSFeedSearcher.h"
10+
#import "Feed.h"
11+
12+
@implementation CSFeedSearcher
13+
14+
/**
15+
* Returns a set of Feeds and associated FeedItems
16+
*/
17+
- (void)feedsLike:(NSString *)name
18+
{
19+
[self searchForFeedsLike:name];
20+
}
21+
22+
/**
23+
* Call to the API that returns feeds similar to user input
24+
*/
25+
- (void)searchForFeedsLike:(NSString *)name
26+
{
27+
[Feed requestFeedsByName:name
28+
success:^(id responseData){
29+
NSLog(@"Search for feeds");
30+
}
31+
failure:^(id responseData){}];
32+
}
33+
34+
@end

EasyReader/Application/AppDelegates/CSAppDelegate.m

Lines changed: 55 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,63 @@ @implementation CSAppDelegate
2727
*/
2828
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
2929
{
30-
[self registerService:[CSRegisterRoutesService shared]];
31-
[self registerService:[CSCoreDataService shared]];
32-
[self registerService:[CSApplicationStyleService shared]];
33-
[self registerService:[CSFeedUpdateService shared]];
30+
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
31+
// Override point for customization after application launch.
32+
33+
// Observe account status in settings!!
34+
// This is important, if something changes we need to check authentication settingsi
35+
//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(canTweetStatus) name:ACAccountStoreDidChangeNotification object:nil];
36+
37+
// [self applyStyles];
38+
39+
40+
//
41+
// Set up core data
42+
//
43+
[MagicalRecord setupAutoMigratingCoreDataStack];
44+
45+
CSFeedItemUpdater *updater = [[CSFeedItemUpdater alloc] init];
46+
[updater start];
47+
48+
//
49+
// Set up root view controller and menu container
50+
//
51+
UIStoryboard *storyboard_home = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:[NSBundle mainBundle]];
3452

35-
[self invokeServiceMethodWithSelector:@selector(application:didFinishLaunchingWithOptions:) withArgument:&launchOptions];
53+
CSMenuLeftViewController *leftMenuViewController = [storyboard_home instantiateViewControllerWithIdentifier:@"LeftMenu"];
54+
CSRootViewController *rootVC = [[CSRootViewController alloc] init];
55+
56+
self.container = [MFSideMenuContainerViewController containerWithCenterViewController:rootVC
57+
leftMenuViewController:leftMenuViewController
58+
rightMenuViewController:nil];
59+
60+
self.window.rootViewController = self.container;
61+
[self.window makeKeyAndVisible];
3662

37-
[self setUpApplicationWindow];
38-
39-
return YES;
63+
return YES;
64+
}
65+
66+
67+
- (void)applicationWillResignActive:(UIApplication *)application
68+
{
69+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
70+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
71+
}
72+
73+
- (void)applicationDidEnterBackground:(UIApplication *)application
74+
{
75+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
76+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
77+
}
78+
79+
- (void)applicationWillEnterForeground:(UIApplication *)application
80+
{
81+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
82+
}
83+
84+
- (void)applicationDidBecomeActive:(UIApplication *)application
85+
{
86+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
4087
}
4188

4289
/**

EasyReader/Application/Controllers/CSRootViewController.m

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
3838
return self;
3939
}
4040

41-
- (void) viewWillAppear:(BOOL)animated
42-
{
43-
[super viewWillAppear:animated];
44-
CSAppDelegate *delegate = (CSAppDelegate *)[UIApplication sharedApplication].delegate;
45-
delegate.container.panMode = MFSideMenuPanModeNone;
46-
}
47-
4841
/**
4942
* If the left menu is open, it closes it
5043
* Otherwise it opens to the left menu

EasyReader/Application/Controllers/Home/CSHomeViewController.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,24 @@
88

99
#import <UIKit/UIKit.h>
1010
#import "CSBaseViewController.h"
11+
#import "CSCollectionPageControl.h"
12+
#import "CSFeedItemCollectionViewDataSource.h"
1113

1214
@class User;
1315

1416
@interface CSHomeViewController : CSBaseViewController<UICollectionViewDelegate,UIScrollViewDelegate>
1517

1618
@property (weak, nonatomic) IBOutlet UIScrollView *verticalScrollView;
1719
@property (strong, nonatomic) IBOutlet UIButton *button_leftMenu;
20+
@property (strong, nonatomic) IBOutlet CSCollectionPageControl *pageControl_itemIndicator;
1821
@property (nonatomic, strong) UIWebView *feedItemWebView;
19-
@property (nonatomic, strong) NSSet *feedItems;
22+
@property (nonatomic, strong) NSMutableSet *feedItems;
23+
2024
@property User* currentUser;
25+
@property CSFeedItemCollectionViewDataSource *feedCollectionViewDataSource;
26+
@property FeedItem *currentFeedItem;
27+
@property int collectionCellGoingTo;
28+
29+
- (void)scrollToCurrentFeedItem;
2130

2231
@end

0 commit comments

Comments
 (0)