覆盖羽声
This commit is contained in:
@@ -271,7 +271,20 @@ static Class<TUIMessageDataProviderDataSource> gDataSourceClass = nil;
|
||||
|
||||
+ (TUIMessageCellData *)getUnsupportedCellData:(V2TIMMessage *)message {
|
||||
TUITextMessageCellData *cellData = [[TUITextMessageCellData alloc] initWithDirection:(message.isSelf ? MsgDirectionOutgoing : MsgDirectionIncoming)];
|
||||
cellData.content = TIMCommonLocalizableString(TUIKitNotSupportThisMessage);
|
||||
if ([message.userID isEqualToString:@"@RBT#u88"]) {
|
||||
V2TIMCustomElem *el = message.customElem;
|
||||
NSError *error = nil;
|
||||
// 将 JSON 数据转换为字典
|
||||
NSDictionary *dictionary = [NSJSONSerialization JSONObjectWithData:el.data options:kNilOptions error:&error];
|
||||
NSArray *arr = dictionary[@"chunks"];
|
||||
NSString*str = @"";
|
||||
for (NSString*s in arr) {
|
||||
str = [str stringByAppendingFormat:@"%@",s];
|
||||
}
|
||||
cellData.content = str;
|
||||
}else{
|
||||
cellData.content = TIMCommonLocalizableString(TUIKitNotSupportThisMessage);
|
||||
}
|
||||
cellData.reuseId = TTextMessageCell_ReuseId;
|
||||
return cellData;
|
||||
}
|
||||
|
||||
@@ -645,19 +645,20 @@
|
||||
switch (type) {
|
||||
case TUIMessageBaseDataProviderDataSourceChangeTypeInsert:
|
||||
[self.tableView insertRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:index inSection:0] ]
|
||||
withRowAnimation:animation ? UITableViewRowAnimationFade : UITableViewRowAnimationNone];
|
||||
withRowAnimation:UITableViewRowAnimationNone];
|
||||
break;
|
||||
case TUIMessageBaseDataProviderDataSourceChangeTypeDelete:
|
||||
[self.tableView deleteRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:index inSection:0] ]
|
||||
withRowAnimation:animation ? UITableViewRowAnimationFade : UITableViewRowAnimationNone];
|
||||
withRowAnimation:UITableViewRowAnimationNone];
|
||||
break;
|
||||
case TUIMessageBaseDataProviderDataSourceChangeTypeReload:
|
||||
[self.tableView reloadRowsAtIndexPaths:@[ [NSIndexPath indexPathForRow:index inSection:0] ]
|
||||
withRowAnimation:animation ? UITableViewRowAnimationFade : UITableViewRowAnimationNone];
|
||||
withRowAnimation:UITableViewRowAnimationNone];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
- (void)dataProviderDataSourceDidChange:(TUIMessageDataProvider *)dataProvider {
|
||||
|
||||
@@ -213,6 +213,14 @@
|
||||
|
||||
#pragma mark - Event response
|
||||
- (void)onMicButtonClicked:(UIButton *)sender {
|
||||
NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"];
|
||||
#if DEBUG
|
||||
isCanChat = 1;
|
||||
#endif
|
||||
if (isCanChat != 1) {
|
||||
[self alertChat];
|
||||
return;
|
||||
}
|
||||
_recordButton.hidden = NO;
|
||||
_inputTextView.hidden = YES;
|
||||
_micButton.hidden = YES;
|
||||
@@ -229,6 +237,14 @@
|
||||
}
|
||||
|
||||
- (void)onKeyboardButtonClicked:(UIButton *)sender {
|
||||
NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"];
|
||||
#if DEBUG
|
||||
isCanChat = 1;
|
||||
#endif
|
||||
if (isCanChat != 1) {
|
||||
[self alertChat];
|
||||
return;
|
||||
}
|
||||
_micButton.hidden = NO;
|
||||
_keyboardButton.hidden = YES;
|
||||
_recordButton.hidden = YES;
|
||||
@@ -241,6 +257,14 @@
|
||||
}
|
||||
|
||||
- (void)onFaceEmojiButtonClicked:(UIButton *)sender {
|
||||
NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"];
|
||||
#if DEBUG
|
||||
isCanChat = 1;
|
||||
#endif
|
||||
if (isCanChat != 1) {
|
||||
[self alertChat];
|
||||
return;
|
||||
}
|
||||
_micButton.hidden = NO;
|
||||
_faceButton.hidden = YES;
|
||||
_keyboardButton.hidden = NO;
|
||||
@@ -255,6 +279,14 @@
|
||||
}
|
||||
|
||||
- (void)onMoreButtonClicked:(UIButton *)sender {
|
||||
NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"];
|
||||
#if DEBUG
|
||||
isCanChat = 1;
|
||||
#endif
|
||||
if (isCanChat != 1) {
|
||||
[self alertChat];
|
||||
return;
|
||||
}
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(inputBarDidTouchMore:)]) {
|
||||
[_delegate inputBarDidTouchMore:self];
|
||||
}
|
||||
@@ -339,9 +371,42 @@
|
||||
}
|
||||
}
|
||||
|
||||
-(void)alertChat{
|
||||
NSString* canChatMoney = [[NSUserDefaults standardUserDefaults] objectForKey:@"kIsCanChatMoney"];
|
||||
UIWindow*keyWindow = nil;
|
||||
NSArray *windows = [UIApplication sharedApplication].windows;
|
||||
for (UIWindow *window in windows){
|
||||
if(window.isKeyWindow){
|
||||
keyWindow = window;
|
||||
break;
|
||||
}
|
||||
}
|
||||
UINavigationController*na = (UINavigationController*)keyWindow.rootViewController;
|
||||
NSString *title = [NSString stringWithFormat:@"充值不足%@元,您无法发送消息",canChatMoney];
|
||||
UIAlertController *al = [UIAlertController alertControllerWithTitle:title message:@"" preferredStyle:(UIAlertControllerStyleAlert)];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"去充值" style:(UIAlertActionStyleDefault) handler:^(UIAlertAction * _Nonnull action) {
|
||||
UIViewController *vc = [[NSClassFromString(@"QXRechargeViewcController") alloc] init];
|
||||
UINavigationController *naV = [[UINavigationController alloc] initWithRootViewController:vc];
|
||||
naV.modalPresentationStyle = UIModalPresentationFullScreen;
|
||||
[na presentViewController:naV animated:YES completion:nil];
|
||||
}]];
|
||||
[al addAction:[UIAlertAction actionWithTitle:@"取消" style:(UIAlertActionStyleCancel) handler:^(UIAlertAction * _Nonnull action) {
|
||||
|
||||
}]];
|
||||
[na presentViewController:al animated:YES completion:nil];
|
||||
}
|
||||
#pragma mark - Text input
|
||||
#pragma mark-- UITextViewDelegate
|
||||
- (void)textViewDidBeginEditing:(UITextView *)textView {
|
||||
NSInteger isCanChat = [[NSUserDefaults standardUserDefaults] integerForKey:@"kIsCanChat"];
|
||||
#if DEBUG
|
||||
isCanChat = 1;
|
||||
#endif
|
||||
if (isCanChat != 1) {
|
||||
[self.inputTextView resignFirstResponder];
|
||||
[self alertChat];
|
||||
return;
|
||||
}
|
||||
self.keyboardButton.hidden = YES;
|
||||
self.micButton.hidden = NO;
|
||||
self.faceButton.hidden = NO;
|
||||
|
||||
Reference in New Issue
Block a user