Skip to content

Commit 72c2c90

Browse files
authored
Merge pull request #147 from QuickBlox/development
Development
2 parents a19a521 + 93b72f6 commit 72c2c90

13 files changed

Lines changed: 227 additions & 131 deletions

File tree

ChatExample/ChatExample.xcodeproj/project.pbxproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
isa = PBXProject;
133133
attributes = {
134134
LastSwiftUpdateCheck = 0920;
135-
LastUpgradeCheck = 0920;
135+
LastUpgradeCheck = 0930;
136136
ORGANIZATIONNAME = "Andrey Ivanov";
137137
TargetAttributes = {
138138
FB9EA92320614E2300E3FF45 = {
@@ -282,13 +282,15 @@
282282
CLANG_WARN_BOOL_CONVERSION = YES;
283283
CLANG_WARN_COMMA = YES;
284284
CLANG_WARN_CONSTANT_CONVERSION = YES;
285+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
285286
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
286287
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
287288
CLANG_WARN_EMPTY_BODY = YES;
288289
CLANG_WARN_ENUM_CONVERSION = YES;
289290
CLANG_WARN_INFINITE_RECURSION = YES;
290291
CLANG_WARN_INT_CONVERSION = YES;
291292
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
293+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
292294
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
293295
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
294296
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -339,13 +341,15 @@
339341
CLANG_WARN_BOOL_CONVERSION = YES;
340342
CLANG_WARN_COMMA = YES;
341343
CLANG_WARN_CONSTANT_CONVERSION = YES;
344+
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
342345
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
343346
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
344347
CLANG_WARN_EMPTY_BODY = YES;
345348
CLANG_WARN_ENUM_CONVERSION = YES;
346349
CLANG_WARN_INFINITE_RECURSION = YES;
347350
CLANG_WARN_INT_CONVERSION = YES;
348351
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
352+
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
349353
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
350354
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
351355
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

ChatExample/ChatExample/Base.lproj/Main.storyboard

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13771" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="taU-GF-uub">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="taU-GF-uub">
33
<device id="retina4_7" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
77
<deployment identifier="iOS"/>
8-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13772"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
99
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
1010
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1111
</dependencies>
@@ -41,6 +41,46 @@
4141
<segue destination="Sj9-Ac-pHW" kind="show" id="wfj-uG-yjb"/>
4242
</connections>
4343
</tableViewCell>
44+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="IQw-p5-wX5" style="IBUITableViewCellStyleDefault" id="JSa-yG-Fek">
45+
<rect key="frame" x="0.0" y="79" width="375" height="44"/>
46+
<autoresizingMask key="autoresizingMask"/>
47+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="JSa-yG-Fek" id="tNb-sa-BSY">
48+
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
49+
<autoresizingMask key="autoresizingMask"/>
50+
<subviews>
51+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Tabbar" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="IQw-p5-wX5">
52+
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
53+
<autoresizingMask key="autoresizingMask"/>
54+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
55+
<nil key="textColor"/>
56+
<nil key="highlightedColor"/>
57+
</label>
58+
</subviews>
59+
</tableViewCellContentView>
60+
<connections>
61+
<segue destination="LGg-GY-vP7" kind="show" id="HsO-Nd-FiP"/>
62+
</connections>
63+
</tableViewCell>
64+
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" textLabel="bWj-P4-OW7" style="IBUITableViewCellStyleDefault" id="P7G-27-qdQ">
65+
<rect key="frame" x="0.0" y="123" width="375" height="44"/>
66+
<autoresizingMask key="autoresizingMask"/>
67+
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="P7G-27-qdQ" id="J6o-I9-PWF">
68+
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
69+
<autoresizingMask key="autoresizingMask"/>
70+
<subviews>
71+
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Embed" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="bWj-P4-OW7">
72+
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
73+
<autoresizingMask key="autoresizingMask"/>
74+
<fontDescription key="fontDescription" type="system" pointSize="17"/>
75+
<nil key="textColor"/>
76+
<nil key="highlightedColor"/>
77+
</label>
78+
</subviews>
79+
</tableViewCellContentView>
80+
<connections>
81+
<segue destination="sTD-cH-6YX" kind="show" id="gzl-NH-7x6"/>
82+
</connections>
83+
</tableViewCell>
4484
</cells>
4585
</tableViewSection>
4686
</sections>
@@ -55,20 +95,67 @@
5595
</objects>
5696
<point key="canvasLocation" x="743" y="184"/>
5797
</scene>
58-
<!--Chat View Controller-->
98+
<!--Tab Bar Controller-->
99+
<scene sceneID="gnC-bF-xG3">
100+
<objects>
101+
<tabBarController id="LGg-GY-vP7" sceneMemberID="viewController">
102+
<tabBar key="tabBar" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="V6o-na-pO8">
103+
<rect key="frame" x="0.0" y="0.0" width="375" height="49"/>
104+
<autoresizingMask key="autoresizingMask"/>
105+
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
106+
</tabBar>
107+
<connections>
108+
<segue destination="Sj9-Ac-pHW" kind="relationship" relationship="viewControllers" id="aEJ-hB-6tA"/>
109+
</connections>
110+
</tabBarController>
111+
<placeholder placeholderIdentifier="IBFirstResponder" id="jpQ-gy-C7Q" userLabel="First Responder" sceneMemberID="firstResponder"/>
112+
</objects>
113+
<point key="canvasLocation" x="742" y="1008"/>
114+
</scene>
115+
<!--View Controller-->
116+
<scene sceneID="t4J-uw-Z1U">
117+
<objects>
118+
<viewController id="sTD-cH-6YX" sceneMemberID="viewController">
119+
<view key="view" contentMode="scaleToFill" id="oEa-8W-VCm">
120+
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
121+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
122+
<subviews>
123+
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="EMN-nq-vm2">
124+
<rect key="frame" x="0.0" y="0.0" width="375" height="527"/>
125+
<connections>
126+
<segue destination="Sj9-Ac-pHW" kind="embed" id="nGO-qT-EUX"/>
127+
</connections>
128+
</containerView>
129+
</subviews>
130+
<color key="backgroundColor" red="1" green="0.0" blue="0.50196081400000003" alpha="1" colorSpace="calibratedRGB"/>
131+
<constraints>
132+
<constraint firstItem="EMN-nq-vm2" firstAttribute="trailing" secondItem="H4m-4h-YG0" secondAttribute="trailing" id="Brr-4K-1ja"/>
133+
<constraint firstItem="H4m-4h-YG0" firstAttribute="bottom" secondItem="EMN-nq-vm2" secondAttribute="bottom" constant="140" id="H9I-yA-KUQ"/>
134+
<constraint firstItem="EMN-nq-vm2" firstAttribute="top" secondItem="oEa-8W-VCm" secondAttribute="top" id="Sej-xe-F2R"/>
135+
<constraint firstItem="EMN-nq-vm2" firstAttribute="leading" secondItem="H4m-4h-YG0" secondAttribute="leading" id="pMD-x2-auT"/>
136+
</constraints>
137+
<viewLayoutGuide key="safeArea" id="H4m-4h-YG0"/>
138+
</view>
139+
</viewController>
140+
<placeholder placeholderIdentifier="IBFirstResponder" id="HKk-sI-3kB" userLabel="First Responder" sceneMemberID="firstResponder"/>
141+
</objects>
142+
<point key="canvasLocation" x="1809" y="-355"/>
143+
</scene>
144+
<!--Item-->
59145
<scene sceneID="gjs-cb-kls">
60146
<objects>
61147
<viewController id="Sj9-Ac-pHW" customClass="ChatViewController" customModule="ChatExample" customModuleProvider="target" sceneMemberID="viewController">
62148
<view key="view" contentMode="scaleToFill" id="phq-JM-P46">
63-
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
149+
<rect key="frame" x="0.0" y="0.0" width="375" height="527"/>
64150
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
65151
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
66152
<viewLayoutGuide key="safeArea" id="HM3-CI-svk"/>
67153
</view>
154+
<tabBarItem key="tabBarItem" title="Item" id="h30-k5-goz"/>
68155
</viewController>
69156
<placeholder placeholderIdentifier="IBFirstResponder" id="hBk-YS-k5X" userLabel="First Responder" sceneMemberID="firstResponder"/>
70157
</objects>
71-
<point key="canvasLocation" x="1466" y="172"/>
158+
<point key="canvasLocation" x="1729" y="432"/>
72159
</scene>
73160
<!--Navigation Controller-->
74161
<scene sceneID="loI-pp-4ro">
@@ -87,4 +174,7 @@
87174
<point key="canvasLocation" x="-209" y="184"/>
88175
</scene>
89176
</scenes>
177+
<inferredMetricsTieBreakers>
178+
<segue reference="nGO-qT-EUX"/>
179+
</inferredMetricsTieBreakers>
90180
</document>

ChatExample/ChatExample/ChatViewController.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ class ChatViewController: QMChatViewController {
5858
}
5959
}
6060

61-
override func collectionView(_ collectionView: QMChatCollectionView!, dynamicSizeAt indexPath: IndexPath!, maxWidth: CGFloat) -> CGSize {
61+
override func collectionView(_ collectionView: QMChatCollectionView!,
62+
dynamicSizeAt indexPath: IndexPath!,
63+
maxWidth: CGFloat) -> CGSize {
6264

6365
let size = TTTAttributedLabel.sizeThatFitsAttributedString(self.attributedString(forItem: self.chatDataSource.message(for: indexPath)),
6466
withConstraints: CGSize(width:maxWidth, height:1000),
6567
limitedToNumberOfLines: 0)
6668
return size
6769
}
6870

69-
override func collectionView(_ collectionView: QMChatCollectionView!, minWidthAt indexPath: IndexPath!) -> CGFloat {
71+
override func collectionView(_ collectionView: QMChatCollectionView!,
72+
minWidthAt indexPath: IndexPath!) -> CGFloat {
7073

7174
let msg = self.chatDataSource.message(for: indexPath)
7275
let viewClass: AnyClass = self.viewClass(forItem: msg!)

PublicCocoaPods/QMChatViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Pod::Spec.new do |s|
1212

1313
s.name = "QMChatViewController"
14-
s.version = "0.6.3"
14+
s.version = "0.6.4"
1515
s.summary = "An elegant ready-to-go chat view controller for iOS chat applications that use Quickblox communication backend."
1616

1717
s.description = <<-DESC

QMChatViewController.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Pod::Spec.new do |s|
1010

1111
s.name = "QMChatViewController"
12-
s.version = "0.6.3"
12+
s.version = "0.6.4"
1313
s.summary = "An elegant ready-to-go chat view controller for iOS chat applications that use Quickblox communication backend."
1414

1515
s.description = <<-DESC

QMChatViewController/QMChatViewController.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@
3838
#import "QMChatIncomingLinkPreviewCell.h"
3939
#import "QMChatOutgoingLinkPreviewCell.h"
4040

41-
@interface QMChatViewController : UIViewController <QMChatCollectionViewDataSource, QMChatCollectionViewDelegateFlowLayout, UITextViewDelegate>
41+
NS_ASSUME_NONNULL_BEGIN
4242

43+
@interface QMChatViewController : UIViewController <QMChatCollectionViewDataSource, QMChatCollectionViewDelegateFlowLayout, UITextViewDelegate>
4344

4445
@property (strong, nonatomic) QMChatDataSource *chatDataSource;
4546
/**
@@ -108,7 +109,7 @@
108109
*
109110
* @return Configured attributed string.
110111
*/
111-
- (NSAttributedString *)attributedStringForItem:(QBChatMessage *)messageItem;
112+
- (nullable NSAttributedString *)attributedStringForItem:(QBChatMessage *)messageItem;
112113

113114
/**
114115
* Method to create chat message top label attributed string (Usually - chat message owner name). Have to be overriden in subclasses.
@@ -117,7 +118,7 @@
117118
*
118119
* @return Configured attributed string.
119120
*/
120-
- (NSAttributedString *)topLabelAttributedStringForItem:(QBChatMessage *)messageItem;
121+
- (nullable NSAttributedString *)topLabelAttributedStringForItem:(QBChatMessage *)messageItem;
121122

122123
/**
123124
* Method to create chat message bottom label attributed string (Usually - chat message date sent). Have to be overriden in subclasses.
@@ -126,7 +127,7 @@
126127
*
127128
* @return Configured attributed string.
128129
*/
129-
- (NSAttributedString *)bottomLabelAttributedStringForItem:(QBChatMessage *)messageItem;
130+
- (nullable NSAttributedString *)bottomLabelAttributedStringForItem:(QBChatMessage *)messageItem;
130131

131132
/**
132133
* Collection Cell View class for specific message. Have to be overriden in subclasses. Defaults cells are supplied with QMChatViewController.
@@ -250,6 +251,11 @@
250251
*/
251252
- (void)finishReceivingMessageAnimated:(BOOL)animated;
252253

254+
/**
255+
Input bar start pos
256+
*/
257+
- (NSUInteger)inputToolBarStartPos;
258+
253259
/**
254260
* Scrolls the collection view such that the bottom most cell is completely visible, above the `inputToolbar`.
255261
*
@@ -280,3 +286,5 @@
280286
- (void)viewWillAppear:(BOOL)animated NS_REQUIRES_SUPER;
281287

282288
@end
289+
290+
NS_ASSUME_NONNULL_END

QMChatViewController/QMChatViewController.m

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ - (void)viewDidLoad {
9393
self.systemInputToolbar.frame = CGRectMake(0, 0, 0, kQMSystemInputToolbarDebugHeight);
9494
self.systemInputToolbar.hostViewFrameChangeBlock = ^(UIView *view, BOOL animated) {
9595

96-
CGFloat pos = view.superview.frame.size.height - view.frame.origin.y ;
97-
96+
CGFloat pos = weakSelf.view.frame.size.height - [view.superview convertPoint:view.frame.origin toView:weakSelf.view].y;
97+
9898
if (weakSelf.inputToolbar.contentView.textView.isFirstResponder) {
9999

100100
if (view.superview.frame.origin.y > 0 && pos == 0) {
@@ -103,11 +103,11 @@ - (void)viewDidLoad {
103103
}
104104

105105
const CGFloat v = [weakSelf inputToolBarStartPos];
106-
107-
if (pos < v ) {
106+
107+
if (pos < v || !view) {
108108
pos = v;
109109
}
110-
110+
111111
[weakSelf setToolbarBottomConstraintValue:pos animated:animated];
112112
};
113113

@@ -282,11 +282,7 @@ - (void)chatDataSource:(QMChatDataSource *)chatDataSource willBeChangedWithMessa
282282
#pragma mark - View lifecycle
283283

284284
- (NSUInteger)inputToolBarStartPos {
285-
286-
if (self.tabBarItem) {
287-
return self.tabBarController.tabBar.frame.size.height;
288-
}
289-
285+
290286
return 0;
291287
}
292288

@@ -798,7 +794,6 @@ - (void)setToolbarBottomConstraintValue:(CGFloat)constraintValue animated:(BOOL)
798794
self.toolbarBottomLayoutGuide.constant = constraintValue;
799795

800796
if (animated) {
801-
802797
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
803798
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
804799

0 commit comments

Comments
 (0)