You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.4 KiB

//
// TFBannerActionManager.m
// TFReader
//
// Created by 谢腾飞 on 2020/12/11.
// Copyright © 2020 xtfei_2011@126.com. All rights reserved.
//
#import "TFBannerActionManager.h"
#import "TFMemberViewController.h"
#import "TFTaskViewController.h"
#import "TFTaskViewController.h"
#import "TFRechargeViewController.h"
#import "WXYZ_FeedbackSubViewController.h"
#import "TFSetViewController.h"
#import "TFWebViewController.h"
@implementation TFBannerActionManager
+ (TFBasicViewController *_Nullable)getBannerActionWithBannerModel:(TFBannerModel *)bannerModel productionType:(TFProductionType)type
{
switch (bannerModel.action) {
case 1:
switch (type) {
#if TF_Enable_Book
case TFProductionTypeNovel: {
TFNovelDetailViewController *novelDetail = [[TFNovelDetailViewController alloc] init];
novelDetail.book_id = [bannerModel.content integerValue];
return novelDetail;
}
break;
#endif
#if TF_Enable_Comic
case TFProductionTypeComic: {
TFComicDetailViewController *comicDetail = [[TFComicDetailViewController alloc] init];
comicDetail.comic_id = [bannerModel.content integerValue];
return comicDetail;
}
break;
#endif
#if TF_Enable_Audio
case TFProductionTypeAudio: {
TFAudioDetailViewController *audioDetail = [[TFAudioDetailViewController alloc] init];
audioDetail.audio_id = [bannerModel.content integerValue];
return audioDetail;
}
break;
#endif
default:
break;
}
break;
case 2: {
if ([bannerModel.content isEqualToString:@"vip"]) { // 会员中心
return [[TFMemberViewController alloc] init];
} else if ([bannerModel.content isEqualToString:@"task"]) { // 任务
return [[TFTaskViewController alloc] init];
} else if ([bannerModel.content isEqualToString:@"sign"]) { // 签到
return [[TFTaskViewController alloc] init];
} else if ([bannerModel.content isEqualToString:@"recharge"]) { // 金币充值
return [[TFRechargeViewController alloc] init];
} else if ([bannerModel.content isEqualToString:@"feedback"]) { // 意见反馈
return [[WXYZ_FeedbackSubViewController alloc] init];
} else if ([bannerModel.content isEqualToString:@"setting"]) { // 设置
return [[TFSetViewController alloc] init];
}
}
break;
case 3: {
TFWebViewController *vc = [[TFWebViewController alloc] init];
vc.URLString = bannerModel.content;
return vc;
}
break;
case 4:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:bannerModel.content] options:@{} completionHandler:nil];
break;
default:
break;
}
return nil;
}
@end