diff options
author | Vitaly Takmazov | 2023-05-13 17:41:43 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-05-14 01:15:35 +0300 |
commit | cc94c2555c22cd51722034ac1ff02a0c041653c4 (patch) | |
tree | eeca6f34f9d8d36c7066b1d1f1d78f2d657bead7 | |
parent | 773754148b7006140963dcebfab21766b6f1c6fb (diff) |
ConversationCell.{h,m} -> ConversationCell.swift
-rw-r--r-- | Juick.xcodeproj/project.pbxproj | 10 | ||||
-rw-r--r-- | Juick/Supporting Files/Juick-Bridging-Header.h | 3 | ||||
-rw-r--r-- | Juick/ViewControllers/DialogsViewController.m | 3 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.h | 20 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.m | 31 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.swift | 30 | ||||
-rw-r--r-- | Juick/Views/ConversationCell.xib | 26 |
7 files changed, 52 insertions, 71 deletions
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 = "<group>"; }; 773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = BubbleMessageCell.xib; sourceTree = "<group>"; }; 773E6392204BCAD6008B8F8D /* ConversationCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ConversationCell.xib; sourceTree = "<group>"; }; - 773E6395204BCB64008B8F8D /* ConversationCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConversationCell.h; sourceTree = "<group>"; }; - 773E6396204BCB64008B8F8D /* ConversationCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConversationCell.m; sourceTree = "<group>"; }; 773E6398204BCE6D008B8F8D /* DialogsViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DialogsViewController.h; sourceTree = "<group>"; }; 773E6399204BCE6D008B8F8D /* DialogsViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DialogsViewController.m; sourceTree = "<group>"; }; 773E639B204BD0F2008B8F8D /* Chat.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Chat.h; sourceTree = "<group>"; }; @@ -161,6 +159,7 @@ 776C41BF1FD3FF6E0063B82E /* FeedViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FeedViewController.h; sourceTree = "<group>"; }; 776C41C01FD3FF6E0063B82E /* FeedViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FeedViewController.m; sourceTree = "<group>"; }; 776D4EE22A0FD1A300C8BD91 /* ContentLoadingCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentLoadingCell.swift; sourceTree = "<group>"; }; + 776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationCell.swift; sourceTree = "<group>"; }; 7785605E2343D24E00BB37A2 /* NSData+Hex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+Hex.h"; sourceTree = "<group>"; }; 7785605F2343D24E00BB37A2 /* NSData+Hex.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+Hex.m"; sourceTree = "<group>"; }; 778560612344CF6F00BB37A2 /* JuickNavigationController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JuickNavigationController.h; sourceTree = "<group>"; }; @@ -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 <UserNotifications/UserNotifications.h> +#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 <UIKit/UIKit.h> -#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 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES"> <device id="retina4_7" orientation="portrait" appearance="light"/> <dependencies> <deployment identifier="iOS"/> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/> <capability name="Named colors" minToolsVersion="9.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> - <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="notificationCell" rowHeight="84" id="eKX-ht-IFf" customClass="ConversationCell"> + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="notificationCell" rowHeight="84" id="eKX-ht-IFf" customClass="ConversationCell" customModule="Juick" customModuleProvider="target"> <rect key="frame" x="0.0" y="0.0" width="324" height="84"/> <autoresizingMask key="autoresizingMask"/> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="eKX-ht-IFf" id="3NU-ng-4QM"> @@ -18,14 +18,14 @@ <autoresizingMask key="autoresizingMask"/> <subviews> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="WsB-eh-dhD"> - <rect key="frame" x="12" y="12" width="48" height="48"/> + <rect key="frame" x="20" y="20" width="48" height="48"/> <constraints> <constraint firstAttribute="width" constant="48" id="6ox-eq-Vlp"/> <constraint firstAttribute="height" constant="48" id="e88-rG-unU"/> </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="751" text="●" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jW2-kr-sJn"> - <rect key="frame" x="29.5" y="55" width="13" height="17"/> + <rect key="frame" x="37.5" y="47" width="13" height="17"/> <constraints> <constraint firstAttribute="height" constant="17" id="AG9-E4-rLK"/> <constraint firstAttribute="width" constant="13" id="KHD-TS-qMx"/> @@ -35,13 +35,13 @@ <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="TTg-gl-dzG"> - <rect key="frame" x="68" y="12" width="244" height="17"/> + <rect key="frame" x="76" y="20" width="228" height="20.5"/> <fontDescription key="fontDescription" style="UICTFontTextStyleHeadline"/> <color key="textColor" name="Text"/> <nil key="highlightedColor"/> </label> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalCompressionResistancePriority="1000" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EiA-lG-gV5"> - <rect key="frame" x="68" y="37" width="244" height="30.5"/> + <rect key="frame" x="76" y="48.5" width="228" height="38"/> <string key="text">Lorem sdsdasds sdsada ddas dsad asdsadas dasd asdsa sadsa dasdsad asd asdas dasd asdas dasd asdas dasdasdasd asdasdasdadasdasd asdasd asdas dasdsa dasdasdasdasdas dasdas</string> <fontDescription key="fontDescription" style="UICTFontTextStyleSubhead"/> <color key="textColor" name="Muted"/> @@ -49,17 +49,17 @@ </label> </subviews> <constraints> - <constraint firstAttribute="trailing" secondItem="TTg-gl-dzG" secondAttribute="trailing" constant="12" id="1uw-1z-335"/> - <constraint firstAttribute="bottom" secondItem="jW2-kr-sJn" secondAttribute="bottom" constant="12" id="6n4-T7-Jph"/> + <constraint firstAttribute="trailing" secondItem="TTg-gl-dzG" secondAttribute="trailing" constant="20" symbolic="YES" id="1uw-1z-335"/> + <constraint firstAttribute="bottom" secondItem="jW2-kr-sJn" secondAttribute="bottom" constant="20" symbolic="YES" id="6n4-T7-Jph"/> <constraint firstItem="jW2-kr-sJn" firstAttribute="top" secondItem="WsB-eh-dhD" secondAttribute="bottom" priority="750" constant="8" symbolic="YES" id="GXK-L2-yPH"/> - <constraint firstAttribute="trailing" secondItem="EiA-lG-gV5" secondAttribute="trailing" constant="12" id="H4w-29-uxg"/> - <constraint firstItem="WsB-eh-dhD" firstAttribute="leading" secondItem="3NU-ng-4QM" secondAttribute="leading" constant="12" id="Vg1-Ss-N8r"/> - <constraint firstItem="WsB-eh-dhD" firstAttribute="top" secondItem="3NU-ng-4QM" secondAttribute="top" constant="12" id="ji2-4k-ZsD"/> + <constraint firstAttribute="trailing" secondItem="EiA-lG-gV5" secondAttribute="trailing" constant="20" symbolic="YES" id="H4w-29-uxg"/> + <constraint firstItem="WsB-eh-dhD" firstAttribute="leading" secondItem="3NU-ng-4QM" secondAttribute="leading" constant="20" symbolic="YES" id="Vg1-Ss-N8r"/> + <constraint firstItem="WsB-eh-dhD" firstAttribute="top" secondItem="3NU-ng-4QM" secondAttribute="top" constant="20" symbolic="YES" id="ji2-4k-ZsD"/> <constraint firstItem="EiA-lG-gV5" firstAttribute="leading" secondItem="WsB-eh-dhD" secondAttribute="trailing" constant="8" symbolic="YES" id="n5j-fx-61t"/> <constraint firstItem="EiA-lG-gV5" firstAttribute="top" secondItem="TTg-gl-dzG" secondAttribute="bottom" constant="8" symbolic="YES" id="nvI-wS-KRq"/> <constraint firstItem="jW2-kr-sJn" firstAttribute="centerX" secondItem="WsB-eh-dhD" secondAttribute="centerX" id="pJH-mQ-9dF"/> <constraint firstItem="TTg-gl-dzG" firstAttribute="leading" secondItem="WsB-eh-dhD" secondAttribute="trailing" constant="8" symbolic="YES" id="zAw-P6-Ac1"/> - <constraint firstItem="TTg-gl-dzG" firstAttribute="top" secondItem="3NU-ng-4QM" secondAttribute="top" constant="12" id="zvB-Ak-HDC"/> + <constraint firstItem="TTg-gl-dzG" firstAttribute="top" secondItem="3NU-ng-4QM" secondAttribute="top" constant="20" symbolic="YES" id="zvB-Ak-HDC"/> </constraints> </tableViewCellContentView> <connections> |