summaryrefslogtreecommitdiff
path: root/Juick
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-05-13 18:17:06 +0300
committerGravatar Vitaly Takmazov2023-05-14 01:15:35 +0300
commit312afec3c4fd7f0f51c82c6dc067bc5c89a4c453 (patch)
tree9f0f0ea47024e3b2cd3f797346db3a4a047e0709 /Juick
parentea7006ad743375855fab434f4e6e9caf4274bfb5 (diff)
BubbleMessageCell conversion
Diffstat (limited to 'Juick')
-rw-r--r--Juick/Supporting Files/Juick-Bridging-Header.h1
-rw-r--r--Juick/ViewControllers/ChatViewController.m1
-rw-r--r--Juick/Views/BubbleMessageCell.h20
-rw-r--r--Juick/Views/BubbleMessageCell.m45
-rw-r--r--Juick/Views/BubbleMessageCell.swift35
-rw-r--r--Juick/Views/BubbleMessageCell.xib27
6 files changed, 51 insertions, 78 deletions
diff --git a/Juick/Supporting Files/Juick-Bridging-Header.h b/Juick/Supporting Files/Juick-Bridging-Header.h
index 954d628..f1dc47d 100644
--- a/Juick/Supporting Files/Juick-Bridging-Header.h
+++ b/Juick/Supporting Files/Juick-Bridging-Header.h
@@ -3,5 +3,6 @@
//
#import "UIView+Shimmer.h"
#import "Chat.h"
+#import "Message.h"
#import <UserNotifications/UserNotifications.h>
#import "AppDelegate.h"
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m
index 86d7b2f..76635f2 100644
--- a/Juick/ViewControllers/ChatViewController.m
+++ b/Juick/ViewControllers/ChatViewController.m
@@ -7,7 +7,6 @@
//
#import "ChatViewController.h"
-#import "BubbleMessageCell.h"
#import "Juick-Swift.h"
diff --git a/Juick/Views/BubbleMessageCell.h b/Juick/Views/BubbleMessageCell.h
deleted file mode 100644
index bad2fc4..0000000
--- a/Juick/Views/BubbleMessageCell.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//
-// BubbleMessageCell.h
-// Juick
-//
-// Created by Vitaly Takmazov on 04/03/2018.
-// Copyright © 2018 com.juick. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "Message.h"
-
-@interface BubbleMessageCell : UITableViewCell
-@property (strong, nonatomic) IBOutlet UIImageView *avatarView;
-@property (strong, nonatomic) IBOutlet UILabel *unreadMarker;
-@property (strong, nonatomic) IBOutlet UILabel *name;
-@property (strong, nonatomic) IBOutlet UITextView *message;
-
--(void) configureWithMessage:(Message *) message isMe:(BOOL)isMe;
-
-@end
diff --git a/Juick/Views/BubbleMessageCell.m b/Juick/Views/BubbleMessageCell.m
deleted file mode 100644
index 1c923c7..0000000
--- a/Juick/Views/BubbleMessageCell.m
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// BubbleMessageCell.m
-// Juick
-//
-// Created by Vitaly Takmazov on 04/03/2018.
-// Copyright © 2018 com.juick. All rights reserved.
-//
-
-#import "BubbleMessageCell.h"
-
-@implementation BubbleMessageCell
-
-- (void)awakeFromNib {
- [super awakeFromNib];
- // Initialization code
-}
-
-- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- // Configure the view for the selected state
-}
-
--(void) configureWithMessage:(Message *)message isMe:(BOOL)isMe {
- self.selectionStyle = UITableViewCellSelectionStyleNone;
- self.message.backgroundColor = isMe ? [UIColor colorNamed:@"Title"] : [UIColor colorNamed:@"Chat"];
- self.message.textColor = isMe ? [UIColor whiteColor] : [UIColor colorNamed:@"Text"];
- self.message.dataDetectorTypes = UIDataDetectorTypeAll;
- self.message.tintColor = isMe? [UIColor whiteColor] : [UIColor colorNamed:@"Title"];
- self.name.text = message.user.uname;
- self.message.text = message.text;
- self.unreadMarker.text = @"";
- __weak UIImageView *weakAvatar = self.avatarView;
- [[AppDelegate shared].api fetchImageWithURL:[NSURL URLWithString:message.user.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/BubbleMessageCell.swift b/Juick/Views/BubbleMessageCell.swift
new file mode 100644
index 0000000..fcd9381
--- /dev/null
+++ b/Juick/Views/BubbleMessageCell.swift
@@ -0,0 +1,35 @@
+//
+// BubbleMessageCell.swift
+// Juick
+//
+// Created by Vitaly Takmazov on 13.05.2023.
+// Copyright © 2023 com.juick. All rights reserved.
+//
+
+import UIKit
+
+@objc
+class BubbleMessageCell: UITableViewCell {
+ @IBOutlet weak var avatarView: UIImageView!
+ @IBOutlet weak var unreadMarker: UILabel!
+ @IBOutlet weak var name: UILabel!
+ @IBOutlet weak var message: UITextView!
+
+ @objc
+ func configure(message: Message, isMe: Bool) {
+ self.message.backgroundColor = isMe ? UIColor(named: "Title") : UIColor(named: "Chat")
+ self.message.textColor = isMe ? UIColor.white : UIColor(named: "Text")
+ self.message.dataDetectorTypes = .all
+ self.message.tintColor = isMe ? UIColor.white : UIColor(named: "Title")
+ self.name.text = message.user.uname
+ self.message.text = message.text
+ self.unreadMarker.text = ""
+ AppDelegate.shared().api.fetchImage(with: URL(string: message.user.avatar)) { data in
+ if let imageData = data {
+ UIView.transition(with: self.avatarView, duration: 0.3, options: .transitionCrossDissolve, animations: {
+ self.avatarView.image = UIImage(data: imageData)
+ })
+ }
+ }
+ }
+}
diff --git a/Juick/Views/BubbleMessageCell.xib b/Juick/Views/BubbleMessageCell.xib
index 75afe92..0ad0ea7 100644
--- a/Juick/Views/BubbleMessageCell.xib
+++ b/Juick/Views/BubbleMessageCell.xib
@@ -1,28 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<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="14283.14"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
<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="bubbleMessageCell" rowHeight="192" id="8qR-do-bgA" customClass="BubbleMessageCell">
+ <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="bubbleMessageCell" rowHeight="192" id="8qR-do-bgA" customClass="BubbleMessageCell" customModule="Juick" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="377" height="192"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="8qR-do-bgA" id="PhM-Oe-eqm">
- <rect key="frame" x="0.0" y="0.0" width="377" height="191.5"/>
+ <rect key="frame" x="0.0" y="0.0" width="377" height="192"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" alignment="center" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="W9k-Ah-WF5">
- <rect key="frame" x="6" y="6" width="365" height="179.5"/>
+ <rect key="frame" x="6" y="6" width="365" height="180"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" alignment="center" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="qtf-Wj-Irh">
- <rect key="frame" x="0.0" y="60.5" width="42" height="58.5"/>
+ <rect key="frame" x="0.0" y="61" width="42" height="58.5"/>
<subviews>
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="ho8-hh-u3y">
<rect key="frame" x="5" y="0.0" width="32" height="32"/>
@@ -43,16 +41,16 @@
</constraints>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="12" translatesAutoresizingMaskIntoConstraints="NO" id="xm7-By-6oe">
- <rect key="frame" x="54" y="0.0" width="311" height="179.5"/>
+ <rect key="frame" x="54" y="0.0" width="311" height="180"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="ermine" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UEj-yl-U0d">
<rect key="frame" x="0.0" y="0.0" width="311" height="0.0"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleFootnote"/>
- <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <color key="textColor" systemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" verticalCompressionResistancePriority="1000" scrollEnabled="NO" editable="NO" textAlignment="natural" adjustsFontForContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PUY-2b-P8y">
- <rect key="frame" x="0.0" y="12" width="311" height="167.5"/>
+ <rect key="frame" x="0.0" y="12" width="311" height="168"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<string key="text">Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.</string>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
@@ -82,4 +80,9 @@
<point key="canvasLocation" x="610.39999999999998" y="216.79160419790108"/>
</tableViewCell>
</objects>
+ <resources>
+ <systemColor name="darkTextColor">
+ <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </systemColor>
+ </resources>
</document>