Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Show login modal box when not signed in.

Not sure if this is the best way, but we can show the authentication controller when no username is found.
We'd have to change the design of the authentication view, but it saves us from building a new view that will only tell you have to be signed in.
  • Loading branch information...
commit 0f1099c75f848332f973e37f2bd4bfb743eaa957 1 parent 0730cb2
@matsimitsu authored
View
4 Classes/Controllers/LibraryViewController.m
@@ -2,7 +2,7 @@
#import "Show.h"
#import "ShowDetailsViewController.h"
-
+#import "AuthenticationViewController.h"
#import "Trakt.h"
#import "HTTPDownload.h"
@@ -13,6 +13,7 @@ @implementation LibraryViewController
- (void)viewDidLoad {
[super viewDidLoad];
+ [self checkAuth];
self.feedSelector = @"library:";
self.cachedFeedProperty = @"library";
@@ -27,6 +28,7 @@ - (void)viewDidLoad {
}
- (void)reloadTableViewData:(NSArray *)data {
+
NSMutableArray *groupedShows = [NSMutableArray array];
NSMutableArray *titles = [NSMutableArray array];
View
2  Classes/Controllers/RootViewController.h
@@ -7,9 +7,9 @@
@property (nonatomic, retain) NSString *feedSelector, *cachedFeedProperty;
- (void)refreshData;
+- (void)checkAuth;
- (void)reloadTableViewData:(NSArray *)data;
- (void)showRefreshDataButton;
- (void)showStopRefreshDataButton;
- (void)cancelRefreshData;
-
@end
View
13 Classes/Controllers/RootViewController.m
@@ -1,7 +1,7 @@
#import "RootViewController.h"
#import "Trakt.h"
#import "HTTPDownload.h"
-
+#import "AuthenticationViewController.h"
@implementation RootViewController
@synthesize feedSelector, cachedFeedProperty;
@@ -26,6 +26,17 @@ - (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
+- (void)checkAuth {
+ NSString *username = [Trakt sharedInstance].apiUser;
+ if([username length] == 0){
+ AuthenticationViewController *controller = [AuthenticationViewController alloc];
+
+ [self presentModalViewController:controller animated:YES];
+
+ [controller release];
+ }
+}
+
- (void)refreshData {
[self showStopRefreshDataButton];
[[Trakt sharedInstance] retrieveRootControllerDataStartingWith:feedSelector block:^(NSArray *data) {
Please sign in to comment.
Something went wrong with that request. Please try again.