Commit 5e6b0960fdfff1c1de640ea1c2f0ee22fb3b8f24

Authored by 朱林
2 parents 50c8a4a6 68398150

Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/VLionADSDKDemo

# Conflicts:
#	VLionADSDKDemo/VLionADSDKDemo/Info.plist
VLionADSDKDemo/VLionADSDKDemo.xcodeproj/project.pbxproj
@@ -11,8 +11,12 @@ @@ -11,8 +11,12 @@
11 81DC51D31F95FB7E0060EBE3 /* NativeAdListsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */; }; 11 81DC51D31F95FB7E0060EBE3 /* NativeAdListsController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */; };
12 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */; }; 12 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */ = {isa = PBXBuildFile; fileRef = 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */; };
13 D2188EA41F9F1CA8006BF9C8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2188EA31F9F1CA8006BF9C8 /* ViewController.m */; }; 13 D2188EA41F9F1CA8006BF9C8 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D2188EA31F9F1CA8006BF9C8 /* ViewController.m */; };
14 - D26C18FB1FD66529000D74FC /* VLionADSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D26C18FA1FD66529000D74FC /* VLionADSDK.framework */; };  
15 - D26C18FD1FD6652B000D74FC /* VLionADSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D26C18FA1FD66529000D74FC /* VLionADSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 + D26C065E1FD66AD6004EF3D7 /* NativeInfosDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = D26C06591FD66AD5004EF3D7 /* NativeInfosDemoController.m */; };
  15 + D26C065F1FD66AD6004EF3D7 /* BaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D26C065B1FD66AD5004EF3D7 /* BaseViewController.m */; };
  16 + D26C06601FD66AD6004EF3D7 /* IRUIWebView.m in Sources */ = {isa = PBXBuildFile; fileRef = D26C065C1FD66AD6004EF3D7 /* IRUIWebView.m */; };
  17 + D26C06611FD66AD6004EF3D7 /* CNLiveVLionAdWebController.m in Sources */ = {isa = PBXBuildFile; fileRef = D26C065D1FD66AD6004EF3D7 /* CNLiveVLionAdWebController.m */; };
  18 + D26C19051FD669C3000D74FC /* VLionADSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D26C19041FD669C3000D74FC /* VLionADSDK.framework */; };
  19 + D26C19071FD669C5000D74FC /* VLionADSDK.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D26C19041FD669C3000D74FC /* VLionADSDK.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
16 D29BFE621FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE421FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m */; }; 20 D29BFE621FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE421FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m */; };
17 D29BFE631FCFB0F500D3EE1B /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE441FCFB0F500D3EE1B /* NSData+ImageContentType.m */; }; 21 D29BFE631FCFB0F500D3EE1B /* NSData+ImageContentType.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE441FCFB0F500D3EE1B /* NSData+ImageContentType.m */; };
18 D29BFE641FCFB0F500D3EE1B /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE461FCFB0F500D3EE1B /* SDImageCache.m */; }; 22 D29BFE641FCFB0F500D3EE1B /* SDImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = D29BFE461FCFB0F500D3EE1B /* SDImageCache.m */; };
@@ -38,13 +42,13 @@ @@ -38,13 +42,13 @@
38 /* End PBXBuildFile section */ 42 /* End PBXBuildFile section */
39 43
40 /* Begin PBXCopyFilesBuildPhase section */ 44 /* Begin PBXCopyFilesBuildPhase section */
41 - DCE2503F1FBC37C500E27BDE /* Embed Frameworks */ = { 45 + D26C19081FD669C5000D74FC /* Embed Frameworks */ = {
42 isa = PBXCopyFilesBuildPhase; 46 isa = PBXCopyFilesBuildPhase;
43 buildActionMask = 2147483647; 47 buildActionMask = 2147483647;
44 dstPath = ""; 48 dstPath = "";
45 dstSubfolderSpec = 10; 49 dstSubfolderSpec = 10;
46 files = ( 50 files = (
47 - D26C18FD1FD6652B000D74FC /* VLionADSDK.framework in Embed Frameworks */, 51 + D26C19071FD669C5000D74FC /* VLionADSDK.framework in Embed Frameworks */,
48 ); 52 );
49 name = "Embed Frameworks"; 53 name = "Embed Frameworks";
50 runOnlyForDeploymentPostprocessing = 0; 54 runOnlyForDeploymentPostprocessing = 0;
@@ -58,7 +62,15 @@ @@ -58,7 +62,15 @@
58 81DC51D11F95FB7E0060EBE3 /* BannerADController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BannerADController.h; sourceTree = "<group>"; }; 62 81DC51D11F95FB7E0060EBE3 /* BannerADController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BannerADController.h; sourceTree = "<group>"; };
59 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BannerADController.m; sourceTree = "<group>"; }; 63 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BannerADController.m; sourceTree = "<group>"; };
60 D2188EA31F9F1CA8006BF9C8 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; }; 64 D2188EA31F9F1CA8006BF9C8 /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
61 - D26C18FA1FD66529000D74FC /* VLionADSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = VLionADSDK.framework; sourceTree = "<group>"; }; 65 + D26C06561FD66AD4004EF3D7 /* IRUIWebView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IRUIWebView.h; sourceTree = "<group>"; };
  66 + D26C06571FD66AD5004EF3D7 /* NativeInfosDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeInfosDemoController.h; sourceTree = "<group>"; };
  67 + D26C06581FD66AD5004EF3D7 /* BaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BaseViewController.h; sourceTree = "<group>"; };
  68 + D26C06591FD66AD5004EF3D7 /* NativeInfosDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NativeInfosDemoController.m; sourceTree = "<group>"; };
  69 + D26C065A1FD66AD5004EF3D7 /* CNLiveVLionAdWebController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNLiveVLionAdWebController.h; sourceTree = "<group>"; };
  70 + D26C065B1FD66AD5004EF3D7 /* BaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BaseViewController.m; sourceTree = "<group>"; };
  71 + D26C065C1FD66AD6004EF3D7 /* IRUIWebView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = IRUIWebView.m; sourceTree = "<group>"; };
  72 + D26C065D1FD66AD6004EF3D7 /* CNLiveVLionAdWebController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNLiveVLionAdWebController.m; sourceTree = "<group>"; };
  73 + D26C19041FD669C3000D74FC /* VLionADSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = VLionADSDK.framework; sourceTree = "<group>"; };
62 D29BFE411FCFB0F500D3EE1B /* MKAnnotationView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MKAnnotationView+WebCache.h"; sourceTree = "<group>"; }; 74 D29BFE411FCFB0F500D3EE1B /* MKAnnotationView+WebCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MKAnnotationView+WebCache.h"; sourceTree = "<group>"; };
63 D29BFE421FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKAnnotationView+WebCache.m"; sourceTree = "<group>"; }; 75 D29BFE421FCFB0F500D3EE1B /* MKAnnotationView+WebCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MKAnnotationView+WebCache.m"; sourceTree = "<group>"; };
64 D29BFE431FCFB0F500D3EE1B /* NSData+ImageContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ImageContentType.h"; sourceTree = "<group>"; }; 76 D29BFE431FCFB0F500D3EE1B /* NSData+ImageContentType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+ImageContentType.h"; sourceTree = "<group>"; };
@@ -110,7 +122,7 @@ @@ -110,7 +122,7 @@
110 isa = PBXFrameworksBuildPhase; 122 isa = PBXFrameworksBuildPhase;
111 buildActionMask = 2147483647; 123 buildActionMask = 2147483647;
112 files = ( 124 files = (
113 - D26C18FB1FD66529000D74FC /* VLionADSDK.framework in Frameworks */, 125 + D26C19051FD669C3000D74FC /* VLionADSDK.framework in Frameworks */,
114 ); 126 );
115 runOnlyForDeploymentPostprocessing = 0; 127 runOnlyForDeploymentPostprocessing = 0;
116 }; 128 };
@@ -184,7 +196,7 @@ @@ -184,7 +196,7 @@
184 D2ED41621F95F3BD00803E9D /* VLionAdSDKDemo */ = { 196 D2ED41621F95F3BD00803E9D /* VLionAdSDKDemo */ = {
185 isa = PBXGroup; 197 isa = PBXGroup;
186 children = ( 198 children = (
187 - D26C18FA1FD66529000D74FC /* VLionADSDK.framework */, 199 + D26C19041FD669C3000D74FC /* VLionADSDK.framework */,
188 817BA9931F9606AB00599550 /* VLionAdImg.bundle */, 200 817BA9931F9606AB00599550 /* VLionAdImg.bundle */,
189 D29BFE401FCFB0F500D3EE1B /* SDWebImage */, 201 D29BFE401FCFB0F500D3EE1B /* SDWebImage */,
190 D2ED41631F95F3BD00803E9D /* AppDelegate.h */, 202 D2ED41631F95F3BD00803E9D /* AppDelegate.h */,
@@ -195,6 +207,14 @@ @@ -195,6 +207,14 @@
195 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */, 207 81DC51D21F95FB7E0060EBE3 /* BannerADController.m */,
196 81DC51CF1F95FB7D0060EBE3 /* NativeAdListsController.h */, 208 81DC51CF1F95FB7D0060EBE3 /* NativeAdListsController.h */,
197 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */, 209 81DC51D01F95FB7D0060EBE3 /* NativeAdListsController.m */,
  210 + D26C06581FD66AD5004EF3D7 /* BaseViewController.h */,
  211 + D26C065B1FD66AD5004EF3D7 /* BaseViewController.m */,
  212 + D26C065A1FD66AD5004EF3D7 /* CNLiveVLionAdWebController.h */,
  213 + D26C065D1FD66AD6004EF3D7 /* CNLiveVLionAdWebController.m */,
  214 + D26C06561FD66AD4004EF3D7 /* IRUIWebView.h */,
  215 + D26C065C1FD66AD6004EF3D7 /* IRUIWebView.m */,
  216 + D26C06571FD66AD5004EF3D7 /* NativeInfosDemoController.h */,
  217 + D26C06591FD66AD5004EF3D7 /* NativeInfosDemoController.m */,
198 D29BFE721FCFB14A00D3EE1B /* UIView+Extension.h */, 218 D29BFE721FCFB14A00D3EE1B /* UIView+Extension.h */,
199 D29BFE731FCFB14A00D3EE1B /* UIView+Extension.m */, 219 D29BFE731FCFB14A00D3EE1B /* UIView+Extension.m */,
200 D2ED41691F95F3BD00803E9D /* Main.storyboard */, 220 D2ED41691F95F3BD00803E9D /* Main.storyboard */,
@@ -216,7 +236,7 @@ @@ -216,7 +236,7 @@
216 D2ED415C1F95F3BD00803E9D /* Sources */, 236 D2ED415C1F95F3BD00803E9D /* Sources */,
217 D2ED415D1F95F3BD00803E9D /* Frameworks */, 237 D2ED415D1F95F3BD00803E9D /* Frameworks */,
218 D2ED415E1F95F3BD00803E9D /* Resources */, 238 D2ED415E1F95F3BD00803E9D /* Resources */,
219 - DCE2503F1FBC37C500E27BDE /* Embed Frameworks */, 239 + D26C19081FD669C5000D74FC /* Embed Frameworks */,
220 ); 240 );
221 buildRules = ( 241 buildRules = (
222 ); 242 );
@@ -250,7 +270,7 @@ @@ -250,7 +270,7 @@
250 }; 270 };
251 }; 271 };
252 }; 272 };
253 - buildConfigurationList = D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionADSDKDemo" */; 273 + buildConfigurationList = D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionAdSDKDemo" */;
254 compatibilityVersion = "Xcode 8.0"; 274 compatibilityVersion = "Xcode 8.0";
255 developmentRegion = en; 275 developmentRegion = en;
256 hasScannedForEncodings = 0; 276 hasScannedForEncodings = 0;
@@ -288,13 +308,17 @@ @@ -288,13 +308,17 @@
288 buildActionMask = 2147483647; 308 buildActionMask = 2147483647;
289 files = ( 309 files = (
290 D2ED41731F95F3BD00803E9D /* main.m in Sources */, 310 D2ED41731F95F3BD00803E9D /* main.m in Sources */,
  311 + D26C065F1FD66AD6004EF3D7 /* BaseViewController.m in Sources */,
  312 + D26C06601FD66AD6004EF3D7 /* IRUIWebView.m in Sources */,
291 D29BFE6F1FCFB0F500D3EE1B /* UIImageView+HighlightedWebCache.m in Sources */, 313 D29BFE6F1FCFB0F500D3EE1B /* UIImageView+HighlightedWebCache.m in Sources */,
292 D29BFE741FCFB14B00D3EE1B /* UIView+Extension.m in Sources */, 314 D29BFE741FCFB14B00D3EE1B /* UIView+Extension.m in Sources */,
293 D29BFE701FCFB0F500D3EE1B /* UIImageView+WebCache.m in Sources */, 315 D29BFE701FCFB0F500D3EE1B /* UIImageView+WebCache.m in Sources */,
294 D29BFE6E1FCFB0F500D3EE1B /* UIImage+WebP.m in Sources */, 316 D29BFE6E1FCFB0F500D3EE1B /* UIImage+WebP.m in Sources */,
  317 + D26C06611FD66AD6004EF3D7 /* CNLiveVLionAdWebController.m in Sources */,
295 D29BFE6A1FCFB0F500D3EE1B /* SDWebImagePrefetcher.m in Sources */, 318 D29BFE6A1FCFB0F500D3EE1B /* SDWebImagePrefetcher.m in Sources */,
296 D2ED41651F95F3BD00803E9D /* AppDelegate.m in Sources */, 319 D2ED41651F95F3BD00803E9D /* AppDelegate.m in Sources */,
297 D29BFE661FCFB0F500D3EE1B /* SDWebImageDecoder.m in Sources */, 320 D29BFE661FCFB0F500D3EE1B /* SDWebImageDecoder.m in Sources */,
  321 + D26C065E1FD66AD6004EF3D7 /* NativeInfosDemoController.m in Sources */,
298 D29BFE671FCFB0F500D3EE1B /* SDWebImageDownloader.m in Sources */, 322 D29BFE671FCFB0F500D3EE1B /* SDWebImageDownloader.m in Sources */,
299 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */, 323 81DC51D41F95FB7E0060EBE3 /* BannerADController.m in Sources */,
300 D29BFE691FCFB0F500D3EE1B /* SDWebImageManager.m in Sources */, 324 D29BFE691FCFB0F500D3EE1B /* SDWebImageManager.m in Sources */,
@@ -499,7 +523,7 @@ @@ -499,7 +523,7 @@
499 /* End XCBuildConfiguration section */ 523 /* End XCBuildConfiguration section */
500 524
501 /* Begin XCConfigurationList section */ 525 /* Begin XCConfigurationList section */
502 - D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionADSDKDemo" */ = { 526 + D2ED415B1F95F3BD00803E9D /* Build configuration list for PBXProject "VLionAdSDKDemo" */ = {
503 isa = XCConfigurationList; 527 isa = XCConfigurationList;
504 buildConfigurations = ( 528 buildConfigurations = (
505 D2ED41741F95F3BD00803E9D /* Debug */, 529 D2ED41741F95F3BD00803E9D /* Debug */,
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/backBtn.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "filename" : "back.png",
  6 + "scale" : "1x"
  7 + },
  8 + {
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "idiom" : "universal",
  14 + "scale" : "3x"
  15 + }
  16 + ],
  17 + "info" : {
  18 + "version" : 1,
  19 + "author" : "xcode"
  20 + }
  21 +}
0 \ No newline at end of file 22 \ No newline at end of file
VLionADSDKDemo/VLionADSDKDemo/Assets.xcassets/backBtn.imageset/back.png 0 → 100644

396 Bytes

VLionADSDKDemo/VLionADSDKDemo/Info.plist
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 <key>CFBundlePackageType</key> 17 <key>CFBundlePackageType</key>
18 <string>APPL</string> 18 <string>APPL</string>
19 <key>CFBundleShortVersionString</key> 19 <key>CFBundleShortVersionString</key>
20 - <string>1.1</string> 20 + <string>1.1.2</string>
21 <key>CFBundleURLTypes</key> 21 <key>CFBundleURLTypes</key>
22 <array> 22 <array>
23 <dict> 23 <dict>
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 </dict> 28 </dict>
29 </array> 29 </array>
30 <key>CFBundleVersion</key> 30 <key>CFBundleVersion</key>
31 - <string>1</string> 31 + <string>10</string>
32 <key>LSRequiresIPhoneOS</key> 32 <key>LSRequiresIPhoneOS</key>
33 <true/> 33 <true/>
34 <key>NSAppTransportSecurity</key> 34 <key>NSAppTransportSecurity</key>
VLionADSDKDemo/VLionADSDKDemo/NativeAdListsController.m
@@ -7,9 +7,11 @@ @@ -7,9 +7,11 @@
7 // 7 //
8 8
9 #import "NativeAdListsController.h" 9 #import "NativeAdListsController.h"
10 -#import <VLionAdSDK/VLionAdSDK.h> 10 +#import <VLionADSDK/VLionADSDK.h>
11 #import "UIView+Extension.h" 11 #import "UIView+Extension.h"
12 #import "UIImageView+WebCache.h" 12 #import "UIImageView+WebCache.h"
  13 +#import "NativeInfosDemoController.h"
  14 +
13 #define IPHONEX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO) 15 #define IPHONEX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
14 #define H_SPACE (self.view.bounds.size.height-250)/2 16 #define H_SPACE (self.view.bounds.size.height-250)/2
15 17
@@ -23,6 +25,7 @@ @@ -23,6 +25,7 @@
23 NSString *_imgUrl; 25 NSString *_imgUrl;
24 id currentMdl; 26 id currentMdl;
25 } 27 }
  28 +
