From cc94c2555c22cd51722034ac1ff02a0c041653c4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 13 May 2023 17:41:43 +0300 Subject: ConversationCell.{h,m} -> ConversationCell.swift --- Juick/Supporting Files/Juick-Bridging-Header.h | 3 +++ Juick/ViewControllers/DialogsViewController.m | 3 ++- Juick/Views/ConversationCell.h | 20 ----------------- Juick/Views/ConversationCell.m | 31 -------------------------- Juick/Views/ConversationCell.swift | 30 +++++++++++++++++++++++++ Juick/Views/ConversationCell.xib | 26 ++++++++++----------- 6 files changed, 48 insertions(+), 65 deletions(-) delete mode 100644 Juick/Views/ConversationCell.h delete mode 100644 Juick/Views/ConversationCell.m create mode 100644 Juick/Views/ConversationCell.swift (limited to 'Juick') diff --git a/Juick/Supporting Files/Juick-Bridging-Header.h b/Juick/Supporting Files/Juick-Bridging-Header.h index 5dfa23b..954d628 100644 --- a/Juick/Supporting Files/Juick-Bridging-Header.h +++ b/Juick/Supporting Files/Juick-Bridging-Header.h @@ -2,3 +2,6 @@ // Use this file to import your target's public headers that you would like to expose to Swift. // #import "UIView+Shimmer.h" +#import "Chat.h" +#import +#import "AppDelegate.h" diff --git a/Juick/ViewControllers/DialogsViewController.m b/Juick/ViewControllers/DialogsViewController.m index dff8529..a1950dc 100644 --- a/Juick/ViewControllers/DialogsViewController.m +++ b/Juick/ViewControllers/DialogsViewController.m @@ -6,9 +6,10 @@ // Copyright © 2018 com.juick. All rights reserved. // +#import "Chat.h" #import "DialogsViewController.h" #import "ChatViewController.h" -#import "ConversationCell.h" +#import "Juick-Swift.h" @interface DialogsViewController() diff --git a/Juick/Views/ConversationCell.h b/Juick/Views/ConversationCell.h deleted file mode 100644 index f31057b..0000000 --- a/Juick/Views/ConversationCell.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ConversationCell.h -// Juick -// -// Created by Vitaly Takmazov on 04/03/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import -#import "Chat.h" - -@interface ConversationCell : UITableViewCell -@property (strong, nonatomic) IBOutlet UILabel *chatName; -@property (strong, nonatomic) IBOutlet UIImageView *avatar; -@property (strong, nonatomic) IBOutlet UILabel *lastMessage; -@property (strong, nonatomic) IBOutlet UILabel *unreadMarker; - --(void) configureWithChat:(Chat *)chat; - -@end diff --git a/Juick/Views/ConversationCell.m b/Juick/Views/ConversationCell.m deleted file mode 100644 index 360ed2b..0000000 --- a/Juick/Views/ConversationCell.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// ConversationCell.m -// Juick -// -// Created by Vitaly Takmazov on 04/03/2018. -// Copyright © 2018 com.juick. All rights reserved. -// - -#import "ConversationCell.h" - -@implementation ConversationCell - --(void) configureWithChat:(Chat *)chat { - self.selectionStyle = UITableViewCellSelectionStyleNone; - self.chatName.textColor = [UIColor colorNamed:@"Title"]; - self.chatName.text = chat.uname; - self.lastMessage.text = chat.lastMessageText; - self.unreadMarker.hidden = false; - __weak UIImageView *weakAvatar = self.avatar; - [[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:chat.avatar] callback:^(NSData *data) { - [UIView transitionWithView:weakAvatar - duration:0.3 - options:UIViewAnimationOptionTransitionCrossDissolve - animations:^{ - weakAvatar.image = [UIImage imageWithData:data]; - } - completion:nil]; - }]; -} - -@end diff --git a/Juick/Views/ConversationCell.swift b/Juick/Views/ConversationCell.swift new file mode 100644 index 0000000..b8fe113 --- /dev/null +++ b/Juick/Views/ConversationCell.swift @@ -0,0 +1,30 @@ +// +// ConversationCell.swift +// Juick +// +// Created by Vitaly Takmazov on 13.05.2023. +// Copyright © 2023 com.juick. All rights reserved. +// + +import UIKit + +@objc class ConversationCell : UITableViewCell { + @IBOutlet weak var chatName: UILabel! + @IBOutlet weak var lastMessage: UILabel! + @IBOutlet weak var unreadMarker: UILabel! + @IBOutlet weak var avatar: UIImageView! + + @objc func configure(chat: Chat) { + self.chatName.textColor = UIColor(named: "Title") + self.chatName.text = chat.uname + self.lastMessage.text = chat.lastMessageText + self.unreadMarker.isHidden = false + AppDelegate.shared().api.fetchImage(with: URL(string: chat.avatar)) { data in + if let imageData = data { + UIView.transition(with: self.avatar, duration: 0.3, options: .transitionCrossDissolve, animations: { + self.avatar.image = UIImage(data: imageData) + }) + } + } + } +} diff --git a/Juick/Views/ConversationCell.xib b/Juick/Views/ConversationCell.xib index b524816..b2dcae2 100644 --- a/Juick/Views/ConversationCell.xib +++ b/Juick/Views/ConversationCell.xib @@ -1,16 +1,16 @@ - + - + - + @@ -18,14 +18,14 @@ - + - - + + - - - + + + - + -- cgit v1.2.3