diff --git a/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/Contents.json b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/Contents.json new file mode 100644 index 0000000..f4d1e94 --- /dev/null +++ b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "ai_sendmessage_icon@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "ai_sendmessage_icon@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@2x.png b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@2x.png new file mode 100644 index 0000000..0577af0 Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@2x.png differ diff --git a/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@3x.png b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@3x.png new file mode 100644 index 0000000..8496688 Binary files /dev/null and b/keyBoard/Assets.xcassets/AI/ai_sendmessage_icon.imageset/ai_sendmessage_icon@3x.png differ diff --git a/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m b/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m index bc9dc2a..48afdb5 100644 --- a/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m +++ b/keyBoard/Class/AiTalk/V/Chat/KBPersonaChatCell.m @@ -1075,7 +1075,7 @@ static NSString * const KBChatSessionDidResetNotification = @"KBChatSessionDidRe [self.popView dismiss]; } - CGFloat customViewHeight = KB_SCREEN_HEIGHT * 0.7; + CGFloat customViewHeight = KB_SCREEN_HEIGHT * 0.75; KBAICommentView *customView = [[KBAICommentView alloc] initWithFrame:CGRectMake(0, 0, KB_SCREEN_WIDTH, customViewHeight)]; diff --git a/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m index a4d7edc..757b74a 100644 --- a/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m +++ b/keyBoard/Class/AiTalk/V/Comment/KBAICommentInputView.m @@ -11,8 +11,9 @@ @interface KBAICommentInputView () @property(nonatomic, strong) UIView *containerView; -@property(nonatomic, strong) UIImageView *avatarImageView; +//@property(nonatomic, strong) UIImageView *avatarImageView; @property(nonatomic, strong) UITextField *textField; +@property(nonatomic, strong) UILabel *placeholderLabel; @property(nonatomic, strong) UIButton *sendButton; @property(nonatomic, strong) UIView *topLine; @@ -31,12 +32,13 @@ #pragma mark - UI Setup - (void)setupUI { - self.backgroundColor = [UIColor whiteColor]; + self.backgroundColor = [UIColor colorWithHex:0x797979 alpha:0.49]; [self addSubview:self.topLine]; - [self addSubview:self.avatarImageView]; +// [self addSubview:self.avatarImageView]; [self addSubview:self.containerView]; [self.containerView addSubview:self.textField]; + [self addSubview:self.placeholderLabel]; [self addSubview:self.sendButton]; [self.topLine mas_makeConstraints:^(MASConstraintMaker *make) { @@ -44,17 +46,17 @@ make.height.mas_equalTo(0.5); }]; - [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self).offset(12); - make.centerY.equalTo(self); - make.width.height.mas_equalTo(32); - }]; +// [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { +// make.left.equalTo(self).offset(12); +// make.centerY.equalTo(self); +// make.width.height.mas_equalTo(32); +// }]; [self.containerView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.equalTo(self.avatarImageView.mas_right).offset(10); - make.right.equalTo(self.sendButton.mas_left).offset(-10); + make.left.equalTo(self).offset(12); + make.right.equalTo(self.sendButton.mas_left).offset(-12); make.centerY.equalTo(self); - make.height.mas_equalTo(36); + make.height.mas_equalTo(52); }]; [self.textField mas_makeConstraints:^(MASConstraintMaker *make) { @@ -69,17 +71,23 @@ make.width.mas_equalTo(50); make.height.mas_equalTo(30); }]; + + [self.placeholderLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.equalTo(self); + }]; } #pragma mark - Public Methods - (void)setPlaceholder:(NSString *)placeholder { _placeholder = placeholder; - self.textField.placeholder = placeholder; + self.placeholderLabel.text = placeholder; + [self updatePlaceholderVisibility]; } - (void)clearText { self.textField.text = @""; + [self updatePlaceholderVisibility]; [self updateSendButtonState]; } @@ -97,13 +105,14 @@ } - (void)textFieldDidChange:(UITextField *)textField { + [self updatePlaceholderVisibility]; [self updateSendButtonState]; } - (void)updateSendButtonState { BOOL hasText = self.textField.text.length > 0; self.sendButton.enabled = hasText; - self.sendButton.alpha = hasText ? 1.0 : 0.5; +// self.sendButton.alpha = hasText ? 1.0 : 0.5; } #pragma mark - UITextFieldDelegate @@ -113,6 +122,15 @@ return YES; } +- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField { + [self updatePlaceholderVisibility]; + return YES; +} + +- (void)textFieldDidEndEditing:(UITextField *)textField { + [self updatePlaceholderVisibility]; +} + #pragma mark - Lazy Loading - (UIView *)topLine { @@ -123,25 +141,24 @@ return _topLine; } -- (UIImageView *)avatarImageView { - if (!_avatarImageView) { - _avatarImageView = [[UIImageView alloc] init]; - _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; - _avatarImageView.layer.cornerRadius = 16; - _avatarImageView.layer.masksToBounds = YES; - _avatarImageView.backgroundColor = [UIColor systemGray5Color]; - _avatarImageView.image = [UIImage systemImageNamed:@"person.circle.fill"]; - _avatarImageView.tintColor = [UIColor systemGray3Color]; - } - return _avatarImageView; -} +//- (UIImageView *)avatarImageView { +// if (!_avatarImageView) { +// _avatarImageView = [[UIImageView alloc] init]; +// _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; +// _avatarImageView.layer.cornerRadius = 16; +// _avatarImageView.layer.masksToBounds = YES; +// _avatarImageView.backgroundColor = [UIColor systemGray5Color]; +// _avatarImageView.image = [UIImage systemImageNamed:@"person.circle.fill"]; +// _avatarImageView.tintColor = [UIColor systemGray3Color]; +// } +// return _avatarImageView; +//} - (UIView *)containerView { if (!_containerView) { _containerView = [[UIView alloc] init]; - _containerView.backgroundColor = [UIColor systemGray6Color]; - _containerView.layer.cornerRadius = 18; - _containerView.layer.masksToBounds = YES; +// _containerView.layer.cornerRadius = 26; +// _containerView.layer.masksToBounds = YES; } return _containerView; } @@ -149,27 +166,42 @@ - (UITextField *)textField { if (!_textField) { _textField = [[UITextField alloc] init]; - _textField.placeholder = @"说点什么..."; + _textField.textColor = [UIColor whiteColor]; + _textField.textAlignment = NSTextAlignmentLeft; _textField.font = [UIFont systemFontOfSize:14]; _textField.delegate = self; _textField.returnKeyType = UIReturnKeySend; [_textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; + [self updatePlaceholderVisibility]; } return _textField; } +- (UILabel *)placeholderLabel { + if (!_placeholderLabel) { + _placeholderLabel = [[UILabel alloc] init]; + _placeholderLabel.text = @"Send A Message"; + _placeholderLabel.textColor = [UIColor whiteColor]; + _placeholderLabel.font = [UIFont systemFontOfSize:14]; + _placeholderLabel.textAlignment = NSTextAlignmentCenter; + _placeholderLabel.userInteractionEnabled = NO; + } + return _placeholderLabel; +} + - (UIButton *)sendButton { if (!_sendButton) { _sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_sendButton setTitle:@"发送" forState:UIControlStateNormal]; - [_sendButton setTitleColor:[UIColor systemBlueColor] - forState:UIControlStateNormal]; - _sendButton.titleLabel.font = [UIFont systemFontOfSize:15 - weight:UIFontWeightMedium]; +// [_sendButton setTitle:@"发送" forState:UIControlStateNormal]; +// [_sendButton setTitleColor:[UIColor systemBlueColor] +// forState:UIControlStateNormal]; +// _sendButton.titleLabel.font = [UIFont systemFontOfSize:15 +// weight:UIFontWeightMedium]; + [_sendButton setImage:[UIImage imageNamed:@"ai_sendmessage_icon"] forState:UIControlStateNormal]; _sendButton.enabled = NO; - _sendButton.alpha = 0.5; +// _sendButton.alpha = 0.5; [_sendButton addTarget:self action:@selector(sendButtonTapped) forControlEvents:UIControlEventTouchUpInside]; @@ -177,4 +209,11 @@ return _sendButton; } +#pragma mark - Private + +- (void)updatePlaceholderVisibility { + BOOL hasText = self.textField.text.length > 0; + self.placeholderLabel.hidden = hasText; +} + @end diff --git a/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m b/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m index f8fa9f1..040f052 100644 --- a/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m +++ b/keyBoard/Class/AiTalk/V/Comment/KBAICommentView.m @@ -189,8 +189,8 @@ static NSString *const kCommentFooterIdentifier = @"CommentFooter"; }]; [self.inputView mas_makeConstraints:^(MASConstraintMaker *make) { - make.left.right.equalTo(self); - make.height.mas_equalTo(50); + make.left.right.equalTo(self).inset(12); + make.height.mas_equalTo(52); self.inputBottomConstraint = make.bottom.equalTo(self).offset(-KB_SafeAreaBottom()); }]; @@ -846,8 +846,9 @@ static NSInteger const kRepliesLoadCount = 5; - (KBAICommentInputView *)inputView { if (!_inputView) { _inputView = [[KBAICommentInputView alloc] init]; - _inputView.placeholder = @"说点什么..."; - + _inputView.placeholder = @"Send A Message"; + _inputView.layer.cornerRadius = 26; + _inputView.clipsToBounds = true; __weak typeof(self) weakSelf = self; _inputView.onSend = ^(NSString *text) { [weakSelf sendCommentWithText:text]; diff --git a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m index 30e724f..de1adfe 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIHomeVC.m @@ -791,7 +791,7 @@ - (UIButton *)sendButton { if (!_sendButton) { _sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [_sendButton setTitle:KBLocalized(@"发送") forState:UIControlStateNormal]; + [_sendButton setTitle:KBLocalized(@"send") forState:UIControlStateNormal]; [_sendButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; _sendButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; _sendButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.6 blue:1.0 alpha:1.0]; diff --git a/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m b/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m index 1f48937..c6de732 100644 --- a/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m +++ b/keyBoard/Class/AiTalk/VC/KBAIMessageVC.m @@ -23,7 +23,7 @@ @property (nonatomic, strong) JXCategoryListContainerView *listContainerView; /// 右侧搜索按钮 -@property (nonatomic, strong) UIButton *searchButton; +//@property (nonatomic, strong) UIButton *searchButton; /// 标题数组 @property (nonatomic, strong) NSArray *titles; @@ -42,7 +42,7 @@ [self setupUI]; /// 2:绑定事件 - [self bindActions]; +// [self bindActions]; } #pragma mark - 1:控件初始化 @@ -69,12 +69,12 @@ }]; // 添加搜索按钮 - [self.kb_navView addSubview:self.searchButton]; - [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { - make.right.equalTo(self.kb_navView).offset(-16); - make.centerY.equalTo(self.kb_backButton); - make.width.height.mas_equalTo(24); - }]; +// [self.kb_navView addSubview:self.searchButton]; +// [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { +// make.right.equalTo(self.kb_navView).offset(-16); +// make.centerY.equalTo(self.kb_backButton); +// make.width.height.mas_equalTo(24); +// }]; // 添加列表容器 [self.view addSubview:self.listContainerView]; @@ -94,9 +94,9 @@ #pragma mark - 2:绑定事件 -- (void)bindActions { - [self.searchButton addTarget:self action:@selector(searchButtonTapped) forControlEvents:UIControlEventTouchUpInside]; -} +//- (void)bindActions { +// [self.searchButton addTarget:self action:@selector(searchButtonTapped) forControlEvents:UIControlEventTouchUpInside]; +//} #pragma mark - Actions @@ -189,16 +189,16 @@ return _listContainerView; } -- (UIButton *)searchButton { - if (!_searchButton) { - _searchButton = [UIButton buttonWithType:UIButtonTypeCustom]; - if (@available(iOS 13.0, *)) { - UIImage *searchImage = [UIImage systemImageNamed:@"magnifyingglass"]; - [_searchButton setImage:searchImage forState:UIControlStateNormal]; - _searchButton.tintColor = [UIColor colorWithHex:0x1B1F1A]; - } - } - return _searchButton; -} +//- (UIButton *)searchButton { +// if (!_searchButton) { +// _searchButton = [UIButton buttonWithType:UIButtonTypeCustom]; +// if (@available(iOS 13.0, *)) { +// UIImage *searchImage = [UIImage systemImageNamed:@"magnifyingglass"]; +// [_searchButton setImage:searchImage forState:UIControlStateNormal]; +// _searchButton.tintColor = [UIColor colorWithHex:0x1B1F1A]; +// } +// } +// return _searchButton; +//} @end diff --git a/keyBoard/Class/Categories/UIColor+Extension.h b/keyBoard/Class/Categories/UIColor+Extension.h index 170bb4d..383aa24 100644 --- a/keyBoard/Class/Categories/UIColor+Extension.h +++ b/keyBoard/Class/Categories/UIColor+Extension.h @@ -11,6 +11,7 @@ NS_ASSUME_NONNULL_BEGIN @interface UIColor (Extension) + (UIColor *)colorWithHex:(int)hexValue; ++ (UIColor *)colorWithHex:(int)hexValue alpha:(CGFloat)alpha; + (nullable UIColor *)colorWithHexString:(NSString *)hexString; + (UIColor *)kb_dynamicColorWithLightColor:(UIColor *)lightColor darkColor:(UIColor *)darkColor;