Skip to content

Commit 9a95152

Browse files
committed
fixed warnings
1 parent f3fab1d commit 9a95152

File tree

8 files changed

+56
-144
lines changed

8 files changed

+56
-144
lines changed

QMChatViewController/QMChatDataSource/QMChatDataSource.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ - (void)changeDataSourceWithMessages:(NSArray *)messages forUpdateType:(QMDataSo
104104
NSMutableArray *messagesArray = [NSMutableArray arrayWithCapacity:messages.count];
105105
NSEnumerator *enumerator = [messages objectEnumerator];
106106

107-
if (_customDividerInterval > 0 && updateType == QMDataSourceActionTypeAdd) {
107+
if (self.customDividerInterval > 0 && updateType == QMDataSourceActionTypeAdd) {
108108

109109
NSSortDescriptor *dateSentDescriptor =
110110
[NSSortDescriptor sortDescriptorWithKey:@"dateSent" ascending:YES];

QMChatViewController/QMChatViewController.m

+18-17
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
const NSUInteger kQMSystemInputToolbarDebugHeight = 0;
2727

2828
@interface QMChatViewController () <QMInputToolbarDelegate, UIImagePickerControllerDelegate,
29-
UINavigationControllerDelegate, UIActionSheetDelegate, UIScrollViewDelegate, UIAlertViewDelegate,
29+
UINavigationControllerDelegate, UIActionSheetDelegate, UIScrollViewDelegate,
3030
QMChatDataSourceDelegate, QMAudioRecordToolbarDelegate>
3131

3232
@property (weak, nonatomic) IBOutlet QMChatCollectionView *collectionView;
@@ -68,8 +68,7 @@ - (void)dealloc {
6868
self.inputToolbar.contentView.textView.delegate = nil;
6969
self.inputToolbar.contentView.textView.qm_placeholderTextViewPasteDelegate = nil;
7070
self.inputToolbar.delegate = nil;
71-
72-
self.senderDisplayName = nil;
71+
7372
}
7473

7574
- (void)viewDidLoad {
@@ -710,14 +709,6 @@ - (void)textViewDidEndEditing:(UITextView *)textView {
710709
}
711710
}
712711

713-
#pragma mark - UIAlertViewDelegate
714-
715-
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
716-
if (buttonIndex == 1) {
717-
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
718-
}
719-
}
720-
721712
#pragma mark - UIImagePickerControllerDelegate
722713

723714
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
@@ -982,13 +973,23 @@ - (void)showAlertForAccess {
982973
message = NSLocalizedString(@"You can allow access to Photos in Settings", nil);
983974
}
984975

985-
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title
986-
message:message
987-
delegate:self
988-
cancelButtonTitle:NSLocalizedString(@"Cancel", nil)
989-
otherButtonTitles:NSLocalizedString(@"Open Settings", nil),nil];
976+
UIAlertController *alertController = [UIAlertController
977+
alertControllerWithTitle:title
978+
message:message
979+
preferredStyle:UIAlertControllerStyleAlert];
980+
981+
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Open Settings", nil)
982+
style:UIAlertActionStyleDefault
983+
handler:^(UIAlertAction * _Nonnull __unused action)
984+
{
985+
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
986+
}]];
987+
988+
[alertController addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"Cancel", nil)
989+
style:UIAlertActionStyleCancel
990+
handler:nil]];
990991

991-
[alert show];
992+
[self presentViewController:alertController animated:YES completion:nil];
992993
}
993994

