Skip to content

cool beans #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 71 additions & 2 deletions TalkinToTheNet/TalkinToTheNet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
objects = {

/* Begin PBXBuildFile section */
3B5A11301BB57CB600AB703A /* SearchResultsTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B5A112F1BB57CB600AB703A /* SearchResultsTableViewCell.m */; settings = {ASSET_TAGS = (); }; };
3B5A11341BB5828700AB703A /* AuthenticationViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B5A11331BB5828700AB703A /* AuthenticationViewController.m */; settings = {ASSET_TAGS = (); }; };
3B5A11381BB5968D00AB703A /* APIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B5A11371BB5968D00AB703A /* APIManager.m */; settings = {ASSET_TAGS = (); }; };
3B5A113B1BB59BA000AB703A /* Venue.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B5A113A1BB59BA000AB703A /* Venue.m */; settings = {ASSET_TAGS = (); }; };
3BB320F51BB5CE5E001B2042 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB320F41BB5CE5E001B2042 /* DetailViewController.m */; settings = {ASSET_TAGS = (); }; };
3BB320FA1BB5EB98001B2042 /* FLAnimatedImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB320F71BB5EB98001B2042 /* FLAnimatedImage.m */; settings = {ASSET_TAGS = (); }; };
3BB320FB1BB5EB98001B2042 /* FLAnimatedImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BB320F91BB5EB98001B2042 /* FLAnimatedImageView.m */; settings = {ASSET_TAGS = (); }; };
8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4A1BAF859400A92AD2 /* main.m */; };
8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */; };
8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D7DCD501BAF859400A92AD2 /* ViewController.m */; };
Expand All @@ -16,6 +23,21 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
3B5A112E1BB57CB600AB703A /* SearchResultsTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SearchResultsTableViewCell.h; sourceTree = "<group>"; };
3B5A112F1BB57CB600AB703A /* SearchResultsTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SearchResultsTableViewCell.m; sourceTree = "<group>"; };
3B5A11311BB5807C00AB703A /* Config.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Config.h; sourceTree = "<group>"; };
3B5A11321BB5828700AB703A /* AuthenticationViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AuthenticationViewController.h; sourceTree = "<group>"; };
3B5A11331BB5828700AB703A /* AuthenticationViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthenticationViewController.m; sourceTree = "<group>"; };
3B5A11361BB5968D00AB703A /* APIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIManager.h; sourceTree = "<group>"; };
3B5A11371BB5968D00AB703A /* APIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APIManager.m; sourceTree = "<group>"; };
3B5A11391BB59BA000AB703A /* Venue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Venue.h; sourceTree = "<group>"; };
3B5A113A1BB59BA000AB703A /* Venue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Venue.m; sourceTree = "<group>"; };
3BB320F31BB5CE5E001B2042 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DetailViewController.h; sourceTree = "<group>"; };
3BB320F41BB5CE5E001B2042 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DetailViewController.m; sourceTree = "<group>"; };
3BB320F61BB5EB98001B2042 /* FLAnimatedImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImage.h; sourceTree = "<group>"; };
3BB320F71BB5EB98001B2042 /* FLAnimatedImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLAnimatedImage.m; sourceTree = "<group>"; };
3BB320F81BB5EB98001B2042 /* FLAnimatedImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FLAnimatedImageView.h; sourceTree = "<group>"; };
3BB320F91BB5EB98001B2042 /* FLAnimatedImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FLAnimatedImageView.m; sourceTree = "<group>"; };
8D7DCD461BAF859400A92AD2 /* TalkinToTheNet.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TalkinToTheNet.app; sourceTree = BUILT_PRODUCTS_DIR; };
8D7DCD4A1BAF859400A92AD2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
Expand All @@ -39,6 +61,40 @@
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
3B5A11351BB58D8400AB703A /* Controllers */ = {
isa = PBXGroup;
children = (
3B5A11321BB5828700AB703A /* AuthenticationViewController.h */,
3B5A11331BB5828700AB703A /* AuthenticationViewController.m */,
8D7DCD4F1BAF859400A92AD2 /* ViewController.h */,
8D7DCD501BAF859400A92AD2 /* ViewController.m */,
3BB320F31BB5CE5E001B2042 /* DetailViewController.h */,
3BB320F41BB5CE5E001B2042 /* DetailViewController.m */,
);
name = Controllers;
sourceTree = "<group>";
};
3BB320FC1BB5EBA3001B2042 /* FLAnimatedImage */ = {
isa = PBXGroup;
children = (
3BB320F61BB5EB98001B2042 /* FLAnimatedImage.h */,
3BB320F71BB5EB98001B2042 /* FLAnimatedImage.m */,
3BB320F81BB5EB98001B2042 /* FLAnimatedImageView.h */,
3BB320F91BB5EB98001B2042 /* FLAnimatedImageView.m */,
);
name = FLAnimatedImage;
sourceTree = "<group>";
};
3BB320FD1BB5EBD4001B2042 /* APICommunication */ = {
isa = PBXGroup;
children = (
3B5A11311BB5807C00AB703A /* Config.h */,
3B5A11361BB5968D00AB703A /* APIManager.h */,
3B5A11371BB5968D00AB703A /* APIManager.m */,
);
name = APICommunication;
sourceTree = "<group>";
};
8D7DCD3D1BAF859400A92AD2 = {
isa = PBXGroup;
children = (
Expand All @@ -60,8 +116,13 @@
children = (
8D7DCD4C1BAF859400A92AD2 /* AppDelegate.h */,
8D7DCD4D1BAF859400A92AD2 /* AppDelegate.m */,
8D7DCD4F1BAF859400A92AD2 /* ViewController.h */,
8D7DCD501BAF859400A92AD2 /* ViewController.m */,
3B5A11391BB59BA000AB703A /* Venue.h */,
3B5A113A1BB59BA000AB703A /* Venue.m */,
3B5A112E1BB57CB600AB703A /* SearchResultsTableViewCell.h */,
3B5A112F1BB57CB600AB703A /* SearchResultsTableViewCell.m */,
3BB320FD1BB5EBD4001B2042 /* APICommunication */,
3BB320FC1BB5EBA3001B2042 /* FLAnimatedImage */,
3B5A11351BB58D8400AB703A /* Controllers */,
8D7DCD521BAF859400A92AD2 /* Main.storyboard */,
8D7DCD551BAF859400A92AD2 /* Assets.xcassets */,
8D7DCD571BAF859400A92AD2 /* LaunchScreen.storyboard */,
Expand Down Expand Up @@ -149,9 +210,16 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3B5A11341BB5828700AB703A /* AuthenticationViewController.m in Sources */,
8D7DCD511BAF859400A92AD2 /* ViewController.m in Sources */,
3B5A113B1BB59BA000AB703A /* Venue.m in Sources */,
3BB320F51BB5CE5E001B2042 /* DetailViewController.m in Sources */,
3B5A11381BB5968D00AB703A /* APIManager.m in Sources */,
8D7DCD4E1BAF859400A92AD2 /* AppDelegate.m in Sources */,
3B5A11301BB57CB600AB703A /* SearchResultsTableViewCell.m in Sources */,
3BB320FB1BB5EB98001B2042 /* FLAnimatedImageView.m in Sources */,
8D7DCD4B1BAF859400A92AD2 /* main.m in Sources */,
3BB320FA1BB5EB98001B2042 /* FLAnimatedImage.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -300,6 +368,7 @@
8D7DCD5F1BAF859400A92AD2 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
Expand Down
14 changes: 14 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/APIManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// APIManager.h
// Networking
//
// Created by Elber Carneiro on 9/20/15.
// Copyright © 2015 Elber Carneiro. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface APIManager : NSObject
+ (void)GETRequestWithURL:(NSURL *)URL
completionHandler:(void(^)(NSData *data, NSURLResponse *response, NSError *error)) completionHandler;
@end
37 changes: 37 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/APIManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// APIManager.m
// Networking
//
// Created by Elber Carneiro on 9/20/15.
// Copyright © 2015 Elber Carneiro. All rights reserved.
//

#import "APIManager.h"

@implementation APIManager

// Nasty abstracted logic
+ (void)GETRequestWithURL:(NSURL *)URL
completionHandler:(void(^)(NSData *data, NSURLResponse *response, NSError *error)) completionHandler {

// Create a session (look, ma! a singleton!).
NSURLSession *session = [NSURLSession sharedSession];

// Create a task with the URL and a completion block
NSURLSessionDataTask *task = [session dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {

// if you try to change the interface from outside the main thread, it
// will throw all sorts of errors. That's why we need to make sure we
// dispatch the action to the main thread.
dispatch_async(dispatch_get_main_queue(), ^ {

completionHandler(data, response, error);

});
}];

// Get the task going
[task resume];
}

@end
4 changes: 0 additions & 4 deletions TalkinToTheNet/TalkinToTheNet/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;


@end

6 changes: 6 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "largeImage.jpg",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "smallImage.jpg",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/AuthenticationViewController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// AuthenticationViewController.h
// TalkinToTheNet
//
// Created by Elber Carneiro on 9/25/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "Config.h"

@interface AuthenticationViewController : UIViewController <UIWebViewDelegate>

@end
49 changes: 49 additions & 0 deletions TalkinToTheNet/TalkinToTheNet/AuthenticationViewController.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// AuthenticationViewController.m
// TalkinToTheNet
//
// Created by Elber Carneiro on 9/25/15.
// Copyright © 2015 Mike Kavouras. All rights reserved.
//

#import "AuthenticationViewController.h"

@interface AuthenticationViewController ()
@property (nonatomic, strong) UIWebView *webView;
@end

@implementation AuthenticationViewController

- (void)viewDidLoad {
[super viewDidLoad];
self.webView = [[UIWebView alloc]initWithFrame:[self.view bounds]];
self.webView.delegate = self;
[self.view addSubview:self.webView];

NSString *authenticateURLString = [NSString stringWithFormat:@"%@?client_id=%@&response_type=token&redirect_uri=%@", FOURSQUARE_AUTHENTICATE_URL, FOURSQUARE_CLIENT_ID, FOURSQUARE_REDIRECT_URI];

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:authenticateURLString]];

[self.webView loadRequest:request];
}

#pragma mark - UIWebViewDelegate methods
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {

if ([request.URL.scheme isEqualToString:@"ec-foursquare-login"]) {
NSString *URLString = [[request URL] absoluteString];

if ([URLString rangeOfString:[NSString stringWithFormat:@"%@=", ACCESS_TOKEN_KEY]].location != NSNotFound) {
NSString *accessToken = [[URLString componentsSeparatedByString:@"="] lastObject];
NSLog(@"From AuthenticationViewController - access token: %@", accessToken);
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:accessToken forKey:ACCESS_TOKEN_KEY];
[defaults synchronize];
[self dismissViewControllerAnimated:YES completion:nil];
}
}

return YES;
}

@end
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand Down
Loading