-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0dd8f91
commit 75ef3b1
Showing
116 changed files
with
5,033 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// AppDelegate+GS.h | ||
// Camera | ||
// | ||
// Created by 冯 传祥 on 16/3/17. | ||
// Copyright © 2016年 冯 传祥. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate.h" | ||
#import "GDTSplashAd.h" | ||
|
||
@interface AppDelegate (GS) <GDTSplashAdDelegate> | ||
|
||
@property (nonatomic, strong) GDTSplashAd *splash; | ||
@property (nonatomic, strong) UIImageView *customSplashView; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
// | ||
// AppDelegate+GS.m | ||
// Camera | ||
// | ||
// Created by 冯 传祥 on 16/3/17. | ||
// Copyright © 2016年 冯 传祥. All rights reserved. | ||
// | ||
|
||
#import "AppDelegate+GS.h" | ||
#import <objc/runtime.h> | ||
#import "FCXGuide.h" | ||
|
||
|
||
@implementation AppDelegate (GS) | ||
|
||
+ (void)load { | ||
static dispatch_once_t onceToken; | ||
dispatch_once(&onceToken, ^{ | ||
[self swizzleInstanceMethodWithClass:[self class] originalSelector:@selector(application:didFinishLaunchingWithOptions:) swizzledMethod:@selector(fcx_application:didFinishLaunchingWithOptions:)]; | ||
|
||
[self swizzleInstanceMethodWithClass:[self class] originalSelector:@selector(applicationDidEnterBackground:) swizzledMethod:@selector(fcx_applicationDidEnterBackground:)]; | ||
|
||
[self swizzleInstanceMethodWithClass:[self class] originalSelector:@selector(applicationWillEnterForeground:) swizzledMethod:@selector(fcx_applicationWillEnterForeground:)]; | ||
}); | ||
} | ||
|
||
- (BOOL)fcx_application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
[self setupS]; | ||
return [self fcx_application:application didFinishLaunchingWithOptions:launchOptions]; | ||
} | ||
|
||
//app已经进入后台后 | ||
- (void)fcx_applicationDidEnterBackground:(UIApplication *)application { | ||
self.enterBackgroundDate = [NSDate date]; | ||
} | ||
|
||
//app将要进入前台 | ||
- (void)fcx_applicationWillEnterForeground:(UIApplication *)application { | ||
if (self.enterBackgroundDate) { | ||
NSDate *currentDate = [NSDate date]; | ||
double duration = [currentDate timeIntervalSinceDate:self.enterBackgroundDate]; | ||
if (duration >= 30 * 60) {//超过30分钟再次显示开屏 | ||
[self setupS]; | ||
} | ||
} | ||
} | ||
|
||
- (void)setupS { | ||
|
||
BOOL showSplash; | ||
|
||
if ([FCXOnlineConfig fcxGetConfigParams:@"showSplash"]) { | ||
showSplash = [[FCXOnlineConfig fcxGetConfigParams:@"showSplash"] boolValue]; | ||
}else {//首次进入应用,请求不到友盟的参数,根据日期判断是否显示 | ||
NSDate *currentDate = [NSDate date]; | ||
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init]; | ||
[dateFormatter setDateFormat: @"yyyy-MM-dd"]; | ||
NSString *currentDateString = [dateFormatter stringFromDate:currentDate]; | ||
|
||
showSplash = ([currentDateString compare:@"2016-04-01"] == NSOrderedDescending); | ||
} | ||
showSplash = YES; | ||
if (!showSplash) { | ||
[FCXGuide startGuide]; | ||
return; | ||
} | ||
return; | ||
NSString *appKey = @"1105186430"; | ||
NSString *placementId = @"2060408926246021"; | ||
|
||
NSString *paramsString = [FCXOnlineConfig fcxGetConfigParams:@"GDT_SplashInfo" defaultValue:@""]; | ||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:[paramsString dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableLeaves error:nil]; | ||
if([dict isKindOfClass:[NSDictionary class]]){ | ||
appKey = dict[@"appkey"];; | ||
placementId = dict[@"placementId"]; | ||
} | ||
|
||
//开屏广告初始化 | ||
self.splash = [[GDTSplashAd alloc] initWithAppkey:appKey placementId:placementId]; | ||
self.splash.delegate = self;//设置代理 | ||
|
||
self.customSplashView = [[UIImageView alloc]initWithFrame:self.window.bounds]; | ||
self.customSplashView.userInteractionEnabled = YES; | ||
|
||
//针对不同设备尺寸设置不同的默认图片,拉取广告等待时间会展示该默认图片。 | ||
CGSize winSize = self.window.size; | ||
NSArray* imagesDict = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"UILaunchImages"]; | ||
for (NSDictionary* dict in imagesDict) { | ||
if(CGSizeEqualToSize(CGSizeFromString(dict[@"UILaunchImageSize"]),winSize)) | ||
{ | ||
self.customSplashView.image = [UIImage imageNamed:dict[@"UILaunchImageName"]]; | ||
self.splash.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:dict[@"UILaunchImageName"]]]; | ||
break; | ||
} | ||
} | ||
|
||
[self.window.rootViewController.view addSubview:self.customSplashView]; | ||
|
||
//设置开屏拉取时长限制,若超时则不再展示广告 | ||
self.splash.fetchDelay = 3; | ||
//拉取并展示 | ||
[self.splash loadAdAndShowInWindow:self.window]; | ||
|
||
} | ||
|
||
-(void)splashAdSuccessPresentScreen:(GDTSplashAd *)splashAd | ||
{ | ||
DBLOG(@"%s",__FUNCTION__); | ||
} | ||
|
||
-(void)splashAdFailToPresent:(GDTSplashAd *)splashAd withError:(NSError *)error | ||
{ | ||
DBLOG(@"%s%@",__FUNCTION__,error); | ||
[self clearSplashData]; | ||
|
||
} | ||
|
||
-(void)splashAdClicked:(GDTSplashAd *)splashAd | ||
{ | ||
DBLOG(@"%s",__FUNCTION__); | ||
} | ||
|
||
-(void)splashAdApplicationWillEnterBackground:(GDTSplashAd *)splashAd | ||
{ | ||
DBLOG(@"%s",__FUNCTION__); | ||
} | ||
|
||
-(void)splashAdClosed:(GDTSplashAd *)splashAd | ||
{ | ||
DBLOG(@"%s",__FUNCTION__); | ||
[self clearSplashData]; | ||
} | ||
|
||
- (void)splashAdDidDismissFullScreenModal:(GDTSplashAd *)splashAd { | ||
DBLOG(@"%s",__FUNCTION__); | ||
[self clearSplashData]; | ||
} | ||
|
||
- (void)clearSplashData { | ||
[self.customSplashView removeFromSuperview]; | ||
self.splash.delegate = nil; | ||
self.splash = nil; | ||
self.customSplashView = nil; | ||
|
||
[FCXGuide startGuide]; | ||
} | ||
|
||
+ (void)swizzleInstanceMethodWithClass:(Class)class | ||
originalSelector:(SEL)originalSelector | ||
swizzledMethod:(SEL)swizzledSelector { | ||
|
||
Method originalMethod = class_getInstanceMethod(class, originalSelector); | ||
Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector); | ||
|
||
if (class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod))) { | ||
|
||
class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod)); | ||
}else { | ||
|
||
method_exchangeImplementations(originalMethod, swizzledMethod); | ||
} | ||
} | ||
|
||
- (GDTSplashAd *)splash { | ||
return objc_getAssociatedObject(self, _cmd); | ||
} | ||
|
||
- (void)setSplash:(GDTSplashAd *)splash { | ||
objc_setAssociatedObject(self, @selector(splash), splash, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | ||
} | ||
|
||
- (UIImageView *)customSplashView { | ||
return objc_getAssociatedObject(self, _cmd); | ||
} | ||
|
||
- (void)setCustomSplashView:(UIImageView *)customSplashView { | ||
|
||
objc_setAssociatedObject(self, @selector(customSplashView), customSplashView, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | ||
} | ||
|
||
- (NSDate *)enterBackgroundDate { | ||
return objc_getAssociatedObject(self, _cmd); | ||
} | ||
|
||
- (void)setEnterBackgroundDate:(NSDate *)enterBackgroundDate { | ||
objc_setAssociatedObject(self, @selector(enterBackgroundDate), enterBackgroundDate, OBJC_ASSOCIATION_RETAIN_NONATOMIC); | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
|
||
|
||
Pod::Spec.new do |s| | ||
s.name = "FCXUniversial" | ||
s.version = "0.0.1" | ||
s.summary = "FCX's FCXUniversial." | ||
s.description = <<-DESC | ||
FCXUniversial of FCX | ||
DESC | ||
|
||
s.homepage = "https://github.com/FCXPods/FCXUniversial" | ||
|
||
s.license = "MIT" | ||
s.author = { "fengchuanxiang" => "[email protected]" } | ||
s.source = { :git => "https://github.com/FCXPods/FCXUniversial.git", :tag => "0.0.1" } | ||
s.platform = :ios, "6.0" | ||
|
||
s.source_files = "FCXUniversial/FCXDiscover/", "FCXUniversial/FCXCategory/", "FCXUniversial/FCXUniversial/", "FCXUniversial/FCXShare/", "FCXUniversial/FCXAdvert/" | ||
|
||
s.vendored_libraries = "FCXUniversial/FCXAdvert/libGDTMobSDK.a" | ||
s.vendored_frameworks = "FCXUniversial/FCXAdvert/GoogleMobileAds.framework" | ||
|
||
s.frameworks = "AdSupport", "CoreLocation", "SystemConfiguration", "CoreTelephony", "Security", "StoreKit", "QuartzCore", "AudioToolbox", "AVFoundation", "CoreGraphics", "CoreMedia", "EventKit", "EventKitUI", "MessageUI", "CoreMotion", "MediaPlayer", "MessageUI", "CoreLocation", "Foundation", "WebKit" | ||
|
||
|
||
s.libraries = "z" | ||
|
||
#s.frameworks = "UIKit" | ||
|
||
s.dependency "SDWebImage", "~> 3.7.5" | ||
s.dependency "UMengAnalytics", "~> 3.6.6" | ||
s.dependency "UMengSocial", "~> 5.0" | ||
s.dependency "UMOnlineConfig", "~> 0.1.0" | ||
s.dependency "UMengFeedback", "~> 2.3.4" | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// | ||
// GDTMobBannerView.h | ||
// GDTMobSDK | ||
// | ||
// Created by chaogao on 13-11-5. | ||
// Copyright (c) 2013年 Tencent. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
/** | ||
* 广点通推荐尺寸,开发者在嵌入Banner条时,可以手动设置Banner条的宽度用来满足场景需求, | ||
* 而高度的话广点通侧不建议更改,否则显示效果会有影响 | ||
*/ | ||
#define GDTMOB_AD_SUGGEST_SIZE_320x50 CGSizeMake(320, 50) //For iPhone | ||
#define GDTMOB_AD_SUGGEST_SIZE_468x60 CGSizeMake(468, 60) //For iPad | ||
#define GDTMOB_AD_SUGGEST_SIZE_728x90 CGSizeMake(728, 90) //For iPad | ||
|
||
@protocol GDTMobBannerViewDelegate <NSObject> | ||
|
||
@optional | ||
|
||
- (void)bannerViewMemoryWarning; | ||
|
||
/** | ||
* 请求广告条数据成功后调用 | ||
* 详解:当接收服务器返回的广告数据成功后调用该函数 | ||
*/ | ||
- (void)bannerViewDidReceived; | ||
|
||
/** | ||
* 请求广告条数据失败后调用 | ||
* 详解:当接收服务器返回的广告数据失败后调用该函数 | ||
*/ | ||
- (void)bannerViewFailToReceived:(NSError *)error; | ||
|
||
/** | ||
* 应用进入后台时调用 | ||
* 详解:当点击应用下载或者广告调用系统程序打开,应用将被自动切换到后台 | ||
*/ | ||
- (void)bannerViewWillLeaveApplication; | ||
|
||
/** | ||
* banner条被用户关闭时调用 | ||
* 详解:当打开showCloseBtn开关时,用户有可能点击关闭按钮从而把广告条关闭 | ||
*/ | ||
- (void)bannerViewWillClose; | ||
/** | ||
* banner条曝光回调 | ||
*/ | ||
- (void)bannerViewWillExposure; | ||
/** | ||
* banner条点击回调 | ||
*/ | ||
- (void)bannerViewClicked; | ||
|
||
/** | ||
* banner广告点击以后即将弹出全屏广告页 | ||
*/ | ||
- (void)bannerViewWillPresentFullScreenModal; | ||
/** | ||
* banner广告点击以后弹出全屏广告页完毕 | ||
*/ | ||
- (void)bannerViewDidPresentFullScreenModal; | ||
/** | ||
* 全屏广告页即将被关闭 | ||
*/ | ||
- (void)bannerViewWillDismissFullScreenModal; | ||
/** | ||
* 全屏广告页已经被关闭 | ||
*/ | ||
- (void)bannerViewDidDismissFullScreenModal; | ||
@end | ||
|
||
@interface GDTMobBannerView : UIView | ||
|
||
/** | ||
* 父视图 | ||
* 详解:[必选]需设置为显示广告的UIViewController | ||
*/ | ||
@property (nonatomic, weak) UIViewController *currentViewController; | ||
|
||
/** | ||
* 委托 [可选] | ||
*/ | ||
@property(nonatomic, weak) id<GDTMobBannerViewDelegate> delegate; | ||
|
||
/** | ||
* 广告刷新间隔 [可选] | ||
*/ | ||
@property(nonatomic, assign) int interval; | ||
|
||
/** | ||
* GPS精准广告定位模式开关,默认Gps关闭 | ||
* 详解:[可选]GPS精准定位模式开关,YES为开启GPS,NO为关闭GPS,建议设为开启,可以获取地理位置信息,提高广告的填充率,增加收益。 | ||
*/ | ||
@property(nonatomic, assign) BOOL isGpsOn; | ||
|
||
/** | ||
* Banner展现和轮播时的动画效果开关,默认打开 | ||
*/ | ||
@property(nonatomic, assign) BOOL isAnimationOn; | ||
|
||
/** | ||
* Banner条展示关闭按钮,默认打开 | ||
*/ | ||
@property(nonatomic, assign) BOOL showCloseBtn; | ||
|
||
/** | ||
* 构造方法 | ||
* 详解:frame是广告banner展示的位置和大小,包含四个参数(x, y, width, height) | ||
* appkey是应用id | ||
* placementId是广告位id | ||
*/ | ||
- (id) initWithFrame:(CGRect)frame appkey:(NSString *)appkey placementId:(NSString *)placementId; | ||
|
||
/** | ||
* 拉取并展示广告 | ||
*/ | ||
- (void) loadAdAndShow; | ||
@end |
Oops, something went wrong.