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.xcodeproj/project.pbxproj | 10 ++++----- 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 ++++++++++----------- 7 files changed, 52 insertions(+), 71 deletions(-) delete mode 100644 Juick/Views/ConversationCell.h delete mode 100644 Juick/Views/ConversationCell.m create mode 100644 Juick/Views/ConversationCell.swift diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj index e6d4931..7201ebe 100644 --- a/Juick.xcodeproj/project.pbxproj +++ b/Juick.xcodeproj/project.pbxproj @@ -21,7 +21,6 @@ 77317BC7181BBE8500D60005 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 77317BC6181BBE8500D60005 /* Images.xcassets */; }; 773E6393204BCAD6008B8F8D /* BubbleMessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */; }; 773E6394204BCAD6008B8F8D /* ConversationCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 773E6392204BCAD6008B8F8D /* ConversationCell.xib */; }; - 773E6397204BCB64008B8F8D /* ConversationCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E6396204BCB64008B8F8D /* ConversationCell.m */; }; 773E639A204BCE6D008B8F8D /* DialogsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E6399204BCE6D008B8F8D /* DialogsViewController.m */; }; 773E639D204BD0F2008B8F8D /* Chat.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E639C204BD0F2008B8F8D /* Chat.m */; }; 773E63A0204BDF16008B8F8D /* ChatViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E639F204BDF16008B8F8D /* ChatViewController.m */; }; @@ -43,6 +42,7 @@ 776C41BE1FD3EF180063B82E /* MessageCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 776C41BC1FD3EF180063B82E /* MessageCell.xib */; }; 776C41C11FD3FF6E0063B82E /* FeedViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 776C41C01FD3FF6E0063B82E /* FeedViewController.m */; }; 776D4EE32A0FD1A300C8BD91 /* ContentLoadingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE22A0FD1A300C8BD91 /* ContentLoadingCell.swift */; }; + 776D4EE52A0FD4B500C8BD91 /* ConversationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */; }; 778560602343D24E00BB37A2 /* NSData+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = 7785605F2343D24E00BB37A2 /* NSData+Hex.m */; }; 778560632344CF6F00BB37A2 /* JuickNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 778560622344CF6F00BB37A2 /* JuickNavigationController.m */; }; 77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77975A1C182B6E9A00410C2B /* NewPostViewController.m */; }; @@ -123,8 +123,6 @@ 77317BC6181BBE8500D60005 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BubbleMessageCell.xib; sourceTree = ""; }; 773E6392204BCAD6008B8F8D /* ConversationCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConversationCell.xib; sourceTree = ""; }; - 773E6395204BCB64008B8F8D /* ConversationCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConversationCell.h; sourceTree = ""; }; - 773E6396204BCB64008B8F8D /* ConversationCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConversationCell.m; sourceTree = ""; }; 773E6398204BCE6D008B8F8D /* DialogsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DialogsViewController.h; sourceTree = ""; }; 773E6399204BCE6D008B8F8D /* DialogsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DialogsViewController.m; sourceTree = ""; }; 773E639B204BD0F2008B8F8D /* Chat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Chat.h; sourceTree = ""; }; @@ -161,6 +159,7 @@ 776C41BF1FD3FF6E0063B82E /* FeedViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedViewController.h; sourceTree = ""; }; 776C41C01FD3FF6E0063B82E /* FeedViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedViewController.m; sourceTree = ""; }; 776D4EE22A0FD1A300C8BD91 /* ContentLoadingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentLoadingCell.swift; sourceTree = ""; }; + 776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationCell.swift; sourceTree = ""; }; 7785605E2343D24E00BB37A2 /* NSData+Hex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Hex.h"; sourceTree = ""; }; 7785605F2343D24E00BB37A2 /* NSData+Hex.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Hex.m"; sourceTree = ""; }; 778560612344CF6F00BB37A2 /* JuickNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JuickNavigationController.h; sourceTree = ""; }; @@ -416,8 +415,7 @@ 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */, 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */, 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */, - 773E6395204BCB64008B8F8D /* ConversationCell.h */, - 773E6396204BCB64008B8F8D /* ConversationCell.m */, + 776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */, 773E6392204BCAD6008B8F8D /* ConversationCell.xib */, 776C41BA1FD3EF180063B82E /* MessageCell.h */, 776C41BB1FD3EF180063B82E /* MessageCell.m */, @@ -616,7 +614,7 @@ 774746AD239F82A10001C7F9 /* NSDate+TimeAgo.m in Sources */, 77C36495224417E90017522C /* DiscoverViewController.m in Sources */, 77E35A82189A5B5A00B2D216 /* LoginViewController.m in Sources */, - 773E6397204BCB64008B8F8D /* ConversationCell.m in Sources */, + 776D4EE52A0FD4B500C8BD91 /* ConversationCell.swift in Sources */, 778560602343D24E00BB37A2 /* NSData+Hex.m in Sources */, 774C98CD25126C070073C70A /* Service.swift in Sources */, 776C41BD1FD3EF180063B82E /* MessageCell.m in Sources */, 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