VLionManager.h
7.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
//
// VLionManager.h
// VLionADSDKDemo
//
// Created by iOS on 2017/10/9.
// Copyright © 2017年 zhulin. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "VLionAdConfiguration.h"
#import "VLionADStatusDef.h"
#import "VLionNativeAdNewsModel.h"
#import "VLionNativeAdAppWallModel.h"
#import "VLionNativeAdShufflingModel.h"
#import "VLionNativeAdWaterfallModel.h"
#import "VLionNativeAdInformationFlowModel.h"
typedef void(^VLionNativeAdNewsHandler)(VLionNativeAdNewsModel *_Nullable adModel, NSDictionary * _Nullable errorDic);
typedef void(^VLionNativeAdAppWallHandler)(VLionNativeAdAppWallModel *_Nullable adModel, NSDictionary * _Nullable errorDic);
typedef void(^VLionNativeAdShufflingHandler)(VLionNativeAdShufflingModel *_Nullable adModel, NSDictionary * _Nullable errorDic);
typedef void(^VLionNativeAdWaterfallHandler)(VLionNativeAdWaterfallModel *_Nullable adModel, NSDictionary * _Nullable errorDic);
typedef void(^VLionNativeAdInformationFlowHandler)(VLionNativeAdInformationFlowModel *_Nullable adModel, NSDictionary * _Nullable errorDic);
@interface VLionManager : NSObject
@property (nonatomic, readonly) NSString *_Nonnull appId;
@property (nonatomic, readonly) NSString *_Nonnull appKey;
+ (VLionManager *_Nonnull)manager;
- (void)initVLionSDKWithAppId:(NSString *_Nonnull)appId appKey:(NSString *_Nonnull)appKey;
/**
开屏广告
@param tagId 广告位Id,由vlion提供,请到瑞狮SSP后台获取
@param configuration 广告显示参数配置
@param keyWindow App的keyWindow
@param placeholderImage 占位图 (最好是启动页图片)
@param completeBlock 广告数据回调 window:SDK内部创建的广告位容器window,设置此window的大小可重新设置开屏广告的大小 w:广告物料的宽(单位px) h:广告物料的高(单位px)
@param successBlock 加载成功回调
@param failedBlock 失败回调,errorDic:错误信息
@param finishBlock 开屏广告完成回调
*/
- (void)vl_setupLaunchAdWithTagId:(NSString *_Nonnull)tagId
configuration:(VLionAdConfiguration *_Nonnull)configuration
keyWindow:(UIWindow *_Nonnull)keyWindow
placeholderImage:(UIImage *_Nullable)placeholderImage
completeBlock:(void(^_Nullable)(CGFloat w,CGFloat h,UIWindow *_Nonnull window))completeBlock
successBlock:(void(^_Nullable)(void))successBlock
failedBlock:(void(^_Nullable)(NSDictionary *_Nullable errorDic))failedBlock
finishBlock:(void(^_Nullable)(void))finishBlock;
/**
插屏广告
@param tagId 广告位Id 由vlion提供。请到瑞狮SSP后台获取
@param configuration 广告显示参数配置,可设置图片类广告view的填充模式
@param superView 广告父视图(必传)
@param placeholderImage 占位图(必传)
@param viewController 当前控制器(必传),若不传,点击广告无法跳转
@param completeBlock 广告数据请求成功回调 interstitialView:广告位容器 w:广告物料的宽(单位px) h:广告物料的高(单位px) closeBtnH:关闭按钮的高; 可根据返回物料宽高比重新设置容器的宽高,以免出现广告展示和容器比例不一致问题 注*重新设置广告位容器frame时,高度请加上关闭按钮的高,否则广告视图可能被拉伸
@param successBlock 加载完成回调,建议在此回调中将广告容器添加到要展示的view上
@param failedBlock 失败回调
@param closeBlock 关闭按钮点击事件回调,建议在该回调中移除广告容器
*/
- (void)vl_interstitialWithTagId:(NSString *_Nonnull)tagId
configuration:(VLionAdConfiguration *_Nonnull)configuration
superView:(UIView *_Nonnull)superView
placeholderImage:(UIImage *_Nonnull)placeholderImage
viewController:(UIViewController *_Nonnull)viewController
completeBlock:(void(^_Nullable)(UIView *_Nullable interstitialView, float w, float h, float closeBtnH ))completeBlock
successBlock:(void(^_Nullable)(void))successBlock
failedBlock:(void(^_Nullable)(NSDictionary *_Nullable errorDic))failedBlock
closeBlock:(void(^_Nullable)(void))closeBlock;
/**
横幅广告
@param tagId 广告位Id 由vlion提供。请到瑞狮SSP后台获取
@param configuration 广告显示参数配置,可设置图片类广告view的填充模式
@param superView 广告父视图(必传)
@param placeholderImage 占位图(必传)
@param viewController 当前控制器(必传),若不传,点击广告无法跳转
@param completeBlock 广告数据请求成功回调 bannerView:广告位容器 w:广告物料的宽(单位px) h:广告物料的高(单位px); 可根据返回物料宽高比重新设置容器的宽高,以免出现广告展示和容器比例不一致问题
@param successBlock 加载完成回调,建议在此回调中将广告容器添加到要展示的view上
@param failedBlock 失败回调
*/
- (void)vl_bannerWithTagId:(NSString *_Nonnull)tagId
configuration:(VLionAdConfiguration *_Nonnull)configuration
superView:(UIView *_Nonnull)superView
placeholderImage:(UIImage *_Nonnull)placeholderImage
viewController:(UIViewController *_Nonnull)viewController
completeBlock:(void(^_Nullable)(UIView *_Nullable bannerView, float w, float h))completeBlock
successBlock:(void(^_Nullable)(void))successBlock
failedBlock:(void(^_Nullable)(NSDictionary *_Nullable errorDic))failedBlock;
/**
* 销毁并移除广告(仅对横屏和插屏广告设置有效)
*/
- (void)vl_destroyBannerOrInterstitialAdvertisement:(UIView *_Nonnull)superView;
/**
请求原生新闻类型广告模型数据
@param tagId 广告位id
@param handler 回调
*/
- (void)vl_nativeAdNewsWithTagId:(NSString *_Nonnull)tagId handler:(VLionNativeAdNewsHandler _Nullable)handler;
/**
请求原生应用墙类型广告模型数据
@param tagId 广告位id
@param handler 回调
*/
- (void)vl_nativeAdAppWallWithTagId:(NSString *_Nonnull)tagId handler:(VLionNativeAdAppWallHandler _Nullable)handler;
/**
请求原生轮播图类型广告模型数据
@param tagId 广告位id
@param handler 回调
*/
- (void)vl_nativeAdShufflingWithTagId:(NSString *_Nonnull)tagId handler:(VLionNativeAdShufflingHandler _Nullable)handler;
/**
请求原生瀑布流类型广告模型数据
@param tagId 广告位id
@param handler 回调
*/
- (void)vl_nativeAdWaterfallWithTagId:(NSString *_Nonnull)tagId handler:(VLionNativeAdWaterfallHandler _Nullable)handler;
/**
请求原生信息流类型广告模型数据
@param tagId 广告位id
@param handler 回调
*/
- (void)vl_nativeAdInformationFlowWithTagId:(NSString *_Nonnull)tagId handler:(VLionNativeAdInformationFlowHandler _Nullable)handler;
#pragma mark - 缓存清除及大小
/**
* 清除VLionAd本地缓存
*/
+(void)clearDiskCache;
/**
* 获取VLionAd本地缓存大小(M)
*/
+(float)diskCacheSize;
/**
* 缓存路径
*/
+(NSString *_Nullable)vlAdCachePath;
@end