Skip to content

Commit 807b5fe

Browse files
committed
clean up / modernize
1 parent 4c52e50 commit 807b5fe

38 files changed

+36
-306
lines changed

JSQMessages.xcodeproj/xcshareddata/xcschemes/JSQMessages.xcscheme

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0710"
3+
LastUpgradeVersion = "0720"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

JSQMessagesDemo/Images.xcassets/AppIcon.appiconset/Contents.json

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
"idiom" : "ipad",
7272
"filename" : "[email protected]",
7373
"scale" : "2x"
74+
},
75+
{
76+
"size" : "83.5x83.5",
77+
"idiom" : "ipad",
78+
"filename" : "icon167.png",
79+
"scale" : "2x"
7480
}
7581
],
7682
"info" : {
Loading

JSQMessagesTests/ModelTests/JSQMessageMediaTests.m

-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ - (void)testMediaMessageInit
8282

8383
- (void)testMediaMessageInvalidInit
8484
{
85-
XCTAssertThrows([[JSQMessage alloc] init], @"Invalid init should throw");
8685
XCTAssertThrows([[JSQMessage alloc] initWithSenderId:nil senderDisplayName:nil date:nil media:nil], @"Invalid init should throw");
8786
}
8887

JSQMessagesTests/ModelTests/JSQMessageTextTests.m

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ - (void)testTextMessageInit
6060

6161
- (void)testTextMessageInvalidInit
6262
{
63-
XCTAssertThrows([[JSQMessage alloc] init], @"Invalid init should throw");
6463
XCTAssertThrows([[JSQMessage alloc] initWithSenderId:nil senderDisplayName:nil date:nil text:nil], @"Invalid init should throw");
6564
}
6665

JSQMessagesTests/ModelTests/JSQMessagesAvatarImageTests.m

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ - (void)tearDown
3232

3333
- (void)testInitInvalid
3434
{
35-
XCTAssertThrows([[JSQMessagesAvatarImage alloc] init], @"Invalid init should throw");
3635
XCTAssertThrows([JSQMessagesAvatarImage avatarImageWithPlaceholder:nil], @"Invalid init should throw");
3736
XCTAssertThrows([[JSQMessagesAvatarImage alloc] initWithAvatarImage:nil highlightedImage:nil placeholderImage:nil], @"Invalid init should throw");
3837
}

JSQMessagesTests/ModelTests/JSQMessagesBubbleImageTests.m

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ - (void)tearDown
3434

3535
- (void)testInitInvalid
3636
{
37-
XCTAssertThrows([[JSQMessagesBubbleImage alloc] init], @"Invalid init should throw");
3837
XCTAssertThrows([[JSQMessagesBubbleImage alloc] initWithMessageBubbleImage:nil highlightedImage:nil], @"Invalid init should throw");
3938
}
4039

JSQMessagesViewController/Controllers/JSQMessagesKeyboardController.m

-20
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,6 @@ @interface JSQMessagesKeyboardController () <UIGestureRecognizerDelegate>
4141

4242
@property (weak, nonatomic) UIView *keyboardView;
4343

44-
- (void)jsq_registerForNotifications;
45-
- (void)jsq_unregisterForNotifications;
46-
47-
- (void)jsq_didReceiveKeyboardDidShowNotification:(NSNotification *)notification;
48-
- (void)jsq_didReceiveKeyboardWillChangeFrameNotification:(NSNotification *)notification;
49-
- (void)jsq_didReceiveKeyboardDidChangeFrameNotification:(NSNotification *)notification;
50-
- (void)jsq_didReceiveKeyboardDidHideNotification:(NSNotification *)notification;
51-
- (void)jsq_handleKeyboardNotification:(NSNotification *)notification completion:(JSQAnimationCompletionBlock)completion;
52-
53-
- (void)jsq_setKeyboardViewHidden:(BOOL)hidden;
54-
- (void)jsq_notifyKeyboardFrameNotificationForFrame:(CGRect)frame;
55-
- (void)jsq_resetKeyboardAndTextView;
56-
57-
- (void)jsq_removeKeyboardFrameObserver;
58-
59-
- (void)jsq_handlePanGestureRecognizer:(UIPanGestureRecognizer *)pan;
60-
6144
@end
6245

6346

@@ -91,11 +74,8 @@ - (void)dealloc
9174
{
9275
[self jsq_removeKeyboardFrameObserver];
9376
[self jsq_unregisterForNotifications];
94-
_textView = nil;
95-
_contextView = nil;
9677
_panGestureRecognizer = nil;
9778
_delegate = nil;
98-
_keyboardView = nil;
9979
}
10080

10181
#pragma mark - Setters

JSQMessagesViewController/Controllers/JSQMessagesViewController.m

-40
Original file line numberDiff line numberDiff line change
@@ -65,36 +65,6 @@ @interface JSQMessagesViewController () <JSQMessagesInputToolbarDelegate,
6565

6666
@property (assign, nonatomic) BOOL textViewWasFirstResponderDuringInteractivePop;
6767

68-
- (void)jsq_configureMessagesViewController;
69-
70-
- (NSString *)jsq_currentlyComposedMessageText;
71-
72-
- (void)jsq_handleDidChangeStatusBarFrameNotification:(NSNotification *)notification;
73-
- (void)jsq_didReceiveMenuWillShowNotification:(NSNotification *)notification;
74-
- (void)jsq_didReceiveMenuWillHideNotification:(NSNotification *)notification;
75-
76-
- (void)jsq_updateKeyboardTriggerPoint;
77-
- (void)jsq_setToolbarBottomLayoutGuideConstant:(CGFloat)constant;
78-
79-
- (void)jsq_handleInteractivePopGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
80-
81-
- (BOOL)jsq_inputToolbarHasReachedMaximumHeight;
82-
- (void)jsq_adjustInputToolbarForComposerTextViewContentSizeChange:(CGFloat)dy;
83-
- (void)jsq_adjustInputToolbarHeightConstraintByDelta:(CGFloat)dy;
84-
- (void)jsq_scrollComposerTextViewToBottomAnimated:(BOOL)animated;
85-
86-
- (void)jsq_updateCollectionViewInsets;
87-
- (void)jsq_setCollectionViewInsetsTopValue:(CGFloat)top bottomValue:(CGFloat)bottom;
88-
89-
- (BOOL)jsq_isMenuVisible;
90-
91-
- (void)jsq_addObservers;
92-
- (void)jsq_removeObservers;
93-
94-
- (void)jsq_registerForNotifications:(BOOL)registerForNotifications;
95-
96-
- (void)jsq_addActionToInteractivePopGestureRecognizer:(BOOL)addAction;
97-
9868
@end
9969

10070

@@ -167,19 +137,9 @@ - (void)dealloc
167137

168138
_collectionView.dataSource = nil;
169139
_collectionView.delegate = nil;
170-
_collectionView = nil;
171140

172141
_inputToolbar.contentView.textView.delegate = nil;
173142
_inputToolbar.delegate = nil;
174-
_inputToolbar = nil;
175-
176-
_toolbarHeightConstraint = nil;
177-
_toolbarBottomLayoutGuide = nil;
178-
179-
_senderId = nil;
180-
_senderDisplayName = nil;
181-
_outgoingCellIdentifier = nil;
182-
_incomingCellIdentifier = nil;
183143

184144
[_keyboardController endListeningForKeyboard];
185145
_keyboardController = nil;

JSQMessagesViewController/Controllers/JSQMessagesViewController.xib

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
66
</dependencies>
77
<objects>
88
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="JSQMessagesViewController">
@@ -21,21 +21,18 @@
2121
<subviews>
2222
<collectionView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" minimumZoomScale="0.0" maximumZoomScale="0.0" dataMode="prototypes" translatesAutoresizingMaskIntoConstraints="NO" id="l9u-2b-4LK" customClass="JSQMessagesCollectionView">
2323
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
24-
<animations/>
2524
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
2625
<collectionViewLayout key="collectionViewLayout" id="dZl-7C-LHR" customClass="JSQMessagesCollectionViewFlowLayout"/>
2726
<cells/>
2827
</collectionView>
2928
<toolbar opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BoD-Az-3DM" customClass="JSQMessagesInputToolbar">
3029
<rect key="frame" x="0.0" y="524" width="320" height="44"/>
31-
<animations/>
3230
<constraints>
3331
<constraint firstAttribute="height" constant="44" id="HIk-02-qcW"/>
3432
</constraints>
3533
<items/>
3634
</toolbar>
3735
</subviews>
38-
<animations/>
3936
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
4037
<constraints>
4138
<constraint firstAttribute="trailing" secondItem="BoD-Az-3DM" secondAttribute="trailing" id="7xc-Ha-asg"/>

JSQMessagesViewController/Factories/JSQMessagesAvatarImageFactory.m

-16
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,6 @@
2121
#import "UIColor+JSQMessages.h"
2222

2323

24-
@interface JSQMessagesAvatarImageFactory ()
25-
26-
+ (UIImage *)jsq_circularImage:(UIImage *)image
27-
withDiameter:(NSUInteger)diameter
28-
highlightedColor:(UIColor *)highlightedColor;
29-
30-
+ (UIImage *)jsq_imageWitInitials:(NSString *)initials
31-
backgroundColor:(UIColor *)backgroundColor
32-
textColor:(UIColor *)textColor
33-
font:(UIFont *)font
34-
diameter:(NSUInteger)diameter;
35-
36-
@end
37-
38-
39-
4024
@implementation JSQMessagesAvatarImageFactory
4125

4226
#pragma mark - Public

JSQMessagesViewController/Factories/JSQMessagesBubbleImageFactory.m

-13
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ @interface JSQMessagesBubbleImageFactory ()
2727
@property (strong, nonatomic, readonly) UIImage *bubbleImage;
2828
@property (assign, nonatomic, readonly) UIEdgeInsets capInsets;
2929

30-
- (UIEdgeInsets)jsq_centerPointEdgeInsetsForImageSize:(CGSize)bubbleImageSize;
31-
32-
- (JSQMessagesBubbleImage *)jsq_messagesBubbleImageWithColor:(UIColor *)color flippedForIncoming:(BOOL)flippedForIncoming;
33-
34-
- (UIImage *)jsq_horizontallyFlippedImageFromImage:(UIImage *)image;
35-
36-
- (UIImage *)jsq_stretchableImageFromImage:(UIImage *)image withCapInsets:(UIEdgeInsets)capInsets;
37-
3830
@end
3931

4032

@@ -66,11 +58,6 @@ - (instancetype)init
6658
return [self initWithBubbleImage:[UIImage jsq_bubbleCompactImage] capInsets:UIEdgeInsetsZero];
6759
}
6860

