diff --git a/YuMi/Modules/YMMessage/View/Session/SessionViewController.h b/YuMi/Modules/YMMessage/View/Session/SessionViewController.h index be0cfcef..97fb9d08 100644 --- a/YuMi/Modules/YMMessage/View/Session/SessionViewController.h +++ b/YuMi/Modules/YMMessage/View/Session/SessionViewController.h @@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN ///integer($int64)当 hallBtnStatus=6 时,对应的申请记录Id,用户申请 @property (nonatomic,assign) BOOL isUser; ///是否需要关注用户 -//@property(nonatomic,assign) BOOL +@property(nonatomic,assign) BOOL isAttention; - (instancetype)initWithSession:(NIMSession *)session; @property (nonatomic, assign) SessionListOpenType openType; ///置顶回话 diff --git a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m index 80c7c93e..caaeb676 100644 --- a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m +++ b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m @@ -481,6 +481,9 @@ - (void)getFansLikeSuccess:(BOOL)isLike { self.sessionNavView.isLike = isLike; + if(self.isAttention == YES && isLike == NO){ + [self startAttention]; + } } - (void)attentionUserSuccess:(NSString *)uid { diff --git a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m index 389c9950..fa1e48aa 100644 --- a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m @@ -102,6 +102,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; if([ClientConfig shareConfig].chatId != nil){ NIMSession * session = [NIMSession session:[ClientConfig shareConfig].chatId type:NIMSessionTypeP2P]; SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; + sessionVC.isAttention = YES; [self.navigationController pushViewController:sessionVC animated:YES]; [ClientConfig shareConfig].chatId = nil; } @@ -116,6 +117,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; if (uid.length > 0) { NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P]; SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; + sessionVC.isAttention = YES; [self.navigationController pushViewController:sessionVC animated:YES]; [ClientConfig shareConfig].chatId = nil; } diff --git a/YuMi/Modules/YMWeb/XPWebViewController.m b/YuMi/Modules/YMWeb/XPWebViewController.m index 010ccbe1..943753c1 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.m +++ b/YuMi/Modules/YMWeb/XPWebViewController.m @@ -101,7 +101,7 @@ NSString * const kJumpAppointPage = @"jumpAppointPage"; NSString * const kJSOpenRoom = @"openRoom"; NSString * const kJSOpenRoomForGiftId = @"openRoomForGiftId"; NSString * const kJSOpenChatPage = @"geToChatPage"; - +NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat"; @implementation XPWebViewController @@ -248,123 +248,123 @@ NSString * const kJSOpenChatPage = @"geToChatPage"; #ifdef DEBUG if (currentUrl != nil) { #else - if (currentUrl != nil && [currentUrl containsString:API_HOST_URL]) { + if (currentUrl != nil && [currentUrl containsString:API_HOST_URL]) { #endif - if ([message.name isEqualToString:kJSOpenSharePage]) { - if (message.body && message.body != [NSNull null]) { - NSDictionary *body; - //不知道是哪个蓝精灵弄的,变成了个dic,所以我们要判断类型 - if ([message.body isKindOfClass:[NSDictionary class]]) { - body = message.body; - } else if ([message.body isKindOfClass:[NSString class]]) { - body = [message.body toJSONObject]; - } - self.shareDic = body[@"data"]; - [self showSharePanel]; - } - } else if ([message.name isEqualToString:kJSGetUid]) { - NSString *uid = [[AccountInfoStorage instance] getUid]; - NSString *js = [NSString stringWithFormat:@"getMessage(\"uid\",%@)", uid]; - [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { - NSLog(@"%@",error); - }]; - } else if ([message.name isEqualToString:kJSGetTicket]) { - NSString *ticket = [[AccountInfoStorage instance] getTicket]; - NSString *js = [NSString stringWithFormat:@"getMessage(\"ticket\",\"%@\")",ticket]; - [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { - NSLog(@"%@",error); - }]; - } else if ([message.name isEqualToString:kJSGetDeviceId]) { - NSString *js = [NSString stringWithFormat:@"getMessage(\"deviceId\",\"%@\")",[YYUtility deviceUniqueIdentification]]; - [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { - NSLog(@"%@",error); - }]; - } else if ([message.name isEqualToString:kJSGetDeviceInfo]) { - NSDictionary *basicParmars = [HttpRequestHelper configBaseParmars:[[NSDictionary alloc] init]]; - NSString *json = [basicParmars mj_JSONString]; - NSString *js = [NSString stringWithFormat:@"getMessage(\"deviceInfo\",%@)", json]; - [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable ohter, NSError * _Nullable error) { - NSLog(@"%@", error); - }]; - } else if ([message.name isEqualToString:kJSOpenPurse]) { - - }else if([message.name isEqualToString:kJSChargePayPage]){ - NSString *money = [NSString stringWithFormat:@"%@",message.body] ; - - }else if([message.name isEqualToString:kJSChargePayClickPage]){ - if(message.body != nil && self.model.diamonds != nil){ - NSString *type = [NSString stringWithFormat:@"%@",message.body]; - } - }else if ([message.name isEqualToString:kJSOpenChargePage]) { - if(self.delegate && [self.delegate respondsToSelector:@selector(payHandler)]){ - [self.delegate payHandler]; - return; - } - - - - [TTPopup dismiss]; - if(self.isPush){ - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - return; - } - UIViewController *controller = [XCCurrentVCStackManager shareManager].getCurrentVC; - if (controller.presentingViewController) { - [controller dismissViewControllerAnimated:NO completion:nil]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - }); - }else { - XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; - } - } else if ([message.name isEqualToString:kOpenPersonPage]) { - NSString *uid = [NSString stringWithFormat:@"%@",message.body]; - if (uid.integerValue > 0) { - [TTPopup dismiss]; - XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; - userInfoVC.uid = uid.integerValue; - [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:userInfoVC animated:YES]; - } - } else if([message.name isEqualToString:kJSInitNav]) { - [self initNav:message.body]; - } else if([message.name isEqualToString:kJSGetRoomUid]) { - NSString *js = [NSString stringWithFormat:@"getMessage(\"roomUid\",\"%@\")",self.roomUid]; - [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { - NSLog(@"%@",error); - }]; - } else if([message.name isEqualToString:kInitShowNav]) { - if (((NSNumber *)message.body).intValue == 0) { - if (self.InitShowNavBlock) { - self.InitShowNavBlock(YES); - return; - } - if (self.navigationController) { - [self.navigationController setNavigationBarHidden:YES]; - } - } - } else if([message.name isEqualToString:kCloseWebView]) { - if (self.CloseWebViewBlock) { - self.CloseWebViewBlock(YES); - return; - } - if (self.navigationController) { - [self.navigationController popViewControllerAnimated:YES]; - } - } else if ([message.name isEqualToString:kJumpAppointPage]) { - // h5与原生交互新协议 - NSDictionary *bodyDict; - if ([message.body isKindOfClass:[NSDictionary class]]) { - bodyDict = message.body; - } else if ([message.body isKindOfClass:[NSString class]]) { - NSString *str = (NSString *)message.body; - bodyDict = [str toJSONObject]; - } - NSInteger skyType = [bodyDict[@"routerType"] integerValue]; - [self handleRouterType:skyType message:message]; + if ([message.name isEqualToString:kJSOpenSharePage]) { + if (message.body && message.body != [NSNull null]) { + NSDictionary *body; + //不知道是哪个蓝精灵弄的,变成了个dic,所以我们要判断类型 + if ([message.body isKindOfClass:[NSDictionary class]]) { + body = message.body; + } else if ([message.body isKindOfClass:[NSString class]]) { + body = [message.body toJSONObject]; + } + self.shareDic = body[@"data"]; + [self showSharePanel]; + } + } else if ([message.name isEqualToString:kJSGetUid]) { + NSString *uid = [[AccountInfoStorage instance] getUid]; + NSString *js = [NSString stringWithFormat:@"getMessage(\"uid\",%@)", uid]; + [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { + NSLog(@"%@",error); + }]; + } else if ([message.name isEqualToString:kJSGetTicket]) { + NSString *ticket = [[AccountInfoStorage instance] getTicket]; + NSString *js = [NSString stringWithFormat:@"getMessage(\"ticket\",\"%@\")",ticket]; + [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { + NSLog(@"%@",error); + }]; + } else if ([message.name isEqualToString:kJSGetDeviceId]) { + NSString *js = [NSString stringWithFormat:@"getMessage(\"deviceId\",\"%@\")",[YYUtility deviceUniqueIdentification]]; + [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { + NSLog(@"%@",error); + }]; + } else if ([message.name isEqualToString:kJSGetDeviceInfo]) { + NSDictionary *basicParmars = [HttpRequestHelper configBaseParmars:[[NSDictionary alloc] init]]; + NSString *json = [basicParmars mj_JSONString]; + NSString *js = [NSString stringWithFormat:@"getMessage(\"deviceInfo\",%@)", json]; + [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable ohter, NSError * _Nullable error) { + NSLog(@"%@", error); + }]; + } else if ([message.name isEqualToString:kJSOpenPurse]) { + + }else if([message.name isEqualToString:kJSChargePayPage]){ + NSString *money = [NSString stringWithFormat:@"%@",message.body] ; + + }else if([message.name isEqualToString:kJSChargePayClickPage]){ + if(message.body != nil && self.model.diamonds != nil){ + NSString *type = [NSString stringWithFormat:@"%@",message.body]; + } + }else if ([message.name isEqualToString:kJSOpenChargePage]) { + if(self.delegate && [self.delegate respondsToSelector:@selector(payHandler)]){ + [self.delegate payHandler]; + return; + } + + + + [TTPopup dismiss]; + if(self.isPush){ + XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; + return; + } + UIViewController *controller = [XCCurrentVCStackManager shareManager].getCurrentVC; + if (controller.presentingViewController) { + [controller dismissViewControllerAnimated:NO completion:nil]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + + XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; + }); + }else { + XPIAPRechargeViewController * webVC =[[XPIAPRechargeViewController alloc] init]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES]; + } + } else if ([message.name isEqualToString:kOpenPersonPage]) { + NSString *uid = [NSString stringWithFormat:@"%@",message.body]; + if (uid.integerValue > 0) { + [TTPopup dismiss]; + XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init]; + userInfoVC.uid = uid.integerValue; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:userInfoVC animated:YES]; + } + } else if([message.name isEqualToString:kJSInitNav]) { + [self initNav:message.body]; + } else if([message.name isEqualToString:kJSGetRoomUid]) { + NSString *js = [NSString stringWithFormat:@"getMessage(\"roomUid\",\"%@\")",self.roomUid]; + [self.webview evaluateJavaScript:js completionHandler:^(id _Nullable other, NSError * _Nullable error) { + NSLog(@"%@",error); + }]; + } else if([message.name isEqualToString:kInitShowNav]) { + if (((NSNumber *)message.body).intValue == 0) { + if (self.InitShowNavBlock) { + self.InitShowNavBlock(YES); + return; + } + if (self.navigationController) { + [self.navigationController setNavigationBarHidden:YES]; + } + } + } else if([message.name isEqualToString:kCloseWebView]) { + if (self.CloseWebViewBlock) { + self.CloseWebViewBlock(YES); + return; + } + if (self.navigationController) { + [self.navigationController popViewControllerAnimated:YES]; + } + } else if ([message.name isEqualToString:kJumpAppointPage]) { + // h5与原生交互新协议 + NSDictionary *bodyDict; + if ([message.body isKindOfClass:[NSDictionary class]]) { + bodyDict = message.body; + } else if ([message.body isKindOfClass:[NSString class]]) { + NSString *str = (NSString *)message.body; + bodyDict = [str toJSONObject]; + } + NSInteger skyType = [bodyDict[@"routerType"] integerValue]; + [self handleRouterType:skyType message:message]; }else if ([message.name isEqualToString:kJSOpenChatPage]){ NSString *uid = [NSString stringWithFormat:@"%@",message.body]; if (uid.length > 0) { @@ -372,6 +372,14 @@ NSString * const kJSOpenChatPage = @"geToChatPage"; SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:sessionVC animated:YES]; } + }else if([message.name isEqualToString:kJSOpenAppConcernedChat]){ + NSString *uid = [NSString stringWithFormat:@"%@",message.body]; + if (uid.length > 0) { + NIMSession * session = [NIMSession session:uid type:NIMSessionTypeP2P]; + SessionViewController * sessionVC = [[SessionViewController alloc] initWithSession:session]; + sessionVC.isAttention = YES; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:sessionVC animated:YES]; + } }else if ([message.name isEqualToString:kJSOpenRoom]) { NSString *uid = [NSString stringWithFormat:@"%@",message.body]; if (uid.length > 0) { @@ -719,6 +727,9 @@ NSString * const kJSOpenChatPage = @"geToChatPage"; [_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenRoomForGiftId]; ///进入聊天 [_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenChatPage]; + ///进入聊天并关注 + [_pi_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenAppConcernedChat]; + } return _pi_userContentController;