123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- //
- // ASJumpHandler.m
- // Asteria
- //
- // Created by xingyu on 2024/7/12.
- //
- #import "ASJumpHandler.h"
- #import "ASOrderListViewController.h"
- #import "Cart_MyCartC.h"
- #import "ASMessageListViewController.h"
- #import "ASProductListViewController.h"
- #import "ASGoodsDetailsViewController.h"
- #import "ASPointsHomeViewController.h"
- #import "ASVipCenterViewController.h"
- #import "ASCouponsListViewController.h"
- @implementation ASJumpHandler
- static ASJumpHandler *jumpHandler = nil;
- + (instancetype)shareInstance{
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- jumpHandler = [[ASJumpHandler alloc] init];
- });
- return jumpHandler;
- }
- - (void)handleMessage:(NSString *)title messageId:(NSString *)mid pushPara:(NSString *)push_para pushType:(NSInteger)type {
-
- [self handleJumpWithTitle:title jumpData:push_para type:type];
- }
- - (void)handleJumpWithTitle:(NSString *)title jumpData:(NSString *)jumpData type:(NSInteger)type {
-
-
- UIViewController *topVC = topViewController();
- /// 跳转类型 0:url 1:商品列表 2:订单列表 3:商品详情 4:购物车 5:消息列表
- /// 2024-02-27新增: 6.explore首页 7.explore详情 8.我的积分 9.koc 10.vip Center 11.我的优惠券 12. 登录注册, 13.签到 14.首页
- switch (type) {
- case 0:
- [Fuction_Tool push_BaseWebUrl:jumpData webTitle:title];
- break;
- case 1:
- [self pushToProductList:title typeid:jumpData];
- break;
- case 2:
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
-
- if (![topVC isKindOfClass:[ASOrderListViewController class]]) {
- ASOrderListViewController *orderC = [[ASOrderListViewController alloc] init];
- [topVC.navigationController pushViewController:orderC animated:true];
- }
- }
- break;
- case 3:
- [self goto_WKM_GoodsDetailsC:jumpData];
- break;
- case 4:
- {
-
- if (![topVC isKindOfClass:[Cart_MyCartC class]]) {
- Cart_MyCartC *cartC = [[Cart_MyCartC alloc]init];
- [topVC.navigationController pushViewController:cartC animated:true];
- }
- }
- break;
- case 5: {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
-
- if (![topVC isKindOfClass:[ASMessageListViewController class]]) {
- ASMessageListViewController *mesVC = [[ASMessageListViewController alloc]init];
- [topVC.navigationController pushViewController:mesVC animated:true];
- }
- }
- break;
- case 6:// explore列表
- {
- // [Fuction_Tool navPopRootToExpolerVC];
- }
- break;
- case 7:// explore详情
- {
- // [self goto_exploreDetailsC:push_para];
- }
- break;
- case 8:// 积分
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
- [self to_pointsVc];
- }
- break;
- case 9:// koc
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
- [self to_KocVc];
- }
- break;
- case 10:// vip center
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
- [self to_vipCenter];
- }
- break;
- case 11:// 我的优惠券
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
- NSInteger index = jumpData.integerValue;
- [self to_couponsVc:index];
- }
- break;
- case 12://登录注册
- {
- [Fuction_Tool pop_toLoginVC];
- }
- break;
- case 13://签到
- {
- if (!ASUserInfoManager.shared.isLogin) {
- [Fuction_Tool pop_toLoginVC];
- return;
- }
- [self to_checkInVc];
- }
- break;
- case 14:// 首页
- [Fuction_Tool popToHomeVc];
- break;
- default:
- if (jumpData.isValidUrl) {
- [Fuction_Tool push_BaseWebUrl:jumpData webTitle:title];
-
- }
- break;
- }
- }
- -(void)pushToProductList:(NSString *)name typeid:(NSString *)typeId {
- if (typeId == nil || [typeId isEqualToString:@""]) {
- return;
- }
- if (name == nil || [name isEqualToString:@""]) {
- name = @"Products";
- }
- ASProductListViewController *vc = [[ASProductListViewController alloc] init];
- vc.titleName = name;
- vc.type = typeId;
- [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
- }
- -(void)goto_WKM_GoodsDetailsC:(NSString *)entity_id {
- ASGoodsDetailsViewController *vc = [[ASGoodsDetailsViewController alloc]init];
- vc.entity_id = entity_id;
- [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
- }
- //// 跳explore详情
- //-(void)goto_exploreDetailsC:(NSString *)entity_id {
- // UIViewController *topC = [Current_normalTool topViewController];
- // if ([topC isKindOfClass:AP_ExploreDetailsC.class]) {
- // return;
- // }
- // AP_ExploreDetailsC *vc = [[AP_ExploreDetailsC alloc]init];
- // ExploreListM *m = [[ExploreListM alloc] init];
- // m.listId = entity_id;
- // vc.listModel = m;
- // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:YES];
- //
- //}
- - (void)to_pointsVc {
- UIViewController *topC = [Current_normalTool topViewController];
- if ([topC isKindOfClass:ASPointsHomeViewController.class]) {
- return;
- }
- ASPointsHomeViewController *vc = [[ASPointsHomeViewController alloc] init];
- [topC.navigationController pushViewController:vc animated:true];
- }
- - (void)to_KocVc {
- // UIViewController *vc = [Current_normalTool topViewController];
- // if ([vc isKindOfClass:KWBrandAMBViewController.class] || [vc isKindOfClass:[APKocTotalViewController class]]) {
- // return;
- // }
- // UIWindow *w = UIApplication.sharedApplication.windows.firstObject;
- // [MBProgressHUD showHUDAddedTo:w animated:true];
- // __block BOOL hadPush = false;
- // [[KWBalanceInfoManager shareInstance] updateApplyStatus:^(BOOL flag) {
- // [MBProgressHUD hideHUDForView:w animated:true];
- // if (hadPush) {
- // return;
- // }
- // hadPush = true;
- // if (![KWBalanceInfoManager shareInstance].isApply) {
- // KWBrandAMBViewController *vc = [KWBrandAMBViewController new];
- // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
- // } else {
- // APKocTotalViewController *vc = [[APKocTotalViewController alloc] init];
- // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
- // }
- // }];
- }
- - (void)to_vipCenter {
- UIViewController *vc = [Current_normalTool topViewController];
- // [MBProgressHUD showHUDAddedTo:vc.view animated:true];
- // __block BOOL hadPush = false;
- //
- // [KWLoginedManager.shareInstance getAllLevelInfo:^(bool flag) {
- // if (hadPush) {
- // return;
- // }
- // hadPush = true;
- // [MBProgressHUD hideHUDForView:vc.view animated:true];
- // ASVipCenterViewController *vc = [[ASVipCenterViewController alloc] init];
- // vc.currentLeave = KWLoginedManager.shareInstance.levelInfo.level;
- // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
- // }];
-
-
- ASVipCenterViewController *vipCenterVC = [[ASVipCenterViewController alloc] init];
- // vipCenterVC.currentLeave = KWLoginedManager.shareInstance.levelInfo.level;
- [vc.navigationController pushViewController:vipCenterVC animated:true];
- }
- - (void)to_couponsVc:(NSInteger)index {
- ASCouponsListViewController *vc = [[ASCouponsListViewController alloc] init];
- [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
- }
- - (void)to_checkInVc {
- // WK_CheckPointsC *vc = [[WK_CheckPointsC alloc] init];
- // KWLoginedUserModel *m = [KWLoginedManager.shareInstance getCurrentLoginedUser];
- // vc.points = m.points;
- // [[Current_normalTool topViewController].navigationController pushViewController:vc animated:true];
- }
- @end
|