69-
- (void)dealloc
70-
{
71-
_bubbleImage = nil;
72-
}
73-
7461
#pragma mark - Public
7562

7663
- (JSQMessagesBubbleImage *)outgoingMessagesBubbleImageWithColor:(UIColor *)color

JSQMessagesViewController/Factories/JSQMessagesMediaViewBubbleImageMasker.m

-7
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
#import "JSQMessagesBubbleImageFactory.h"
2222

2323

24-
@interface JSQMessagesMediaViewBubbleImageMasker ()
25-
26-
- (void)jsq_maskView:(UIView *)view withImage:(UIImage *)image;
27-
28-
@end
29-
30-
3124
@implementation JSQMessagesMediaViewBubbleImageMasker
3225

3326
#pragma mark - Initialization

JSQMessagesViewController/Factories/JSQMessagesTimestampFormatter.m

-7
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ - (instancetype)init
6666
return self;
6767
}
6868

69-
- (void)dealloc
70-
{
71-
_dateFormatter = nil;
72-
_dateTextAttributes = nil;
73-
_timeTextAttributes = nil;
74-
}
75-
7669
#pragma mark - Formatter
7770

7871
- (NSString *)timestampForDate:(NSDate *)date

JSQMessagesViewController/Layout/JSQMessagesCollectionViewFlowLayout.m