994995
- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {

QMChatViewController/Views/Cells/QMChatOutgoingCell/QMChatOutgoingCell.xib

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
7-
<deployment version="2048" identifier="iOS"/>
7+
<deployment identifier="iOS"/>
88
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
99
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1010
</dependencies>
@@ -138,7 +138,7 @@
138138
<outlet property="topLabelHeightConstraint" destination="VYw-Ld-ar1" id="SGp-H8-Qeb"/>
139139
<outlet property="topLabelTextViewVerticalSpaceConstraint" destination="mbp-Hv-6Tq" id="OJk-NT-Qbw"/>
140140
</connections>
141-
<point key="canvasLocation" x="256.5" y="369"/>
141+
<point key="canvasLocation" x="-35" y="-8"/>
142142
</collectionViewCell>
143143
</objects>
144144
</document>

QMChatViewController/Views/CustomUI/InputToolBar/QMInputToolbar.h

+1-62
Original file line numberDiff line numberDiff line change
@@ -96,67 +96,6 @@
9696
- (void)messagesInputToolbar:(QMInputToolbar *)toolbar
9797
didPressLeftBarButton:(UIButton *)sender;
9898

99-
@optional
100-
101-
/**
102-
Asks the delegate if it can start the audio recording by touching the audio record button.
103-
104-
@param toolbar An instance of `QMInputToolbar`
105-
@return YES if the audio recording should start or NO if it should not.
106-
*/
107-
- (BOOL)messagesInputToolbarAudioRecordingShouldStart:(QMInputToolbar *)toolbar
108-
__deprecated_msg("Method deprecated. Use audioRecordingShouldStart");
109-
110-
/**
111-
This method is called when an audio recording has started.
112-
113-
@param toolbar An instance of `QMInputToolbar`
114-
*/
115-
- (void)messagesInputToolbarAudioRecordingStart:(QMInputToolbar *)toolbar
116-
__deprecated_msg("Method deprecated. Use audioRecordingStart");
117-
118-
/**
119-
This method is called when an audio recording has cancelled.
120-
121-
@param toolbar An instance of `QMInputToolbar`
122-
*/
123-
- (void)messagesInputToolbarAudioRecordingCancel:(QMInputToolbar *)toolbar
124-
__deprecated_msg("Method deprecated. Use audioRecordingCancel");
125-
126-
/**
127-
This method is called when an audio recording has completed.
128-
129-
@param toolbar An instance of `QMInputToolbar`
130-
*/
131-
- (void)messagesInputToolbarAudioRecordingComplete:(QMInputToolbar *)toolbar
132-
__deprecated_msg("Method deprecated. Use audioRecordingComplete");
133-
134-
/**
135-
This method is called when an audio recording has paused because of timeout.
136-
@discussion: This mehod will be called only if 'inputPanelAudioRecordingMaximumDuration:' is adopted.
137-
@param toolbar An instance of `QMInputToolbar`.
138-
*/
139-
- (void)messagesInputToolbarAudioRecordingPausedByTimeOut:(QMInputToolbar *)toolbar
140-
__deprecated_msg("Method deprecated. Use audioRecordingPausedByTimeOut");
141-
142-
/**
143-
Tells the delegate to return the current duration.
144-
145-
@param toolbar An instance of `QMInputToolbar`
146-
@return Current duration of the audio recorder.
147-
*/
148-
- (NSTimeInterval)inputPanelAudioRecordingDuration:(QMInputToolbar *)toolbar
149-
__deprecated_msg("Method deprecated. Use audioRecordingDuration:");
150-
151-
/**
152-
Tells the delegate to return the maximum duration.
153-
154-
@param toolbar An instance of `QMInputToolbar`
155-
@return The maximum duration of the recorded audio.
156-
*/
157-
- (NSTimeInterval)inputPanelAudioRecordingMaximumDuration:(QMInputToolbar *)toolbar
158-
__deprecated_msg("Method deprecated. Use audioRecordingMaximumDuration:");
159-
16099
@end
161100

162101
/**
@@ -223,7 +162,7 @@ __deprecated_msg("Method deprecated. Use audioRecordingMaximumDuration:");
223162
@property (assign, nonatomic) BOOL audioRecordingEnabled;
224163

225164
/**
226-
Cancels current audio recording and calls the delegate method 'messagesInputToolbarAudioRecordingCancel:'
165+
Cancels current audio recording and calls the delegate method 'audioRecordingCancel:'
227166
*/
228167
- (void)cancelAudioRecording;
229168

QMChatViewController/Views/CustomUI/InputToolBar/QMInputToolbar.m

+7-43
Original file line numberDiff line numberDiff line change
@@ -317,30 +317,16 @@ - (void)finishAudioRecording {
317317
}
318318

319319
- (void)recordButtonInteractionDidBegin {
320-
321-
dispatch_block_t startRecording = ^{
322-
323-
self.recording = YES;
324-
[self setShowRecordingInterface:true velocity:0.0f];
325-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingStart:)]) {
326-
[self.delegate messagesInputToolbarAudioRecordingStart:self];
327-
}
328-
329-
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingStart:)]) {
330-
[self.audioRecordDelegate audioRecordingStart:self];
331-
}
332-
[self startAudioRecording];
333-
};
334-
335-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingShouldStart:)]) {
336-
if ([self.delegate messagesInputToolbarAudioRecordingShouldStart:self]) {
337-
startRecording();
338-
}
339-
}
340320

