From 6499148cb3f62e20534b62c181125ebeacfa3438 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 27 Sep 2017 22:24:38 +0300 Subject: cleanup --- Juick/APIClient.h | 15 +- Juick/APIClient.m | 43 ++++ Juick/AppDelegate.h | 5 - Juick/AppDelegate.m | 49 +---- .../AppIcon.appiconset/Contents.json | 5 + .../LaunchImage.launchimage/Contents.json | 2 +- Juick/Images.xcassets/res/Contents.json | 6 + .../res/active_dot.imageset/Contents.json | 23 +++ .../res/active_dot.imageset/active_dot.png | Bin 0 -> 138 bytes .../res/active_dot.imageset/active_dot@2x.png | Bin 0 -> 196 bytes .../res/active_dot.imageset/active_dot@3x.png | Bin 0 -> 255 bytes .../res/chats_icon.imageset/Contents.json | 23 +++ .../res/chats_icon.imageset/chats_icon.png | Bin 0 -> 487 bytes .../res/chats_icon.imageset/chats_icon@2x.png | Bin 0 -> 908 bytes .../res/chats_icon.imageset/chats_icon@3x.png | Bin 0 -> 1251 bytes .../res/circle.imageset/Contents.json | 23 +++ .../Images.xcassets/res/circle.imageset/circle.png | Bin 0 -> 928 bytes .../res/circle.imageset/circle@2x.png | Bin 0 -> 1915 bytes .../res/circle.imageset/circle@3x.png | Bin 0 -> 2940 bytes .../res/circle_left.imageset/Contents.json | 23 +++ .../res/circle_left.imageset/circle_left.png | Bin 0 -> 593 bytes .../res/circle_left.imageset/circle_left@2x.png | Bin 0 -> 1100 bytes .../res/circle_left.imageset/circle_left@3x.png | Bin 0 -> 1687 bytes .../res/circle_right.imageset/Contents.json | 23 +++ .../res/circle_right.imageset/circle_right.png | Bin 0 -> 584 bytes .../res/circle_right.imageset/circle_right@2x.png | Bin 0 -> 1107 bytes .../res/circle_right.imageset/circle_right@3x.png | Bin 0 -> 1629 bytes .../res/circle_square.imageset/Contents.json | 23 +++ .../res/circle_square.imageset/circle_square.png | Bin 0 -> 122 bytes .../circle_square.imageset/circle_square@2x.png | Bin 0 -> 133 bytes .../circle_square.imageset/circle_square@3x.png | Bin 0 -> 150 bytes .../res/edit_icon.imageset/Contents.json | 23 +++ .../res/edit_icon.imageset/edit_icon.png | Bin 0 -> 509 bytes .../res/edit_icon.imageset/edit_icon@2x.png | Bin 0 -> 1095 bytes .../res/edit_icon.imageset/edit_icon@3x.png | Bin 0 -> 1644 bytes .../res/nearby_icon.imageset/Contents.json | 23 +++ .../res/nearby_icon.imageset/nearby_icon.png | Bin 0 -> 501 bytes .../res/nearby_icon.imageset/nearby_icon@2x.png | Bin 0 -> 968 bytes .../res/nearby_icon.imageset/nearby_icon@3x.png | Bin 0 -> 1603 bytes .../res/new_chat_icon.imageset/Contents.json | 23 +++ .../res/new_chat_icon.imageset/new_chat_icon.png | Bin 0 -> 453 bytes .../new_chat_icon.imageset/new_chat_icon@2x.png | Bin 0 -> 779 bytes .../new_chat_icon.imageset/new_chat_icon@3x.png | Bin 0 -> 1078 bytes .../res/plus_icon.imageset/Contents.json | 23 +++ .../res/plus_icon.imageset/plus_icon.png | Bin 0 -> 297 bytes .../res/plus_icon.imageset/plus_icon@2x.png | Bin 0 -> 463 bytes .../res/plus_icon.imageset/plus_icon@3x.png | Bin 0 -> 671 bytes .../res/profile_icon.imageset/Contents.json | 23 +++ .../res/profile_icon.imageset/profile_icon.png | Bin 0 -> 478 bytes .../res/profile_icon.imageset/profile_icon@2x.png | Bin 0 -> 972 bytes .../res/profile_icon.imageset/profile_icon@3x.png | Bin 0 -> 1466 bytes .../res/search_icon.imageset/Contents.json | 23 +++ .../res/search_icon.imageset/search_icon.png | Bin 0 -> 477 bytes .../res/search_icon.imageset/search_icon@2x.png | Bin 0 -> 988 bytes .../res/search_icon.imageset/search_icon@3x.png | Bin 0 -> 1536 bytes .../res/settings_icon.imageset/Contents.json | 23 +++ .../res/settings_icon.imageset/settings_icon.png | Bin 0 -> 586 bytes .../settings_icon.imageset/settings_icon@2x.png | Bin 0 -> 1255 bytes .../settings_icon.imageset/settings_icon@3x.png | Bin 0 -> 1965 bytes .../res/side_button.imageset/Contents.json | 23 +++ .../res/side_button.imageset/side_button.png | Bin 0 -> 814 bytes .../res/side_button.imageset/side_button@2x.png | Bin 0 -> 1609 bytes .../res/side_button.imageset/side_button@3x.png | Bin 0 -> 2336 bytes Juick/LaunchScreen.storyboard | 42 ++++ Juick/Main.storyboard | 219 +++++++++++++++++++++ Juick/Model/Message.h | 5 - Juick/Model/Message.m | 37 ---- Juick/Model/User.h | 2 +- Juick/Splash.png | Bin 0 -> 1216 bytes Juick/Splash@2x.png | Bin 0 -> 2669 bytes Juick/Splash@3x.png | Bin 0 -> 4657 bytes Juick/Supporting Files/Juick-Info.plist | 5 +- Juick/Supporting Files/Juick-Prefix.pch | 9 - Juick/Supporting Files/SerpentineBoldItalic.ttf | Bin 0 -> 41748 bytes Juick/ViewControllers/LoginViewController.h | 2 +- Juick/ViewControllers/LoginViewController.m | 17 +- Juick/ViewControllers/MessagesViewController.h | 5 +- Juick/ViewControllers/MessagesViewController.m | 134 ++++--------- Juick/ViewControllers/NewPostViewController.m | 42 +--- Juick/ViewControllers/RevealPanelViewController.h | 16 -- Juick/ViewControllers/RevealPanelViewController.m | 179 ----------------- Juick/ViewControllers/RootNavigationController.h | 13 ++ Juick/ViewControllers/RootNavigationController.m | 24 +++ Juick/ViewControllers/ThreadViewController.h | 15 ++ Juick/ViewControllers/ThreadViewController.m | 63 ++++++ Juick/Views/MessageCell.h | 8 +- Juick/Views/MessageCell.m | 15 +- Juick/Views/MessageCell.xib | 87 -------- Juick/Views/NavCell.h | 14 -- Juick/Views/NavCell.m | 24 --- Juick/Views/NavCell.xib | 51 ----- 91 files changed, 844 insertions(+), 631 deletions(-) create mode 100644 Juick/Images.xcassets/res/Contents.json create mode 100644 Juick/Images.xcassets/res/active_dot.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/active_dot.imageset/active_dot.png create mode 100644 Juick/Images.xcassets/res/active_dot.imageset/active_dot@2x.png create mode 100644 Juick/Images.xcassets/res/active_dot.imageset/active_dot@3x.png create mode 100644 Juick/Images.xcassets/res/chats_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/chats_icon.imageset/chats_icon.png create mode 100644 Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@2x.png create mode 100644 Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@3x.png create mode 100644 Juick/Images.xcassets/res/circle.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/circle.imageset/circle.png create mode 100644 Juick/Images.xcassets/res/circle.imageset/circle@2x.png create mode 100644 Juick/Images.xcassets/res/circle.imageset/circle@3x.png create mode 100644 Juick/Images.xcassets/res/circle_left.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/circle_left.imageset/circle_left.png create mode 100644 Juick/Images.xcassets/res/circle_left.imageset/circle_left@2x.png create mode 100644 Juick/Images.xcassets/res/circle_left.imageset/circle_left@3x.png create mode 100644 Juick/Images.xcassets/res/circle_right.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/circle_right.imageset/circle_right.png create mode 100644 Juick/Images.xcassets/res/circle_right.imageset/circle_right@2x.png create mode 100644 Juick/Images.xcassets/res/circle_right.imageset/circle_right@3x.png create mode 100644 Juick/Images.xcassets/res/circle_square.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/circle_square.imageset/circle_square.png create mode 100644 Juick/Images.xcassets/res/circle_square.imageset/circle_square@2x.png create mode 100644 Juick/Images.xcassets/res/circle_square.imageset/circle_square@3x.png create mode 100644 Juick/Images.xcassets/res/edit_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/edit_icon.imageset/edit_icon.png create mode 100644 Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@2x.png create mode 100644 Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@3x.png create mode 100644 Juick/Images.xcassets/res/nearby_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon.png create mode 100644 Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@2x.png create mode 100644 Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@3x.png create mode 100644 Juick/Images.xcassets/res/new_chat_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon.png create mode 100644 Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@2x.png create mode 100644 Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@3x.png create mode 100644 Juick/Images.xcassets/res/plus_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/plus_icon.imageset/plus_icon.png create mode 100644 Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@2x.png create mode 100644 Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@3x.png create mode 100644 Juick/Images.xcassets/res/profile_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/profile_icon.imageset/profile_icon.png create mode 100644 Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@2x.png create mode 100644 Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@3x.png create mode 100644 Juick/Images.xcassets/res/search_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/search_icon.imageset/search_icon.png create mode 100644 Juick/Images.xcassets/res/search_icon.imageset/search_icon@2x.png create mode 100644 Juick/Images.xcassets/res/search_icon.imageset/search_icon@3x.png create mode 100644 Juick/Images.xcassets/res/settings_icon.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/settings_icon.imageset/settings_icon.png create mode 100644 Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@2x.png create mode 100644 Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@3x.png create mode 100644 Juick/Images.xcassets/res/side_button.imageset/Contents.json create mode 100644 Juick/Images.xcassets/res/side_button.imageset/side_button.png create mode 100644 Juick/Images.xcassets/res/side_button.imageset/side_button@2x.png create mode 100644 Juick/Images.xcassets/res/side_button.imageset/side_button@3x.png create mode 100644 Juick/LaunchScreen.storyboard create mode 100644 Juick/Main.storyboard create mode 100644 Juick/Splash.png create mode 100644 Juick/Splash@2x.png create mode 100644 Juick/Splash@3x.png create mode 100644 Juick/Supporting Files/SerpentineBoldItalic.ttf delete mode 100644 Juick/ViewControllers/RevealPanelViewController.h delete mode 100644 Juick/ViewControllers/RevealPanelViewController.m create mode 100644 Juick/ViewControllers/RootNavigationController.h create mode 100644 Juick/ViewControllers/RootNavigationController.m create mode 100644 Juick/ViewControllers/ThreadViewController.h create mode 100644 Juick/ViewControllers/ThreadViewController.m delete mode 100644 Juick/Views/MessageCell.xib delete mode 100644 Juick/Views/NavCell.h delete mode 100644 Juick/Views/NavCell.m delete mode 100644 Juick/Views/NavCell.xib (limited to 'Juick') diff --git a/Juick/APIClient.h b/Juick/APIClient.h index 8546d4d..8c6e024 100644 --- a/Juick/APIClient.h +++ b/Juick/APIClient.h @@ -6,8 +6,17 @@ // Copyright © 2016 com.juick. All rights reserved. // #import +@import AFNetworking; @interface APIClient : NSObject - @property (nonatomic, retain) AFHTTPSessionManager *manager; - +(APIClient *) sharedClient; -@end \ No newline at end of file + +@property (nonatomic, retain) AFHTTPSessionManager *manager; ++(APIClient *) sharedClient; + +-(void) pullNextFromPath:(NSString *)path params:(NSDictionary *)params callback:(void(^)(NSArray *, NSError *))callback; + ++(NSString *) messagesUrl; ++(NSString *) threadUrl; ++(NSString *) feedUrl; + +@end diff --git a/Juick/APIClient.m b/Juick/APIClient.m index 1fc2743..d2356b5 100644 --- a/Juick/APIClient.m +++ b/Juick/APIClient.m @@ -6,6 +6,8 @@ // Copyright © 2016 com.juick. All rights reserved. // #import "APIClient.h" +#import "PDKeychainBindings.h" +#import "Message.h" @implementation APIClient @@ -25,4 +27,45 @@ return self; } +-(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *, NSError *))callback { + AFHTTPSessionManager *manager = [APIClient sharedClient].manager; + if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) { + manager.requestSerializer = [AFJSONRequestSerializer serializer]; + [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; + } + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [manager GET:path parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + NSMutableArray *messages = [NSMutableArray new]; + [((NSArray *)responseObject) enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [messages addObject:[Message yy_modelWithJSON:obj]]; + }]; + dispatch_async(dispatch_get_main_queue(), ^{ + callback(messages, nil); + }); + + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + NSLog(@"REST Error: %@", error); + NSInteger statusCode = ((NSHTTPURLResponse *)task.response).statusCode; + if (statusCode == 401) { + dispatch_async(dispatch_get_main_queue(), ^{ + callback(nil, [[NSError alloc] initWithDomain:@"JuickErrorDomain" code:401 userInfo:nil]); + }); + } + }]; + }); +} + + ++(NSString *) messagesUrl { + return @"/messages"; +} + ++(NSString *) threadUrl { + return @"/thread"; +} + ++(NSString *) feedUrl { + return @"/home"; +} + @end diff --git a/Juick/AppDelegate.h b/Juick/AppDelegate.h index 04a8bb2..6753fd7 100644 --- a/Juick/AppDelegate.h +++ b/Juick/AppDelegate.h @@ -9,13 +9,8 @@ #import #import "User.h" -@class SWRevealViewController; - @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; -@property (strong, nonatomic) UIViewController *viewController; - -- (void) pushLoginForm; @end 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]; diff --git a/Juick/Images.xcassets/AppIcon.appiconset/Contents.json b/Juick/Images.xcassets/AppIcon.appiconset/Contents.json index dbd6347..520a8bf 100644 --- a/Juick/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/Juick/Images.xcassets/AppIcon.appiconset/Contents.json @@ -127,6 +127,11 @@ "idiom" : "ipad", "filename" : "Icon-83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { diff --git a/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json b/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json index c79ebd3..fadb823 100644 --- a/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/Juick/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -10,9 +10,9 @@ { "orientation" : "portrait", "idiom" : "iphone", - "subtype" : "retina4", "extent" : "full-screen", "minimum-system-version" : "7.0", + "subtype" : "retina4", "scale" : "2x" } ], diff --git a/Juick/Images.xcassets/res/Contents.json b/Juick/Images.xcassets/res/Contents.json new file mode 100644 index 0000000..da4a164 --- /dev/null +++ b/Juick/Images.xcassets/res/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/active_dot.imageset/Contents.json b/Juick/Images.xcassets/res/active_dot.imageset/Contents.json new file mode 100644 index 0000000..f1493b4 --- /dev/null +++ b/Juick/Images.xcassets/res/active_dot.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "active_dot.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "active_dot@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "active_dot@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/active_dot.imageset/active_dot.png b/Juick/Images.xcassets/res/active_dot.imageset/active_dot.png new file mode 100644 index 0000000..4182bc1 Binary files /dev/null and b/Juick/Images.xcassets/res/active_dot.imageset/active_dot.png differ diff --git a/Juick/Images.xcassets/res/active_dot.imageset/active_dot@2x.png b/Juick/Images.xcassets/res/active_dot.imageset/active_dot@2x.png new file mode 100644 index 0000000..1427060 Binary files /dev/null and b/Juick/Images.xcassets/res/active_dot.imageset/active_dot@2x.png differ diff --git a/Juick/Images.xcassets/res/active_dot.imageset/active_dot@3x.png b/Juick/Images.xcassets/res/active_dot.imageset/active_dot@3x.png new file mode 100644 index 0000000..4f7ce87 Binary files /dev/null and b/Juick/Images.xcassets/res/active_dot.imageset/active_dot@3x.png differ diff --git a/Juick/Images.xcassets/res/chats_icon.imageset/Contents.json b/Juick/Images.xcassets/res/chats_icon.imageset/Contents.json new file mode 100644 index 0000000..e666842 --- /dev/null +++ b/Juick/Images.xcassets/res/chats_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "chats_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "chats_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "chats_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon.png b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon.png new file mode 100644 index 0000000..9161afa Binary files /dev/null and b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon.png differ diff --git a/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@2x.png b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@2x.png new file mode 100644 index 0000000..2811b24 Binary files /dev/null and b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@3x.png b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@3x.png new file mode 100644 index 0000000..9009095 Binary files /dev/null and b/Juick/Images.xcassets/res/chats_icon.imageset/chats_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/circle.imageset/Contents.json b/Juick/Images.xcassets/res/circle.imageset/Contents.json new file mode 100644 index 0000000..cb3acd9 --- /dev/null +++ b/Juick/Images.xcassets/res/circle.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "circle.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "circle@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "circle@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/circle.imageset/circle.png b/Juick/Images.xcassets/res/circle.imageset/circle.png new file mode 100644 index 0000000..f0e5b53 Binary files /dev/null and b/Juick/Images.xcassets/res/circle.imageset/circle.png differ diff --git a/Juick/Images.xcassets/res/circle.imageset/circle@2x.png b/Juick/Images.xcassets/res/circle.imageset/circle@2x.png new file mode 100644 index 0000000..431af57 Binary files /dev/null and b/Juick/Images.xcassets/res/circle.imageset/circle@2x.png differ diff --git a/Juick/Images.xcassets/res/circle.imageset/circle@3x.png b/Juick/Images.xcassets/res/circle.imageset/circle@3x.png new file mode 100644 index 0000000..f8b9c70 Binary files /dev/null and b/Juick/Images.xcassets/res/circle.imageset/circle@3x.png differ diff --git a/Juick/Images.xcassets/res/circle_left.imageset/Contents.json b/Juick/Images.xcassets/res/circle_left.imageset/Contents.json new file mode 100644 index 0000000..021f3a0 --- /dev/null +++ b/Juick/Images.xcassets/res/circle_left.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "circle_left.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "circle_left@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "circle_left@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/circle_left.imageset/circle_left.png b/Juick/Images.xcassets/res/circle_left.imageset/circle_left.png new file mode 100644 index 0000000..1ea5221 Binary files /dev/null and b/Juick/Images.xcassets/res/circle_left.imageset/circle_left.png differ diff --git a/Juick/Images.xcassets/res/circle_left.imageset/circle_left@2x.png b/Juick/Images.xcassets/res/circle_left.imageset/circle_left@2x.png new file mode 100644 index 0000000..69be45d Binary files /dev/null and b/Juick/Images.xcassets/res/circle_left.imageset/circle_left@2x.png differ diff --git a/Juick/Images.xcassets/res/circle_left.imageset/circle_left@3x.png b/Juick/Images.xcassets/res/circle_left.imageset/circle_left@3x.png new file mode 100644 index 0000000..dcc262e Binary files /dev/null and b/Juick/Images.xcassets/res/circle_left.imageset/circle_left@3x.png differ diff --git a/Juick/Images.xcassets/res/circle_right.imageset/Contents.json b/Juick/Images.xcassets/res/circle_right.imageset/Contents.json new file mode 100644 index 0000000..1645b0d --- /dev/null +++ b/Juick/Images.xcassets/res/circle_right.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "circle_right.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "circle_right@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "circle_right@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/circle_right.imageset/circle_right.png b/Juick/Images.xcassets/res/circle_right.imageset/circle_right.png new file mode 100644 index 0000000..4b0eb6d Binary files /dev/null and b/Juick/Images.xcassets/res/circle_right.imageset/circle_right.png differ diff --git a/Juick/Images.xcassets/res/circle_right.imageset/circle_right@2x.png b/Juick/Images.xcassets/res/circle_right.imageset/circle_right@2x.png new file mode 100644 index 0000000..2d9c488 Binary files /dev/null and b/Juick/Images.xcassets/res/circle_right.imageset/circle_right@2x.png differ diff --git a/Juick/Images.xcassets/res/circle_right.imageset/circle_right@3x.png b/Juick/Images.xcassets/res/circle_right.imageset/circle_right@3x.png new file mode 100644 index 0000000..0778501 Binary files /dev/null and b/Juick/Images.xcassets/res/circle_right.imageset/circle_right@3x.png differ diff --git a/Juick/Images.xcassets/res/circle_square.imageset/Contents.json b/Juick/Images.xcassets/res/circle_square.imageset/Contents.json new file mode 100644 index 0000000..f9ef167 --- /dev/null +++ b/Juick/Images.xcassets/res/circle_square.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "circle_square.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "circle_square@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "circle_square@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/circle_square.imageset/circle_square.png b/Juick/Images.xcassets/res/circle_square.imageset/circle_square.png new file mode 100644 index 0000000..16643dc Binary files /dev/null and b/Juick/Images.xcassets/res/circle_square.imageset/circle_square.png differ diff --git a/Juick/Images.xcassets/res/circle_square.imageset/circle_square@2x.png b/Juick/Images.xcassets/res/circle_square.imageset/circle_square@2x.png new file mode 100644 index 0000000..42179f4 Binary files /dev/null and b/Juick/Images.xcassets/res/circle_square.imageset/circle_square@2x.png differ diff --git a/Juick/Images.xcassets/res/circle_square.imageset/circle_square@3x.png b/Juick/Images.xcassets/res/circle_square.imageset/circle_square@3x.png new file mode 100644 index 0000000..7ce6281 Binary files /dev/null and b/Juick/Images.xcassets/res/circle_square.imageset/circle_square@3x.png differ diff --git a/Juick/Images.xcassets/res/edit_icon.imageset/Contents.json b/Juick/Images.xcassets/res/edit_icon.imageset/Contents.json new file mode 100644 index 0000000..68f6792 --- /dev/null +++ b/Juick/Images.xcassets/res/edit_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "edit_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "edit_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "edit_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon.png b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon.png new file mode 100644 index 0000000..f3bf8b8 Binary files /dev/null and b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon.png differ diff --git a/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@2x.png b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@2x.png new file mode 100644 index 0000000..2a915a9 Binary files /dev/null and b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@3x.png b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@3x.png new file mode 100644 index 0000000..cb58e3d Binary files /dev/null and b/Juick/Images.xcassets/res/edit_icon.imageset/edit_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/nearby_icon.imageset/Contents.json b/Juick/Images.xcassets/res/nearby_icon.imageset/Contents.json new file mode 100644 index 0000000..5e03565 --- /dev/null +++ b/Juick/Images.xcassets/res/nearby_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "nearby_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "nearby_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "nearby_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon.png b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon.png new file mode 100644 index 0000000..e0e4665 Binary files /dev/null and b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon.png differ diff --git a/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@2x.png b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@2x.png new file mode 100644 index 0000000..05f367c Binary files /dev/null and b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@3x.png b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@3x.png new file mode 100644 index 0000000..586ed71 Binary files /dev/null and b/Juick/Images.xcassets/res/nearby_icon.imageset/nearby_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/new_chat_icon.imageset/Contents.json b/Juick/Images.xcassets/res/new_chat_icon.imageset/Contents.json new file mode 100644 index 0000000..df38a58 --- /dev/null +++ b/Juick/Images.xcassets/res/new_chat_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "new_chat_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "new_chat_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "new_chat_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon.png b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon.png new file mode 100644 index 0000000..bcf43a8 Binary files /dev/null and b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon.png differ diff --git a/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@2x.png b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@2x.png new file mode 100644 index 0000000..d786501 Binary files /dev/null and b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@3x.png b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@3x.png new file mode 100644 index 0000000..f1dafa7 Binary files /dev/null and b/Juick/Images.xcassets/res/new_chat_icon.imageset/new_chat_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/plus_icon.imageset/Contents.json b/Juick/Images.xcassets/res/plus_icon.imageset/Contents.json new file mode 100644 index 0000000..c3e2c88 --- /dev/null +++ b/Juick/Images.xcassets/res/plus_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "plus_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "plus_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "plus_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon.png b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon.png new file mode 100644 index 0000000..0562748 Binary files /dev/null and b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon.png differ diff --git a/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@2x.png b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@2x.png new file mode 100644 index 0000000..fa037a5 Binary files /dev/null and b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@3x.png b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@3x.png new file mode 100644 index 0000000..9650046 Binary files /dev/null and b/Juick/Images.xcassets/res/plus_icon.imageset/plus_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/profile_icon.imageset/Contents.json b/Juick/Images.xcassets/res/profile_icon.imageset/Contents.json new file mode 100644 index 0000000..1ae5012 --- /dev/null +++ b/Juick/Images.xcassets/res/profile_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "profile_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "profile_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "profile_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon.png b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon.png new file mode 100644 index 0000000..5cbd35c Binary files /dev/null and b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon.png differ diff --git a/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@2x.png b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@2x.png new file mode 100644 index 0000000..780e59a Binary files /dev/null and b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@3x.png b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@3x.png new file mode 100644 index 0000000..74d55b8 Binary files /dev/null and b/Juick/Images.xcassets/res/profile_icon.imageset/profile_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/search_icon.imageset/Contents.json b/Juick/Images.xcassets/res/search_icon.imageset/Contents.json new file mode 100644 index 0000000..00819b0 --- /dev/null +++ b/Juick/Images.xcassets/res/search_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "search_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "search_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "search_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/search_icon.imageset/search_icon.png b/Juick/Images.xcassets/res/search_icon.imageset/search_icon.png new file mode 100644 index 0000000..3bc5682 Binary files /dev/null and b/Juick/Images.xcassets/res/search_icon.imageset/search_icon.png differ diff --git a/Juick/Images.xcassets/res/search_icon.imageset/search_icon@2x.png b/Juick/Images.xcassets/res/search_icon.imageset/search_icon@2x.png new file mode 100644 index 0000000..2b6cab0 Binary files /dev/null and b/Juick/Images.xcassets/res/search_icon.imageset/search_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/search_icon.imageset/search_icon@3x.png b/Juick/Images.xcassets/res/search_icon.imageset/search_icon@3x.png new file mode 100644 index 0000000..44adf99 Binary files /dev/null and b/Juick/Images.xcassets/res/search_icon.imageset/search_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/settings_icon.imageset/Contents.json b/Juick/Images.xcassets/res/settings_icon.imageset/Contents.json new file mode 100644 index 0000000..72b8e2e --- /dev/null +++ b/Juick/Images.xcassets/res/settings_icon.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "settings_icon.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "settings_icon@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "settings_icon@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon.png b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon.png new file mode 100644 index 0000000..082ca9f Binary files /dev/null and b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon.png differ diff --git a/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@2x.png b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@2x.png new file mode 100644 index 0000000..344531b Binary files /dev/null and b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@2x.png differ diff --git a/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@3x.png b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@3x.png new file mode 100644 index 0000000..1f79f5b Binary files /dev/null and b/Juick/Images.xcassets/res/settings_icon.imageset/settings_icon@3x.png differ diff --git a/Juick/Images.xcassets/res/side_button.imageset/Contents.json b/Juick/Images.xcassets/res/side_button.imageset/Contents.json new file mode 100644 index 0000000..7334a81 --- /dev/null +++ b/Juick/Images.xcassets/res/side_button.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "side_button.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "side_button@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "side_button@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/Juick/Images.xcassets/res/side_button.imageset/side_button.png b/Juick/Images.xcassets/res/side_button.imageset/side_button.png new file mode 100644 index 0000000..5f674b9 Binary files /dev/null and b/Juick/Images.xcassets/res/side_button.imageset/side_button.png differ diff --git a/Juick/Images.xcassets/res/side_button.imageset/side_button@2x.png b/Juick/Images.xcassets/res/side_button.imageset/side_button@2x.png new file mode 100644 index 0000000..28fde79 Binary files /dev/null and b/Juick/Images.xcassets/res/side_button.imageset/side_button@2x.png differ diff --git a/Juick/Images.xcassets/res/side_button.imageset/side_button@3x.png b/Juick/Images.xcassets/res/side_button.imageset/side_button@3x.png new file mode 100644 index 0000000..b1197d6 Binary files /dev/null and b/Juick/Images.xcassets/res/side_button.imageset/side_button@3x.png differ diff --git a/Juick/LaunchScreen.storyboard b/Juick/LaunchScreen.storyboard new file mode 100644 index 0000000..e0a196b --- /dev/null +++ b/Juick/LaunchScreen.storyboard @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Juick/Main.storyboard b/Juick/Main.storyboard new file mode 100644 index 0000000..ebc1465 --- /dev/null +++ b/Juick/Main.storyboard @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Juick/Model/Message.h b/Juick/Model/Message.h index 438f693..1b41315 100644 --- a/Juick/Model/Message.h +++ b/Juick/Model/Message.h @@ -21,9 +21,4 @@ @property NSString *repliesBy; @property NSNumber *repliesCount; -+(void) pullNextFromPath:(NSString *)path params:(NSDictionary *)params callback:(void(^)(NSArray *))callback; -+(NSString *) messagesUrl; -+(NSString *) threadUrl; -+(NSString *) feedUrl; - @end diff --git a/Juick/Model/Message.m b/Juick/Model/Message.m index 4a6e96c..d4d6a88 100644 --- a/Juick/Model/Message.m +++ b/Juick/Model/Message.m @@ -7,7 +7,6 @@ // #import "Message.h" -#import "PDKeychainBindings.h" #import "AppDelegate.h" @implementation Message @@ -20,40 +19,4 @@ @"repliesCount": @"replies", @"repliesBy": @"repliesby"}; } - - -+(void) pullNextFromPath:(NSString *)path params:(NSDictionary *) params callback:(void(^)(NSArray *))callback { - AFHTTPSessionManager *manager = [APIClient sharedClient].manager; - if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] != nil) { - manager.requestSerializer = [AFJSONRequestSerializer serializer]; - [manager.requestSerializer setAuthorizationHeaderFieldWithUsername:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] password:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.password"]]; - } - [manager GET:path parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - NSMutableArray *messages = [NSMutableArray new]; - [((NSArray *)responseObject) enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - [messages addObject:[Message yy_modelWithJSON:obj]]; - }]; - callback(messages); - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - NSLog(@"REST Error: %@", error); - NSInteger statusCode = ((NSHTTPURLResponse *)task.response).statusCode; - if (statusCode == 401) { - AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; - [appDelegate pushLoginForm]; - } - }]; -} - -+(NSString *) messagesUrl { - return @"https://api.juick.com/messages"; -} - -+(NSString *) threadUrl { - return @"https://api.juick.com/thread"; -} - -+(NSString *) feedUrl { - return @"https://api.juick.com/home"; -} - @end diff --git a/Juick/Model/User.h b/Juick/Model/User.h index 84300f3..ca84d50 100644 --- a/Juick/Model/User.h +++ b/Juick/Model/User.h @@ -7,7 +7,7 @@ // #import -#import "PDKeychainBindings.h" +@import PDKeychainBindingsController; #import "SIAlertView.h" #import "APIClient.h" #import "YYModel.h" diff --git a/Juick/Splash.png b/Juick/Splash.png new file mode 100644 index 0000000..c5d9d60 Binary files /dev/null and b/Juick/Splash.png differ diff --git a/Juick/Splash@2x.png b/Juick/Splash@2x.png new file mode 100644 index 0000000..166a664 Binary files /dev/null and b/Juick/Splash@2x.png differ diff --git a/Juick/Splash@3x.png b/Juick/Splash@3x.png new file mode 100644 index 0000000..3ef7388 Binary files /dev/null and b/Juick/Splash@3x.png differ diff --git a/Juick/Supporting Files/Juick-Info.plist b/Juick/Supporting Files/Juick-Info.plist index 4e1224b..74fbe61 100644 --- a/Juick/Supporting Files/Juick-Info.plist +++ b/Juick/Supporting Files/Juick-Info.plist @@ -35,9 +35,12 @@ UIAppFonts FontAwesome.ttf + SerpentineBoldItalic.ttf UILaunchStoryboardName - Launch Screen + LaunchScreen + UIMainStoryboardFile + Main UIPrerenderedIcon UIRequiredDeviceCapabilities diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch index f69266f..1062827 100644 --- a/Juick/Supporting Files/Juick-Prefix.pch +++ b/Juick/Supporting Files/Juick-Prefix.pch @@ -15,13 +15,4 @@ #import #import #import - #import - #import - #import "UIImage+Utils.h" - #import - #import - #import - #import - #import - #import #endif diff --git a/Juick/Supporting Files/SerpentineBoldItalic.ttf b/Juick/Supporting Files/SerpentineBoldItalic.ttf new file mode 100644 index 0000000..21434ec Binary files /dev/null and b/Juick/Supporting Files/SerpentineBoldItalic.ttf differ diff --git a/Juick/ViewControllers/LoginViewController.h b/Juick/ViewControllers/LoginViewController.h index bf980fa..6a834a8 100644 --- a/Juick/ViewControllers/LoginViewController.h +++ b/Juick/ViewControllers/LoginViewController.h @@ -8,7 +8,7 @@ #import #import "XLForm.h" -#import "PDKeychainbindingsController.h" +#import "PDKeychainBindingsController.h" @interface LoginViewController : XLFormViewController diff --git a/Juick/ViewControllers/LoginViewController.m b/Juick/ViewControllers/LoginViewController.m index eedc6d3..1718366 100644 --- a/Juick/ViewControllers/LoginViewController.m +++ b/Juick/ViewControllers/LoginViewController.m @@ -12,20 +12,9 @@ @implementation LoginViewController -- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self){ - [self initializeForm]; - } - return self; -} - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self){ - [self initializeForm]; - } - return self; +- (void) awakeFromNib { + [super awakeFromNib]; + [self initializeForm]; } - (void)initializeForm { diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h index 3dac200..fc3545a 100644 --- a/Juick/ViewControllers/MessagesViewController.h +++ b/Juick/ViewControllers/MessagesViewController.h @@ -7,9 +7,10 @@ // #import +@import PHFComposeBarView; @interface MessagesViewController : UITableViewController -- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title; +@property(nonatomic, strong) NSString *path; +@property(nonatomic, strong) NSMutableDictionary *params; - (void) refreshData; -- (void) composePressed; @end diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 95879bf..b877cd1 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -6,58 +6,34 @@ // Copyright (c) 2013 com.juick. All rights reserved. // -#import "SWRevealViewController/SWRevealViewController.h" #import "MessagesViewController.h" +@import YYWebImage; #import "MessageCell.h" #import "Message.h" #import "ColorScheme.h" #import "NewPostViewController.h" +#import "LoginViewController.h" +#import "ThreadViewController.h" #import "NSURL+PathParameters.h" -static NSString *CellIdentifier = @"MessageCell"; - @interface MessagesViewController (); @property(nonatomic, strong) NSMutableArray *messages; @property(nonatomic, assign) Boolean dataLoading; -@property(nonatomic, strong) NSString *path; -@property(nonatomic, strong) NSMutableDictionary *params; -@property(nonatomic, strong) dispatch_queue_t concurrent_queue; -@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; - @end @implementation MessagesViewController -- (id)init { - if (self = [super init]) { - self.concurrent_queue = dispatch_queue_create("Queue", DISPATCH_QUEUE_SERIAL); - }; - return self; -} - -- (void)loadFromPath:(NSString *)messagesPath withParams:(NSDictionary *)params withTitle:(NSString *)title -{ - [self setPath:messagesPath]; - [self setParams:[[NSMutableDictionary alloc] initWithDictionary:params]]; - self.title = title; - __weak MessagesViewController * weakSelf = self; - dispatch_sync(self.concurrent_queue, ^{ - [self.messages removeAllObjects]; - [weakSelf refreshData]; - }); -} - - (void) refreshData { self.dataLoading = YES; - [Message pullNextFromPath:self.path params:self.params callback:^(NSArray *next) { + [[APIClient sharedClient] pullNextFromPath:self.path params:self.params callback:^(NSArray *next, NSError *err) { NSArray *newMsgs = next; - if ([self.path isEqualToString:[Message threadUrl]]) { + if ([self.path isEqualToString:[APIClient threadUrl]]) { NSUInteger lastRid = [((Message *)[self.messages lastObject]).rid unsignedIntegerValue]; NSUInteger count = [next count] - 1; NSUInteger oldCount = [self.messages count]; @@ -84,30 +60,37 @@ static NSString *CellIdentifier = @"MessageCell"; - (void)viewDidLoad { [super viewDidLoad]; + self.dataLoading = NO; [self.view setBackgroundColor:[ColorScheme mainBackground]]; self.messages = [NSMutableArray array]; + self.params = [NSMutableDictionary new]; - SWRevealViewController *revealController = [self revealViewController]; - if (revealController) { - // TODO: add to thread view too - [self.view addGestureRecognizer:[revealController panGestureRecognizer]]; - } - - [self.tableView registerNib:[UINib nibWithNibName:@"MessageCell" bundle:nil] forCellReuseIdentifier:CellIdentifier]; self.tableView.rowHeight = UITableViewAutomaticDimension; self.tableView.estimatedRowHeight = 500.0f; self.refreshControl = [UIRefreshControl new]; - [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];} + [self.refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged]; + if ([User isAuthenticated]) { + [User checkIsValid:^(BOOL success) { + if (success) { + self.path = [APIClient feedUrl]; + [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:(UIUserNotificationTypeAlert|UIUserNotificationTypeSound|UIUserNotificationTypeBadge) categories:nil]]; + [self refreshData]; + } else { + [User throwUnableToLogin]; + } + }]; + + } else { + self.path = [APIClient messagesUrl]; + [self refreshData]; + } + self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"profile_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(composePressed)]; + self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"settings_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(composePressed)]; +} - (void) composePressed { - CATransition* transition = [CATransition animation]; - transition.duration = 0.3; - transition.type = kCATransitionFade; - transition.subtype = kCATransitionFromTop; - [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; - [self.navigationController pushViewController:[[NewPostViewController alloc] init] animated:NO]; } - (void)viewDidAppear:(BOOL)animated @@ -137,32 +120,20 @@ static NSString *CellIdentifier = @"MessageCell"; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - __block NSInteger count; - dispatch_sync(self.concurrent_queue, ^{ - count = self.messages.count; - }); - return count; + return self.messages.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; - __block Message *msg; - dispatch_sync(self.concurrent_queue, ^{ - msg = [self.messages objectAtIndex:indexPath.row]; - }); + MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:@"messageCell" forIndexPath:indexPath]; + Message *msg = [self.messages objectAtIndex:indexPath.row]; cell.layer.borderWidth = 6; cell.layer.borderColor = [ColorScheme mainBackground].CGColor; [cell setMessage:msg]; if ([msg.attach length] > 0) { [cell.attach yy_setImageWithURL:[NSURL URLWithString:msg.attach] placeholder:[UIImage imageNamed:@"AttachPlaceholder"] options:YYWebImageOptionProgressiveBlur | YYWebImageOptionSetImageWithFadeAnimation completion:^(UIImage * _Nullable image, NSURL * _Nonnull url, YYWebImageFromType from, YYWebImageStage stage, NSError * _Nullable error) { - [[NSOperationQueue mainQueue] addOperationWithBlock:^{ - [cell setNeedsUpdateConstraints]; - [cell updateConstraintsIfNeeded]; - [cell setNeedsLayout]; - [cell layoutIfNeeded]; - }]; + [cell setNeedsUpdateConstraints]; + [cell updateConstraintsIfNeeded]; }]; - } else { cell.attach.image = nil; } @@ -171,14 +142,12 @@ static NSString *CellIdentifier = @"MessageCell"; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - if ([self.path isEqualToString:[Message threadUrl]]) + if ([self.path isEqualToString:[APIClient threadUrl]]) return; - __block Message *msg; - dispatch_sync(self.concurrent_queue, ^{ - msg = [self.messages objectAtIndex:indexPath.row]; - }); - MessagesViewController *threadViewController = [[MessagesViewController alloc] init]; - [threadViewController loadFromPath:[Message threadUrl] withParams:[NSDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil] withTitle:@"Thread"]; + Message *msg = [self.messages objectAtIndex:indexPath.row]; + ThreadViewController *threadViewController = [[ThreadViewController alloc] init]; + [threadViewController setPath:[APIClient threadUrl]]; + [threadViewController setParams:[NSMutableDictionary dictionaryWithObjectsAndKeys:msg.mid, @"mid", nil]]; [self.navigationController pushViewController:threadViewController animated:NO]; } @@ -186,36 +155,15 @@ static NSString *CellIdentifier = @"MessageCell"; CGFloat actualPosition = scrollView_.contentOffset.y; CGFloat contentHeight = scrollView_.contentSize.height - scrollView_.contentSize.height / 2; if (actualPosition >= contentHeight && !self.dataLoading) { - __block Message *lastMsg; - dispatch_sync(self.concurrent_queue, ^{ - lastMsg = [self.messages lastObject]; + Message *lastMsg = [self.messages lastObject]; + if (lastMsg != nil) { NSNumber *lastMid = lastMsg.mid; - if (![self.path isEqualToString:[Message threadUrl]]) { - [self.params setValue:lastMid forKey:@"before_mid"]; + if (![self.path isEqualToString:[APIClient threadUrl]]) { + [self.params setObject:lastMid forKey:@"before_mid"]; } [self refreshData]; - }); - } -} - -- (BOOL) canBecomeFirstResponder { - return [self.path isEqualToString:[Message threadUrl]]; -} - -- (UIView *)inputAccessoryView { - if (!_inputAccessoryView) { - CGRect viewBounds = self.view.bounds; - CGRect frame = CGRectMake(0, viewBounds.size.height - PHFComposeBarViewInitialHeight, viewBounds.size.width, - PHFComposeBarViewInitialHeight); - PHFComposeBarView *_view = [[PHFComposeBarView alloc] initWithFrame:frame]; - _view.backgroundColor = [UIColor whiteColor]; - _view.buttonTintColor = [ColorScheme linkColor]; - _view.maxLinesCount = 4; - _view.utilityButtonImage = [UIImage imageNamed:@"Camera"]; - _view.delegate = self; - _inputAccessoryView = _view; + } } - return _inputAccessoryView; } @end diff --git a/Juick/ViewControllers/NewPostViewController.m b/Juick/ViewControllers/NewPostViewController.m index 8c8fbf0..318de4e 100644 --- a/Juick/ViewControllers/NewPostViewController.m +++ b/Juick/ViewControllers/NewPostViewController.m @@ -7,55 +7,33 @@ // #import "NewPostViewController.h" +#import "ColorScheme.h" @interface NewPostViewController () +@property (nonatomic, assign) BOOL didSetupConstraints; + @end @implementation NewPostViewController -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel + self.navigationController.visibleViewController.title = @"Post"; + self.view.backgroundColor = [ColorScheme mainBackground]; + self.navigationController.visibleViewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(cancelCompose)]; - self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self action:@selector(doneCompose)]; + self.navigationController.visibleViewController.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd + target:self action:@selector(doneCompose)]; } - (void) cancelCompose { - CATransition* transition = [CATransition animation]; - transition.duration = 0.3; - transition.type = kCATransitionFade; - transition.subtype = kCATransitionFromTop; - - [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; - [self.navigationController popViewControllerAnimated:NO]; + [self.navigationController.visibleViewController.navigationController popViewControllerAnimated:YES]; } - (void) doneCompose { - CATransition* transition = [CATransition animation]; - transition.duration = 0.3; - transition.type = kCATransitionFade; - transition.subtype = kCATransitionFromTop; - - [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; - [self.navigationController popToRootViewControllerAnimated:NO]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. + [self.navigationController.visibleViewController.navigationController popToRootViewControllerAnimated:YES]; } @end diff --git a/Juick/ViewControllers/RevealPanelViewController.h b/Juick/ViewControllers/RevealPanelViewController.h deleted file mode 100644 index 87cc257..0000000 --- a/Juick/ViewControllers/RevealPanelViewController.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// RevealPanelViewController.h -// Juick -// -// Created by Vitaly Takmazov on 04.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import -#import "FAImageView.h" -#import "LoginViewController.h" - -@interface RevealPanelViewController : UIViewController -@property (nonatomic, strong) IBOutlet UITableView *tableView; -@property (nonatomic, strong) IBOutlet UIButton *signButton; -@end diff --git a/Juick/ViewControllers/RevealPanelViewController.m b/Juick/ViewControllers/RevealPanelViewController.m deleted file mode 100644 index 623bb87..0000000 --- a/Juick/ViewControllers/RevealPanelViewController.m +++ /dev/null @@ -1,179 +0,0 @@ -// -// RevealPanelViewController.m -// Juick -// -// Created by Vitaly Takmazov on 04.11.13. -// Copyright (c) 2013 com.juick. All rights reserved. -// - -#import "SWRevealViewController.h" - -#import "RevealPanelViewController.h" -#import "MessagesViewController.h" - -#import "ColorScheme.h" -#import "NSURL+PathParameters.h" -#import "NavCell.h" -#import "Message.h" -#import "User.h" -#import "AppDelegate.h" - - -static NSString *CellIdentifier = @"NavCell"; - -@interface RevealPanelViewController () - -@end - -@implementation RevealPanelViewController - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; - if (self) { - // Custom initialization - } - return self; -} - -- (void)viewDidLoad -{ - [super viewDidLoad]; - [self.view setBackgroundColor:[UIColor whiteColor]]; - self.tableView = [[UITableView alloc] init]; - //[self.tableView setBackgroundColor:[UIColor whiteColor]]; - self.tableView.delegate = self; - self.tableView.dataSource = self; - [self.tableView setSeparatorInset:UIEdgeInsetsZero]; - self.tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; - self.tableView.separatorColor =[UIColor whiteColor]; - [self.tableView registerNib:[UINib nibWithNibName:@"NavCell" bundle:nil] forCellReuseIdentifier:CellIdentifier]; - [self.view addSubview:self.tableView]; - self.signButton = [[UIButton alloc] init]; - [self.signButton addTarget:self action:@selector(signInOut) forControlEvents:UIControlEventTouchUpInside]; - [self.view addSubview:self.signButton]; - [self refreshInfo]; -} - --(void) refreshInfo { - NSString *text; - UIColor *color; - - if ([User isAuthenticated]) { - text = @"Sign Out"; - color = [UIColor redColor]; - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{ - [User get:[[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] callback:^(User *user) { - if (user != nil) { - /*[self.titleView.image setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/as/%@.png", user.uid]]]; - [self.titleView.title setText:user.uname];*/ - } - }]; - }); - } else { - text = @"Sign In"; - color = [UIColor greenColor]; - } - [self.signButton setTitle:text forState:UIControlStateNormal]; - [self.signButton setBackgroundColor:color]; -} - --(void) signInOut { - [self refreshInfo]; - AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; - [appDelegate pushLoginForm]; -} - --(void) viewWillLayoutSubviews { - [super viewWillLayoutSubviews]; - self.tableView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 400); - self.signButton.frame = CGRectMake(0, self.view.bounds.size.height - 40, self.view.bounds.size.width, 40); -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return 4; -} - -- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 32 + 10*2; // icon size + insets -} - -- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - NavCell * cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; - NSInteger row = indexPath.row; - [cell.contentView setBackgroundColor:[UIColor whiteColor]]; - cell.icon.font = [UIFont fontWithName:kFontAwesomeFamilyName size:32.f]; - cell.icon.textColor = [ColorScheme colorWithHex:0x222222]; - cell.descriptionText.textColor = [ColorScheme colorWithHex:0x222222]; - if (row == 0) { - cell.descriptionText.text = @"My feed"; - cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconHome]; - - } else if (row == 1) { - cell.descriptionText.text = @"Popular"; - cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconComments]; - } else if (row == 2) { - cell.descriptionText.text = @"Discover"; - cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconSearch]; - } else if (row == 3) { - cell.descriptionText.text = @"Images"; - cell.icon.text = [NSString fontAwesomeIconStringForEnum:FAIconPicture]; - } - UIView *bgColorView = [[UIView alloc] init]; - bgColorView.backgroundColor = [ColorScheme colorWithHex:0xddddd5]; - bgColorView.layer.masksToBounds = YES; - [cell setSelectedBackgroundView:bgColorView]; - [cell.contentView setNeedsLayout]; - [cell.contentView layoutIfNeeded]; - return cell; -} - -- (void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSInteger row = indexPath.row; - NSString *targetPath; - NSDictionary *targetParams; - NSString *targetTitle; - SWRevealViewController *reveal = self.revealViewController; - [reveal revealToggle:self]; - if (row == 0) { - if ([[PDKeychainBindings sharedKeychainBindings] stringForKey:@"com.juick.username"] == nil) { - AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate; - [appDelegate pushLoginForm]; - return; - } else { - targetTitle = @"My feed"; - targetPath = [Message feedUrl]; - } - - } - if (row == 1) { - targetTitle = @"Popular"; - targetPath = [Message messagesUrl]; - targetParams = [NSDictionary dictionaryWithObjectsAndKeys:@"1", @"popular", nil]; - } else if (row == 2) { - targetTitle = @"Discover"; - targetPath = [Message messagesUrl]; - } - if (row == 3) { - targetTitle = @"Images"; - targetPath = [Message messagesUrl]; - targetParams = [NSDictionary dictionaryWithObjectsAndKeys:@"photo", @"media", nil]; - } - - UINavigationController *front = (UINavigationController *)reveal.frontViewController; - MessagesViewController *messages = (MessagesViewController *)[front.viewControllers objectAtIndex:0]; - [messages loadFromPath:targetPath withParams:targetParams withTitle:targetTitle]; -} - -@end diff --git a/Juick/ViewControllers/RootNavigationController.h b/Juick/ViewControllers/RootNavigationController.h new file mode 100644 index 0000000..f7f6734 --- /dev/null +++ b/Juick/ViewControllers/RootNavigationController.h @@ -0,0 +1,13 @@ +// +// RootNavigationController.h +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import + +@interface RootNavigationController : UINavigationController + +@end diff --git a/Juick/ViewControllers/RootNavigationController.m b/Juick/ViewControllers/RootNavigationController.m new file mode 100644 index 0000000..9be0a5f --- /dev/null +++ b/Juick/ViewControllers/RootNavigationController.m @@ -0,0 +1,24 @@ +// +// RootNavigationController.m +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import "RootNavigationController.h" +#import "ColorScheme.h" + +@interface RootNavigationController () + +@end + +@implementation RootNavigationController + +- (void) awakeFromNib { + [super awakeFromNib]; + [self.toolbar setTintColor:[ColorScheme linkColor]]; + [self.visibleViewController setToolbarItems:@[[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"nearby_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"new_chat_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil],[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"chats_icon"] style:UIBarButtonItemStylePlain target:self action:nil],[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]] animated:YES]; +} + +@end diff --git a/Juick/ViewControllers/ThreadViewController.h b/Juick/ViewControllers/ThreadViewController.h new file mode 100644 index 0000000..3f2b59c --- /dev/null +++ b/Juick/ViewControllers/ThreadViewController.h @@ -0,0 +1,15 @@ +// +// ThreadViewController.h +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import +@import PHFComposeBarView; + +@interface ThreadViewController : UITableViewController +@property(nonatomic, strong) NSString *path; +@property(nonatomic, strong) NSMutableDictionary *params; +@end diff --git a/Juick/ViewControllers/ThreadViewController.m b/Juick/ViewControllers/ThreadViewController.m new file mode 100644 index 0000000..2ee4af5 --- /dev/null +++ b/Juick/ViewControllers/ThreadViewController.m @@ -0,0 +1,63 @@ +// +// ThreadViewController.m +// Juick +// +// Created by Vitaly Takmazov on 24/09/2017. +// Copyright © 2017 com.juick. All rights reserved. +// + +#import "ThreadViewController.h" +#import "ColorScheme.h" + +@interface ThreadViewController () + +@property (nonatomic, readwrite, retain) UIView *inputAccessoryView; + +@end + +@implementation ThreadViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Uncomment the following line to preserve selection between presentations. + // self.clearsSelectionOnViewWillAppear = NO; + + // Uncomment the following line to display an Edit button in the navigation bar for this view controller. + // self.navigationItem.rightBarButtonItem = self.editButtonItem; +} + +#pragma mark - Table view data source + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { +#warning Incomplete implementation, return the number of sections + return 0; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { +#warning Incomplete implementation, return the number of rows + return 0; +} + + +- (BOOL) canBecomeFirstResponder { + return YES; +} + +- (UIView *)inputAccessoryView { + if (!_inputAccessoryView) { + CGRect viewBounds = self.view.bounds; + CGRect frame = CGRectMake(0, viewBounds.size.height - PHFComposeBarViewInitialHeight, viewBounds.size.width, + PHFComposeBarViewInitialHeight); + PHFComposeBarView *_view = [[PHFComposeBarView alloc] initWithFrame:frame]; + _view.backgroundColor = [UIColor whiteColor]; + _view.buttonTintColor = [ColorScheme linkColor]; + _view.maxLinesCount = 4; + _view.utilityButtonImage = [UIImage imageNamed:@"Camera"]; + _view.delegate = self; + _inputAccessoryView = _view; + } + return _inputAccessoryView; +} + +@end diff --git a/Juick/Views/MessageCell.h b/Juick/Views/MessageCell.h index 394757b..124ed83 100644 --- a/Juick/Views/MessageCell.h +++ b/Juick/Views/MessageCell.h @@ -7,15 +7,19 @@ // #import +@import TTTAttributedLabel; +@import TagListView_ObjC; #import "Message.h" @interface MessageCell : UITableViewCell +@property (weak, nonatomic) IBOutlet UIImageView *avatar; +@property (weak, nonatomic) IBOutlet UILabel *timestamp; @property (weak, nonatomic) IBOutlet UILabel *title; -@property (weak, nonatomic) IBOutlet UILabel *timestamp; -@property (weak, nonatomic) IBOutlet UIImageView *avatar; +@property (weak, nonatomic) IBOutlet TagListView *tags; @property (weak, nonatomic) IBOutlet TTTAttributedLabel *text; @property (weak, nonatomic) IBOutlet UIImageView *attach; @property (weak, nonatomic) IBOutlet UILabel *summary; + @property (strong, nonatomic) Message * message; @end diff --git a/Juick/Views/MessageCell.m b/Juick/Views/MessageCell.m index 2aae74b..cc35446 100644 --- a/Juick/Views/MessageCell.m +++ b/Juick/Views/MessageCell.m @@ -7,6 +7,9 @@ // #import "MessageCell.h" +@import YYWebImage; +@import DateTools; +@import MWFeedParser; #import "ColorScheme.h" @implementation MessageCell @@ -19,12 +22,6 @@ (id)kCTUnderlineStyleAttributeName : [NSNumber numberWithInt:NSUnderlineStyleSingle] }; } -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - [super setSelected:selected animated:animated]; - - // Configure the view for the selected state -} - - (void) setMessage:(Message *)msg { _message = msg; self.avatar.yy_imageURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://i.juick.com/a/%d.png", [msg.user.uid intValue]]]; @@ -45,9 +42,11 @@ self.summary.text = nil; } self.text.text = [msg.text stringByDecodingHTMLEntities]; + [self.tags removeAllTags]; if ([msg.tags count] > 0) { - self.text.text = [[NSString alloc] initWithFormat:@"%@\n%@", [msg.tags componentsJoinedByString:@", "], - [msg.text stringByDecodingHTMLEntities]]; + [msg.tags enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + [self.tags addTag:obj]; + }]; } } diff --git a/Juick/Views/MessageCell.xib b/Juick/Views/MessageCell.xib deleted file mode 100644 index e555b60..0000000 --- a/Juick/Views/MessageCell.xib +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Juick/Views/NavCell.h b/Juick/Views/NavCell.h deleted file mode 100644 index c8c2b41..0000000 --- a/Juick/Views/NavCell.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// NavCell.h -// Juick -// -// Created by Vitaly Takmazov on 14/08/16. -// Copyright © 2016 com.juick. All rights reserved. -// - -#import - -@interface NavCell : UITableViewCell -@property (weak, nonatomic) IBOutlet UILabel *icon; -@property (weak, nonatomic) IBOutlet UILabel *descriptionText; -@end diff --git a/Juick/Views/NavCell.m b/Juick/Views/NavCell.m deleted file mode 100644 index f2ab9f1..0000000 --- a/Juick/Views/NavCell.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// NavCell.m -// Juick -// -// Created by Vitaly Takmazov on 14/08/16. -// Copyright © 2016 com.juick. All rights reserved. -// - -#import "NavCell.h" - -@implementation NavCell - -- (void)awakeFromNib { - [super awakeFromNib]; - // Initialization code -} - -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - [super setSelected:selected animated:animated]; - - // Configure the view for the selected state -} - -@end diff --git a/Juick/Views/NavCell.xib b/Juick/Views/NavCell.xib deleted file mode 100644 index bf2691d..0000000 --- a/Juick/Views/NavCell.xib +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3