summaryrefslogtreecommitdiff
path: root/Juick/ViewControllers
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-04-28 04:45:13 +0300
committerGravatar Vitaly Takmazov2018-04-28 04:45:13 +0300
commit05520b1f723b021bb57972b71cbe13684ab2195b (patch)
tree5bb39543164001537552e41cdb7e03a797398697 /Juick/ViewControllers
parentf6fed5b2374c7d847c68efccce363f9513aa2efb (diff)
Blog view
Diffstat (limited to 'Juick/ViewControllers')
-rw-r--r--Juick/ViewControllers/BlogViewController.h16
-rw-r--r--Juick/ViewControllers/BlogViewController.m17
-rw-r--r--Juick/ViewControllers/DiscoverViewController.h2
-rw-r--r--Juick/ViewControllers/DiscoverViewController.m20
-rw-r--r--Juick/ViewControllers/MessagesViewController.h1
-rw-r--r--Juick/ViewControllers/MessagesViewController.m2
6 files changed, 55 insertions, 3 deletions
diff --git a/Juick/ViewControllers/BlogViewController.h b/Juick/ViewControllers/BlogViewController.h
new file mode 100644
index 0000000..e428ab5
--- /dev/null
+++ b/Juick/ViewControllers/BlogViewController.h
@@ -0,0 +1,16 @@
+//
+// BlogViewController.h
+// Juick
+//
+// Created by Vitaly Takmazov on 28/04/2018.
+// Copyright © 2018 com.juick. All rights reserved.
+//
+
+#import "MessagesViewController.h"
+#import "User.h"
+
+@interface BlogViewController : MessagesViewController
+
+@property(nonatomic, strong) NSString *uname;
+
+@end
diff --git a/Juick/ViewControllers/BlogViewController.m b/Juick/ViewControllers/BlogViewController.m
new file mode 100644
index 0000000..7e23556
--- /dev/null
+++ b/Juick/ViewControllers/BlogViewController.m
@@ -0,0 +1,17 @@
+//
+// BlogViewController.m
+// Juick
+//
+// Created by Vitaly Takmazov on 28/04/2018.
+// Copyright © 2018 com.juick. All rights reserved.
+//
+
+#import "BlogViewController.h"
+
+@interface BlogViewController ()
+
+@end
+
+@implementation BlogViewController
+
+@end
diff --git a/Juick/ViewControllers/DiscoverViewController.h b/Juick/ViewControllers/DiscoverViewController.h
index 9f96b98..bb34d5e 100644
--- a/Juick/ViewControllers/DiscoverViewController.h
+++ b/Juick/ViewControllers/DiscoverViewController.h
@@ -9,6 +9,6 @@
#import <UIKit/UIKit.h>
#import "MessagesViewController.h"
-@interface DiscoverViewController : MessagesViewController<MessagesDelegate>
+@interface DiscoverViewController : MessagesViewController<MessagesDelegate, MessageCellDelegate>
@end
diff --git a/Juick/ViewControllers/DiscoverViewController.m b/Juick/ViewControllers/DiscoverViewController.m
index d57947e..a02f23c 100644
--- a/Juick/ViewControllers/DiscoverViewController.m
+++ b/Juick/ViewControllers/DiscoverViewController.m
@@ -8,6 +8,7 @@
#import "DiscoverViewController.h"
#import "ThreadViewController.h"
+#import "BlogViewController.h"
#import "MessageCell.h"
#import "APIClient.h"
#import "AppDelegate.h"
@@ -16,7 +17,7 @@
@interface DiscoverViewController ()
@property(nonatomic, strong) AppDelegate *appDelegate;
-
+@property NSString *selectedUser;
@end
@implementation DiscoverViewController
@@ -54,6 +55,16 @@
MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier forIndexPath:indexPath];
[self performSegueWithIdentifier:@"threadViewSegue" sender:cell];
}
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+ MessageCell *cell = (MessageCell *)[super tableView:tableView cellForRowAtIndexPath:indexPath];
+ cell.delegate = self;
+ return cell;
+}
+
+-(void)avatarClicked:(NSString *)uname {
+ self.selectedUser = uname;
+ [self performSegueWithIdentifier:@"profileSegue" sender:self];
+}
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqual: @"threadViewSegue"]) {
@@ -73,6 +84,13 @@
[threadVC setParams:@{@"mid": mid }];
[threadVC refreshData:scrollToEnd];
}
+ if ([segue.identifier isEqual: @"profileSegue"]) {
+ BlogViewController *blogVC = (BlogViewController *)segue.destinationViewController;
+ [blogVC setUname:self.selectedUser];
+ [blogVC setTitle:self.selectedUser];
+ blogVC.path = [NSString stringWithFormat:@"/messages?uname=%@", self.selectedUser];
+ [blogVC refreshData:NO];
+ }
}
- (IBAction)filterAction:(id)sender {
if (![User isAuthenticated]) {
diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h
index 2259b91..688336b 100644
--- a/Juick/ViewControllers/MessagesViewController.h
+++ b/Juick/ViewControllers/MessagesViewController.h
@@ -7,6 +7,7 @@
//
#import <UIKit/UIKit.h>
+#import "MessageCell.h"
@protocol MessagesDelegate
-(void) loadMore;
diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m
index c718336..a37f502 100644
--- a/Juick/ViewControllers/MessagesViewController.m
+++ b/Juick/ViewControllers/MessagesViewController.m
@@ -16,11 +16,11 @@
#import "NewPostViewController.h"
#import "LoginViewController.h"
#import "ThreadViewController.h"
+#import "BlogViewController.h"
#import "NSURL+PathParameters.h"
-
@implementation MessagesViewController
-(void) refreshData {