diff --git a/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m b/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m index 71092f72..be3b7857 100644 --- a/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m +++ b/xplan-ios/Main/Tabbar/View/AnchorCard/XPAnchorCardView.m @@ -64,8 +64,8 @@ - (void)removeFromSuperview { [super removeFromSuperview]; - [self resumeTimer]; if (self.isPlaying) { + [self resumeTimer]; [[XPSkillCardPlayerManager shareInstance] stopMusic]; } } diff --git a/xplan-ios/Main/Tabbar/View/TabbarViewController.m b/xplan-ios/Main/Tabbar/View/TabbarViewController.m index 712e7b5d..96a1f852 100644 --- a/xplan-ios/Main/Tabbar/View/TabbarViewController.m +++ b/xplan-ios/Main/Tabbar/View/TabbarViewController.m @@ -10,6 +10,7 @@ #import #import #import +#import ///Tool #import "XPMacro.h" #import "ThemeColor.h" @@ -141,7 +142,7 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; vc.hadAnimate = YES; [self.selectedViewController.navigationController presentViewController:vc animated:YES completion:nil]; } - if ([self hadLaunchApp] && (self.selectedIndex == 0 | self.selectedIndex == 1) && [self canShowAnchorCard]) { + if ([self hadLaunchApp] && [self canShowAnchorCard]) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ if (self.view.window && self.isViewLoaded) { [self.presenter getAnchorCardInfo]; @@ -258,11 +259,8 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; self.anchorCardView.frame = CGRectMake(0, -90-kStatusBarHeight, KScreenWidth, 90); [UIView animateWithDuration:0.5 animations:^{ self.anchorCardView.frame = CGRectMake(0, kStatusBarHeight, KScreenWidth, 90); - } completion:^(BOOL finished) { - if (finished) { - [self shakeAction]; - } - }]; + } completion:nil]; + AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);//默认震动效果 long time = (long)([[NSDate date] timeIntervalSince1970]*1000); [[NSUserDefaults standardUserDefaults] setObject:@(time) forKey:kLastShowAnchorCardTime]; [[NSUserDefaults standardUserDefaults] synchronize]; @@ -274,36 +272,6 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey; } } -///主播卡片震动动画 -- (void)shakeAction { - // 晃动次数 - static int numberOfShakes = 4; - // 晃动幅度(相对于总宽度) - static float vigourOfShake = 0.04f; - // 晃动延续时常(秒) - static float durationOfShake = 0.5f; - CAKeyframeAnimation *shakeAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"]; - //关键帧(点) - CGPoint layerPosition = self.anchorCardView.layer.position; - // 起始点 - NSValue *value1 = [NSValue valueWithCGPoint:self.anchorCardView.layer.position]; - // 关键点数组 - NSMutableArray *values = [[NSMutableArray alloc] initWithObjects:value1, nil]; - for (int i = 0; i 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; }