26 @property (nonatomic, strong) UIButton *closeBtn; 29 @property (nonatomic, strong) UIButton *closeBtn;
27 @property (nonatomic, strong) UIButton *xuanRanBtn; 30 @property (nonatomic, strong) UIButton *xuanRanBtn;
28 @property (nonatomic, strong) UIImageView *imgView; 31 @property (nonatomic, strong) UIImageView *imgView;
@@ -40,15 +43,15 @@ @@ -40,15 +43,15 @@
40 bg.image = [UIImage imageNamed:@"bg_activity"]; 43 bg.image = [UIImage imageNamed:@"bg_activity"];
41 [self.view addSubview:bg]; 44 [self.view addSubview:bg];
42 45
43 - [self.view addSubview:self.xuanRanBtn]; 46 + // [self.view addSubview:self.xuanRanBtn];
44 [self.view addSubview:self.closeBtn]; 47 [self.view addSubview:self.closeBtn];
45 - [self.view addSubview:self.imgView]; 48 + // [self.view addSubview:self.imgView];
46 49
47 - NSArray *titleArr = @[@"原生新闻广告数据",@"原生应用墙广告数据",@"原生轮播图广告数据",@"原生瀑布流广告数据",@"原生信息流广告数据"]; 50 + NSArray *titleArr = @[@"新闻数据",@"应用墙数据",@"轮播图数据",@"瀑布流数据",@"信息流数据",@"展示信息流Demo"];
48 51
49 for (int i = 0; i < titleArr.count; i ++) { 52 for (int i = 0; i < titleArr.count; i ++) {
50 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; 53 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
51 - button.frame = CGRectMake((self.view.bounds.size.width-200)/2, ((IPHONEX ? 30 : 15)+40)*i+H_SPACE+(IPHONEX ? 100 : 120), 200, 40); 54 + button.frame = CGRectMake((self.view.bounds.size.width-200)/2, (15+40)*i+H_SPACE, 200, 40);//(IPHONEX ? 30 : 15) +(IPHONEX ? 100 : 120)
52 [button setTitle:titleArr[i] forState:UIControlStateNormal]; 55 [button setTitle:titleArr[i] forState:UIControlStateNormal];
53 button.titleLabel.font = [UIFont systemFontOfSize:16]; 56 button.titleLabel.font = [UIFont systemFontOfSize:16];
54 [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; 57 [button setTitleColor:[UIColor blueColor] forState:UIControlStateNormal];
@@ -238,6 +241,11 @@ @@ -238,6 +241,11 @@
238 }]; 241 }];
239 } 242 }
240 break; 243 break;
  244 + case 10005: {//信息流Demo
  245 +
  246 + [self presentViewController:[NativeInfosDemoController new] animated:YES completion:NULL];
  247 + }
  248 + break;
