summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-05-13 17:41:43 +0300
committerGravatar Vitaly Takmazov2023-05-14 01:15:35 +0300
commitcc94c2555c22cd51722034ac1ff02a0c041653c4 (patch)
treeeeca6f34f9d8d36c7066b1d1f1d78f2d657bead7 /Juick
parent773754148b7006140963dcebfab21766b6f1c6fb (diff)
ConversationCell.{h,m} -> ConversationCell.swift
Diffstat (limited to 'Juick')
-rw-r--r--Juick/Supporting Files/Juick-Bridging-Header.h3
-rw-r--r--Juick/ViewControllers/DialogsViewController.m3
-rw-r--r--Juick/Views/ConversationCell.h20
-rw-r--r--Juick/Views/ConversationCell.m31
-rw-r--r--Juick/Views/ConversationCell.swift30
-rw-r--r--Juick/Views/ConversationCell.xib26
6 files changed, 48 insertions, 65 deletions
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>