主播卡片弹出时手机震动

This commit is contained in:
chenguilong
2022-08-04 11:42:49 +08:00
parent f3e1d3d204
commit 2da12a4e4f
3 changed files with 129 additions and 39 deletions

View File

@@ -20,6 +20,10 @@
#import "XCCurrentVCStackManager.h"
#import "XPMineUserInfoViewController.h"
#import "XPMineRechargeViewController.h"
///vc
#import "XPMineDressUpViewController.h"
#import "XPDressUpShopViewController.h"
#import "XPRoomViewController.h"
typedef NS_ENUM(NSUInteger, RightNavigationPushType){
///h5
@@ -83,6 +87,8 @@ NSString * const kJSGetRoomUid = @"getRoomUid";
NSString * const kOpenPersonPage = @"openPersonPage";
NSString * const kInitShowNav = @"initShowNav";
NSString * const kCloseWebView = @"closeWebView";
NSString * const kJumpAppointPage = @"jumpAppointPage";
NSString * const kJSOpenRoom = @"openRoom";
@implementation XPWebViewController
@@ -262,11 +268,124 @@ NSString * const kCloseWebView = @"closeWebView";
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:kJSOpenRoom]) {
// 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];
// }
NSString *uid = [NSString stringWithFormat:@"%@",message.body];
if (uid.length > 0) {
[XPRoomViewController openRoom:uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
}
}
}];
}
#pragma mark - private method
- (void)handleRouterType:(NSInteger)skyType message:(WKScriptMessage *)message {
NSDictionary *bodyDict = (NSDictionary *)message.body;
switch (skyType) {
case 1:
{
// uid
NSString *uid = [NSString stringWithFormat:@"%@", bodyDict[@"routerVal"]];
if (uid.length) {
[XPRoomViewController openRoom:uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
}
}
break;
// case P2PInteractive_SkipType_H5:
// {
// //H5
// NSString *urlString = [NSString stringWithFormat:@"%@", bodyDict[@"routerVal"]];
// if (urlString.length) {
// XCWKWebViewController *vc = [[[self class] alloc] init];
// vc.urlString = urlString;
// [self.navigationController pushViewController:vc animated:YES];
// }
// }
// break;
// case P2PInteractive_SkipType_Purse:
// {
// //
// [self h5OpenPurseAction:message];
// }
// break;
// case P2PInteractive_SkipType_Recharge:
// {
// //
// [self h5OpenChargePageAction:message];
// }
// break;
// case P2PInteractive_SkipType_Person:
// {
// // uid
// NSString *uid = [NSString stringWithFormat:@"%@", bodyDict[@"routerVal"]];
// if (uid.length) {
// [self h5OpenPersonPageAction:uid.userIDValue message:message];
// }
// }
// break;
case 7:
{
//
XPMineDressUpViewController *vc = [[XPMineDressUpViewController alloc] init];
vc.currentIndex = 1;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:vc animated:YES];
}
break;
case 8:
{
//
XPMineDressUpViewController *vc = [[XPMineDressUpViewController alloc] init];
vc.currentIndex = 0;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:vc animated:YES];
}
break;
// case P2PInteractive_SkipType_SystemMessage:
// {
// //
// [self h5JumpSystemMessageAction:message];
// }
// break;
case 73:
{
//
NSString *index = [NSString stringWithFormat:@"%@", bodyDict[@"routerVal"]];
XPDressUpShopViewController *vc = [[XPDressUpShopViewController alloc] init];
vc.currentIndex = [index integerValue];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:vc animated:YES];
}
break;
case 74:
{
//
NSString *index = [NSString stringWithFormat:@"%@", bodyDict[@"routerVal"]];
XPMineDressUpViewController *vc = [[XPMineDressUpViewController alloc] init];
vc.currentIndex = [index integerValue];
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:vc animated:YES];
}
break;
default:
break;
}
}
- (void)setUrl:(NSString *)urlString{
_url = urlString;
if (_url == nil) {
@@ -517,7 +636,10 @@ NSString * const kCloseWebView = @"closeWebView";
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kInitShowNav];
//
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kCloseWebView];
//
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJumpAppointPage];
//
[_userContentController addScriptMessageHandler:weakScriptMessageDelegate name:kJSOpenRoom];
}
return _userContentController;
}