From 37f8fb16c6ce16ca601c386b62f65a48e31642fc Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 13 May 2023 04:51:09 +0300 Subject: Message layout updates and clickable images --- Juick/ViewControllers/FeedViewController.h | 2 +- Juick/ViewControllers/FeedViewController.m | 10 ---------- Juick/ViewControllers/MessagesViewController.h | 2 +- Juick/ViewControllers/MessagesViewController.m | 15 +++++++++++++++ 4 files changed, 17 insertions(+), 12 deletions(-) (limited to 'Juick/ViewControllers') diff --git a/Juick/ViewControllers/FeedViewController.h b/Juick/ViewControllers/FeedViewController.h index 76388aa..a669bcb 100644 --- a/Juick/ViewControllers/FeedViewController.h +++ b/Juick/ViewControllers/FeedViewController.h @@ -9,6 +9,6 @@ #import #import "MessagesViewController.h" -@interface FeedViewController : MessagesViewController +@interface FeedViewController : MessagesViewController @end diff --git a/Juick/ViewControllers/FeedViewController.m b/Juick/ViewControllers/FeedViewController.m index c492f2e..3575f16 100644 --- a/Juick/ViewControllers/FeedViewController.m +++ b/Juick/ViewControllers/FeedViewController.m @@ -14,11 +14,6 @@ NSString * const UserNotAuthenticatedNotificationName = @"UserNotAuthenticated"; -@interface FeedViewController () - -@property NSString *selectedUser; -@end - @implementation FeedViewController -(void) viewDidLoad { @@ -29,11 +24,6 @@ NSString * const UserNotAuthenticatedNotificationName = @"UserNotAuthenticated"; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(userDidSignedIn:) name:UserChangedNotificationName object:nil]; } --(void)avatarClicked:(NSString *)uname { - self.selectedUser = uname; - [self performSegueWithIdentifier:@"profileSegue" sender:self]; -} - -(void) loadMore { Message *lastMsg = [self.messages lastObject]; if (lastMsg != nil) { diff --git a/Juick/ViewControllers/MessagesViewController.h b/Juick/ViewControllers/MessagesViewController.h index 3b466f0..6d2c7e2 100644 --- a/Juick/ViewControllers/MessagesViewController.h +++ b/Juick/ViewControllers/MessagesViewController.h @@ -15,7 +15,7 @@ extern NSString* const messageCellIdentifier; -(void) loadMore; @end -@interface MessagesViewController : UITableViewController +@interface MessagesViewController : UITableViewController @property(nonatomic, strong) NSString *path; @property(nonatomic, strong) NSDictionary *params; @property(nonatomic, assign) BOOL shouldScrollToUnreadOnRefresh; diff --git a/Juick/ViewControllers/MessagesViewController.m b/Juick/ViewControllers/MessagesViewController.m index 12f8176..10b7c37 100644 --- a/Juick/ViewControllers/MessagesViewController.m +++ b/Juick/ViewControllers/MessagesViewController.m @@ -27,6 +27,8 @@ NSString* const messageCellIdentifier = @"messageCell"; -(void) applicationActivated; +@property NSString *selectedUser; + @end @implementation MessagesViewController @@ -155,6 +157,7 @@ NSString* const messageCellIdentifier = @"messageCell"; Message *msg = [self.messages objectAtIndex:indexPath.row]; MessageCell *cell = [tableView dequeueReusableCellWithIdentifier:messageCellIdentifier forIndexPath:indexPath]; [cell configureWithMessage:msg selectable:self.shouldAllowToSelectText]; + cell.delegate = self; return cell; } } @@ -219,6 +222,18 @@ NSString* const messageCellIdentifier = @"messageCell"; return configuration; } +-(void)avatarClicked:(NSString *)uname { + /*self.selectedUser = uname; + [self performSegueWithIdentifier:@"profileSegue" sender:self];*/ +} + +-(void)linkClicked:(NSString *)urlString { + NSURL *url = [NSURL URLWithString:urlString]; + [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) { + + }]; +} + - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil]; -- cgit v1.2.3