From 530bc2b8b83c5c17a1fd45c781d33548871c6c26 Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 28 Dec 2010 22:54:14 +0000 Subject: [PATCH 1/3] Added latitude, longitude and locationTime properties, which should allow ads to be better targetted if set. Current version does not crash, but not sure if correct values are sent for date. --- Classes/TiAdMobView.h | 4 ++++ Classes/TiAdMobView.m | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Classes/TiAdMobView.h b/Classes/TiAdMobView.h index e222073..acd016f 100644 --- a/Classes/TiAdMobView.h +++ b/Classes/TiAdMobView.h @@ -31,4 +31,8 @@ @property (nonatomic, retain) NSTimer *refreshTimer; @property (nonatomic, retain) AdMobView* admob; +@property (nonatomic, assign) double latitude; +@property (nonatomic, assign) double longitude; +@property (nonatomic, retain) NSDate* locationTime; + @end diff --git a/Classes/TiAdMobView.m b/Classes/TiAdMobView.m index 1433b77..b93b898 100644 --- a/Classes/TiAdMobView.m +++ b/Classes/TiAdMobView.m @@ -15,7 +15,7 @@ @implementation TiAdMobView @synthesize publisher, test, refresh, adBackgroundColor, primaryTextColor, secondaryTextColor; -@synthesize refreshTimer, admob; +@synthesize refreshTimer, admob, latitude, longitude, locationTime; #pragma mark Cleanup @@ -28,6 +28,8 @@ -(void)dealloc [refreshTimer invalidate]; self.refreshTimer = nil; self.admob = nil; + self.locationTime = nil; + [super dealloc]; } @@ -45,6 +47,9 @@ -(void)initializeState self.test = NO; self.publisher = @""; self.refresh = AD_REFRESH_PERIOD; + self.latitude = 0; + self.longitude = 0; + self.locationTime = nil; } -(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds @@ -118,6 +123,17 @@ - (UIColor*)colorValue:(id)color_ return color; } +- (double)locationLatitude { + return self.latitude; +} +- (double)locationLongitude { + return self.longitude; +} +- (NSDate *)locationTimestamp { + return self.locationTime; +} + + #pragma Properties -(void)setHeight_:(id)height_ @@ -160,6 +176,21 @@ -(void)setSecondaryTextColor_:(id)color self.secondaryTextColor = [self colorValue:color]; } +-(void)setLatitude_:(id)latitude_ +{ + self.latitude = [TiUtils floatValue:latitude_]; +} + +-(void)setLongitude_:(id)longitude_ +{ + self.longitude = [TiUtils floatValue:longitude_]; +} + +-(void)setLocationTime_:(id)locationTime_ +{ + self.locationTime = [NSDate dateWithTimeIntervalSince1970:[TiUtils floatValue:locationTime_]/1000.0]; +} + #pragma Public APIs @end From 2b148cbce5089def4a3b0bc8b7f85e99895b63ca Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 28 Dec 2010 22:59:08 +0000 Subject: [PATCH 2/3] Use correct type. --- Classes/TiAdMobView.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/TiAdMobView.m b/Classes/TiAdMobView.m index b93b898..1dd3fd7 100644 --- a/Classes/TiAdMobView.m +++ b/Classes/TiAdMobView.m @@ -178,12 +178,12 @@ -(void)setSecondaryTextColor_:(id)color -(void)setLatitude_:(id)latitude_ { - self.latitude = [TiUtils floatValue:latitude_]; + self.latitude = [TiUtils doubleValue:latitude_]; } -(void)setLongitude_:(id)longitude_ { - self.longitude = [TiUtils floatValue:longitude_]; + self.longitude = [TiUtils doubleValue:longitude_]; } -(void)setLocationTime_:(id)locationTime_ From 0f44f84fd51c7275af16b9a17d91886c39490e13 Mon Sep 17 00:00:00 2001 From: Lukas Date: Tue, 28 Dec 2010 23:24:56 +0000 Subject: [PATCH 3/3] Fixed install command. Added location variables. --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3878b0..14dc00f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,10 @@ HOW TO USE IT adBackgroundColor: "#ffffff", primaryTextColor: "#000000", secondaryTextColor: "#000000", - refresh: 30.0 + refresh: 30.0, + latitude: 51.0, + longitude: -0.180, + locationTime: new Date() }); admob.addEventListener('error', function(error) { alert(error.message); @@ -38,7 +41,7 @@ INSTALL TiAdMob4iPhone 1. Open `Terminal` 2. Run below command - `python build.py && unzip jp.masuidrive.ti.admob-0.1.zip -d /Library/Application\ Support/Titanium/` + `python build.py && unzip jp.masuidrive.ti.admob-iphone-0.1.zip -d /Library/Application\ Support/Titanium/` REGISTER TO YOUR PROJECT