341321
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingShouldStart:)]) {
342322
if ([self.audioRecordDelegate audioRecordingShouldStart:self]) {
343-
startRecording();
323+
self.recording = YES;
324+
[self setShowRecordingInterface:true velocity:0.0f];
325+
326+
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingStart:)]) {
327+
[self.audioRecordDelegate audioRecordingStart:self];
328+
}
329+
[self startAudioRecording];
344330
}
345331
}
346332
}
@@ -352,9 +338,6 @@ - (void)recordButtonInteractionDidCancel:(CGFloat)velocity {
352338
self.recording = NO;
353339
[self setShowRecordingInterface:false velocity:velocity];
354340

355-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingCancel:)]) {
356-
[self.delegate messagesInputToolbarAudioRecordingCancel:self];
357-
}
358341
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingCancel:)]) {
359342
[self.audioRecordDelegate audioRecordingCancel:self];
360343
}
@@ -368,9 +351,6 @@ - (void)cancelAudioRecording {
368351

369352
[self setShowRecordingInterface:false velocity:0.0];
370353

371-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingCancel:)]) {
372-
[self.delegate messagesInputToolbarAudioRecordingCancel:self];
373-
}
374354
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingCancel:)]) {
375355
[self.audioRecordDelegate audioRecordingCancel:self];
376356
}
@@ -384,10 +364,6 @@ - (void)recordButtonInteractionDidComplete:(CGFloat)velocity {
384364
self.recording = NO;
385365
[self setShowRecordingInterface:false velocity:velocity];
386366

387-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingComplete:)]) {
388-
[self.delegate messagesInputToolbarAudioRecordingComplete:self];
389-
}
390-
391367
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingComplete:)]) {
392368
[self.audioRecordDelegate audioRecordingComplete:self];
393369
}
@@ -414,21 +390,13 @@ - (void)shakeControls {
414390

415391
- (void)shouldStopRecordingByTimeOut {
416392

417-
if ([self.delegate respondsToSelector:@selector(messagesInputToolbarAudioRecordingPausedByTimeOut:)]) {
418-
return [self.delegate messagesInputToolbarAudioRecordingPausedByTimeOut:self];
419-
}
420-
421393
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingPausedByTimeOut:)]) {
422394
return [self.audioRecordDelegate audioRecordingPausedByTimeOut:self];
423395
}
424396
}
425397

