Skip to content

Commit 0977e55

Browse files
committed
给陌人发送失败的私信,提示输入验证码,输完验证码后,直接再次重新发送
1 parent 69b8d67 commit 0977e55

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

Coding_iOS/Controllers/ConversationViewController.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,6 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
285285
UIActionSheet *actionSheet = [UIActionSheet bk_actionSheetCustomWithTitle:@"重新发送" buttonTitles:@[@"发送"] destructiveTitle:nil cancelTitle:@"取消" andDidDismissBlock:^(UIActionSheet *sheet, NSInteger index) {
286286
if (index == 0 && _self.messageToResendOrDelete) {
287287
[_self sendPrivateMessageWithMsg:_messageToResendOrDelete];
288-
289288
}
290289
}];
291290
[actionSheet showInView:self.view];
@@ -423,7 +422,12 @@ - (void)sendPrivateMessageWithMsg:(PrivateMessage *)nextMsg{
423422
NSDictionary *params = @{@"type": @2,
424423
@"receiver_global_key": nextMsg.friend.global_key ?: @"",
425424
};
426-
[NSObject showCaptchaViewParams:params.mutableCopy];
425+
[NSObject showCaptchaViewParams:params.mutableCopy success:^{
426+
[NSObject showHudTipStr:@"验证码正确"];
427+
weakSelf.messageToResendOrDelete = nextMsg;
428+
[weakSelf.myMsgInputView isAndResignFirstResponder];
429+
[weakSelf sendPrivateMessageWithMsg:weakSelf.messageToResendOrDelete];
430+
}];
427431
}
428432
[weakSelf dataChangedWithError:NO scrollToBottom:YES animated:YES];
429433
} progerssBlock:^(CGFloat progressValue) {

Coding_iOS/Util/OC_Category/NSObject+Common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
+ (void)showStatusBarErrorStr:(NSString *)errorStr;
2424
+ (void)showStatusBarError:(NSError *)error;
2525
+ (void)showCaptchaViewParams:(NSMutableDictionary *)params;
26+
+ (void)showCaptchaViewParams:(NSMutableDictionary *)params success:(void (^)())block;
2627

2728
#pragma mark BaseURL
2829
+ (NSString *)baseURLStr;

Coding_iOS/Util/OC_Category/NSObject+Common.m

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,11 @@ -(id)handleResponse:(id)responseJSON autoShowError:(BOOL)autoShowError{
451451
return error;
452452
}
453453

454-
455454
+ (void)showCaptchaViewParams:(NSMutableDictionary *)params{
455+
[self showCaptchaViewParams:params success:nil];
456+
}
457+
458+
+ (void)showCaptchaViewParams:(NSMutableDictionary *)params success:(void (^)())block{
456459
//Data
457460
if (!params) {
458461
params = @{}.mutableCopy;
@@ -505,7 +508,11 @@ + (void)showCaptchaViewParams:(NSMutableDictionary *)params{
505508
[[CodingNetAPIClient sharedJsonClient] requestJsonDataWithPath:path withParams:params withMethodType:Post andBlock:^(id data, NSError *error) {
506509
if (data) {
507510
[weakAlertV dismissWithCompletion:^{
508-
[NSObject showHudTipStr:@"验证码正确"];
511+
if (block) {
512+
block();
513+
}else{
514+
[NSObject showHudTipStr:@"验证码正确"];
515+
}
509516
}];
510517
}else{
511518
[weakImageV sd_setImageWithURL:imageURL placeholderImage:nil options:(SDWebImageRetryFailed | SDWebImageRefreshCached | SDWebImageHandleCookies)];

0 commit comments

Comments
 (0)