-24
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ @interface JSQMessagesCollectionViewFlowLayout ()
4646

4747
@property (assign, nonatomic) CGFloat latestDelta;
4848

49-
- (void)jsq_configureFlowLayout;
50-
51-
- (void)jsq_didReceiveApplicationMemoryWarningNotification:(NSNotification *)notification;
52-
- (void)jsq_didReceiveDeviceOrientationDidChangeNotification:(NSNotification *)notification;
53-
54-
- (void)jsq_resetLayout;
55-
- (void)jsq_resetDynamicAnimator;
56-
57-
- (void)jsq_configureMessageCellLayoutAttributes:(JSQMessagesCollectionViewLayoutAttributes *)layoutAttributes;
58-
59-
- (UIAttachmentBehavior *)jsq_springBehaviorWithLayoutAttributesItem:(UICollectionViewLayoutAttributes *)item;
60-
- (void)jsq_addNewlyVisibleBehaviorsFromVisibleItems:(NSArray *)visibleItems;
61-
- (void)jsq_removeNoLongerVisibleBehaviorsFromVisibleItemsIndexPaths:(NSSet *)visibleItemsIndexPaths;
62-
- (void)jsq_adjustSpringBehavior:(UIAttachmentBehavior *)springBehavior forTouchLocation:(CGPoint)touchLocation;
63-
6449
@end
6550

