Skip to content

Commit 0101419

Browse files
authored
Merge pull request #7 from CommuteStream/0.8_dev
0.8 dev
2 parents f4fba45 + 449dcec commit 0101419

File tree

612 files changed

+51186
-337
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

612 files changed

+51186
-337
lines changed

CommuteStream.xcodeproj/project.pbxproj

Lines changed: 2447 additions & 75 deletions
Large diffs are not rendered by default.

CommuteStream/CSAdFactory.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// CSAdFactory.h
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/20/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
#import <UIKit/UIKit.h>
11+
12+
13+
extern NSString * const gotFilePathNotification;
14+
15+
@interface CSAdFactory : NSObject {
16+
17+
}
18+
19+
+ (CSAdFactory *) factoryWithAdType:(NSString *)adType;
20+
21+
- (UIView *)adViewFromDictionary:(NSMutableDictionary*)dictionary;
22+
23+
@end

CommuteStream/CSAdFactory.m

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// CSAdFactory.m
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/20/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import "CSAdFactory.h"
10+
#import "CSBasicBannerAdFactory.h"
11+
#import "CSHTMLBannerFactory.h"
12+
#import "CSMRAIDViewFactory.h"
13+
14+
NSString * const BASIC_BANNER_AD = @"basic_banner_ad";
15+
NSString * const HTML_BANNER = @"html";
16+
NSString * const MRAID_BANNER = @"mraid_banner";
17+
18+
@implementation CSAdFactory
19+
20+
+ (CSAdFactory *) factoryWithAdType:(NSString *)adType {
21+
22+
if([adType isEqualToString:BASIC_BANNER_AD]){
23+
return [[CSBasicBannerAdFactory alloc] init];
24+
}else if([adType isEqualToString:HTML_BANNER]){
25+
return [[CSHTMLBannerFactory alloc] init];
26+
}else if([adType isEqualToString:MRAID_BANNER]){
27+
return [[CSMRAIDViewFactory alloc] init];
28+
}else{
29+
return [[CSHTMLBannerFactory alloc] init];
30+
}
31+
32+
}
33+
34+
- (UIView *)adViewFromDictionary:(NSMutableDictionary*)dictionary {
35+
return nil;
36+
}
37+
38+
@end

CommuteStream/CSBasicBannerAd.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// CSBasicBannerAd.h
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/24/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
@interface CSBasicBannerAd : UIWebView<UIGestureRecognizerDelegate>
12+
13+
- (void)setUrl:(NSString *)url;
14+
15+
16+
17+
18+
19+
@end

CommuteStream/CSBasicBannerAd.m

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//
2+
// CSBasicBannerAd.m
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/24/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import "CSBasicBannerAd.h"
10+
11+
@implementation CSBasicBannerAd{
12+
NSString *basicBannerAdUrl;
13+
}
14+
15+
- (id)initWithFrame:(CGRect)frame
16+
{
17+
self = [super initWithFrame:frame];
18+
if (self) {
19+
20+
21+
22+
23+
}
24+
return self;
25+
}
26+
27+
- (void)setUrl:(NSString *)url{
28+
basicBannerAdUrl = url;
29+
30+
UITapGestureRecognizer *webViewTappedRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapViewAction:)];
31+
webViewTappedRecognizer.numberOfTapsRequired = 1;
32+
webViewTappedRecognizer.delegate = self;
33+
NSLog(@"Web View Tapped Delegate: %@", webViewTappedRecognizer.delegate);
34+
[self addGestureRecognizer:webViewTappedRecognizer];
35+
36+
37+
38+
}
39+
40+
41+
42+
43+
- (void)tapViewAction:(UITapGestureRecognizer *)sender
44+
{
45+
NSLog(@"%@", basicBannerAdUrl);
46+
47+
NSURL *url = [NSURL URLWithString:basicBannerAdUrl];
48+
[[UIApplication sharedApplication] openURL:url];
49+
50+
51+
}
52+
53+
54+
/*
55+
// Only override drawRect: if you perform custom drawing.
56+
// An empty implementation adversely affects performance during animation.
57+
- (void)drawRect:(CGRect)rect {
58+
// Drawing code
59+
}
60+
*/
61+
62+
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
63+
{
64+
return YES;
65+
}
66+
67+
@end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// CSBasicBannerAdFactory.h
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/20/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import "CSAdFactory.h"
10+
11+
@interface CSBasicBannerAdFactory : CSAdFactory {
12+
13+
}
14+
15+
- (UIView *)adViewFromDictionary:(NSMutableDictionary*)dictionary;
16+
17+
@end
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
//
2+
// CSBasicBannerAdFactory.m
3+
// CommuteStream
4+
//
5+
// Created by David Rogers on 10/20/16.
6+
// Copyright © 2016 CommuteStream. All rights reserved.
7+
//
8+
9+
#import "CSBasicBannerAdFactory.h"
10+
#import "CSBasicBannerAd.h"
11+
12+
@implementation CSBasicBannerAdFactory
13+
14+
NSString *basicBannerUrl;
15+
16+
- (UIView *)adViewFromDictionary:(NSMutableDictionary*)dictionary {
17+
18+
float banner_width = [[dictionary objectForKey:@"bannerWidth"] floatValue];
19+
float banner_height = [[dictionary objectForKey:@"bannerHeight"] floatValue];
20+
21+
22+
NSLog(@"CS_SDK: Generating UIWebView for ad display.");
23+
//NSLog(@"Web View %f width, %f height", [banner_width floatValue], [banner_height floatValue]);
24+
CSBasicBannerAd *webView = [[CSBasicBannerAd alloc] initWithFrame:CGRectMake(0.0, 0.0, banner_width, banner_height)];
25+
NSString *htmlString = [dictionary objectForKey:@"html"];
26+
basicBannerUrl = [dictionary objectForKey:@"url"];
27+
[webView loadHTMLString:htmlString baseURL:nil];
28+
[webView setUrl:basicBannerUrl];
29+
webView.scrollView.scrollEnabled = NO;
30+
webView.scrollView.bounces = NO;
31+
32+
33+
34+
return webView;
35+
36+
}
37+
38+
39+
40+
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
41+
{
42+
return YES;
43+
}
44+
45+
@end

CommuteStream/CSCustomBanner.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44
#import "GADBannerView.h"
55
#import "GADBannerViewDelegate.h"
66
#import "CSNetworkEngine.h"
7+
#import "CSCustomEventDelegate.h"
78

8-
@interface CSCustomBanner : NSObject <GADCustomEventBanner, GADBannerViewDelegate, UIGestureRecognizerDelegate> {
9+
@interface CSCustomBanner : NSObject <GADCustomEventBanner, GADBannerViewDelegate, UIGestureRecognizerDelegate, CSCustomEventDelegate> {
910
GADBannerView *bannerView_;
1011
}
1112

12-
@property (nonatomic, strong) CSNetworkEngine *csNetworkEngine;
13-
-(void)buildWebView:(NSMutableDictionary*)dict;
14-
+ (NSString *)getIdfa;
15-
+ (NSString *)getMacSha:(NSString *)deviceAddress;
16-
@end
13+
14+
@end

0 commit comments

Comments
 (0)