summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2019-10-03 15:16:18 +0300
committerGravatar Vitaly Takmazov2019-10-03 15:16:18 +0300
commita5c35479e144eef8bea9f80a10dfeb7a860763f1 (patch)
tree1fa25fd810b07cd72ffd93880206fb08c78da96d
parent19675633bce3dc7f7e4ff9712eff3938065e868c (diff)
Drop PHFComposeBarView
-rw-r--r--Juick/Supporting Files/Juick-Prefix.pch1
-rw-r--r--Juick/ViewControllers/ChatViewController.h3
-rw-r--r--Juick/ViewControllers/ChatViewController.m27
-rw-r--r--Juick/Views/MessageInputView.h9
-rw-r--r--Juick/Views/MessageInputView.m4
-rw-r--r--Juick/Views/MessageInputView.xib24
-rw-r--r--Podfile1
-rw-r--r--Podfile.lock10
8 files changed, 43 insertions, 36 deletions
diff --git a/Juick/Supporting Files/Juick-Prefix.pch b/Juick/Supporting Files/Juick-Prefix.pch
index 3a66330..2e32df2 100644
--- a/Juick/Supporting Files/Juick-Prefix.pch
+++ b/Juick/Supporting Files/Juick-Prefix.pch
@@ -19,6 +19,5 @@
#import "UIImage+Utils.h"
#import <DateTools/DateTools.h>
- #import <PHFComposeBarView/PHFComposeBarView.h>
#import <UIView+Shimmer.h>
#endif
diff --git a/Juick/ViewControllers/ChatViewController.h b/Juick/ViewControllers/ChatViewController.h
index 4a5133a..bfd63e7 100644
--- a/Juick/ViewControllers/ChatViewController.h
+++ b/Juick/ViewControllers/ChatViewController.h
@@ -8,8 +8,9 @@
#import <UIKit/UIKit.h>
#import "User.h"
+#import "MessageInputView.h"
-@interface ChatViewController : UITableViewController<PHFComposeBarViewDelegate>
+@interface ChatViewController : UITableViewController<MessageInputDelegate>
@property(nonatomic, strong) NSMutableArray *messages;
@property(nonatomic, strong) NSString *uname;
diff --git a/Juick/ViewControllers/ChatViewController.m b/Juick/ViewControllers/ChatViewController.m
index 989b531..2612719 100644
--- a/Juick/ViewControllers/ChatViewController.m
+++ b/Juick/ViewControllers/ChatViewController.m
@@ -10,9 +10,11 @@
#import "BubbleMessageCell.h"
#import "APIClient.h"
+#import "MessageInputView.h"
+
@interface ChatViewController ()
-@property (nonatomic, readwrite, retain) UIView *inputAccessoryView;
+@property (nonatomic, readwrite, retain) MessageInputView *accessoryView;
@property (nonatomic, strong) NSString *me;
@end
@@ -26,6 +28,7 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.keyboardDismissMode = UIScrollViewKeyboardDismissModeInteractive;
self.tableView.allowsSelection = NO;
+ self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentAutomatic;
self.me = [APIClient sharedClient].credential.user;
[self reloadChat];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
@@ -77,15 +80,16 @@
return YES;
}
+- (BOOL)canResignFirstResponder {
+ return YES;
+}
+
- (UIView *) inputAccessoryView {
- if (!_inputAccessoryView) {
- PHFComposeBarView *composeView = [[PHFComposeBarView alloc] initWithFrame:CGRectMake(0, self.view.bounds.size.height - PHFComposeBarViewInitialHeight, self.view.bounds.size.width, PHFComposeBarViewInitialHeight)];
- composeView.delegate = self;
- [composeView.bottomAnchor constraintEqualToSystemSpacingBelowAnchor:self.view.safeAreaLayoutGuide.bottomAnchor multiplier:1.0f];
- composeView.maxLinesCount = 4;
- _inputAccessoryView = composeView;
+ if (!_accessoryView) {
+ _accessoryView = [[[NSBundle mainBundle] loadNibNamed:@"MessageInputView" owner:self options:nil] firstObject];
+ _accessoryView.delegate = self;
}
- return _inputAccessoryView;
+ return _accessoryView;
}
-(void) keyboardWillChangeFrame:(NSNotification *)notification {
@@ -102,12 +106,11 @@
}
}
--(void) composeBarViewDidPressButton:(PHFComposeBarView *)composeBarView {
- [[APIClient sharedClient] postPMToUser:self.uname text:composeBarView.text result:^(NSError *err) {
+-(void) textSent:(NSString *)text {
+ [[APIClient sharedClient] postPMToUser:self.uname text:text result:^(NSError *err) {
if (!err) {
NSLog(@"Success!");
- [composeBarView becomeFirstResponder];
- [composeBarView setText:nil animated:NO];
+ [self.accessoryView becomeFirstResponder];
[self reloadChat];
}
}];
diff --git a/Juick/Views/MessageInputView.h b/Juick/Views/MessageInputView.h
index 38ce721..c78f498 100644
--- a/Juick/Views/MessageInputView.h
+++ b/Juick/Views/MessageInputView.h
@@ -8,8 +8,17 @@
#import <UIKit/UIKit.h>
+@protocol MessageInputDelegate <NSObject>
+
+-(void) textSent:(NSString *)text;
+
+@end
+
@interface MessageInputView : UIVisualEffectView
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *bottomConstraint;
@property (strong, nonatomic) IBOutlet UITextField *textView;
+- (IBAction)sendPressed:(id)sender;
+
+@property (nonatomic, weak) id<MessageInputDelegate> delegate;
@end
diff --git a/Juick/Views/MessageInputView.m b/Juick/Views/MessageInputView.m
index ab6b3e5..c4d96de 100644
--- a/Juick/Views/MessageInputView.m
+++ b/Juick/Views/MessageInputView.m
@@ -15,4 +15,8 @@
[self setTintColor:[UIColor colorNamed:@"Title"]];
}
+- (IBAction)sendPressed:(id)sender {
+ [self.delegate textSent:self.textView.text];
+ self.textView.text = nil;
+}
@end
diff --git a/Juick/Views/MessageInputView.xib b/Juick/Views/MessageInputView.xib
index 240391c..9cb8bd4 100644
--- a/Juick/Views/MessageInputView.xib
+++ b/Juick/Views/MessageInputView.xib
@@ -1,41 +1,41 @@
<?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" useSafeAreas="YES" colorMatched="YES">
- <device id="retina4_7" orientation="portrait">
- <adaptation id="fullscreen"/>
- </device>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14868" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="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="14824"/>
<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"/>
<visualEffectView opaque="NO" contentMode="scaleToFill" id="2Ze-bx-tgN" customClass="MessageInputView">
- <rect key="frame" x="0.0" y="0.0" width="320" height="74"/>
+ <rect key="frame" x="0.0" y="0.0" width="320" height="58"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="Jo1-Go-4dO">
- <rect key="frame" x="0.0" y="0.0" width="320" height="74"/>
+ <rect key="frame" x="0.0" y="0.0" width="320" height="58"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" spacing="6" translatesAutoresizingMaskIntoConstraints="NO" id="OCM-7q-caQ">
- <rect key="frame" x="4" y="4" width="300" height="54"/>
+ <rect key="frame" x="4" y="4" width="300" height="38"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="112-Yb-83a">
- <rect key="frame" x="0.0" y="0.0" width="30" height="54"/>
+ <rect key="frame" x="0.0" y="0.0" width="30" height="38"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<state key="normal" title="@"/>
</button>
<textField opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="249" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" adjustsFontForContentSizeCategory="YES" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="Dkb-8O-5u6">
- <rect key="frame" x="36" y="0.0" width="218" height="54"/>
- <nil key="textColor"/>
+ <rect key="frame" x="36" y="0.0" width="218" height="38"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<textInputTraits key="textInputTraits"/>
</textField>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iUb-5g-Btb">
- <rect key="frame" x="260" y="0.0" width="40" height="54"/>
+ <rect key="frame" x="260" y="0.0" width="40" height="38"/>
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
<state key="normal" title="Send"/>
+ <connections>
+ <action selector="sendPressed:" destination="2Ze-bx-tgN" eventType="touchUpInside" id="8Nq-cB-tho"/>
+ </connections>
</button>
</subviews>
</stackView>
diff --git a/Podfile b/Podfile
index db6b6b7..f0bfede 100644
--- a/Podfile
+++ b/Podfile
@@ -3,7 +3,6 @@ platform :ios, "11.1"
target "Juick" do
pod 'DateTools'
- pod 'PHFComposeBarView'
pod 'UIView+Shimmer'
end
diff --git a/Podfile.lock b/Podfile.lock
index 08a1a2b..f5af3b9 100644
--- a/Podfile.lock
+++ b/Podfile.lock
@@ -1,28 +1,20 @@
PODS:
- DateTools (2.0.0)
- - PHFComposeBarView (2.1.0):
- - PHFDelegateChain (~> 1.0)
- - PHFDelegateChain (1.0.1)
- "UIView+Shimmer (1.0.0)"
DEPENDENCIES:
- DateTools
- - PHFComposeBarView
- "UIView+Shimmer"
SPEC REPOS:
https://cdn.jsdelivr.net/cocoa/:
- DateTools
- - PHFComposeBarView
- - PHFDelegateChain
- "UIView+Shimmer"
SPEC CHECKSUMS:
DateTools: 933ac9c490f21f92127cf690ccd8c397e0126caf
- PHFComposeBarView: 6382ab846e2f4d8634273c4a78d074bc5deed07f
- PHFDelegateChain: 491f9cd8a3fb8761f390ff05f74a0e168d48d285
"UIView+Shimmer": ed634f95e8f4bda666b28b47bd85a4336a4117d8
-PODFILE CHECKSUM: 07617045e3d7a5f7cdf98542a754f10d85b5ff19
+PODFILE CHECKSUM: ab7a63ae420164b48a6b9ac72ddcae4c21b07330
COCOAPODS: 1.7.1