6651

@@ -137,15 +122,6 @@ + (Class)invalidationContextClass
137122
- (void)dealloc
138123
{
139124
[[NSNotificationCenter defaultCenter] removeObserver:self];
140-
141-
_messageBubbleFont = nil;
142-
_bubbleSizeCalculator = nil;
143-
144-
[_dynamicAnimator removeAllBehaviors];
145-
_dynamicAnimator = nil;
146-
147-
[_visibleIndexPaths removeAllObjects];
148-
_visibleIndexPaths = nil;
149125
}
150126

151127
#pragma mark - Setters

JSQMessagesViewController/Layout/JSQMessagesCollectionViewLayoutAttributes.m

-17
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,8 @@
1818

1919
#import "JSQMessagesCollectionViewLayoutAttributes.h"
2020

21-
22-
@interface JSQMessagesCollectionViewLayoutAttributes ()
23-
24-
- (CGSize)jsq_correctedAvatarSizeFromSize:(CGSize)size;
25-
26-
- (CGFloat)jsq_correctedLabelHeightForHeight:(CGFloat)height;
27-
28-
@end
29-
30-
3121
@implementation JSQMessagesCollectionViewLayoutAttributes
3222

33-
#pragma mark - Lifecycle
34-
35-
- (void)dealloc
36-
{
37-
_messageBubbleFont = nil;
38-
}
39-
4023
#pragma mark - Setters
4124

4225
- (void)setMessageBubbleFont:(UIFont *)messageBubbleFont

JSQMessagesViewController/Model/JSQLocationMediaItem.m

-11
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ @interface JSQLocationMediaItem ()
2828

2929
@property (strong, nonatomic) UIImageView *cachedMapImageView;
3030

31-
- (void)createMapViewSnapshotForLocation:(CLLocation *)location
32-
coordinateRegion:(MKCoordinateRegion)region
33-
withCompletionHandler:(JSQLocationMediaItemCompletionBlock)completion;
34-
3531
@end
3632

3733

@@ -48,13 +44,6 @@ - (instancetype)initWithLocation:(CLLocation *)location
4844
return self;
4945
}
5046

51-
- (void)dealloc
52-
{
53-
_location = nil;
54-
_cachedMapSnapshotImage = nil;
55-
_cachedMapImageView = nil;
56-
}
57-
5847
- (void)clearCachedMediaViews
5948
{
6049
[super clearCachedMediaViews];

JSQMessagesViewController/Model/JSQMediaItem.m

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ - (instancetype)initWithMaskAsOutgoing:(BOOL)maskAsOutgoing
5555
- (void)dealloc
5656
{
5757
[[NSNotificationCenter defaultCenter] removeObserver:self];
58-
_cachedPlaceholderView = nil;
5958
}
6059

6160
- (void)setAppliesMediaViewMaskAsOutgoing:(BOOL)appliesMediaViewMaskAsOutgoing

JSQMessagesViewController/Model/JSQMessage.h

+5
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,9 @@
131131
date:(NSDate *)date
132132
media:(id<JSQMessageMediaData>)media;
133133

134+
/**
135+
Not a valid initializer.
136+
*/
137+
- (id)init NS_UNAVAILABLE;
138+
134139
@end

0 commit comments

Comments
 (0)