summaryrefslogtreecommitdiff
path: root/Juick/AppDelegate.m
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-09-27 22:24:38 +0300
committerGravatar Vitaly Takmazov2017-09-27 22:24:38 +0300
commit6499148cb3f62e20534b62c181125ebeacfa3438 (patch)
tree3aa289caa409366e70dd1802d67df61903fa992b /Juick/AppDelegate.m
parent25bc4f1357252dc0aeee70f0a638a4226231d5fb (diff)
cleanup
Diffstat (limited to 'Juick/AppDelegate.m')
-rw-r--r--Juick/AppDelegate.m49
1 files changed, 3 insertions, 46 deletions
diff --git a/Juick/AppDelegate.m b/Juick/AppDelegate.m
index 1ba0ccf..b5c4e27 100644
--- a/Juick/AppDelegate.m
+++ b/Juick/AppDelegate.m
@@ -8,68 +8,25 @@
#import "AppDelegate.h"
#import "MessagesViewController.h"
-#import "RevealPanelViewController.h"
-#import "SWRevealViewController.h"
#import "LoginViewController.h"
#import "ColorScheme.h"
#import "Message.h"
#import "TokensList.h"
+#import "NewPostViewController.h"
@implementation AppDelegate
-SWRevealViewController *reveal;
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UINavigationBar appearance] setTintColor:[ColorScheme linkColor]];
[[UINavigationBar appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [ColorScheme linkColor]}];
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
-
- MessagesViewController *messages = [[MessagesViewController alloc] init];
- RevealPanelViewController *rear = [[RevealPanelViewController alloc] init];
-
- UINavigationController *main = [[UINavigationController alloc] initWithRootViewController:messages];
- UINavigationController *rearNav = [[UINavigationController alloc] initWithRootViewController:rear];
- reveal = [[SWRevealViewController alloc] initWithRearViewController:rearNav frontViewController:main];
- self.viewController = reveal;
- [messages.navigationController.navigationBar addGestureRecognizer:reveal.panGestureRecognizer];
- UIBarButtonItem *revealButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reveal-icon.png"]
- style:UIBarButtonItemStylePlain target:reveal action:@selector(revealToggle:)];
- messages.navigationItem.leftBarButtonItem = revealButtonItem;
- UIBarButtonItem *compose = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose
- target:messages action:@selector(composePressed)];
- messages.navigationItem.rightBarButtonItem = compose;
-
- if ([User isAuthenticated]) {
- [User checkIsValid:^(BOOL success) {
- if (success) {
- [messages loadFromPath:[Message feedUrl] withParams:nil withTitle:@"My feed"];
- [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeSound|UIUserNotificationTypeBadge) categories:nil]];
- } else {
- [User throwUnableToLogin];
- }
- }];
-
- } else {
- [messages loadFromPath:[Message messagesUrl] withParams:nil withTitle:@"Discover"];
- }
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- self.window.rootViewController = self.viewController;
- [self.window makeKeyAndVisible];
-
+
return YES;
}
-
-- (void) pushLoginForm {
- if ([reveal isBeingPresented]) {
- [reveal revealToggle:self];
- }
- UIViewController *loginView = [[LoginViewController alloc] init];
- UINavigationController *messages = (UINavigationController *)reveal.frontViewController;
- [messages pushViewController:loginView animated:YES];
-}
+
-(void) application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings {
[[UIApplication sharedApplication] registerForRemoteNotifications];