diff options
author | Vitaly Takmazov | 2018-04-28 04:45:13 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-28 04:45:13 +0300 |
commit | 05520b1f723b021bb57972b71cbe13684ab2195b (patch) | |
tree | 5bb39543164001537552e41cdb7e03a797398697 /Juick/ViewControllers/DiscoverViewController.m | |
parent | f6fed5b2374c7d847c68efccce363f9513aa2efb (diff) |
Blog view
Diffstat (limited to 'Juick/ViewControllers/DiscoverViewController.m')
-rw-r--r-- | Juick/ViewControllers/DiscoverViewController.m | 20 |
1 files changed, 19 insertions, 1 deletions
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]) { |