@@ -52,6 +52,7 @@ @interface UIMessageInputView () <AGEmojiKeyboardViewDelegate, AGEmojiKeyboardVi
5252@property (strong , nonatomic ) NSMutableArray *mediaList, *uploadMediaList;
5353
5454@property (strong , nonatomic ) UIButton *addButton, *emotionButton, *photoButton, *voiceButton;
55+ @property (strong , nonatomic ) UIView *voiceRedpointView;
5556
5657@property (assign , nonatomic ) CGFloat viewHeightOld;
5758
@@ -519,6 +520,14 @@ - (void)customUIWithType:(UIMessageInputViewContentType)type{
519520 [_voiceButton setImage: [UIImage imageNamed: @" keyboard_voice" ] forState: UIControlStateNormal];
520521 [_voiceButton addTarget: self action: @selector (voiceButtonClicked: ) forControlEvents: UIControlEventTouchUpInside];
521522 [self addSubview: _voiceButton];
523+
524+ if ([self needDisplayVoiceButtonRedpoint ]) {
525+ _voiceRedpointView = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , 7 , 7 )];
526+ _voiceRedpointView.center = CGPointMake (31 , 5 );
527+ _voiceRedpointView.backgroundColor = [UIColor colorWithRGBHex: 0xFF3C30 ];
528+ _voiceRedpointView.layer .cornerRadius = _voiceRedpointView.frame .size .width /2 ;
529+ [_voiceButton addSubview: _voiceRedpointView];
530+ }
522531 }
523532 _voiceButton.hidden = !hasVoiceBtn;
524533
@@ -745,6 +754,13 @@ - (void)voiceButtonClicked:(id)sender {
745754 }
746755 } completion: ^(BOOL finished) {
747756 }];
757+
758+ if (_voiceRedpointView) {
759+ [_voiceRedpointView removeFromSuperview ];
760+ self.voiceRedpointView = nil ;
761+
762+ [self noDisplayVoiceButtonRedpoint ];
763+ }
748764}
749765
750766#pragma mark QBImagePickerControllerDelegate
@@ -1028,4 +1044,17 @@ - (UIImage *)backSpaceButtonImageForEmojiKeyboardView:(AGEmojiKeyboardView *)emo
10281044 return img;
10291045}
10301046
1047+ #pragma mark - Redpoint
1048+
1049+ #define kInputViewVoiceButtonRedpoint @" InputViewVoiceButtonRedpoint"
1050+
1051+ - (BOOL )needDisplayVoiceButtonRedpoint {
1052+ return ![[NSUserDefaults standardUserDefaults ] boolForKey: kInputViewVoiceButtonRedpoint ];
1053+ }
1054+
1055+ - (void )noDisplayVoiceButtonRedpoint {
1056+ [[NSUserDefaults standardUserDefaults ] setBool: YES forKey: kInputViewVoiceButtonRedpoint ];
1057+ [[NSUserDefaults standardUserDefaults ] synchronize ];
1058+ }
1059+
10311060@end
0 commit comments