summaryrefslogtreecommitdiff
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
parentea7006ad743375855fab434f4e6e9caf4274bfb5 (diff)
BubbleMessageCell conversion
-rw-r--r--Juick.xcodeproj/project.pbxproj10
-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
7 files changed, 55 insertions, 84 deletions
diff --git a/Juick.xcodeproj/project.pbxproj b/Juick.xcodeproj/project.pbxproj
index 1d00963..391edd6 100644
--- a/Juick.xcodeproj/project.pbxproj
+++ b/Juick.xcodeproj/project.pbxproj
@@ -24,7 +24,6 @@
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 */; };
- 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */; };
773F231C1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 773F231B1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf */; };
773F23331F76ECAC00B5B0DF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 773F23321F76ECAC00B5B0DF /* LaunchScreen.storyboard */; };
773F23371F76ED5E00B5B0DF /* Splash.png in Resources */ = {isa = PBXBuildFile; fileRef = 773F23341F76ED5D00B5B0DF /* Splash.png */; };
@@ -44,6 +43,7 @@
776D4EE32A0FD1A300C8BD91 /* ContentLoadingCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE22A0FD1A300C8BD91 /* ContentLoadingCell.swift */; };
776D4EE52A0FD4B500C8BD91 /* ConversationCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */; };
776D4EE72A0FD96C00C8BD91 /* MessageInputView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE62A0FD96C00C8BD91 /* MessageInputView.swift */; };
+ 776D4EE92A0FDF5D00C8BD91 /* BubbleMessageCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 776D4EE82A0FDF5D00C8BD91 /* BubbleMessageCell.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 */; };
@@ -129,8 +129,6 @@
773E639C204BD0F2008B8F8D /* Chat.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Chat.m; sourceTree = "<group>"; };
773E639E204BDF16008B8F8D /* ChatViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ChatViewController.h; sourceTree = "<group>"; };
773E639F204BDF16008B8F8D /* ChatViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ChatViewController.m; sourceTree = "<group>"; };
- 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BubbleMessageCell.h; sourceTree = "<group>"; };
- 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BubbleMessageCell.m; sourceTree = "<group>"; };
773F231B1F76DD0B00B5B0DF /* SerpentineBoldItalic.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = SerpentineBoldItalic.ttf; sourceTree = "<group>"; };
773F23321F76ECAC00B5B0DF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
773F23341F76ED5D00B5B0DF /* Splash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Splash.png; sourceTree = "<group>"; };
@@ -161,6 +159,7 @@
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>"; };
776D4EE62A0FD96C00C8BD91 /* MessageInputView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageInputView.swift; sourceTree = "<group>"; };
+ 776D4EE82A0FDF5D00C8BD91 /* BubbleMessageCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BubbleMessageCell.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>"; };
@@ -411,8 +410,7 @@
77FFC0151D5FD13C003BD81A /* Views */ = {
isa = PBXGroup;
children = (
- 773E63A1204BE036008B8F8D /* BubbleMessageCell.h */,
- 773E63A2204BE036008B8F8D /* BubbleMessageCell.m */,
+ 776D4EE82A0FDF5D00C8BD91 /* BubbleMessageCell.swift */,
773E6391204BCAD6008B8F8D /* BubbleMessageCell.xib */,
776D4EE42A0FD4B500C8BD91 /* ConversationCell.swift */,
773E6392204BCAD6008B8F8D /* ConversationCell.xib */,
@@ -602,12 +600,12 @@
773E639D204BD0F2008B8F8D /* Chat.m in Sources */,
77B8DCD62093FC03000DBB04 /* BlogViewController.m in Sources */,
773E639A204BCE6D008B8F8D /* DialogsViewController.m in Sources */,
+ 776D4EE92A0FDF5D00C8BD91 /* BubbleMessageCell.swift in Sources */,
772B4E6C2199811E0029706E /* Entity.m in Sources */,
77B09994189D0B9900A84F59 /* UIImage+Utils.m in Sources */,
77317BC2181BBE8500D60005 /* MessagesViewController.m in Sources */,
77B099A6189D57F000A84F59 /* User.m in Sources */,
77C6ADE41F7717BC000AEA8C /* ThreadViewController.m in Sources */,
- 773E63A3204BE036008B8F8D /* BubbleMessageCell.m in Sources */,
77975A1D182B6E9A00410C2B /* NewPostViewController.m in Sources */,
774746AD239F82A10001C7F9 /* NSDate+TimeAgo.m in Sources */,
776D4EE72A0FD96C00C8BD91 /* MessageInputView.swift in Sources */,
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>