241 default: 249 default:
242 break; 250 break;
243 } 251 }
@@ -276,21 +284,20 @@ @@ -276,21 +284,20 @@
276 }]; 284 }];
277 } 285 }
278 286
279 -  
280 #pragma mark - alertView 287 #pragma mark - alertView
281 - (void)toast:(NSString *)message 288 - (void)toast:(NSString *)message
282 { 289 {
283 290
284 - UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil  
285 - message:message  
286 - delegate:nil  
287 - cancelButtonTitle:nil  
288 - otherButtonTitles:nil, nil];  
289 - [toast show];  
290 - double duration = 2.5;  
291 - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{  
292 - [toast dismissWithClickedButtonIndex:0 animated:NO];  
293 - }); 291 + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil
  292 + message:message
  293 + delegate:nil
  294 + cancelButtonTitle:nil
  295 + otherButtonTitles:nil, nil];
  296 + [toast show];
  297 + double duration = 2.5;
  298 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  299 + [toast dismissWithClickedButtonIndex:0 animated:NO];
  300 + });
294 } 301 }
295 302
296 - (UIImageView *)imgView 303 - (UIImageView *)imgView
@@ -329,20 +336,20 @@ @@ -329,20 +336,20 @@
329 } 336 }
330 return _closeBtn; 337 return _closeBtn;
331 } 338 }
332 -  
333 - (void)didReceiveMemoryWarning { 339 - (void)didReceiveMemoryWarning {
334 [super didReceiveMemoryWarning]; 340 [super didReceiveMemoryWarning];
335 // Dispose of any resources that can be recreated. 341 // Dispose of any resources that can be recreated.
336 } 342 }
337 343
338 /* 344 /*
339 -#pragma mark - Navigation  
340 -  
341 -// In a storyboard-based application, you will often want to do a little preparation before navigation  
342 -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {  
343 - // Get the new view controller using [segue destinationViewController].  
344 - // Pass the selected object to the new view controller.  
345 -}  
346 -*/ 345 + #pragma mark - Navigation
  346 +
  347 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  348 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  349 + // Get the new view controller using [segue destinationViewController].
  350 + // Pass the selected object to the new view controller.
  351 + }
  352 + */
347 353
348 @end 354 @end
  355 +
VLionADSDKDemo/VLionADSDKDemo/VLionADSDK.framework/Headers/VLionMonitorTrackingManager.h 0 → 100644
  1 +//
  2 +// VLionMonitorTrackingManager.h
  3 +// VLionADSDKDemo
  4 +//
  5 +// Created by 张旭 on 2017/10/13.
  6 +// Copyright © 2017年 zhulin. All rights reserved.
  7 +//
  8 +
  9 +#import <Foundation/Foundation.h>
  10 +
  11 +
  12 +@interface VLionMonitorTrackingManager : NSObject
  13 +
  14 ++ (VLionMonitorTrackingManager *_Nonnull)manager;
  15 +
  16 +- (void)uploadTrackingUrls:(NSArray <NSString *>*_Nullable)trackingUrls;
  17 +@end
  18 +
  19 +typedef void(^TrackingCompleteHandler)(NSURLResponse * _Nullable response, NSData * _Nullable data, NSError * _Nullable connectionError);
  20 +
  21 +@interface VLionMonitorTrackingUpload : NSObject
  22 +- (void)initWithUrl:(NSString * _Nonnull)url queue:(NSOperationQueue *_Nonnull)queue completionHandler:(TrackingCompleteHandler _Nullable )completionHandler;
  23 +
  24 +@end
  25 +
VLionADSDKDemo/VLionADSDKDemo/VLionADSDK.framework/Info.plist
No preview for this file type
VLionADSDKDemo/VLionADSDKDemo/VLionADSDK.framework/VLionADSDK
No preview for this file type
VLionAdSDKDemo/VLionAdSDKDemo/BaseViewController.h 0 → 100644
  1 +//
  2 +// BaseViewController.h
  3 +// ireport
  4 +//
  5 +// Created by 张旭 on 2017/9/7.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface BaseViewController : UIViewController
  12 +
  13 +@property (nonatomic, strong) UIButton *btnRight;
  14 +@property (nonatomic, strong) UIButton *btnLeft;
  15 +
  16 +@property (nonatomic) BOOL isModalButton;
  17 +
  18 +/**
  19 + * 加载视图
  20 + */
  21 +- (void)bindView;
  22 +
  23 +/**
  24 + * 加载模型
  25 + */
  26 +- (void)bindModel;
  27 +
  28 +/**
  29 + * 加载方法
  30 + */
  31 +- (void)bindAction;
  32 +
  33 +- (void)onBackAction;
  34 +
  35 +- (void)onRightAction;
  36 +
  37 +/**
  38 + * 词典转换为字符串
  39 + */
  40 +- (NSString*)dictionaryToJson:(NSDictionary *)dic;
  41 +
  42 +@end
VLionAdSDKDemo/VLionAdSDKDemo/BaseViewController.m 0 → 100644
  1 +//
  2 +// BaseViewController.m
  3 +// ireport
  4 +//
  5 +// Created by 张旭 on 2017/9/7.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "BaseViewController.h"
  10 +#import <Foundation/Foundation.h>
  11 +#define IPHONEX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
  12 +
  13 +@interface BaseViewController ()
  14 +
  15 +@end
  16 +
  17 +@implementation BaseViewController
  18 +
  19 +- (id)init {
  20 + self = [super init];
  21 + if (self) {
  22 +
  23 + [self initParameters];
  24 + self.isModalButton = NO;
  25 + }
  26 + return self;
  27 +}
  28 +
  29 +- (void)viewDidLoad {
  30 + [super viewDidLoad];
  31 + // Do any additional setup after loading the view.
  32 +
  33 + self.view.backgroundColor = [UIColor whiteColor];
  34 + self.navigationController.navigationBar.translucent = NO;
  35 +// self.hidesBottomBarWhenPushed = YES;
  36 +// self.edgesForExtendedLayout = UIRectEdgeNone;
  37 +// self.extendedLayoutIncludesOpaqueBars = NO;
  38 +
  39 + if (@available(iOS 11.0, *)){
  40 + [[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
  41 + }else
  42 + {
  43 + self.automaticallyAdjustsScrollViewInsets = NO;
  44 + }
  45 + [self navigationSet];
  46 + [self bindModel];
  47 + [self bindView];
  48 + [self bindAction];
  49 +}
  50 +
  51 +- (void)viewWillAppear:(BOOL)animated
  52 +{
  53 + [self interfaceOrientation:UIInterfaceOrientationPortrait];
  54 + [self.navigationController.navigationBar setBarStyle:UIBarStyleBlack];
  55 + [self setStatusBarBackgroundColor:[UIColor clearColor]];
  56 +}
  57 +//设置状态栏颜色
  58 +- (void)setStatusBarBackgroundColor:(UIColor *)color {
  59 +
  60 + UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
  61 + if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
  62 + statusBar.backgroundColor = color;
  63 + }
  64 +}
  65 +
  66 +-(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
  67 +{
  68 + return UIInterfaceOrientationPortrait;
  69 +}
  70 +
  71 +//设置是否隐藏
  72 +- (BOOL)prefersStatusBarHidden {
  73 + // [super prefersStatusBarHidden];
  74 + return NO;
  75 +}
  76 +
  77 +//设置隐藏动画
  78 +- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {
  79 + return UIStatusBarAnimationNone;
  80 +}
  81 +
  82 +- (void)interfaceOrientation:(UIInterfaceOrientation)orientation
  83 +{
  84 + if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
  85 + SEL selector = NSSelectorFromString(@"setOrientation:");
  86 + NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]];
  87 + [invocation setSelector:selector];
  88 + [invocation setTarget:[UIDevice currentDevice]];
  89 + int val = orientation;
  90 + // 从2开始是因为0 1 两个参数已经被selector和target占用
  91 + [invocation setArgument:&val atIndex:2];
  92 + [invocation invoke];
  93 + }
  94 +}
  95 +
  96 +- (void)initParameters {}
  97 +
  98 +/**
  99 + * 导航按钮设置
  100 + */
  101 +- (void)navigationSet{
  102 +
  103 + self.btnRight = [UIButton buttonWithType:UIButtonTypeCustom];
  104 + [_btnRight setFrame:CGRectMake(0,(IPHONEX ? 44:20) , 25, 20)];
  105 + [_btnRight addTarget:self action:@selector(onRightAction) forControlEvents:UIControlEventTouchUpInside];
  106 +
  107 + _btnRight.titleLabel.textAlignment = NSTextAlignmentRight;
  108 + _btnRight.titleLabel.font = [UIFont systemFontOfSize:15];
  109 + UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc]initWithCustomView:_btnRight];
  110 + self.navigationItem.rightBarButtonItem = rightBtn;
  111 + self.btnRight.hidden = YES;
  112 +
  113 + self.btnLeft = [UIButton buttonWithType:UIButtonTypeCustom];
  114 + [_btnLeft setFrame:CGRectMake(0, 0, 30, 30)];
  115 + [_btnLeft addTarget:self action:@selector(onBackAction) forControlEvents:UIControlEventTouchUpInside];
  116 +
  117 + [_btnLeft setImage:[UIImage imageNamed:@"fanhui_default"] forState:UIControlStateNormal];
  118 + [_btnLeft setImage:[UIImage imageNamed:@"fanhui_focused"] forState:UIControlStateHighlighted];
  119 + _btnLeft.highlighted = NO;
  120 + UIBarButtonItem *backItem = [[UIBarButtonItem alloc]initWithCustomView:_btnLeft];
  121 +
  122 + UIBarButtonItem * negativeSpacer = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
  123 + negativeSpacer.width = -8;//默认leftItemX == 18,要求距左边10
  124 + [self.navigationItem setLeftBarButtonItems:[NSArray arrayWithObjects:negativeSpacer,backItem, nil]];
  125 +
  126 + if ((self.navigationController.viewControllers[0] == self) && (self.isModalButton == NO)) {
  127 + _btnLeft.hidden = YES;
  128 + }
  129 +}
  130 +
  131 +/**
  132 + * 加载视图
  133 + */
  134 +- (void)bindView {
  135 +}
  136 +
  137 +/**
  138 + * 加载模型
  139 + */
  140 +- (void)bindModel {
  141 +}
  142 +
  143 +/**
  144 + * 加载方法
  145 + */
  146 +- (void)bindAction {
  147 +}
  148 +
  149 +- (void)loadViews {
  150 +
  151 +}
  152 +
  153 +//*****************************************************************
  154 +// MARK: - actions
  155 +//*****************************************************************
  156 +
  157 +/**
  158 + * 导航控制器上角按钮方法
  159 + */
  160 +- (void)onBackAction {
  161 +
  162 + if(self.isModalButton) {
  163 + [self dismissViewControllerAnimated:YES completion:NULL];
  164 + } else {
  165 + [self.navigationController popViewControllerAnimated:YES];
  166 + }
  167 +}
  168 +- (void)onRightAction
  169 +{
  170 +}
  171 +
  172 +/** 词典转换为字符串 */
  173 +- (NSString*)dictionaryToJson:(NSDictionary *)dic {
  174 +
  175 + NSError *parseError = nil;
  176 +
  177 + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError];
  178 + return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
  179 +}
  180 +
  181 +- (void)didReceiveMemoryWarning {
  182 + [super didReceiveMemoryWarning];
  183 + // Dispose of any resources that can be recreated.
  184 +}
  185 +
  186 +/*
  187 + #pragma mark - Navigation
  188 +
  189 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  190 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  191 + // Get the new view controller using [segue destinationViewController].
  192 + // Pass the selected object to the new view controller.
  193 + }
  194 + */
  195 +
  196 +@end
  197 +
VLionAdSDKDemo/VLionAdSDKDemo/CNLiveVLionAdWebController.h 0 → 100644
  1 +//
  2 +// CNLiveVLionAdWebController.h
  3 +// CNLive
  4 +//
  5 +// Created by 张旭 on 2017/11/1.
  6 +// Copyright © 2017年 雷浩杰. All rights reserved.
  7 +//
  8 +
  9 +#import "BaseViewController.h"
  10 +
  11 +@interface CNLiveVLionAdWebController : BaseViewController
  12 +@property (nonatomic, strong) NSString *urlString;
  13 +@end
VLionAdSDKDemo/VLionAdSDKDemo/CNLiveVLionAdWebController.m 0 → 100644
  1 +//
  2 +// CNLiveVLionAdWebController.m
  3 +// CNLive
  4 +//
  5 +// Created by 张旭 on 2017/11/1.
  6 +// Copyright © 2017年 雷浩杰. All rights reserved.
  7 +//
  8 +
  9 +#import "CNLiveVLionAdWebController.h"
  10 +#import "IRUIWebView.h"
  11 +#import "UIView+Extension.h"
  12 +#define IPHONEX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
  13 +
  14 +
  15 +@interface CNLiveVLionAdWebController ()
  16 +@property (nonatomic, strong) IRUIWebView *webView;
  17 +@property (nonatomic, strong) UIProgressView *progressView;
  18 +@property (nonatomic ,strong) UIButton * backBtn;
  19 +@end
  20 +
  21 +@implementation CNLiveVLionAdWebController
  22 +- (void)dealloc {
  23 +// [_webView.webView removeObserver:self forKeyPath:@"estimatedProgress"];
  24 +// [_webView.webView removeObserver:self forKeyPath:@"title"];
  25 +}
  26 +
  27 +- (void)viewDidLoad {
  28 + [super viewDidLoad];
  29 + // Do any additional setup after loading the view.
  30 + self.view.backgroundColor = [UIColor whiteColor];
  31 +
  32 + self.title = @"详情";
  33 + [self.view addSubview:self.backBtn];
  34 + [self.view addSubview:self.webView];
  35 +// [self.view addSubview:self.progressView];
  36 +
  37 +// [self.webView.webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionNew context:nil];
  38 +// [self.webView.webView addObserver:self forKeyPath:@"title" options:NSKeyValueObservingOptionNew context:NULL];
  39 +
  40 + [self.webView loadDataWithURL:self.urlString success:^{
  41 +
  42 + } failed:^(NSError *error) {
  43 +
  44 + }];
  45 +
  46 + __weak typeof(self)weakSelf = self;
  47 + self.webView.titleBlock = ^(NSString *title) {
  48 + weakSelf.title = title;
  49 + };
  50 +}
  51 +
  52 +- (void)onBackAction {
  53 +
  54 + if ([_webView.webView canGoBack]) {
  55 + [self.webView.webView goBack];
  56 + } else {
  57 +
  58 + [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
  59 +
  60 + if(self.isModalButton) {
  61 + [self dismissViewControllerAnimated:YES completion:NULL];
  62 + } else {
  63 + [self.navigationController popViewControllerAnimated:YES];
  64 + }
  65 + }
  66 +}
  67 +
  68 +//- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *,id> *)change context:(void *)context{
  69 +// if ([keyPath isEqualToString:@"estimatedProgress"]) {
  70 +//
  71 +// CGFloat progress = [change[NSKeyValueChangeNewKey] floatValue];
  72 +// [self.progressView setProgress:progress animated:YES];
  73 +// if(progress == 1.0)
  74 +// {
  75 +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  76 +//
  77 +// [self.progressView setProgress:0.0 animated:NO];
  78 +// });
  79 +// }
  80 +//
  81 +// } else if ([keyPath isEqualToString:@"title"]) {
  82 +// self.title = self.webView.webView.title;
  83 +// } else{
  84 +// [super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
  85 +// }
  86 +//}
  87 +
  88 +#pragma mark -
  89 +#pragma mark - lazy
  90 +- (IRUIWebView *)webView
  91 +{
  92 + if (!_webView) {
  93 + _webView = [[IRUIWebView alloc] initWithFrame:CGRectMake(0, (IPHONEX ? 44:20)+30, self.view.width, self.view.height)];
  94 + _webView.intercept = NO;
  95 + }
  96 + return _webView;
  97 +}
  98 +
  99 +- (UIProgressView *)progressView
  100 +{
  101 + if (!_progressView) {
  102 + _progressView = [[UIProgressView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 1.5)];
  103 + _progressView.progressViewStyle = UIProgressViewStyleBar;
  104 + _progressView.progressTintColor = [UIColor lightGrayColor];
  105 + }
  106 + return _progressView;
  107 +}
  108 +
  109 +- (UIButton *)backBtn
  110 +{
  111 + if (!_backBtn)
  112 + {
  113 + _backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  114 + [_backBtn setFrame:CGRectMake(0, (IPHONEX ? 44:20), 30, 30)];
  115 + [_backBtn addTarget:self action:@selector(onBackAction) forControlEvents:UIControlEventTouchUpInside];
  116 + [_backBtn setBackgroundImage:[UIImage imageNamed:@"backBtn"] forState:UIControlStateNormal];
  117 + [_backBtn setBackgroundImage:[UIImage imageNamed:@"backBtn"] forState:UIControlStateHighlighted];
  118 + _backBtn.highlighted = NO;
  119 + }
  120 + return _backBtn;
  121 +}
  122 +
  123 +- (void)didReceiveMemoryWarning {
  124 + [super didReceiveMemoryWarning];
  125 + // Dispose of any resources that can be recreated.
  126 +}
  127 +
  128 +/*
  129 + #pragma mark - Navigation
  130 +
  131 + // In a storyboard-based application, you will often want to do a little preparation before navigation
  132 + - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  133 + // Get the new view controller using [segue destinationViewController].
  134 + // Pass the selected object to the new view controller.
  135 + }
  136 + */
  137 +
  138 +@end
  139 +
VLionAdSDKDemo/VLionAdSDKDemo/IRUIWebView.h 0 → 100644
  1 +//
  2 +// IRUIWebView.h
  3 +// ireport
  4 +//
  5 +// Created by iOS on 2017/11/17.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +typedef void(^WebViewDetailBlock)(NSString *url);
  12 +typedef void(^WebViewTitleBlock)(NSString *title);
  13 +
  14 +@interface IRUIWebView : UIView
  15 +
  16 +@property (nonatomic, strong) UIWebView *webView;
  17 +
  18 +/**
  19 + * 是否拦截
  20 + */
  21 +@property (nonatomic, assign) BOOL intercept;
  22 +
  23 +@property (nonatomic, copy) WebViewDetailBlock webDetailBlock;
  24 +
  25 +@property (nonatomic, copy) WebViewTitleBlock titleBlock;
  26 +
  27 +- (void)loadDataWithURL:(NSString *)urlString success:(void(^)(void))success failed:(void(^)(NSError *error))failed;
  28 +
  29 +
  30 +@end
VLionAdSDKDemo/VLionAdSDKDemo/IRUIWebView.m 0 → 100644
  1 +//
  2 +// IRUIWebView.m
  3 +// ireport
  4 +//
  5 +// Created by iOS on 2017/11/17.
  6 +// Copyright © 2017年 cnlive. All rights reserved.
  7 +//
  8 +
  9 +#import "IRUIWebView.h"
  10 +
  11 +typedef void(^SuccessBlock)(void);
  12 +typedef void(^FailedBlock)(NSError *error);
  13 +
  14 +@interface IRUIWebView ()<UIWebViewDelegate>
  15 +
  16 +@property (nonatomic, copy) SuccessBlock successBlock; //成功回调
  17 +@property (nonatomic, copy) FailedBlock failedBlock; //失败回调
  18 +@property (nonatomic, strong) NSString *loadedURL;
  19 +
  20 +@end
  21 +
  22 +@implementation IRUIWebView
  23 +
  24 +- (void)dealloc
  25 +{
  26 +// VLLog(@"VLionAdUIWebView dealloc");
  27 +}
  28 +
  29 +- (instancetype)initWithFrame:(CGRect)frame
  30 +{
  31 + self = [super initWithFrame:frame];
  32 + if (self) {
  33 + self.webView.backgroundColor = [UIColor clearColor];
  34 + self.webView.opaque = NO;
  35 + [self addSubview:self.webView];
  36 + }
  37 + return self;
  38 +}
  39 +
  40 +- (void)loadDataWithURL:(NSString *)urlString success:(void (^)(void))success failed:(void (^)(NSError *))failed {
  41 +
  42 + self.successBlock = success;
  43 + self.failedBlock = failed;
  44 +
  45 + if (self.intercept) {
  46 + _webView.scrollView.scrollEnabled = NO;
  47 + }
  48 +
  49 + if ([urlString hasPrefix:@"http"]) {
  50 +
  51 + NSString *encodedUrl = [urlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  52 + NSURL *url = [NSURL URLWithString:encodedUrl];
  53 + NSURLRequest *request = [NSURLRequest requestWithURL:url];
  54 + [_webView loadRequest:request];
  55 +
  56 + } else {
  57 + [_webView loadHTMLString:urlString baseURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]]];
  58 + }
  59 +}
  60 +
  61 +- (void)clearCache {
  62 + //清除cookies
  63 +
  64 + NSHTTPCookie *cookie;
  65 +
  66 + NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
  67 +
  68 + for (cookie in [storage cookies]) {
  69 + [storage deleteCookie:cookie];
  70 + }
  71 +
  72 + // 清除webView的缓存
  73 + [[NSURLCache sharedURLCache] removeAllCachedResponses];
  74 +}
  75 +
  76 +#pragma mark -
  77 +#pragma mark - UIWebViewDelegate
  78 +- (void)webViewDidStartLoad:(UIWebView *)webView {
  79 + [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
  80 +}
  81 +
  82 +- (void)webViewDidFinishLoad:(UIWebView *)webView {
  83 + [self.webView.scrollView setContentOffset:CGPointMake(0, 0) animated:YES];
  84 + [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
  85 +
  86 + if (self.successBlock) {
  87 + self.successBlock();
  88 + }
  89 +
  90 + NSString *title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
  91 + if (self.titleBlock) {
  92 + self.titleBlock(title);
  93 + }
  94 +
  95 +}
  96 +
  97 +- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
  98 + self.failedBlock(error);
  99 +}
  100 +
  101 +- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
  102 +
  103 + // NSLog(@"request.URL --------- %@ type:%ld", request.URL.absoluteString, (long)navigationType);
  104 +
  105 + if (navigationType == UIWebViewNavigationTypeLinkClicked) {
  106 + NSString *url = [request.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
  107 +
  108 + if (self.intercept) {
  109 + if (self.webDetailBlock) {
  110 + self.webDetailBlock(url);
  111 + }
  112 + return NO;
  113 + }
  114 + }
  115 +
  116 + return YES;
  117 +}
  118 +
  119 +#pragma mark -
  120 +#pragma mark - lazy
  121 +- (UIWebView *)webView
  122 +{
  123 + if (!_webView) {
  124 + _webView = [[UIWebView alloc] initWithFrame:self.bounds];
  125 + _webView.delegate = self;
  126 + _webView.scalesPageToFit = YES;
  127 + }
  128 + return _webView;
  129 +}
  130 +
  131 +
  132 +/*
  133 +// Only override drawRect: if you perform custom drawing.
  134 +// An empty implementation adversely affects performance during animation.
  135 +- (void)drawRect:(CGRect)rect {
  136 + // Drawing code
  137 +}
  138 +*/
  139 +
  140 +@end
VLionAdSDKDemo/VLionAdSDKDemo/NativeInfosDemoController.h 0 → 100644
  1 +//
  2 +// NativeInfosDemoController.h
  3 +// VLionADSDKDemo
  4 +//
  5 +// Created by 张旭 on 2017/12/5.
  6 +// Copyright © 2017年 zhulin. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface NativeInfosDemoController : UIViewController
  12 +
  13 +@end
VLionAdSDKDemo/VLionAdSDKDemo/NativeInfosDemoController.m 0 → 100644
  1 +//
  2 +// NativeInfosDemoController.m
  3 +// VLionADSDKDemo
  4 +//
  5 +// Created by 张旭 on 2017/12/5.
  6 +// Copyright © 2017年 zhulin. All rights reserved.
  7 +//
  8 +
  9 +#import "NativeInfosDemoController.h"
  10 +#import <VLionADSDK/VLionADSDK.h>
  11 +#import "UIImageView+WebCache.h"
  12 +#import "CNLiveVLionAdWebController.h"
  13 +#import <VLionADSDK/VLionMonitorTrackingManager.h>
  14 +
  15 +#define IPHONEX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
  16 +
  17 +@interface NativeInfosDemoController ()
  18 +{
  19 + NSString *ldp;
  20 + NSArray <NSString *>*_clk_tracking;
  21 + int _interact_type;
  22 +}
  23 +@property (nonatomic ,strong) UIView * adView;
  24 +@property (nonatomic ,strong) UIImageView * iconImg;
  25 +@property (nonatomic ,strong) UIImageView * picImg;
  26 +@property (nonatomic ,strong) UILabel * titleLbl;
  27 +@property (nonatomic ,strong) UILabel * scoreLbl;
  28 +@property (nonatomic ,strong) UIButton * adClickBtn;
  29 +@property (nonatomic, strong) UIButton *closeBtn;
  30 +
  31 +@end
  32 +
  33 +@implementation NativeInfosDemoController
  34 +
  35 +- (void)viewDidLoad {
  36 + [super viewDidLoad];
  37 + // Do any additional setup after loading the view.
  38 + self.view.backgroundColor = [UIColor lightGrayColor];
  39 + [self bindView];
  40 + [self loadData];
  41 +}
  42 +
  43 +- (void)bindView
  44 +{
  45 + [self.view addSubview:self.adView];
  46 + [self.adView addSubview:self.iconImg];
  47 + [self.adView addSubview:self.titleLbl];
  48 + [self.adView addSubview:self.scoreLbl];
  49 + [self.adView addSubview:self.picImg];
  50 +// [self.view addSubview:self.adClickBtn];
  51 + [self.view addSubview:self.closeBtn];
  52 +}
  53 +
  54 +- (void)loadData
  55 +{
  56 + [[VLionManager manager] vl_nativeAdInformationFlowWithTagId:@"425" handler:^(VLionNativeAdInformationFlowModel * _Nullable adModel, NSDictionary * _Nullable errorDic) {
  57 + if (errorDic) {
  58 + self.adView.userInteractionEnabled = NO;
  59 + NSString *tagid = [NSString stringWithFormat:@"%d",adModel.tagid];
  60 + if(adModel.tagid == 0)
  61 + {
  62 + tagid = @"null";
  63 + }
  64 + [self toast:[NSString stringWithFormat:@"错误码:%@,%@\n请求广告位id:%@",errorDic[@"errorCode"],errorDic[@"errorMessage"],tagid]];
  65 + }else
  66 + {
  67 + self.adView.userInteractionEnabled = YES;
  68 + NSString *string = @"";
  69 + string = [string stringByAppendingString:[NSString stringWithFormat:@"状态码:%d\n",adModel.status]];
  70 + string = [string stringByAppendingString:[NSString stringWithFormat:@"创意类型:%d\n",adModel.adt]];
  71 + string = [string stringByAppendingString:[NSString stringWithFormat:@"广告位id:%d\n",adModel.tagid]];
  72 + string = [string stringByAppendingString:[NSString stringWithFormat:@"物料ID:%@\n",adModel.cid]];
  73 + NSArray *imp_tracking = [NSArray arrayWithArray:adModel.imp_tracking];
  74 + if (imp_tracking.count > 0) {
  75 + for (int i = 0; i < imp_tracking.count; i ++) {
  76 + string = [string stringByAppendingString:[NSString stringWithFormat:@"曝光监测地址:%@\n",imp_tracking[i]]];
  77 + }
  78 + }
  79 + NSArray *clk_tracking = [NSArray arrayWithArray:adModel.clk_tracking];
  80 + if (clk_tracking.count > 0) {
  81 + for (int i = 0; i < clk_tracking.count; i ++) {
  82 + string = [string stringByAppendingString:[NSString stringWithFormat:@"点击监测地址:%@\n",clk_tracking[i]]];
  83 + }
  84 + _clk_tracking = clk_tracking;
  85 + }
  86 + string = [string stringByAppendingString:[NSString stringWithFormat:@"落地页:%@\n",adModel.nativead.ldp]];
  87 +
  88 + NSArray *icon = [NSArray arrayWithArray:adModel.nativead.icon];
  89 + if (icon.count > 0) {
  90 + for (int i = 0; i < icon.count; i ++) {
  91 + VLionNativeAdIconModel *mdl = ((VLionNativeAdIconModel *)icon[i]);
  92 + string = [string stringByAppendingString:[NSString stringWithFormat:@"图标url:%@,w:%d,h:%d\n",mdl.url,mdl.w,mdl.h]];
  93 + }
  94 + VLionNativeAdIconModel *mdl1 = ((VLionNativeAdIconModel *)icon[0]);
  95 + [self.iconImg sd_setImageWithURL:[NSURL URLWithString:mdl1.url] placeholderImage:nil];
  96 + }
  97 +
  98 + NSArray *img = [NSArray arrayWithArray:adModel.nativead.icon];
  99 + if (img.count > 0) {
  100 + for (int i = 0; i < img.count; i ++) {
  101 + VLionNativeAdIconModel *mdl = ((VLionNativeAdIconModel *)img[i]);
  102 + string = [string stringByAppendingString:[NSString stringWithFormat:@"大图url:%@,w:%d,h:%d\n",mdl.url,mdl.w,mdl.h]];
  103 + }
  104 + VLionNativeAdIconModel *mdl1 = ((VLionNativeAdIconModel *)img[0]);
  105 + [self.picImg sd_setImageWithURL:[NSURL URLWithString:mdl1.url] placeholderImage:nil];
  106 + }
  107 +
  108 + string = [string stringByAppendingString:[NSString stringWithFormat:@"标题名称:%@\n",adModel.nativead.title]];
  109 + string = [string stringByAppendingString:[NSString stringWithFormat:@"标题描述:%@\n",adModel.nativead.desc]];
  110 + string = [string stringByAppendingString:[NSString stringWithFormat:@"评定星级:%d\n",adModel.nativead.rating]];
  111 + string = [string stringByAppendingString:[NSString stringWithFormat:@"按钮标题:%@\n",adModel.nativead.button]];
  112 + string = [string stringByAppendingString:[NSString stringWithFormat:@"下载次数:%d\n",adModel.nativead.download_count]];
  113 + string = [string stringByAppendingString:[NSString stringWithFormat:@"下载地址:%@\n",adModel.nativead.app_download_url]];
  114 + NSLog(@"string:\n%@",string);
  115 +// [self toast:string];
  116 + self.titleLbl.text = adModel.nativead.title;
  117 + self.scoreLbl.text = [NSString stringWithFormat:@"%d分",adModel.nativead.rating];
  118 + if (adModel.nativead.ldp.length > 0) {
  119 + ldp = adModel.nativead.ldp;
  120 + }else if (adModel.nativead.app_download_url.length > 0)
  121 + {
  122 + ldp = adModel.nativead.app_download_url;
  123 + }else
  124 + {
  125 + ldp = @"";
  126 + }
  127 + _interact_type = adModel.interact_type;
  128 + }
  129 + }];
  130 +}
  131 +
  132 +- (void)adClickAction
  133 +{
  134 +
  135 +}
  136 +
  137 +- (void)closeBtnAction
  138 +{
  139 + [self dismissViewControllerAnimated:YES completion:NULL];
  140 +}
  141 +
  142 +- (void)tapAd:(UITapGestureRecognizer *)gesture
  143 +{
  144 + CGPoint point = [gesture locationInView:self.adView];
  145 +
  146 + NSArray <NSString *>*clkArr = [self insteadAdMonitoringMacroWithArr:_clk_tracking upPoint:point downPoint:point];
  147 + if (clkArr.count > 0 && clkArr) {
  148 + [[VLionMonitorTrackingManager manager] uploadTrackingUrls:clkArr];
  149 + }
  150 +
  151 + NSArray <NSString *>*ldpArr = [self insteadAdMonitoringMacroWithArr:@[ldp] upPoint:point downPoint:point];
  152 + ldp = ldpArr[0];
  153 +
  154 + //interact_type == 1 下载类;0 web类
  155 + if (_interact_type == 1) {
  156 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ldp]];
  157 + return;
  158 +
  159 + } else {
  160 + if ([ldp hasPrefix:@"http://"] || [ldp hasPrefix:@"https://"] || [ldp hasPrefix:@"ftp://"]) {
  161 +
  162 + CNLiveVLionAdWebController *vc = [CNLiveVLionAdWebController new];
  163 + vc.urlString = ldp;
  164 + vc.isModalButton = YES;
  165 + [self presentViewController:vc animated:YES completion:NULL];
  166 + } else {
  167 + [[UIApplication sharedApplication] openURL:[NSURL URLWithString:ldp]];
  168 + }
  169 + }
  170 +
  171 +}
  172 +
  173 +- (NSArray <NSString *>*)insteadAdMonitoringMacroWithArr:(NSArray <NSString *>*)arr upPoint:(CGPoint)upPoint downPoint:(CGPoint)downPoint
  174 +{
  175 + if (arr.count == 0) {
  176 + return nil;
  177 + }
  178 + NSMutableArray *tempArr = [NSMutableArray array];
  179 + for (int i = 0; i < arr.count; i++) {
  180 + NSString *str = arr[i];
  181 + NSString *downX = [NSString stringWithFormat:@"%.0f",downPoint.x];
  182 + str = [str stringByReplacingOccurrencesOfString:@"__CLICK_DOWN_X__" withString:downX];
  183 + NSString *downY = [NSString stringWithFormat:@"%.0f",downPoint.y];
  184 + str = [str stringByReplacingOccurrencesOfString:@"__CLICK_DOWN_Y__" withString:downY];
  185 + NSString *upX = [NSString stringWithFormat:@"%.0f",upPoint.x];
  186 + str = [str stringByReplacingOccurrencesOfString:@"__CLICK_UP_X__" withString:upX];
  187 + NSString *upY = [NSString stringWithFormat:@"%.0f",upPoint.y];
  188 + str = [str stringByReplacingOccurrencesOfString:@"__CLICK_UP_Y__" withString:upY];
  189 + [tempArr addObject:str];
  190 + }
  191 + NSArray *retArr = [NSArray arrayWithArray:tempArr];
  192 + return retArr;
  193 +}
  194 +
  195 +#pragma mark - alertView
  196 +- (void)toast:(NSString *)message
  197 +{
  198 +
  199 + UIAlertView *toast = [[UIAlertView alloc] initWithTitle:nil
  200 + message:message
  201 + delegate:nil
  202 + cancelButtonTitle:nil
  203 + otherButtonTitles:nil, nil];
  204 + [toast show];
  205 + double duration = 2.5;
  206 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
  207 + [toast dismissWithClickedButtonIndex:0 animated:NO];
  208 + });
  209 +}
  210 +
  211 +- (UIView *)adView
  212 +{
  213 + if (!_adView)
  214 + {
  215 + _adView = [[UIView alloc] initWithFrame:CGRectMake(0, (IPHONEX ? 88:64) + 20, self.view.bounds.size.width, 300)];
  216 + _adView.userInteractionEnabled = YES;
  217 + [_adView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAd:)]];
  218 + }
  219 + return _adView;
  220 +}
  221 +
  222 +- (UIImageView *)iconImg
  223 +{
  224 + if (!_iconImg)
  225 + {
  226 + _iconImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 40, 40)];
  227 + }
  228 + return _iconImg;
  229 +}
  230 +
  231 +- (UIImageView *)picImg
  232 +{
  233 + if (!_picImg)
  234 + {
  235 + _picImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 40 + 20, self.view.bounds.size.width - 20, 220)];
  236 + }
  237 + return _picImg;
  238 +}
  239 +
  240 +- (UILabel *)titleLbl
  241 +{
  242 + if (!_titleLbl)
  243 + {
  244 + _titleLbl = [[UILabel alloc] initWithFrame:CGRectMake(60, 10, self.view.bounds.size.width - 70, 20)];
  245 + _titleLbl.textAlignment = NSTextAlignmentLeft;
  246 + _titleLbl.font = [UIFont systemFontOfSize:14];
  247 + }
  248 + return _titleLbl;
  249 +}
  250 +
  251 +- (UILabel *)scoreLbl
  252 +{
  253 + if (!_scoreLbl)
  254 + {
  255 + _scoreLbl = [[UILabel alloc] initWithFrame:CGRectMake(60, 30, self.view.bounds.size.width - 70, 20)];
  256 + _scoreLbl.textAlignment = NSTextAlignmentLeft;
  257 + _scoreLbl.textColor = [UIColor lightGrayColor];
  258 + _scoreLbl.font = [UIFont systemFontOfSize:14];
  259 + }
  260 + return _scoreLbl;
  261 +}
  262 +
  263 +- (UIButton *)adClickBtn
  264 +{
  265 + if (!_adClickBtn)
  266 + {
  267 + _adClickBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  268 + _adClickBtn.frame = CGRectMake(self.view.bounds.size.width-120, (IPHONEX ? 88:64) + 20 + 300 + 20, 100, 40);
  269 + [_adClickBtn setTitle:@"AD CLICK" forState:UIControlStateNormal];
  270 + [_adClickBtn addTarget:self action:@selector(adClickAction) forControlEvents:UIControlEventTouchUpInside];
  271 + [_adClickBtn setBackgroundColor:[UIColor lightGrayColor]];
  272 + [_adClickBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
  273 + [_adClickBtn setBackgroundColor:[UIColor whiteColor]];
  274 + [self.view addSubview:_adClickBtn];
  275 + }
  276 + return _adClickBtn;
  277 +}
  278 +
  279 +- (UIButton *)closeBtn
  280 +{
  281 + if (!_closeBtn) {
  282 + _closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  283 + _closeBtn.frame = CGRectMake(self.view.bounds.size.width - 50, IPHONEX ? 44 : 20, 30, 30);
  284 + [_closeBtn setImage:[UIImage imageNamed:@"native close"] forState:UIControlStateNormal];
  285 + [_closeBtn addTarget:self action:@selector(closeBtnAction) forControlEvents:UIControlEventTouchUpInside];
  286 + }
  287 + return _closeBtn;
  288 +}
  289 +
  290 +- (void)didReceiveMemoryWarning {
  291 + [super didReceiveMemoryWarning];
  292 + // Dispose of any resources that can be recreated.
  293 +}
  294 +
  295 +/*
  296 +#pragma mark - Navigation
  297 +
  298 +// In a storyboard-based application, you will often want to do a little preparation before navigation
  299 +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  300 + // Get the new view controller using [segue destinationViewController].
  301 + // Pass the selected object to the new view controller.
  302 +}
  303 +*/
  304 +
  305 +@end