426398
- (NSTimeInterval)maximumDuration {
427399

428-
if ([self.delegate respondsToSelector:@selector(inputPanelAudioRecordingMaximumDuration:)]) {
429-
return [self.delegate inputPanelAudioRecordingMaximumDuration:self];
430-
}
431-
432400
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingMaximumDuration:)]) {
433401
return [self.audioRecordDelegate audioRecordingMaximumDuration:self];
434402
}
@@ -438,10 +406,6 @@ - (NSTimeInterval)maximumDuration {
438406

439407
- (NSTimeInterval)currentDuration {
440408

441-
if ([self.delegate respondsToSelector:@selector(inputPanelAudioRecordingDuration:)]) {
442-
return [self.delegate inputPanelAudioRecordingDuration:self];
443-
}
444-
445409
if ([self.audioRecordDelegate respondsToSelector:@selector(audioRecordingDuration:)]) {
446410
return [self.audioRecordDelegate audioRecordingDuration:self];
447411
}

QMChatViewController/Views/CustomUI/QMAudioRecordView/QMAudioRecordView.m

+15-15
Original file line numberDiff line numberDiff line change
@@ -124,21 +124,21 @@ - (void)setShowRecordingInterface:(BOOL)show velocity:(CGFloat)velocity
124124
int animationCurveOption = 7 << 16;
125125

126126
[UIView animateWithDuration:0.25 delay:0.06 options:animationCurveOption animations:^{
127-
_recordIndicatorView.alpha = 1.0f;
128-
_recordIndicatorView.transform = CGAffineTransformIdentity;
127+
self.recordIndicatorView.alpha = 1.0f;
128+
self.recordIndicatorView.transform = CGAffineTransformIdentity;
129129
} completion:nil];
130130

131131
[UIView animateWithDuration:0.25 delay:0.0 options:animationCurveOption animations:^{
132-
_recordDurationLabel.alpha = 1.0f;
133-
_recordDurationLabel.transform = CGAffineTransformIdentity;
132+
self.recordDurationLabel.alpha = 1.0f;
133+
self.recordDurationLabel.transform = CGAffineTransformIdentity;
134134
} completion:nil];
135135

136136
[UIView animateWithDuration:0.18
137137
delay:0.04
138138
options:animationCurveOption
139139
animations:^{
140-
_slideToCancelLabel.alpha = 1.0f;
141-
_slideToCancelLabel.transform = CGAffineTransformIdentity;
140+
self.slideToCancelLabel.alpha = 1.0f;
141+
self.slideToCancelLabel.transform = CGAffineTransformIdentity;
142142
} completion:nil];
143143

144144
[self addRecordingDotAnimation];
@@ -161,12 +161,12 @@ - (void)setShowRecordingInterface:(BOOL)show velocity:(CGFloat)velocity
161161
options:options | animationCurveOption
162162
animations:^{
163163

164-
_recordIndicatorView.alpha = 0.5f;
165-
_recordIndicatorView.transform = CGAffineTransformMakeTranslation(-90.0f, 0.0f);
164+
self.recordIndicatorView.alpha = 0.5f;
165+
self.recordIndicatorView.transform = CGAffineTransformMakeTranslation(-90.0f, 0.0f);
166166
}
167167
completion:^(BOOL finished) {
168168
if (finished){
169-
[_recordIndicatorView removeFromSuperview];
169+
[self.recordIndicatorView removeFromSuperview];
170170
}
171171
}];
172172

@@ -175,13 +175,13 @@ - (void)setShowRecordingInterface:(BOOL)show velocity:(CGFloat)velocity
175175
options:UIViewAnimationOptionBeginFromCurrentState | animationCurveOption
176176
animations:^ {
177177

178-
_recordDurationLabel.alpha = 0.0f;
179-
_recordDurationLabel.transform = CGAffineTransformMakeTranslation(-90.0f, 0.0f);
178+
self.recordDurationLabel.alpha = 0.0f;
179+
self.recordDurationLabel.transform = CGAffineTransformMakeTranslation(-90.0f, 0.0f);
180180

181181
} completion:^(BOOL finished) {
182182

183183
if (finished){
184-
[_recordDurationLabel removeFromSuperview];
184+
[self.recordDurationLabel removeFromSuperview];
185185
}
186186
}];
187187

@@ -190,8 +190,8 @@ - (void)setShowRecordingInterface:(BOOL)show velocity:(CGFloat)velocity
190190
options:UIViewAnimationOptionBeginFromCurrentState | animationCurveOption
191191
animations:^ {
192192

193-
_slideToCancelLabel.alpha = 0.0f;
194-
_slideToCancelLabel.transform = CGAffineTransformMakeTranslation(-200, 0.0f);
193+
self.slideToCancelLabel.alpha = 0.0f;
194+
self.slideToCancelLabel.transform = CGAffineTransformMakeTranslation(-200, 0.0f);
195195
} completion:nil];
196196
}
197197
}
@@ -286,7 +286,7 @@ - (void)showErrorMessage:(NSString *)errorMessage completion:(dispatch_block_t)c
286286

287287
[UIView animateWithDuration:0.25 delay:0.06 options:0 animations:^{
288288

289-
_errorMessageLabel.alpha = 1.0f;
289+
self.errorMessageLabel.alpha = 1.0f;
290290

291291
} completion:^(BOOL finished) {
292292

QMChatViewController/Views/CustomUI/QMImageView/QMImageView.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,11 @@ - (void)setImageWithURL:(NSURL *)url
198198

199199
dispatch_block_t showPlaceholder = ^{
200200

201-
[_textLayer setString:title color:[self colorForString:title]];
202-
_textLayer.hidden = NO;
201+
[self.textLayer setString:title color:[self colorForString:title]];
202+
self.textLayer.hidden = NO;
203203

204-
if (!CGRectEqualToRect(_textLayer.frame, self.bounds)) {
205-
_textLayer.frame = self.bounds;
204+
if (!CGRectEqualToRect(self.textLayer.frame, self.bounds)) {
205+
self.textLayer.frame = self.bounds;
206206
}
207207
};
208208

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>

0 commit comments

Comments
 (0)