Commit 5f6266a1 by 刘卓鑫

预约洗浴代码

parent 49adcba8
//
//
// ZXAppointBathTabbarViewController.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXAppointBathTabbarViewController : UITabBarController
@end
NS_ASSUME_NONNULL_END
//
//
// ZXAppointBathTabbarViewController.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAppointBathTabbarViewController.h"
#import "ZXAppointBathViewController.h"
#import "ZXBathAppointRecordViewController.h"
@interface ZXAppointBathTabbarViewController ()
@end
@implementation ZXAppointBathTabbarViewController
- (void)viewDidLoad {
[super viewDidLoad];
ZXAppointBathViewController *bathVc = [[ZXAppointBathViewController alloc] init];
ZXBathAppointRecordViewController *recordVC = [[ZXBathAppointRecordViewController alloc] init];
[self addChildViewController:bathVc];
[self addChildViewController:recordVC];
bathVc.tabBarItem.title = @"洗浴预约";
bathVc.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_laundry_check"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
bathVc.tabBarItem.image = [UIImage imageNamed:@"tab_laundry_default"];
recordVC.tabBarItem.title = @"预约记录";
recordVC.tabBarItem.selectedImage = [[UIImage imageNamed:@"tab_Laundryrecord_check"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
recordVC.tabBarItem.image = [UIImage imageNamed:@"tab_Laundryrecord_default"];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:kRGB(51, 51, 51), NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:kRGB(238, 125, 31),NSForegroundColorAttributeName, nil]forState:UIControlStateSelected];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
//
//
// ZXAppointBathViewController.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXAppointBathViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
//
// ZXBathAppointRecordViewController.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXBathAppointRecordViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
//
//
// ZXBathAppointRecordViewController.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXBathAppointRecordViewController.h"
#import "enlargeClickRegionBtn.h"
#import "ZXAppointBathService.h"
#import "ZXAppointBathRecordCell.h"
@interface ZXBathAppointRecordViewController ()<UITableViewDelegate , UITableViewDataSource>
@property (nonatomic, strong) UITableView *myTableview;
@property (nonatomic, strong) ZXAppointBathService *service;
@end
@implementation ZXBathAppointRecordViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self createNabar];
[self.view addSubview:self.myTableview];
self.service = [[ZXAppointBathService alloc] init];
[self loadNewData];
}
#pragma mark - ========== 创建导航栏 ==========
- (void) createNabar {
[UIApplication sharedApplication].statusBarHidden = NO;
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
UIImage *image = [UIImage imageNamed:@"wash-bg"];
UIImageView *nabar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenWidth * image.size.height / image.size.width)];
nabar.backgroundColor = [UIColor whiteColor];
nabar.userInteractionEnabled = YES;
nabar.image = image;
[self.view addSubview:nabar];
UILabel *naTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kStatusBarHeight, kScreenWidth, kNavBarHeight)];
naTitle.backgroundColor = [UIColor clearColor];
naTitle.textAlignment = NSTextAlignmentCenter;
naTitle.textColor = [UIColor whiteColor];
naTitle.font = [UIFont boldSystemFontOfSize:17 * k6Scale];
naTitle.userInteractionEnabled = YES;
[nabar addSubview:naTitle];
naTitle.text = @"预约记录";
enlargeClickRegionBtn *back = [[enlargeClickRegionBtn alloc] init];
[back setImage:[UIImage imageNamed:@"nav_return"] forState:UIControlStateNormal];
[naTitle addSubview:back];
[back mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(naTitle.mas_left).offset(5 * k6Scale);
make.width.height.mas_equalTo(30 * k6Scale);
make.centerY.equalTo(naTitle);
}];
@weakify(self);
[[back rac_signalForControlEvents:UIControlEventTouchDown] subscribeNext:^(id x) {
@strongify(self);
[self.navigationController popViewControllerAnimated:YES];
}];
}
- (UITableView *)myTableview {
if (_myTableview == nil) {
CGFloat bottomMargin = 0;
if (iPhoneX) {
bottomMargin = 34;
}
_myTableview = [[UITableView alloc] initWithFrame:CGRectMake(0, kTopHeight, kScreenWidth, kScreenHeight - kTopHeight - 49 - bottomMargin) style:UITableViewStylePlain];
_myTableview.delegate = self;
_myTableview.dataSource = self;
_myTableview.separatorStyle = UITableViewCellSeparatorStyleNone;
_myTableview.backgroundColor = kRGBColor(243, 243, 243, 1);
if (@available(iOS 11.0, *)) {
_myTableview.estimatedRowHeight = 0;
_myTableview.estimatedSectionFooterHeight = 0;
_myTableview.estimatedSectionHeaderHeight = 0;
_myTableview.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
}
//下拉刷新
_myTableview.mj_header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(loadNewData)];
//上拉加载
_myTableview.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(loadMoreData)]; self.myTableview.showsVerticalScrollIndicator = NO;
}
return _myTableview;
}
#pragma mark - ==========下拉刷新==========
- (void) loadNewData {
[self.service loadNewAppointRecordListCompleted:^(BOOL is) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
[self.myTableview.mj_header endRefreshing];
[self.myTableview.mj_footer endRefreshing];
if (is) {
[self.myTableview reloadData];
}
});
}];
}
#pragma mark - ==========上拉加载==========
- (void) loadMoreData {
[self.service loadMoreAppointRecordListCompleted:^(BOOL is) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
[self.myTableview.mj_header endRefreshing];
if (self.service.dataSource.count % 10 || self.service.dataSource.count == 0) {
[self.myTableview.mj_footer endRefreshingWithNoMoreData];
} else {
[self.myTableview.mj_footer endRefreshing];
}
if (is) {
[self.myTableview reloadData];
}
});
}];
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.service.recordDataSource.count;
}
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
ZXAppointBathRecordCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ZXAppointBathRecordCell"];
if (cell == nil) {
cell = [[ZXAppointBathRecordCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"ZXAppointBathRecordCell"];
}
cell.recordModel = self.service.recordDataSource[indexPath.row];
return cell;
}
- (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 195 * k6Scale;;
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
//
// ZXAppointBathModel.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface ZXAppointBathModel : NSObject
@property (nonatomic, assign) BOOL appointable;
@property (nonatomic, copy) NSString *location;
@property (nonatomic, copy) NSString *code;
/*是否在惩罚中*/
@property (nonatomic, assign) BOOL inPunishment;
@end
NS_ASSUME_NONNULL_END
//
// ZXAppointBathModel.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAppointBathModel.h"
@implementation ZXAppointBathModel
@end
//
//
// ZXAppointBathService.h
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "ZXAppointForbbidenModel.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^isNeedReload)(BOOL is);
@interface ZXAppointBathService : NSObject
@property (nonatomic, strong) NSMutableArray *dataSource;
@property (nonatomic, strong) NSMutableArray *recordDataSource;
@property (nonatomic, strong) ZXAppointForbbidenModel *forbiddenModel;
/*获取最新设备列表*/
- (void) loadNewMerthinListByLocation:(NSString *) location completed:(isNeedReload) completed;
/*获取下一页设备列表*/
- (void) loadMoreMerthinListByLocation:(NSString *) location completed:(isNeedReload) completed;
/*校验用户是否被禁用预约功能*/
- (void) loadIsForbiddenCompleted:(isNeedReload) completed;
/*预约设备*/
- (void) appointDevice:(NSString *) merthineCode completed:(isNeedReload) completed;
/*最新的预约记录*/
- (void) loadNewAppointRecordListCompleted:(isNeedReload) completed;
/*次页的预约记录*/
- (void) loadMoreAppointRecordListCompleted:(isNeedReload) completed;
/*获取预约结果*/
- (void) getAppointResultByRecordId:(NSInteger) recordId completed:(isNeedReload) completed;
/*获取校区使用模式*/
-(void) getCampusUseModeCompleted:(isNeedReload) completed;
/*查询洗浴控制信息*/
+ (void) checkBathConfigCompleted:(dispatch_block_t) completed;
@end
NS_ASSUME_NONNULL_END
//
// ZXAppointBathService.m
// ColorfulSchool
//
// Created by 刘卓鑫 on 2019/6/25.
// Copyright © 2019 Colorful Any Door. All rights reserved.
//
#import "ZXAppointBathService.h"
#import "ZXAppointBathModel.h"
#import "ZXAppointRecordModel.h"
#import "ZXBathConfig.h"
@interface ZXAppointBathService()
@property (nonatomic, assign) NSInteger currentPage;
@property (nonatomic, assign) NSInteger currentRecordPage;
@end
@implementation ZXAppointBathService
- (NSMutableArray *)dataSource {
if (!_dataSource) {
_dataSource = [[NSMutableArray alloc] init];
}
return _dataSource;
}
- (NSMutableArray *)recordDataSource {
if (!_recordDataSource) {
_recordDataSource = [[NSMutableArray alloc] init];
}
return _recordDataSource;
}
/*获取最新设备列表*/
- (void) loadNewMerthinListByLocation:(NSString *) location completed:(isNeedReload) completed {
self.currentPage = 1;
[self loadMerthinListByLocation:location completed:completed];
}
/*获取下一页设备列表*/
- (void) loadMoreMerthinListByLocation:(NSString *) location completed:(isNeedReload) completed {
self.currentPage++;
[self loadMerthinListByLocation:location completed:completed];
}
- (void) loadMerthinListByLocation:(NSString *) location completed:(isNeedReload) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/devices?pageNum=%ld&pageSize=10&location=%@&campusId=%@&userId=%@", [kUserDefaults valueForKey:@"AppointBATH"], self.currentPage, location, CacheCampusId, CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error];
[ZXTool hideLoadingAnimation];
completed(NO);
});
} else {
//数据解析
if (self.currentPage == 1) {
[self.dataSource removeAllObjects];
}
[self.dataSource addObjectsFromArray:[ZXAppointBathModel mj_objectArrayWithKeyValuesArray:common.data[@"list"]]];
completed(YES);
}
}];
}
/*校验用户是否被禁用预约功能*/
- (void) loadIsForbiddenCompleted:(isNeedReload) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/user/%@/appointable/%@", [kUserDefaults valueForKey:@"AppointBATH"], CacheUserId, CacheCampusId] para:nil completed:^(CommonModel *common, NSString *error) {
if (common.data) {
self.forbiddenModel = [ZXAppointForbbidenModel mj_objectWithKeyValues:common.data];
completed(YES);
} else {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
});
}
}];
}
/*预约设备*/
- (void) appointDevice:(NSString *) merthineCode completed:(isNeedReload) completed {
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/appointing", [kUserDefaults valueForKey:@"AppointBATH"]] para:@{@"deviceCode":merthineCode, @"phone":CacheAccount, @"userId":CacheUserId, @"userName":[kUserDefaults valueForKey:@"username"], @"account":[kUserDefaults objectForKey:@"sbaccount"]?[kUserDefaults objectForKey:@"sbaccount"]:@""} completed:^(CommonModel *common, NSString *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error];
[ZXTool hideLoadingAnimation];
});
} else {
[self getAppointResultByRecordId:[common.data integerValue] times:1 completed:completed];
}
}];
}
/*最新的预约记录*/
- (void) loadNewAppointRecordListCompleted:(isNeedReload) completed {
self.currentRecordPage = 1;
[self loadRecordListCompleted:completed];
}
/*次页的预约记录*/
- (void) loadMoreAppointRecordListCompleted:(isNeedReload) completed {
self.currentRecordPage ++;
[self loadRecordListCompleted:completed];
}
/*获取预约记录列表*/
- (void) loadRecordListCompleted:(isNeedReload) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/appointRecords?pageNum=%ld&pageSize=10&userId=%@", [kUserDefaults valueForKey:@"AppointBATH"], (long)self.currentRecordPage, CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error];
[ZXTool hideLoadingAnimation];
completed(NO);
});
} else {
//数据解析
if (self.currentRecordPage == 1) {
[self.recordDataSource removeAllObjects];
}
[self.recordDataSource addObjectsFromArray:[ZXAppointRecordModel mj_objectArrayWithKeyValuesArray:common.data[@"list"]]];
completed(YES);
}
}];
}
/*获取预约结果*/
- (void) getAppointResultByRecordId:(NSInteger) recordId
times:(NSInteger) times
completed:(isNeedReload) completed {
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/appointResult/%ld?userId=%@&recordId=%ld", [kUserDefaults valueForKey:@"AppointBATH"], (long)recordId,CacheUserId, (long)recordId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error];
[ZXTool hideLoadingAnimation];
});
} else {
//1成功 4失败
if ([common.data integerValue]==1) {
completed(YES);//成功
}if ([common.data integerValue]==4) {
completed(NO);//成功
} else {
if (times > 5) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
[ZXTool showText:common.msg?common.msg:@"请求超时"];
});
} else {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self getAppointResultByRecordId:recordId times:(times+1) completed:completed];
});
}
}
}
}];
}
-(void) getCampusUseModeCompleted:(isNeedReload) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/appointment/usetype/%@", [kUserDefaults valueForKey:@"AppointBATH"], CacheCampusId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if ([common.data integerValue] == 3) {
completed(YES);
} else {
completed(NO);
}
}
});
}];
}
#pragma mark - ==========查询洗浴控制信息==========
+ (void) checkBathConfigCompleted:(dispatch_block_t) completed {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/shower/controllerConfigs?customerId=%@&campusId=%@", [kUserDefaults valueForKey:@"AppointBATH"], CacheUserId, CacheCampusId] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
if (error) {
[ZXTool showText:error];
} else {
ZXBathConfig *config = [ZXBathConfig mj_objectWithKeyValues:common.data];
if (config) {
[ZXBathConfig clearTable];
[config save];
completed();
}
}
});
}];
}
@end
//
// GDTHybridAd.h
// GDTMobApp
//
// Created by royqpwang on 2019/3/8.
// Copyright © 2019 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_OPTIONS(NSInteger, GDTHybridAdOptions) {
GDTHybridAdOptionRewardVideo = 1 << 0
};
@class GDTHybridAd;
@protocol GDTHybridAdDelegate <NSObject>
@optional
- (void)gdt_hybridAdDidPresented:(GDTHybridAd *)hybridAd;
- (void)gdt_hybridAdDidClose:(GDTHybridAd *)hybridAd;
- (void)gdt_hybridAdLoadURLSuccess:(GDTHybridAd *)hybridAd;
- (void)gdt_hybridAd:(GDTHybridAd *)hybridAd didFailWithError:(NSError *)error;
@end
@interface GDTHybridAd : NSObject
/**
自定义浏览器 UI 属性,请在 showWithRootViewController: 方法前设置。
*/
@property (nonatomic, copy) NSString *titleContent;
@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, strong) UIColor *navigationBarColor;
@property (nonatomic, strong) UIColor *navigationBarBottomColor;
@property (nonatomic, strong) UIColor *separatorLineColor;
@property (nonatomic, strong) UIImage *closeImage; // 如需自定义关闭图片,请按 44*44 大小设置
@property (nonatomic, strong) UIImage *backImage; // 如需自定义后退图片,请按 44*44 大小设置
/**
委托对象
*/
@property (nonatomic, weak) id <GDTHybridAdDelegate> delegate;
/**
构造方法
@param appId - 媒体 ID
@param adOptions - 支持的广告类型 Options,激励视频请传 GDTHybridAdOptionRewardVideo
@return GDTHybrid 实例
*/
- (instancetype)initWithAppId:(NSString *)appId type:(GDTHybridAdOptions)adOptions;
/**
加载广告方法 支持 iOS8.1 及以上系统
@param url 加载的 X 中心 URL
*/
- (void)loadWithUrl:(NSString *)url;
/**
展示浏览器方法
@param rootViewController 用于 present 浏览器 VC
*/
- (void)showWithRootViewController:(UIViewController *)rootViewController;
@end
NS_ASSUME_NONNULL_END
//
// GDTUnifiedBannerView.h
// GDTMobSDK
//
// Created by nimomeng on 2019/3/1.
// Copyright © 2019 Tencent. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class GDTUnifiedBannerView;
@protocol GDTUnifiedBannerViewDelegate <NSObject>
@optional
/**
* 请求广告条数据成功后调用
* 当接收服务器返回的广告数据成功后调用该函数
*/
- (void)unifiedBannerViewDidLoad:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* 请求广告条数据失败后调用
* 当接收服务器返回的广告数据失败后调用该函数
*/
- (void)unifiedBannerViewFailedToLoad:(GDTUnifiedBannerView *)unifiedBannerView error:(NSError *)error;
/**
* banner2.0曝光回调
*/
- (void)unifiedBannerViewWillExpose:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* banner2.0点击回调
*/
- (void)unifiedBannerViewClicked:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* banner2.0广告点击以后即将弹出全屏广告页
*/
- (void)unifiedBannerViewWillPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* banner2.0广告点击以后弹出全屏广告页完毕
*/
- (void)unifiedBannerViewDidPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* 全屏广告页即将被关闭
*/
- (void)unifiedBannerViewWillDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* 全屏广告页已经被关闭
*/
- (void)unifiedBannerViewDidDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* 当点击应用下载或者广告调用系统程序打开
*/
- (void)unifiedBannerViewWillLeaveApplication:(GDTUnifiedBannerView *)unifiedBannerView;
/**
* banner2.0被用户关闭时调用
*/
- (void)unifiedBannerViewWillClose:(GDTUnifiedBannerView *)unifiedBannerView;
@end
@interface GDTUnifiedBannerView : UIView
/**
* 委托 [可选]
*/
@property (nonatomic, weak) id<GDTUnifiedBannerViewDelegate> delegate;
/**
* Banner展现和轮播时的动画效果开关,默认打开
*/
@property (nonatomic) BOOL animated;
/**
* 广告刷新间隔,范围 [30, 120] 秒,默认值 30 秒。设 0 则不刷新。 [可选]
*/
@property (nonatomic) int autoSwitchInterval;
/**
* 构造方法
* 详解:appId - 媒体 ID
* placementId - 广告位 ID
* viewController - 视图控制器
*/
- (instancetype)initWithAppId:(NSString *)appId
placementId:(NSString *)placementId
viewController:(UIViewController *)viewController;
/**
* 构造方法
* 详解:frame - banner 展示的位置和大小
* appId - 媒体 ID
* placementId - 广告位 ID
* viewController - 视图控制器
*/
- (instancetype)initWithFrame:(CGRect)frame
appId:(NSString *)appId
placementId:(NSString *)placementId
viewController:(UIViewController *)viewController;
/**
* 拉取并展示广告
*/
- (void)loadAdAndShow;
@end
NS_ASSUME_NONNULL_END
//
// GDTUnifiedInterstitialAd.h
// GDTMobApp
//
// Created by nimomeng on 2019/3/4.
// Copyright © 2019 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class GDTUnifiedInterstitialAd;
@protocol GDTUnifiedInterstitialAdDelegate <NSObject>
@optional
/**
* 插屏2.0广告预加载成功回调
* 当接收服务器返回的广告数据成功后调用该函数
*/
- (void)unifiedInterstitialSuccessToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 插屏2.0广告预加载失败回调
* 当接收服务器返回的广告数据失败后调用该函数
*/
- (void)unifiedInterstitialFailToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial error:(NSError *)error;
/**
* 插屏2.0广告将要展示回调
* 插屏2.0广告即将展示回调该函数
*/
- (void)unifiedInterstitialWillPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 插屏2.0广告视图展示成功回调
* 插屏2.0广告展示成功回调该函数
*/
- (void)unifiedInterstitialDidPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 插屏2.0广告展示结束回调
* 插屏2.0广告展示结束回调该函数
*/
- (void)unifiedInterstitialDidDismissScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 当点击下载应用时会调用系统程序打开其它App或者Appstore时回调
*/
- (void)unifiedInterstitialWillLeaveApplication:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 插屏2.0广告曝光回调
*/
- (void)unifiedInterstitialWillExposure:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 插屏2.0广告点击回调
*/
- (void)unifiedInterstitialClicked:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 点击插屏2.0广告以后即将弹出全屏广告页
*/
- (void)unifiedInterstitialAdWillPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 点击插屏2.0广告以后弹出全屏广告页
*/
- (void)unifiedInterstitialAdDidPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 全屏广告页将要关闭
*/
- (void)unifiedInterstitialAdWillDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
/**
* 全屏广告页被关闭
*/
- (void)unifiedInterstitialAdDidDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial;
@end
@interface GDTUnifiedInterstitialAd : NSObject
/**
* 插屏2.0广告预加载是否完成
*/
@property (nonatomic, readonly) BOOL isAdValid;
/**
* 委托对象
*/
@property (nonatomic, weak) id<GDTUnifiedInterstitialAdDelegate> delegate;
/**
* 构造方法
* 详解:appId - 媒体 ID
* placementId - 广告位 ID
*/
- (instancetype)initWithAppId:(NSString *)appId placementId:(NSString *)placementId;
/**
* 广告发起请求方法
* 详解:[必选]发起拉取广告请求
*/
- (void)loadAd;
/**
* 广告展示方法
* 详解:[必选]发起展示广告请求, 必须传入用于显示插播广告的UIViewController
*/
- (void)presentAdFromRootViewController:(UIViewController *)rootViewController;
/**
返回广告的eCPM,单位:分
@return 成功返回一个大于等于0的值,-1表示无权限或后台出现异常
*/
- (NSInteger)eCPM;
@end
NS_ASSUME_NONNULL_END
//
// GDTVideoConfig.h
// GDTMobApp
//
// Created by royqpwang on 2019/5/16.
// Copyright © 2019 Tencent. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, GDTVideoAutoPlayPolicy) {
GDTVideoAutoPlayPolicyWIFI = 0, // WIFI 下自动播放
GDTVideoAutoPlayPolicyAlways = 1, // 总是自动播放,无论网络条件
GDTVideoAutoPlayPolicyNever = 2, // 从不自动播放,无论网络条件
};
NS_ASSUME_NONNULL_BEGIN
@interface GDTVideoConfig : NSObject
/**
视频自动播放策略,默认 GDTVideoAutoPlayPolicyWIFI,
选择 GDTVideoAutoPlayPolicyNever 策略时,需要开发者调用 GDTMediaView 的 play\pause 方法触发视频播、暂停,
或者开启 userControlEnable 设置,让用户点击 MediaView 控制播放状态
*/
@property (nonatomic, assign) GDTVideoAutoPlayPolicy autoPlayPolicy;
/**
是否静音播放视频广告,视频初始状态是否静音,默认 YES,
可通过 GDTMediaView muteEnable: 方法实时控制播放器j静音状态,
*/
@property (nonatomic, assign) BOOL videoMuted;
/**
是否启动自动续播功能,当在 tableView 等场景播放器被销毁时,广告展示时继续从上次播放位置续播,默认 NO
*/
@property (nonatomic, assign) BOOL autoResumeEnable;
/**
广告发生点击行为时,是否展示视频详情页,默认YES,
设为 NO 时,用户点击 clickableViews 会直接打开 App Store 或者广告落地页
*/
@property (nonatomic, assign) BOOL detailPageEnable;
/**
是否支持用户点击 MediaView 改变视频播放暂停状态,默认 NO
设为 YES 时,用户点击会切换播放器播放、暂停状态
*/
@property (nonatomic, assign) BOOL userControlEnable;
/**
是否展示播放进度条,默认 YES
*/
@property (nonatomic, assign) BOOL progressViewEnable;
/**
是否展示播放器封面图,默认 YES
*/
@property (nonatomic, assign) BOOL coverImageEnable;
@end
NS_ASSUME_NONNULL_END
* iOS 4.8.7, 支持Banner广告,插屏广告,原生广告,开屏广告,原生模板广告,激励视频广告,自渲染2.0广告,最低支持iOS8系统,优化数据上报,修复bug
\ No newline at end of file
../../../GDTMobSDK/lib/GDTHybridAd.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTUnifiedBannerView.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTUnifiedInterstitialAd.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTVideoConfig.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTHybridAd.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTUnifiedBannerView.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTUnifiedInterstitialAd.h
\ No newline at end of file
../../../GDTMobSDK/lib/GDTVideoConfig.h
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment