Commit ec5d5649 by 刘卓鑫

提交3.9.2代码

parent 096f59fc
......@@ -131,7 +131,7 @@
1CB9AF72237102B500ED0434 /* DC_ZXWashOrderListModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9AF50237102B400ED0434 /* DC_ZXWashOrderListModel.m */; };
1CB9AF73237102B500ED0434 /* DC_ZXWashMerthinModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9AF51237102B400ED0434 /* DC_ZXWashMerthinModel.m */; };
1CB9AF74237102B500ED0434 /* DC_ZXWashLocationModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CB9AF56237102B400ED0434 /* DC_ZXWashLocationModel.m */; };
1CBB66172390C11D00351692 /* ad_close.png in Resources */ = {isa = PBXBuildFile; fileRef = 1CBB66162390C11D00351692 /* ad_close.png */; };
1CBB66172390C11D00351692 /* xxxxad_close.png in Resources */ = {isa = PBXBuildFile; fileRef = 1CBB66162390C11D00351692 /* xxxxad_close.png */; };
1CBDE2C6238D0436006DA46E /* ZXTaskManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CBDE2C5238D0435006DA46E /* ZXTaskManager.m */; };
1CC15429230D5B7400582EC1 /* ZXAimiWalletAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1CC15428230D5B7400582EC1 /* ZXAimiWalletAlertView.m */; };
1CC1542D230D6E3600582EC1 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 1CC1542C230D6E3600582EC1 /* LaunchScreen.storyboard */; };
......@@ -974,7 +974,7 @@
1CB9AF55237102B400ED0434 /* DC_ZXWashOrderListModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DC_ZXWashOrderListModel.h; sourceTree = "<group>"; };
1CB9AF56237102B400ED0434 /* DC_ZXWashLocationModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DC_ZXWashLocationModel.m; sourceTree = "<group>"; };
1CB9AF57237102B400ED0434 /* DC_ZXWashMerthinModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DC_ZXWashMerthinModel.h; sourceTree = "<group>"; };
1CBB66162390C11D00351692 /* ad_close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ad_close.png; sourceTree = "<group>"; };
1CBB66162390C11D00351692 /* xxxxad_close.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = xxxxad_close.png; sourceTree = "<group>"; };
1CBDE2C4238D0435006DA46E /* ZXTaskManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXTaskManager.h; sourceTree = "<group>"; };
1CBDE2C5238D0435006DA46E /* ZXTaskManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ZXTaskManager.m; sourceTree = "<group>"; };
1CC15427230D5B7400582EC1 /* ZXAimiWalletAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ZXAimiWalletAlertView.h; sourceTree = "<group>"; };
......@@ -3631,7 +3631,7 @@
A7200868210EF6A600BE2DC6 /* ssssaaaaff.png */,
A7DECC652079F0E20039EC22 /* ss.gif */,
A7BFF1D620D115A300CE350A /* 查看全部@2x.png */,
1CBB66162390C11D00351692 /* ad_close.png */,
1CBB66162390C11D00351692 /* xxxxad_close.png */,
A7265BEC20CA3FAE0084B814 /* close-operation.png */,
A7265BE720CA3AEE0084B814 /* menu-holder@2x.png */,
);
......@@ -5168,7 +5168,7 @@
A72BE4B821D5CD030069C0E1 /* AlertStyleSimple.xib in Resources */,
A705C00221D4B067004F1628 /* ImageSelectedOn.png in Resources */,
A7B058A5211AD1AF00304B38 /* README.txt in Resources */,
1CBB66172390C11D00351692 /* ad_close.png in Resources */,
1CBB66172390C11D00351692 /* xxxxad_close.png in Resources */,
A705C01421D4B067004F1628 /* UIBarButtonItemGrid@2x.png in Resources */,
A78A3F4021952EE7001558A5 /* orderSound.wav in Resources */,
);
......
......@@ -83,5 +83,309 @@
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "9BC4255C-5C8C-4ADE-9BB1-56E66E838941"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "47"
endingLineNumber = "47"
landmarkName = "-nativeExpressAdSuccessToLoad:views:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0F293ACA-BB64-4E6B-B05A-1163F9E7F33A"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "64"
endingLineNumber = "64"
landmarkName = "-nativeExpressAdFailToLoad:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "DEFB91B0-9D12-4340-952B-5FE7B042A68B"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "68"
endingLineNumber = "68"
landmarkName = "-nativeExpressAdViewRenderSuccess:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "2A7A6740-F17E-499E-BF20-84C849668658"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "72"
endingLineNumber = "72"
landmarkName = "-nativeExpressAdViewRenderFail:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D8BB8D1D-0E05-40C9-A67E-E323CE285FD0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "83"
endingLineNumber = "83"
landmarkName = "-nativeExpressAdViewPlayerDidPlayFinish:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3FD395D2-670B-4E4F-AA9A-0780FD50C122"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "96"
endingLineNumber = "96"
landmarkName = "-nativeExpressAdViewWillPresentScreen:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "2E09A9A5-52F0-4870-B38B-498E9087A14E"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "92"
endingLineNumber = "92"
landmarkName = "-nativeExpressAdViewDidClosed:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "1251B703-02EC-4C84-A268-D7DF118F5CB7"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/BUAD/BUFeedAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "88"
endingLineNumber = "88"
landmarkName = "-nativeExpressAdView:dislikeWithReason:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "0A7D3430-7217-4E08-B7DC-4626B44F2664"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "406"
endingLineNumber = "406"
landmarkName = "-bannerViewDidReceived"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "F84AD992-EAED-47FA-B0D4-07363F6B13DB"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "414"
endingLineNumber = "414"
landmarkName = "-bannerViewFailToReceived:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "563A9C16-0067-4D1E-91AF-277F1A8EA5E0"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "422"
endingLineNumber = "422"
landmarkName = "-bannerViewClicked"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "3D1B1127-ACF4-4305-B698-03D2CB7CFBD4"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "431"
endingLineNumber = "431"
landmarkName = "-bannerViewWillLeaveApplication"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C2314746-4AB3-4CF6-8EB6-6DD985C87B15"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "437"
endingLineNumber = "437"
landmarkName = "-bannerViewDidDismissFullScreenModal"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "36BDB56D-ED16-4DB0-BE3E-8B77B786F9DE"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/AD(&#x5e7f;&#x544a;)/TXAD/ZXTXAdTool.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "442"
endingLineNumber = "442"
landmarkName = "-bannerViewWillDismissFullScreenModal"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "D5FCC011-9DFE-4511-B027-AAB23B39033F"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Task(&#x4efb;&#x52a1;)/ZXTaskViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "681"
endingLineNumber = "681"
landmarkName = "-nativeExpresInterstitialAd:didFailWithError:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E013E7EC-29D4-482B-A00B-F89F391CD721"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Task(&#x4efb;&#x52a1;)/ZXTaskViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "988"
endingLineNumber = "988"
landmarkName = "-unifiedBannerViewFailedToLoad:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "2D76FD5E-696A-4E6A-840B-F6069BB08076"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Task(&#x4efb;&#x52a1;)/ZXTaskViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1053"
endingLineNumber = "1053"
landmarkName = "-unifiedBannerViewWillClose:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "C7374EBB-D398-4EC0-8F50-27A7464896D8"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Task(&#x4efb;&#x52a1;)/ZXTaskViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1045"
endingLineNumber = "1045"
landmarkName = "-unifiedBannerViewDidPresentFullScreenModal:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "346BF296-1828-4D9D-89E7-3BB3C8F31306"
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "ColorfulSchool/Classes/Task(&#x4efb;&#x52a1;)/ZXTaskViewController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "1004"
endingLineNumber = "1004"
landmarkName = "-unifiedBannerViewClicked:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
......@@ -562,6 +562,7 @@
if ([userInfo[@"CODE"] integerValue] == 996){
ZXHomePageFeedBackViewController *feedVc = [[ZXHomePageFeedBackViewController alloc] init];
feedVc.hidesBottomBarWhenPushed = YES;
[[ZXTool getCurrentVC].navigationController pushViewController:feedVc animated:YES];
} else if ([userInfo[@"CODE"] integerValue] == 997) {
......@@ -581,10 +582,12 @@
NSInteger orderId = [responseObject[@"orderId"] integerValue];
jumpPay.orderId = orderId;
[ZXPayManager sharedZXPayManager].orderId = orderId;
jumpPay.hidesBottomBarWhenPushed = YES;
[[ZXTool getCurrentVC].navigationController pushViewController:jumpPay animated:YES];
} else {
ZXNewOrderDetailViewController *orderDetail = [[ZXNewOrderDetailViewController alloc] init];
orderDetail.orderId = [userInfo[@"orderInfo"] integerValue];
orderDetail.hidesBottomBarWhenPushed = YES;
[[ZXTool getCurrentVC].navigationController pushViewController:orderDetail animated:YES];
}
});
......
//
//
......@@ -17,13 +17,18 @@ NS_ASSUME_NONNULL_BEGIN
- (void) loadLauchAdByDelegate:(id) delagte;
- (void) loadBannerAdWithController:(UIViewController *) viewController superView:(UIView *) superView isFirstPage:(BOOL) isFirst;
- (void) loadBannerAdWithController:(UIViewController *) viewController
superView:(UIView *) superView
bottomMargin:(CGFloat) bottomMargin;
- (void) loadBannerAdWithController:(UIViewController *) viewController superView:(UIView *) superView ;
//创建激励视频
- (void) createRewardedVideoAdWithController:(UIViewController *) viewController;
////展示激励视频广告
//- (void) showRewardedVideoAd;
@end
NS_ASSUME_NONNULL_END
//
//
......@@ -75,6 +75,26 @@
}
[self.bannerView loadAdData];
}
//自定义
- (void) loadBannerAdWithController:(UIViewController *) viewController
superView:(UIView *) superView
bottomMargin:(CGFloat) bottomMargin {
// splash AD demo
BUSize *imgSize = [BUSize sizeBy:BUProposalSize_Banner600_90];
CGFloat bannerHeigh = kScreenWidth/600*90;
if (self.bannerView == nil) {
self.bannerView = [[BUNativeExpressBannerView alloc] initWithSlotID:@"933112579" rootViewController:viewController imgSize:imgSize adSize:CGSizeMake(kScreenWidth, bannerHeigh) IsSupportDeepLink:YES];
self.bannerView.delegate = self;
[superView insertSubview:self.bannerView atIndex:0];
[self.bannerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(superView.mas_bottom).offset(-bottomMargin);
make.left.right.equalTo(superView);
make.height.mas_equalTo(bannerHeigh);
}];
}
[self.bannerView loadAdData];
}
- (void) loadBannerAdWithController:(UIViewController *) viewController superView:(UIView *) superView {
// splash AD demo
BUSize *imgSize = [BUSize sizeBy:BUProposalSize_Banner600_90];
......
//
//
......@@ -10,7 +10,7 @@
#define TXADHeader_h
#define kTXAdAPPID @"1108089964"
#define kTXAdNativePLACEMENTID @"8030751158735005" //原生广告id
#define kTXAdNativePLACEMENTID @"3080199247582715" //原生广告id
#define kTXAdLauchPLACEMENTID @"9090758636743260" //开屏广告id
......
//
//
......@@ -29,9 +29,13 @@ kSINGLETON_FOR_HEADER(ZXTXAdTool)
viewController:(UIViewController *) viewController
isFirstPage:(BOOL) isFirstPage
isHasBottomMargin:(BOOL) isHasBottomMargin;
- (void) createMessageFlowAdWithSuperView:(UIView *) superView fromViewController:(UIViewController *) fromViewController bottomMargin:(CGFloat) bottomMargin;
/**banner广告*/
-(void) createBannerAdByPlacmentId:(NSString *) placenmentId currentViewController:(UIViewController *) viewController
superView:(UIView *) superView;
- (void) loadBannerAdWithController:(UIViewController *) viewController
superView:(UIView *) superView
bottomMargin:(CGFloat) bottomMargin;
@property (nonatomic, copy) dispatch_block_t closeAction;
@end
......
//
//
......@@ -19,6 +19,8 @@
@property (nonatomic, strong) GDTNativeAdData *currentAdData;
//banner广告
@property (nonatomic, strong) GDTMobBannerView *bannerView;
@property (nonatomic, assign) CGFloat bottomMargin;
@property (nonatomic, weak) UIView *adView;
@property (nonatomic, weak) UIView *topView;
......@@ -141,7 +143,15 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool)
{
NSLog(@"%s",__FUNCTION__);
}
- (void) createMessageFlowAdWithSuperView:(UIView *) superView fromViewController:(UIViewController *) fromViewController bottomMargin:(CGFloat) bottomMargin {
self.nativeAd = [[GDTNativeExpressAd alloc] initWithAppId:kTXAdAPPID placementId:kTXAdNativePLACEMENTID adSize:CGSizeMake(kScreenWidth, kScreenWidth * 0.56)];
self.nativeAd.delegate = self;
self.adView = superView;
self.bottomMargin = bottomMargin;
self.fromVc = fromViewController;
[self.nativeAd loadAd:1];
}
#pragma mark - ========== 原生广告 ==========
- (void) createNativieAdByView:(UIView *) view
topView:(UIView *) topView
......@@ -179,48 +189,11 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool)
expressView.controller = self.fromVc;
[expressView render];
[self.adView addSubview:expressView];
if (self.isFristPage) {
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.adView.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.adView.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(kScreenWidth * 0.56);
make.bottom.equalTo([ZXPayManager sharedZXPayManager].notPayOrderView.mas_top);
}];
} else {
if (self.isHasBottomMargin) {
CGFloat margin = 49;
if (iPhoneX) {
margin = 83;
}
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.adView.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.adView.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(kScreenWidth * 0.56);
make.bottom.equalTo(self.adView.mas_bottom).offset(-margin);
}];
} else {
if (self.topView) {
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.adView.mas_left).offset(5 * k6Scale);
make.right.equalTo(self.adView.mas_right).offset(-5 * k6Scale);
make.height.mas_equalTo(kScreenWidth * 0.56);
make.top.equalTo(self.topView.mas_bottom).offset(5 * k6Scale);
}];
} else {
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.adView).offset(15 * k6Scale);
make.right.equalTo(self.adView).offset(-15 * k6Scale);
make.height.mas_equalTo((kScreenWidth - 20) * 0.56);
make.bottom.equalTo(self.adView);
}];
}
}
}
if (self.isFristPage == NO && self.isHasBottomMargin == NO && self.topView == nil) {
[self createRemoveAdView:expressView];
} else {
[self createCountingDowViewByAdView:expressView];
}
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.adView);
make.bottom.equalTo(self.adView.mas_bottom).offset(-self.bottomMargin);
make.height.mas_equalTo(kScreenWidth * 0.56);
}];
} @catch (NSException *exception) {
} @finally {
......@@ -399,6 +372,23 @@ kSINGLETON_FOR_CLASS(ZXTXAdTool)
[self loadBannerView];
}
- (void)loadBannerAdWithController:(UIViewController *)viewController superView:(UIView *)superView bottomMargin:(CGFloat)bottomMargin {
CGRect rect = {CGPointZero, GDTMOB_AD_SUGGEST_SIZE_320x50};
self.bannerView = [[GDTMobBannerView alloc] initWithFrame:rect appId:kTXAdAPPID placementId:@"1010494297797517"];
self.bannerView.currentViewController = viewController;
self.bannerView.interval = 40;
self.bannerView.delegate = self;
self.bannerView.showCloseBtn = YES;
[superView addSubview:self.bannerView];
[self.bannerView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(superView);
make.height.mas_equalTo(kScreenWidth * 0.15);
make.bottom.equalTo(superView.mas_bottom).offset(-bottomMargin);
}];
[self loadBannerView];
}
- (void)removeBannerAd {
[self.bannerView removeFromSuperview];
self.bannerView = nil;
......
//
//
......@@ -60,14 +60,14 @@
//开屏广告 1次展示
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/open/advert/round/info?id=%@&sourceType=0", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/open/advert/round/info?id=%@&sourceType=2", [kUserDefaults valueForKey:@"SX_MONEY"], CacheUserId] para:nil completed:^(CommonModel *common, NSString *error) {
if (error == nil) {
ZXLauchModel *lauch = [ZXLauchModel mj_objectWithKeyValues:common.data];
[ZXLauchModel clearTable];
[lauch save];
if (lauch.whether == NO) {
return ;
}
// if (lauch.whether == NO) {
// return ;
// }
dispatch_async(dispatch_get_main_queue(), ^{
......@@ -106,7 +106,7 @@
[self jumpAction:lauch];
};
[adView reloadAdImageWithUrl:lauch.advertImg];
[adView reloadAdImageWithUrl:[lauch.advertImg componentsSeparatedByString:@","].firstObject];
[kAppWindow addSubview:adView];
//内部曝光
......
//
//
......@@ -75,6 +75,8 @@ static NSString *kFailurMsg = @"数据加载失败,请检查一下当前网络
#define kAPP_ME_REFRESHAD @"kAPP_ME_REFRESHAD"
//app是否开启了任务
#define kAPP_IS_OPENB_TASK @"kAPP_IS_OPENB_TASK"
//app是否开启了退款
#define kAPP_IS_OPENB_TK @"kAPP_IS_OPENB_TK"
/*首页的key和value--对应rootUrl*/
......
//
//
......@@ -14,8 +14,8 @@
#import "ZXAdViewAdTool.h"
#import "BUADTool.h"
#import "ZXBDTool.h"
@interface ZXSelfHelpViewController () {
#import <GDTMobSDK/GDTUnifiedBannerView.h>
@interface ZXSelfHelpViewController ()<GDTUnifiedBannerViewDelegate> {
enlargeClickRegionBtn *showCode;
......@@ -32,6 +32,12 @@
@property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
@property (nonatomic, strong) UIView *fouvtionView;
@property (nonatomic, strong) UIImageView *barcodeView;
//腾讯banner广告
@property (nonatomic, strong) GDTUnifiedBannerView *tx_bannerAd;
//腾讯banner广告的底部间距
@property (nonatomic, assign) CGFloat tx_banner_bottomMargin;
@end
@implementation ZXSelfHelpViewController
......@@ -85,6 +91,7 @@
if ([[kUserDefaults objectForKey:kAPP_SELP_ADVIEW_SHOW] isEqualToString:@"yes"]) {
[[[BUADTool alloc] init] loadBannerAdWithController:self superView:self.view isFirstPage:NO];
[self createTxBannerAd];
// UIView *adSuperView = [[UIView alloc] init];
// [self.view addSubview:adSuperView];
// adSuperView.backgroundColor = UIColor.whiteColor;
......@@ -401,7 +408,112 @@
#pragma mark - ===================腾讯banner广告===========================
- (void) createTxBannerAd {
self.tx_bannerAd = [[GDTUnifiedBannerView alloc]
initWithFrame:CGRectZero appId:@"1108089964"
placementId:@"1010494297797517"
viewController:self];
self.tx_bannerAd.accessibilityIdentifier = @"banner_ad";
self.tx_bannerAd.animated = YES;
self.tx_bannerAd.autoSwitchInterval = 4;
self.tx_bannerAd.delegate = self;
[self.view insertSubview:self.tx_bannerAd atIndex:0];
[self.tx_bannerAd mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.height.mas_equalTo(kScreenWidth * 0.15);
make.bottom.equalTo(self.view.mas_bottom).offset(-kScreenWidth * 0.15);
}];
[self.tx_bannerAd loadAdAndShow];
}
#pragma mark - GDTUnifiedBannerViewDelegate
/**
* 请求广告条数据成功后调用
* 当接收服务器返回的广告数据成功后调用该函数
*/
- (void)unifiedBannerViewDidLoad:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
NSLog(@"unified banner did load");
}
/**
* 请求广告条数据失败后调用
* 当接收服务器返回的广告数据失败后调用该函数
*/
- (void)unifiedBannerViewFailedToLoad:(GDTUnifiedBannerView *)unifiedBannerView error:(NSError *)error
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0曝光回调
*/
- (void)unifiedBannerViewWillExpose:(nonnull GDTUnifiedBannerView *)unifiedBannerView {
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0点击回调
*/
- (void)unifiedBannerViewClicked:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 应用进入后台时调用
* 当点击应用下载或者广告调用系统程序打开,应用将被自动切换到后台
*/
- (void)unifiedBannerViewWillLeaveApplication:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页已经被关闭
*/
- (void)unifiedBannerViewDidDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页即将被关闭
*/
- (void)unifiedBannerViewWillDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0广告点击以后即将弹出全屏广告页
*/
- (void)unifiedBannerViewWillPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0广告点击以后弹出全屏广告页完毕
*/
- (void)unifiedBannerViewDidPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0被用户关闭时调用
*/
- (void)unifiedBannerViewWillClose:(nonnull GDTUnifiedBannerView *)unifiedBannerView {
self.tx_bannerAd = nil;
NSLog(@"%s",__FUNCTION__);
}
@end
//
//
......@@ -283,6 +283,168 @@ static NSString * const ID = @"CollectionCell";
[self creatBeanCollectionView];
//MARK:退款开关
if ([[kUserDefaults objectForKey:kAPP_IS_OPENB_TK] isEqualToString:@"yes"]) {
UIButton *button = [[UIButton alloc] init];
[self.view addSubview:button];
[button setTitle:@"退款" forState:UIControlStateNormal];
button.backgroundColor = [UIColor whiteColor];
button.titleLabel.font = kFontSize(12);
[button setTitleColor:[UIColor colorWithHexString:@"#333333"] forState:UIControlStateNormal];
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(45 * k6Scale);
make.height.mas_equalTo(20 * k6Scale);
make.left.equalTo(self.aimiLabel.mas_right).offset(10 * k6Scale);
make.centerY.equalTo(self.aimiLabel);
}];
button.layer.cornerRadius = 6 * k6Scale;
button.layer.masksToBounds = YES;
[button addTarget:self action:@selector(showTKDesc) forControlEvents:UIControlEventTouchUpInside];
}
}
#pragma mark - 显示退款说明
- (void) showTKDesc {
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/app/explain/recharge/refund", [kUserDefaults objectForKey:@"NEW_PAY"]] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
[self showCustomWithData:common.data];
}
});
}];
}
-(void) showCustomWithData:(NSDictionary *) data {
NSString *title = data[@"title"];
NSString *contet = data[@"content"];
NSString *contactPerson = data[@"contactPerson"];
NSString *contactNumber = data[@"contactNumber"];
UIView *holder = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
holder.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:.2];
CGFloat bgW = kScreenWidth * 0.75;
UIView *bgView = [[UIView alloc] init];
[holder addSubview:bgView];
[bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(bgW);
make.center.equalTo(holder);
}];
bgView.backgroundColor = [UIColor whiteColor];
bgView.layer.cornerRadius = 15 * k6Scale;
bgView.layer.masksToBounds = YES;
UIView *line = [[UIView alloc] init];
line.backgroundColor = RGB(242, 242, 242);
[bgView addSubview:line];
[line mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(bgView);
make.height.mas_equalTo(1);
make.bottom.mas_equalTo(bgView.mas_bottom).offset(-44 * k6Scale);
}];
UILabel *bottomLabel = [[UILabel alloc] init];
[bgView addSubview:bottomLabel];
bottomLabel.backgroundColor = [UIColor clearColor];
bottomLabel.textAlignment = NSTextAlignmentCenter;
bottomLabel.textColor = RGB(248, 149, 83);
bottomLabel.font = kFontSize(16 * k6Scale);
bottomLabel.text = @"确定";
bottomLabel.userInteractionEnabled = YES;
[bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.equalTo(bgView);
make.height.mas_equalTo(44 * k6Scale);
}];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] init];
[bottomLabel addGestureRecognizer:tap];
__weak typeof(holder) weakholder = holder;
[[tap rac_gestureSignal] subscribeNext:^(id x) {
[weakholder removeFromSuperview];
weakholder.hidden = YES;
}];
UILabel *titleLbel = [[UILabel alloc] init];
[bgView addSubview:titleLbel];
titleLbel.textColor = [UIColor colorWithHexString:@"#333333"];
titleLbel.font = kFontSize(18 * k6Scale);
titleLbel.text = title;
titleLbel.textAlignment = NSTextAlignmentCenter;
[titleLbel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.equalTo(bgView);
make.height.mas_equalTo(55 * k6Scale);
}];
UILabel *msgLbel = [[UILabel alloc] init];
[bgView addSubview:msgLbel];
msgLbel.textColor = [UIColor colorWithHexString:@"#333333"];
msgLbel.font = kFontSize(15 * k6Scale);
msgLbel.numberOfLines = 0;
msgLbel.textAlignment = NSTextAlignmentLeft;
[msgLbel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(10 * k6Scale);
make.right.equalTo(bgView.mas_right).offset(-10 * k6Scale);
make.top.mas_equalTo(titleLbel.mas_bottom);
}];
msgLbel.text = [NSString stringWithFormat:@" %@", contet];;
UILabel *msgLbel1 = [[UILabel alloc] init];
[bgView addSubview:msgLbel1];
msgLbel1.textColor = [UIColor colorWithHexString:@"#333333"];
msgLbel1.font = kFontSize(15 * k6Scale);
msgLbel1.textAlignment = NSTextAlignmentLeft;
[msgLbel1 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(10 * k6Scale);
make.right.equalTo(bgView.mas_right).offset(-10 * k6Scale);
make.top.mas_equalTo(msgLbel.mas_bottom).offset(5 * k6Scale);
}];
if (contactPerson && ![contactPerson isEqualToString:@""]) {
msgLbel1.text = [NSString stringWithFormat:@"联系人: %@", contactPerson];;
}
UILabel *msgLbel2 = [[UILabel alloc] init];
[bgView addSubview:msgLbel2];
msgLbel2.textColor = [UIColor colorWithHexString:@"#333333"];
msgLbel2.font = kFontSize(15 * k6Scale);
msgLbel2.textAlignment = NSTextAlignmentLeft;
[msgLbel2 mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(bgView.mas_left).offset(10 * k6Scale);
make.top.mas_equalTo(msgLbel1.mas_bottom).offset(5 * k6Scale);
make.bottom.equalTo(line.mas_top).offset(-15 * k6Scale);
}];
if (contactNumber && ![contactNumber isEqualToString:@""]) {
msgLbel2.text = [NSString stringWithFormat:@"联系电话: %@", contactNumber];
enlargeClickRegionBtn *button = [[enlargeClickRegionBtn alloc] init];
[bgView addSubview:button];
[button setTitle:@"复制" forState:UIControlStateNormal];
button.backgroundColor = [UIColor colorWithHexString:@"#57bdee"];
button.titleLabel.font = kFontSize(10);
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(30 * k6Scale);
make.height.mas_equalTo(15 * k6Scale);
make.left.equalTo(msgLbel2.mas_right).offset(5 * k6Scale);
make.centerY.equalTo(msgLbel2);
}];
button.layer.cornerRadius = 3 * k6Scale;
button.layer.masksToBounds = YES;
[[button rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
pasteboard.string = contactNumber;
[ZXTool showText:@"复制成功,请在拨打电话处粘贴"];
}];
}
[[UIApplication sharedApplication].keyWindow addSubview:holder];
}
#pragma mark - ==========查询钱包页面数据==========
- (void) checkWalletData {
......
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15505" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15510"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -156,7 +154,7 @@
<constraint firstItem="VFn-Ry-Py4" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="opI-sl-U7b"/>
<constraint firstAttribute="trailing" secondItem="NKH-73-rTA" secondAttribute="trailing" id="pT0-MJ-scw"/>
</constraints>
<point key="canvasLocation" x="-5562" y="-609"/>
<point key="canvasLocation" x="-6001" y="-609"/>
</view>
</objects>
<resources>
......
//
//
......@@ -14,7 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
/** jumpUrl */
@property (nonatomic, copy) NSString *jumpUrl;
/** 页面index */
@property (nonatomic, copy) NSString *pageIndex;
/** 是否是任务首页 */
@property (nonatomic, assign) NSInteger isTaskHomePage;
/** 状态栏颜色 */
......
//
//
......@@ -16,14 +16,61 @@
#import "ZXBDTool.h"
#import "ZXTaskManager.h"
#import <IQKeyboardManager/IQKeyboardManager.h>
@interface ZXTaskViewController ()<WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler, BUNativeExpressRewardedVideoAdDelegate, BaiduMobAdRewardVideoDelegate>
#import <GDTMobSDK/GDTSDKDefines.h>
#import <GDTMobSDK/GDTSDKConfig.h>
#import <GDTMobSDK/GDTNativeAd.h>
#import <GDTMobSDK/GDTSplashAd.h>
#import <GDTMobSDK/GDTMobBannerView.h>
#import <GDTMobSDK/GDTMobInterstitial.h>
#import <GDTMobSDK/GDTNativeExpressAd.h>
#import <GDTMobSDK/GDTNativeExpressAdView.h>
#import <GDTMobSDK/GDTUnifiedBannerView.h>
#import <GDTMobSDK/GDTUnifiedInterstitialAd.h>
@interface ZXTaskViewController ()<WKNavigationDelegate, WKUIDelegate, WKScriptMessageHandler, BUNativeExpressRewardedVideoAdDelegate, BaiduMobAdRewardVideoDelegate, BUNativeExpresInterstitialAdDelegate, BUNativeExpressFullscreenVideoAdDelegate, BUNativeExpressAdViewDelegate, BUNativeExpressBannerViewDelegate, GDTNativeExpressAdDelegete, GDTUnifiedBannerViewDelegate, GDTUnifiedInterstitialAdDelegate>
/** */
@property (nonatomic, strong) WKWebView *webView;
/** */
@property (nonatomic, strong) NSArray *indentifierList;
//穿山甲激励视频
@property (nonatomic, strong) BUNativeExpressRewardedVideoAd *rewardedAd;
//穿山甲插屏广告
@property (nonatomic, strong) BUNativeExpressInterstitialAd *interstitialAd;
//穿山甲全屏视频
@property (nonatomic, strong) BUNativeExpressFullscreenVideoAd *fullscreenAd;
//穿山甲信息流广告
@property (strong, nonatomic) BUNativeExpressAdManager *nativeExpressAdManager;
//穿山甲信息流视频的底部间距
@property (nonatomic, assign) CGFloat csj_bottomMargin;
//穿山甲banner广告
@property (nonatomic, strong) BUNativeExpressBannerView *csj_bannerAd;
//百度激励视频广告
@property (nonatomic, strong) BaiduMobAdRewardVideo *reward;
//腾讯信息流广告
@property (nonatomic, strong) GDTNativeExpressAd *nativeAd;
//腾讯信息流视频的底部间距
@property (nonatomic, assign) CGFloat tx_native_bottomMargin;
//腾讯banner广告
@property (nonatomic, strong) GDTUnifiedBannerView *tx_bannerAd;
//腾讯banner广告的底部间距
@property (nonatomic, assign) CGFloat tx_banner_bottomMargin;
//腾讯插屏广告
@property (nonatomic, strong) GDTUnifiedInterstitialAd *tx_interstitialAd;
//腾讯插屏广告的底部间距
@property (nonatomic, assign) CGFloat tx_interstitial_bottomMargin;
//当前广告父视图的高度
@property (nonatomic, assign) CGFloat current_adSuperView_totalH;
/** 回调H5的方法名 */
@property (nonatomic, copy) NSString *jsFuncName;
......@@ -49,13 +96,14 @@
[self initWebView];
[self addBannerAd];//添加广告
[self preloadCSJRewardAd];
[self preloadFullScreenVideo];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
}
#pragma mark - ========== 键盘收起 ==========
- (void) keyboardWillHide:(NSNotification *) nof {
self.webView.frame = CGRectMake(0, kStatusBarHeight, kScreenWidth, kScreenHeight - kStatusBarHeight);
......@@ -88,51 +136,108 @@
#pragma mark - 添加广告
- (void) addBannerAd {
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/advert/get/initdata?pageNo=TASK_PAGE", [kUserDefaults objectForKey:@"Task"]] para:nil completed:^(CommonModel *common, NSString *error) {
[ZXTool requestDataHideLoadingToastWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/advert/get/initdata?pageNo=%@", [kUserDefaults objectForKey:@"Task"], self.pageIndex?self.pageIndex:@"home"] para:nil completed:^(CommonModel *common, NSString *error) {
if (common && common.data && common.data[@"adverts"]) {
NSArray *arr = common.data[@"adverts"];
NSMutableArray *arrAd = [NSMutableArray new];
// platform 1,腾讯;5,穿山甲
// type 1信息流广告 2banner广告 3插屏广告 4 全屏视频广告 5激励视频 6开屏广告
for (NSDictionary *dic in arr) {
if ([dic[@"type"] integerValue] == 5) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createBannerAd];
});
if ([dic[@"platform"] integerValue] == 1) {
if ([dic[@"type"] integerValue] == 1) {
[arrAd addObject:dic];
} else if ([dic[@"type"] integerValue] == 2) {
[arrAd addObject:dic];
}
} else if ([dic[@"platform"] integerValue] == 5) {
if ([dic[@"type"] integerValue] == 1) {
[arrAd addObject:dic];
} else if ([dic[@"type"] integerValue] == 2) {
[arrAd addObject:dic];
}
}
}
if (arrAd.count) {
dispatch_async(dispatch_get_main_queue(), ^{
[self createBannerAdWithDataSource:arrAd];
});
}
}
}];
}
#pragma mark - 创建广告
- (void) createBannerAd {
if (self.adSuperView == nil) {
self.adSuperView = [[UIView alloc] init];
[self.view addSubview:self.adSuperView];
self.adSuperView.backgroundColor = UIColor.whiteColor;
[self.adSuperView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.height.mas_equalTo(kScreenWidth * 0.15);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
}];
enlargeClickRegionBtn *closeButton = [[enlargeClickRegionBtn alloc] init];
[self.adSuperView addSubview:closeButton];
[closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.equalTo(self.adSuperView);
make.width.height.mas_equalTo(30 * k6Scale);
}];
[[closeButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
self.adSuperView.hidden = YES;
}];
}
for (UIView *v in self.adSuperView.subviews) {
if (![v isKindOfClass:[enlargeClickRegionBtn class]]) {
- (void) clearAd {
if (self.adSuperView) {
self.adSuperView.hidden = YES;
[self.adSuperView removeFromSuperview];
for (UIView *v in self.adSuperView.subviews) {
v.hidden = YES;
[v removeFromSuperview];
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[v class];
});
}
self.adSuperView = nil;
}
self.current_adSuperView_totalH = 0;
}
#pragma mark - 创建广告
- (void) createBannerAdWithDataSource:(NSArray *) arr {
[self clearAd];
self.adSuperView = [[UIView alloc] init];
[self.view addSubview:self.adSuperView];
self.adSuperView.backgroundColor = UIColor.whiteColor;
[self.adSuperView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
}];
enlargeClickRegionBtn *closeButton = [[enlargeClickRegionBtn alloc] init];
[self.adSuperView addSubview:closeButton];
[closeButton setImage:[UIImage imageNamed:@"xxxxad_close"] forState:UIControlStateNormal];
[closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.adSuperView);
make.top.equalTo(self.adSuperView.mas_top).offset(2 * k6Scale);
make.width.height.mas_equalTo(20 * k6Scale);
}];
@weakify(self);
[[closeButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(id x) {
@strongify(self);
[self clearAd];
}];
self.adSuperView.hidden = NO;
[[[BUADTool alloc] init] loadBannerAdWithController:self superView:self.adSuperView];
CGFloat bottomMargin = 0;//初始化与底部的间距
for (int i = 0; i < arr.count; i++) {
NSDictionary *dic = arr[i];
if ([dic[@"platform"] integerValue] == 1) {
if ([dic[@"type"] integerValue] == 1) {
//加载c腾讯的信息流
[self createTxMessageFlowAd];
} else if ([dic[@"type"] integerValue] == 2) {
//加载c腾讯的banner
[self createTxBannerAd];
bottomMargin += kScreenWidth * 0.15;
}
} else if ([dic[@"platform"] integerValue] == 5) {
if ([dic[@"type"] integerValue] == 1) {
//加载c穿山甲的信息流
[self createMessageFlowAd];
bottomMargin += kScreenWidth * 0.56;
} else if ([dic[@"type"] integerValue] == 2) {
//加载c穿山甲的banner
[self loadBannerAd];
bottomMargin += kScreenWidth * 0.15;
}
}
}
}
#pragma mark - ========== 加载失败的时候 创建holder ==========
- (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error {
......@@ -156,6 +261,7 @@
@"wechatAuth",//微信绑定
@"drawCash", //提现
@"refreshAd",//刷新广告
@"loginOut",//登出
];
}
return _indentifierList;
......@@ -178,12 +284,14 @@
NSString *pushPath = message.body[0];//push出的页面的路径
NSString *statusColor = message.body[1];//跳转页面的状态蓝颜色
NSString *suffix = arr.lastObject;
NSString *pageIndex = arr[2];
NSString *jumpUrl = [NSString stringWithFormat:@"%@%@?token=%@", [kUserDefaults objectForKey:@"TaskH5"], pushPath, CacheToken];
if (suffix && ![suffix isEqualToString:@""]) {
jumpUrl = [[NSString stringWithFormat:@"%@%@?token=%@&%@", [kUserDefaults objectForKey:@"TaskH5"], pushPath, CacheToken, suffix] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}
ZXTaskViewController *task = [[ZXTaskViewController alloc] init];
task.jumpUrl = jumpUrl;
task.pageIndex = pageIndex;
task.colorHex = statusColor;
[self.navigationController pushViewController:task animated:YES];
} else if ([message.name isEqualToString:self.indentifierList[1]]) {
......@@ -206,7 +314,9 @@
[ZXTaskManager sharedZXTaskManager].isTaskCompleted = (taskType == 3);
switch (taskType) {
case 1: {//激励视频
[self taskRewardVideo];
NSInteger adType = [arr[5] integerValue]; //3插屏广告 4 全屏视频广告 5激励视频
[self taskAdWithAdvertType:adType];
break;
}
case 2: {//自编内容
......@@ -280,6 +390,8 @@
}];
} else if ([message.name isEqualToString:self.indentifierList[6]]) {//刷新广告
[self addBannerAd];
} else if ([message.name isEqualToString:self.indentifierList[7]]) {//登出
[ZXTool backToLogin];
}
}
......@@ -317,6 +429,143 @@
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aouthSuccess:) name:kWX_AUTH_RESULT object:nil];
}
#pragma mark - 任务获取接口------(全屏视频--激励视频--插屏)
- (void) taskAdWithAdvertType:(NSInteger) advertType {
//请求接口 获取广告类型
[ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/incentiveVideo/least?advertType=%ld", [kUserDefaults objectForKey:@"Task"], (long)advertType] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
return;
}
//平台 1腾讯 2百度 3瑞狮 4友盟 5穿山甲
//类型 advertType 3插屏广告 4 全屏视频广告 5激励视频
switch ([common.data integerValue]) {
case 1: {
switch (advertType) {
case 3: //插屏广告
[self.tx_interstitialAd loadAd];
break;
default:
break;
}
break;
}
case 2: {
break;
}
case 3: {
break;
}
case 4: {
break;
case 5: {
switch (advertType) {
case 3: //插屏广告
[self.interstitialAd loadAdData];
break;
case 4: //全屏视频广告
[self showFullScreenVideo];
break;
case 5: //激励视频广告
[self showCSJRewardVideo];
break;
default:
break;
}
break;
}
default:
break;
}
}
});
}];
}
#pragma mark - 任务完成
- (void) taskCompleted {
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/api/tasks/%@", [kUserDefaults objectForKey:@"Task"], [ZXTaskManager sharedZXTaskManager].taskCode] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error == nil) {
//直接弹
[self callBackToH5WithSuccess:YES];
}
});
}];
}
#pragma mark - 回调前端已经任务完成
- (void) callBackToH5WithSuccess:(BOOL) isSuccess {
//异常情况处理
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@('%d', '%@')", self.jsFuncName, isSuccess, [ZXTaskManager sharedZXTaskManager].taskCode] completionHandler:^(id _Nullable res, NSError * _Nullable error) {
//清空taskid
ZXTaskManager.sharedZXTaskManager.taskCode = @"";
}];
}
#pragma mark - 微信授权成功
- (void) aouthSuccess:(NSNotification *) nof {
if ([self.wxCode isEqualToString:nof.object]) {
return;
}
self.wxCode = nof.object;
NSLog(@"请求微信授权登录----%@", self.wxCode);
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
[manager GET:[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx41cd01f1eb664e21&secret=d709419cf1ba7ed33e6337bd9396bef1&code=%@&grant_type=authorization_code", nof.object] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
self.wxCode = @"";
if (responseObject != nil && responseObject[@"openid"] != nil) {
[self requestUserInfoByToken:responseObject[@"access_token"] andOpenid:responseObject[@"openid"]];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error.userInfo[@"NSLocalizedDescription"]];
});
}];
}
-(void)requestUserInfoByToken:(NSString *)token andOpenid:(NSString *)openID
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager GET:[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/userinfo?access_token=%@&openid=%@",token,openID] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
NSDictionary *dic = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/wx/auth/submit/info", [kUserDefaults objectForKey:@"Task"]] para:@{@"wxInfo":[dic mj_JSONString]} completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if (self.jsFuncName == nil || [self.jsFuncName isEqualToString:@""]) {
self.jsFuncName = @"bindWechatCallback";
}
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@()", self.jsFuncName] completionHandler:^(id _Nullable res, NSError * _Nullable error) {
}];
}
});
}];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
......@@ -329,7 +578,7 @@
self.webView.navigationDelegate = nil;
}
#pragma mark - 预加载穿山视频
#pragma mark - =================预加载穿山视频=========================
- (void) preloadCSJRewardAd {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
BURewardedVideoModel *model = [[BURewardedVideoModel alloc] init];
......@@ -342,7 +591,7 @@
}
#pragma mark - 显示穿山甲激励视频
#pragma mark - ===================显示穿山甲激励视频==================
-(void) showCSJRewardVideo {
if (self.rewardedAd.isAdValid) {
......@@ -413,122 +662,565 @@
- (void)nativeExpressRewardedVideoAdServerRewardDidFail:(BUNativeExpressRewardedVideoAd *)rewardedVideoAd {
}
#pragma mark - =====================穿山甲插屏广告============================
- (BUNativeExpressInterstitialAd *)interstitialAd {
if (!_interstitialAd) {
_interstitialAd = [[BUNativeExpressInterstitialAd alloc] initWithSlotID:@"933112856" imgSize:[BUSize sizeBy:BUProposalSize_Interstitial600_600] adSize:CGSizeMake(300, 450)];
_interstitialAd.delegate = self;
}
return _interstitialAd;
}
#pragma ---BUNativeExpresInterstitialAdDelegate
#pragma mark - 任务--激励视频
- (void) taskRewardVideo {
//请求接口 获取视频平台
// [ZXTool requestDataWithType:kXMHTTPMethodGET url:[NSString stringWithFormat:@"%@/dcxy/api/incentiveVideo/least", [kUserDefaults objectForKey:@"Task"]] para:nil completed:^(CommonModel *common, NSString *error) {
//
// dispatch_async(dispatch_get_main_queue(), ^{
// [ZXTool hideLoadingAnimation];
// if (error) {
// return;
// }
//
// //1腾讯 2百度 3瑞狮 4友盟 5穿山甲
// switch ([common.data integerValue]) {
// case 1: {
//
// break;
// }
// case 2: {
// [self showCSJRewardVideo];
// break;
// }
// case 3: {
//
// break;
// }
// case 4: {
//
// break;
// case 5: {
// [self showCSJRewardVideo];
// break;
// }
// default:
// break;
// }
// }
// });
// }];
[self showCSJRewardVideo];
- (void)nativeExpresInterstitialAdDidLoad:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
}
#pragma mark - 任务完成
- (void) taskCompleted {
- (void)nativeExpresInterstitialAd:(BUNativeExpressInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
NSLog(@"%s",__func__);
[ZXTool showText:error.description];
// [self.interstitialAd loadAdData];
}
- (void)nativeExpresInterstitialAdRenderSuccess:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
if (self.interstitialAd.isAdValid) {
[self.interstitialAd showAdFromRootViewController:self];
}
}
- (void)nativeExpresInterstitialAdRenderFail:(BUNativeExpressInterstitialAd *)interstitialAd error:(NSError *)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpresInterstitialAdWillVisible:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpresInterstitialAdDidClick:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpresInterstitialAdWillClose:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpresInterstitialAdDidClose:(BUNativeExpressInterstitialAd *)interstitialAd {
NSLog(@"%s",__func__);
[self taskCompleted];
}
#pragma mark - =================穿山甲全屏视频广告=====================
- (void) preloadFullScreenVideo {
self.fullscreenAd = [[BUNativeExpressFullscreenVideoAd alloc] initWithSlotID:@"933112433"];
self.fullscreenAd.delegate = self;
[self.fullscreenAd loadAdData];
}
- (void) showFullScreenVideo {
if (self.fullscreenAd.isAdValid) {
[self.fullscreenAd showAdFromRootViewController:self.navigationController];
}
}
#pragma mark - BUFullscreenVideoAdDelegate
- (void)nativeExpressFullscreenVideoAdDidLoad:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/dcxy/api/tasks/%@", [kUserDefaults objectForKey:@"Task"], [ZXTaskManager sharedZXTaskManager].taskCode] para:nil completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error == nil) {
//直接弹
[self callBackToH5WithSuccess:YES];
}
- (void)nativeExpressFullscreenVideoAd:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdViewRenderSuccess:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdViewRenderFail:(BUNativeExpressFullscreenVideoAd *)rewardedVideoAd error:(NSError *_Nullable)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdDidDownLoadVideo:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdWillVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdDidVisible:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdDidClick:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdDidClickSkip:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
}
- (void)nativeExpressFullscreenVideoAdWillClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
[ZXTaskManager sharedZXTaskManager].isTaskCompleted = 1;
}
- (void)nativeExpressFullscreenVideoAdDidClose:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd {
NSLog(@"%s",__func__);
[self.fullscreenAd loadAdData];
}
- (void)nativeExpressFullscreenVideoAdDidPlayFinish:(BUNativeExpressFullscreenVideoAd *)fullscreenVideoAd didFailWithError:(NSError *_Nullable)error {
NSLog(@"%s",__func__);
}
#pragma mark - ===================穿山甲信息流广告===========================
- (void) createMessageFlowAd {
BUAdSlot *slot1 = [[BUAdSlot alloc] init];
slot1.ID = @"933112268";
slot1.AdType = BUAdSlotAdTypeFeed;
BUSize *imgSize = [BUSize sizeBy:BUProposalSize_Feed690_388];
slot1.imgSize = imgSize;
slot1.position = BUAdSlotPositionBottom;
slot1.isSupportDeepLink = YES;
CGSize size = CGSizeMake(kScreenWidth, kScreenWidth * 0.56);
// self.nativeExpressAdManager可以重用
if (!self.nativeExpressAdManager) {
self.nativeExpressAdManager = [[BUNativeExpressAdManager alloc] initWithSlot:slot1 adSize:CGSizeMake(kScreenWidth, kScreenWidth * 0.56)];
}
self.nativeExpressAdManager.adSize = size;
self.nativeExpressAdManager.delegate = self;
[self.nativeExpressAdManager loadAd:1];
}
#pragma mark - BUNativeExpressAdViewDelegate
- (void)nativeExpressAdSuccessToLoad:(BUNativeExpressAdManager *)nativeExpressAd views:(NSArray<__kindof BUNativeExpressAdView *> *)views {
if (views.count) {
[views enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[BUNativeExpressAdView class]]) {
BUNativeExpressAdView *expressView = (BUNativeExpressAdView *)obj;
expressView.rootViewController = self;
[self.adSuperView insertSubview:expressView atIndex:0];
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.adSuperView);
make.bottom.equalTo(self.adSuperView.mas_bottom).offset(-self.current_adSuperView_totalH);
make.height.mas_equalTo(kScreenWidth * 0.56);
}];
self.current_adSuperView_totalH += kScreenWidth * 0.56;
[self.adSuperView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
make.height.mas_equalTo(self.current_adSuperView_totalH);
}];
[expressView render];
} else {
GDTNativeExpressAdView *expressView = (GDTNativeExpressAdView *)views.lastObject;
expressView.controller = self;
[expressView render];
[self.adSuperView insertSubview:expressView atIndex:0];
[expressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.adSuperView);
make.bottom.equalTo(self.adSuperView.mas_bottom).offset(-self.current_adSuperView_totalH);
make.height.mas_equalTo(kScreenWidth * 0.56);
}];
self.current_adSuperView_totalH += kScreenWidth * 0.56;
[self.adSuperView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
make.height.mas_equalTo(self.current_adSuperView_totalH);
}];
}
});
}];
}];
}
NSLog(@"【BytedanceUnion】个性化模板拉取广告成功回调");
}
#pragma mark - 回调前端已经任务完成
- (void) callBackToH5WithSuccess:(BOOL) isSuccess {
//异常情况处理
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@('%d', '%@')", self.jsFuncName, isSuccess, [ZXTaskManager sharedZXTaskManager].taskCode] completionHandler:^(id _Nullable res, NSError * _Nullable error) {
//清空taskid
ZXTaskManager.sharedZXTaskManager.taskCode = @"";
- (void)nativeExpressAdFailToLoad:(BUNativeExpressAdManager *)nativeExpressAd error:(NSError *)error {
NSLog(@"%s",__func__);
}
- (void)nativeExpressAdViewRenderSuccess:(BUNativeExpressAdView *)nativeExpressAdView {
}
- (void)nativeExpressAdViewRenderFail:(BUNativeExpressAdView *)nativeExpressAdView error:(NSError *)error {
}
- (void)nativeExpressAdViewWillShow:(BUNativeExpressAdView *)nativeExpressAdView {
}
- (void)nativeExpressAdViewDidClick:(BUNativeExpressAdView *)nativeExpressAdView {
}
- (void)nativeExpressAdViewPlayerDidPlayFinish:(BUNativeExpressAdView *)nativeExpressAdView error:(NSError *)error {
}
- (void)nativeExpressAdView:(BUNativeExpressAdView *)nativeExpressAdView dislikeWithReason:(NSArray<BUDislikeWords *> *)filterWords {
}
- (void)nativeExpressAdViewDidClosed:(BUNativeExpressAdView *)nativeExpressAdView {
}
- (void)nativeExpressAdViewWillPresentScreen:(BUNativeExpressAdView *)nativeExpressAdView {
}
#pragma mark - ===================穿山甲banner广告===========================
- (void) loadBannerAd {
BUSize *imgSize = [BUSize sizeBy:BUProposalSize_Banner600_90];
self.csj_bannerAd = [[BUNativeExpressBannerView alloc] initWithSlotID:@"933112579" rootViewController:self imgSize:imgSize adSize:CGSizeMake(kScreenWidth, kScreenWidth * 0.15) IsSupportDeepLink:YES];
self.csj_bannerAd.delegate = self;
[self.adSuperView insertSubview:self.csj_bannerAd atIndex:0];
[self.csj_bannerAd loadAdData];
}
- (void)nativeExpressBannerAdViewDidLoad:(BUNativeExpressBannerView *)bannerAdView {
}
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView didLoadFailWithError:(NSError *_Nullable)error {
}
- (void)nativeExpressBannerAdViewRenderSuccess:(BUNativeExpressBannerView *)bannerAdView {
[self.csj_bannerAd mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.adSuperView.mas_bottom).offset(-self.current_adSuperView_totalH);
make.left.right.equalTo(self.adSuperView);
make.height.mas_equalTo(kScreenWidth * 0.15);
}];
self.current_adSuperView_totalH += kScreenWidth * 0.15;
[self.adSuperView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
make.height.mas_equalTo(self.current_adSuperView_totalH);
}];
}
- (void)nativeExpressBannerAdViewRenderFail:(BUNativeExpressBannerView *)bannerAdView error:(NSError * __nullable)error {
}
#pragma mark - 微信授权成功
- (void) aouthSuccess:(NSNotification *) nof {
- (void)nativeExpressBannerAdViewWillBecomVisible:(BUNativeExpressBannerView *)bannerAdView {
if ([self.wxCode isEqualToString:nof.object]) {
return;
}
- (void)nativeExpressBannerAdViewDidClick:(BUNativeExpressBannerView *)bannerAdView {
}
- (void)nativeExpressBannerAdView:(BUNativeExpressBannerView *)bannerAdView dislikeWithReason:(NSArray<BUDislikeWords *> *_Nullable)filterwords {
}
#pragma mark - ==========腾讯信息流广告 PS:代理在穿山甲的信息流广告=============
- (void) createTxMessageFlowAd {
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
self.nativeAd = [[GDTNativeExpressAd alloc] initWithAppId:kTXAdAPPID placementId:kTXAdNativePLACEMENTID adSize:CGSizeMake(kScreenWidth, kScreenWidth * 0.56)];
self.nativeAd.delegate = self;
[self.nativeAd loadAd:1];
}
self.wxCode = nof.object;
}
#pragma mark - ===================腾讯banner广告===========================
- (void) createTxBannerAd {
self.tx_bannerAd = [[GDTUnifiedBannerView alloc]
initWithFrame:CGRectZero appId:@"1108089964"
placementId:@"1010494297797517"
viewController:self];
self.tx_bannerAd.accessibilityIdentifier = @"banner_ad";
self.tx_bannerAd.animated = YES;
self.tx_bannerAd.autoSwitchInterval = 4;
self.tx_bannerAd.delegate = self;
NSLog(@"请求微信授权登录----%@", self.wxCode);
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/plain"];
[manager GET:[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx41cd01f1eb664e21&secret=d709419cf1ba7ed33e6337bd9396bef1&code=%@&grant_type=authorization_code", nof.object] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
self.wxCode = @"";
if (responseObject != nil && responseObject[@"openid"] != nil) {
[self requestUserInfoByToken:responseObject[@"access_token"] andOpenid:responseObject[@"openid"]];
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool showText:error.userInfo[@"NSLocalizedDescription"]];
});
}];
[self.adSuperView insertSubview:self.tx_bannerAd atIndex:0];
[self.tx_bannerAd loadAdAndShow];
}
-(void)requestUserInfoByToken:(NSString *)token andOpenid:(NSString *)openID
#pragma mark - GDTUnifiedBannerViewDelegate
/**
* 请求广告条数据成功后调用
* 当接收服务器返回的广告数据成功后调用该函数
*/
- (void)unifiedBannerViewDidLoad:(GDTUnifiedBannerView *)unifiedBannerView
{
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
manager.requestSerializer = [AFJSONRequestSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
[manager GET:[NSString stringWithFormat:@"https://api.weixin.qq.com/sns/userinfo?access_token=%@&openid=%@",token,openID] parameters:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) {
NSDictionary *dic = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:responseObject options:NSJSONReadingMutableContainers error:nil];
[ZXTool requestDataWithType:kXMHTTPMethodPOST url:[NSString stringWithFormat:@"%@/wx/auth/submit/info", [kUserDefaults objectForKey:@"Task"]] para:@{@"wxInfo":[dic mj_JSONString]} completed:^(CommonModel *common, NSString *error) {
dispatch_async(dispatch_get_main_queue(), ^{
[ZXTool hideLoadingAnimation];
if (error) {
[ZXTool showText:error];
} else {
if (self.jsFuncName == nil || [self.jsFuncName isEqualToString:@""]) {
self.jsFuncName = @"bindWechatCallback";
}
[self.webView evaluateJavaScript:[NSString stringWithFormat:@"%@()", self.jsFuncName] completionHandler:^(id _Nullable res, NSError * _Nullable error) {
}];
}
});
}];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSLog(@"%s",__FUNCTION__);
NSLog(@"unified banner did load");
[self.tx_bannerAd mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.adSuperView);
make.height.mas_equalTo(kScreenWidth * 0.15);
make.bottom.equalTo(self.adSuperView.mas_bottom).offset(-self.current_adSuperView_totalH);
}];
self.current_adSuperView_totalH += kScreenWidth * 0.15;
[self.adSuperView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.bottom.equalTo(self.view.mas_bottom).offset(self.isTaskHomePage?-kTabBarHeight:0);
make.height.mas_equalTo(self.current_adSuperView_totalH);
}];
}
/**
* 请求广告条数据失败后调用
* 当接收服务器返回的广告数据失败后调用该函数
*/
- (void)unifiedBannerViewFailedToLoad:(GDTUnifiedBannerView *)unifiedBannerView error:(NSError *)error
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0曝光回调
*/
- (void)unifiedBannerViewWillExpose:(nonnull GDTUnifiedBannerView *)unifiedBannerView {
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0点击回调
*/
- (void)unifiedBannerViewClicked:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 应用进入后台时调用
* 当点击应用下载或者广告调用系统程序打开,应用将被自动切换到后台
*/
- (void)unifiedBannerViewWillLeaveApplication:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页已经被关闭
*/
- (void)unifiedBannerViewDidDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页即将被关闭
*/
- (void)unifiedBannerViewWillDismissFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0广告点击以后即将弹出全屏广告页
*/
- (void)unifiedBannerViewWillPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0广告点击以后弹出全屏广告页完毕
*/
- (void)unifiedBannerViewDidPresentFullScreenModal:(GDTUnifiedBannerView *)unifiedBannerView
{
NSLog(@"%s",__FUNCTION__);
}
/**
* banner2.0被用户关闭时调用
*/
- (void)unifiedBannerViewWillClose:(nonnull GDTUnifiedBannerView *)unifiedBannerView {
self.tx_bannerAd = nil;
NSLog(@"%s",__FUNCTION__);
}
#pragma mark - ===================腾讯插屏广告===========================
- (void) createTxInterstitialAd {
self.tx_interstitialAd = [[GDTUnifiedInterstitialAd alloc] initWithAppId:kTXAdAPPID placementId:@"7070290218848229"];
self.tx_interstitialAd.delegate = self;
// self.tx_interstitialAd.videoMuted = YES;
// self.tx_interstitialAd.detailPageVideoMuted = YES;
// self.tx_interstitialAd.videoAutoPlayOnWWAN = YES;
// self.tx_interstitialAd.minVideoDuration = 1;
// self.tx_interstitialAd.maxVideoDuration = 30; // 如果需要设置视频最大时长,可以通过这个参数来进行设置
[self.tx_interstitialAd loadAd];
}
#pragma mark - GDTUnifiedInterstitialAdDelegate
/**
* 插屏2.0广告预加载成功回调
* 当接收服务器返回的广告数据成功后调用该函数
*/
- (void)unifiedInterstitialSuccessToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
[self.tx_interstitialAd presentAdFromRootViewController:self];
}
/**
* 插屏2.0广告预加载失败回调
* 当接收服务器返回的广告数据失败后调用该函数
*/
- (void)unifiedInterstitialFailToLoadAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial error:(NSError *)error
{
NSLog(@"%s",__FUNCTION__);
NSLog(@"interstitial fail to load, Error : %@",error);
}
/**
* 插屏2.0广告将要展示回调
* 插屏2.0广告即将展示回调该函数
*/
- (void)unifiedInterstitialWillPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
- (void)unifiedInterstitialFailToPresent:(GDTUnifiedInterstitialAd *)unifiedInterstitial error:(NSError *)error {
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0广告视图展示成功回调
* 插屏2.0广告展示成功回调该函数
*/
- (void)unifiedInterstitialDidPresentScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0广告展示结束回调
* 插屏2.0广告展示结束回调该函数
*/
- (void)unifiedInterstitialDidDismissScreen:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 当点击下载应用时会调用系统程序打开
*/
- (void)unifiedInterstitialWillLeaveApplication:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0广告曝光回调
*/
- (void)unifiedInterstitialWillExposure:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0广告点击回调
*/
- (void)unifiedInterstitialClicked:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 点击插屏2.0广告以后即将弹出全屏广告页
*/
- (void)unifiedInterstitialAdWillPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 点击插屏2.0广告以后弹出全屏广告页
*/
- (void)unifiedInterstitialAdDidPresentFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页将要关闭
*/
- (void)unifiedInterstitialAdWillDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 全屏广告页被关闭
*/
- (void)unifiedInterstitialAdDidDismissFullScreenModal:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
[self taskCompleted];
}
/**
* 插屏2.0视频广告 player 播放状态更新回调
*/
- (void)unifiedInterstitialAd:(GDTUnifiedInterstitialAd *)unifiedInterstitial playerStatusChanged:(GDTMediaPlayerStatus)status
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0视频广告详情页 WillPresent 回调
*/
- (void)unifiedInterstitialAdViewWillPresentVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0视频广告详情页 DidPresent 回调
*/
- (void)unifiedInterstitialAdViewDidPresentVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0视频广告详情页 WillDismiss 回调
*/
- (void)unifiedInterstitialAdViewWillDismissVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
/**
* 插屏2.0视频广告详情页 DidDismiss 回调
*/
- (void)unifiedInterstitialAdViewDidDismissVideoVC:(GDTUnifiedInterstitialAd *)unifiedInterstitial
{
NSLog(@"%s",__FUNCTION__);
}
@end
//
//
......@@ -76,6 +76,8 @@
[kUserDefaults setValue:@"no" forKey:kAPP_QB_SHOW];//默认是no
[kUserDefaults setValue:@"no" forKey:kAPP_SELP_ADVIEW_SHOW];//默认是no
[kUserDefaults setValue:@"no" forKey:kAPP_IS_OPENB_TASK];//默认是no
[kUserDefaults setValue:@"no" forKey:kAPP_IS_OPENB_TK];//默认是no
if (CacheToken==nil || ![CacheToken isKindOfClass:[NSString class]]) {
return;
}
......@@ -91,7 +93,7 @@
if ([responseObject[@"code"] integerValue] == 1000) {
NSArray *arr = responseObject[@"areaSwitchs"];
//type 1资讯 2商城 3支付配置 4免密开关 5小程序(app不需要) 10阿里妈妈 11百青藤 14任务
//type 1资讯 2商城 3支付配置 4免密开关 5小程序(app不需要) 10阿里妈妈 11百青藤 14任务 15退款开关
[self.switchs removeAllObjects];
for (NSDictionary *dic in arr) {
if ([dic[@"type"] isEqualToString:@"1"] || [dic[@"type"] isEqualToString:@"2"] || [dic[@"type"] isEqualToString:@"10"] || [dic[@"type"] isEqualToString:@"11"] || [dic[@"type"] isEqualToString:@"14"]) {
......@@ -111,7 +113,9 @@
if ([dic[@"type"] isEqualToString:@"12"] && [dic[@"isEnabled"] integerValue] == 1) {
[kUserDefaults setValue:@"yes" forKey:kAPP_SELP_ADVIEW_SHOW];//默认是no
}
if ([dic[@"type"] isEqualToString:@"15"] && [dic[@"isEnabled"] integerValue] == 1) {
[kUserDefaults setValue:@"yes" forKey:kAPP_IS_OPENB_TK];//默认是no
}
}
dispatch_async(dispatch_get_main_queue(), ^{
......
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