-
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.
서버쪽 파일 추가, webview에 로그인 테스트 페이지 띄우도록 설정
- Loading branch information
leadbrain
committed
Jul 15, 2012
1 parent
8a20320
commit 5db34c4
Showing
13 changed files
with
282 additions
and
18 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
Binary file modified
BIN
+3.57 KB
(120%)
...eproj/project.xcworkspace/xcuserdata/leadbrain.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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
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
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
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
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 @@ | ||
// | ||
// ProfileViewController.h | ||
// Delis | ||
// | ||
// Created by 김 영선 on 12. 7. 12.. | ||
// Copyright (c) 2012년 LBS. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface ProfileViewController : UIViewController { | ||
IBOutlet UIWebView* webview; | ||
} | ||
|
||
@property (nonatomic, retain) UIWebView* webview; | ||
|
||
@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,21 @@ | ||
// | ||
// ProfileViewController.m | ||
// Delis | ||
// | ||
// Created by 김 영선 on 12. 7. 12.. | ||
// Copyright (c) 2012년 LBS. All rights reserved. | ||
// | ||
|
||
#import "ProfileViewController.h" | ||
|
||
@implementation ProfileViewController | ||
@synthesize webview; | ||
|
||
-(void)viewDidLoad { | ||
[super viewDidLoad]; | ||
NSURL* url = [NSURL URLWithString:@"http://localhost:8000/login_test.html"]; | ||
NSURLRequest* request = [NSURLRequest requestWithURL:url]; | ||
[webview loadRequest:request]; | ||
} | ||
|
||
@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
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,50 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<title>Hello World</title> | ||
<meta name="viewport" | ||
content="initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/> | ||
<script src="login.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
window.fbAsyncInit = function() { | ||
FB.init({ | ||
appId : '494841757196846', // App ID | ||
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File | ||
status : true, // check login status | ||
cookie : true, // enable cookies to allow the server to access the session | ||
xfbml : true // parse XFBML | ||
}); | ||
FB.Event.subscribe('auth.statusChange', handleStatusChange); | ||
}; | ||
|
||
(function(d){ | ||
var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; | ||
if (d.getElementById(id)) {return;} | ||
js = d.createElement('script'); js.id = id; js.async = true; | ||
js.src = "//connect.facebook.net/en_US/all.js"; | ||
ref.parentNode.insertBefore(js, ref); | ||
}(document)) | ||
</script> | ||
|
||
<div id="login"> | ||
<p><button onClick="loginUser();">Login</button></p> | ||
</div> | ||
<div id="logout"> | ||
<p><button onClick="FB.logout();">Logout</button></p> | ||
</div> | ||
|
||
<div id="fb-root"></div> | ||
<style> | ||
body.connected #login { display: none; } | ||
body.connected #logout { display: block; } | ||
body.not_connected #login { display: block; } | ||
body.not_connected #logout { display: none; } | ||
</style> | ||
<div id="user-info"></div> | ||
<a href="#" onclick="getUserFriends();">Get friends</a><br> | ||
<div id="user-friends"></div> | ||
<a href="#" onclick="sendRequest();">Send request</a><br> | ||
</body> | ||
</html> |
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,32 @@ | ||
var sys = require("sys"), | ||
http = require("http"), | ||
url = require("url"), | ||
path = require("path"), | ||
fs = require("fs"); | ||
|
||
http.createServer(function(request, response) { | ||
var uri = url.parse(request.url).pathname; | ||
var filename = path.join(process.cwd(), uri); | ||
path.exists(filename, function(exists) { | ||
if(!exists) { | ||
response.writeHeader(404, {"Content-Type": "text/plain"}); | ||
response.write("404 not found"); | ||
response.end(); | ||
return; | ||
} | ||
|
||
fs.readFile(filename, "binary", function(err, file) { | ||
if(err) { | ||
response.writeHeader(500, {"Content-Type": "text/plain"}); | ||
response.write(err + "\n"); | ||
response.end(); | ||
return; | ||
} | ||
response.writeHeader(200); | ||
response.write(file, "binary"); | ||
response.end(); | ||
}); | ||
}); | ||
}).listen(8000); | ||
|
||
sys.puts("server runnint at http://localhost:8000"); |
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,44 @@ | ||
function handleStatusChange(response) { | ||
document.body.className = response.authResponse ? 'connected' : 'not_connected'; | ||
if (response.authResponse) { | ||
console.log(response); | ||
updateUserInfo(response); | ||
} | ||
} | ||
|
||
function loginUser() { | ||
FB.login(function(response) { }, {scope:'email'}); | ||
} | ||
function updateUserInfo(response) { | ||
FB.api('/me', function(response) { | ||
document.getElementById('user-info').innerHTML = '<img src="https://graph.facebook.com/' + response.id + '/picture">' + response.name; | ||
}); | ||
} | ||
function getUserFriends() { | ||
FB.api('/me/friends&fields=name,picture', function(response) { | ||
console.log('Got friends: ', response); | ||
|
||
if (!response.error) { | ||
var markup = ''; | ||
|
||
var friends = response.data; | ||
|
||
for (var i=0; i < friends.length && i < 25; i++) { | ||
var friend = friends[i]; | ||
|
||
markup += '<img src="' + friend.picture + '"> ' + friend.name + '<br>'; | ||
} | ||
|
||
document.getElementById('user-friends').innerHTML = markup; | ||
} | ||
}); | ||
} | ||
function sendRequest() { | ||
FB.ui({ | ||
method: 'apprequests', | ||
message: 'invites you to learn how to make your mobile web app social', | ||
}, | ||
function(response) { | ||
console.log('sendRequest response: ', response); | ||
}); | ||
} |
Oops, something went wrong.