Skip to content
Browse files

Add twitter connect and including sn connect into mocks

  • Loading branch information...
1 parent 0b37f0f commit a9c3d1a3e7410beb2d9b6438d4e171754d6f7a01 @yonromai yonromai committed May 30, 2012
View
1 snapapp/common/js/load.js
@@ -2,6 +2,7 @@
//define(commonScripts,[
commonScripts = [
"order!/snapapp/common/lib/angular/angular.js",
+ "order!http://platform.twitter.com/anywhere.js?id=HDz4lPcTE9tIMD3SV3Nkg&v=1",
"order!/snapapp/common/js/models/facebook/facebook.js",
"order!/snapapp/common/js/models/facebook/facebookConnect.js",
"order!/snapapp/common/js/models/google+/google+.js",
View
6 snapapp/common/js/models/mocks/SNMocks.js
@@ -25,6 +25,12 @@ angular.module('SNMock',['types']).
var profile=new Profile();
return profile;
}
+
+
+ SNMock.prototype.connect = function(){
+ return ; //Must return connection object?
+ }
+
return SNMock;
});
View
23 snapapp/common/js/models/twitter/twitter.js
@@ -44,6 +44,29 @@ angular.module('twitter',['SNMock']).
}
return listMessages;
}
+
+ Twitter.prototype.connect = function(){
+
+ //FIXME: Set proper callback url
+ //twttr.anywhere.config({ callbackURL: "http://www.yoursite.com/anywhere-complete" });
+
+ if(!this.connectAlreadyCalled){ //FIXME: Ugly Ugly Ugly hack
+ this.connectAlreadyCalled = true;
+ twttr.anywhere(function (T) {
+ T("#login-Twitter").connectButton({ //Fixme: use Twitter.name
+ authComplete: function(user) {
+ // triggered when auth completed successfully
+ console.log("You rock baby");
+ },
+ signOut: function() {
+ // triggered when user logs out
+ console.log("You suck baby");
+ }
+ });
+ });
+ }
+ return ; //Must return connection object?
+ }
return Twitter;
});
View
1 snapapp/desktop/index.html
@@ -56,6 +56,7 @@
</pane>
<pane class="pane" ng-repeat="socialNetwork in socialNetworks" title="{{socialNetwork.displayName}}">
<div class="scrollable-pane" ng-controller="desktopAppCtrlMsg">
+ <span id="login-{{socialNetwork.name}}">{{socialNetwork.connect()}}</span>
<div class="msgContainer well" ng-repeat="message in messages | filter:search">
<!-- Image du profil -->
<img class="msgImgProfile" src="{{getImageProfile(message)}}" />
View
6 snapapp/tablet/index.html
@@ -29,12 +29,13 @@
<div id="fb-root"></div>
- <p> Test Facebook connect<br/>
+<!-- <p> Test Facebook connect<br/>
<div class="fb-login-button" id="connexion">Login with Facebook</div><br/>
<div id="userName" style="display: none"></div><br/>
<button id="byebye" style="border-right-color: #000000;">Logout</button>
</p>
+ -->
<input type="text" ng-model="search" class="search-query" placeholder="Search">
<table>
@@ -44,6 +45,7 @@
<th>Picture</th>
<th>icon</th>
<th>citation</th>
+ <th>connect</th>
</tr>
</thead>
<tbody>
@@ -52,6 +54,8 @@
<td>{{socialNetwork.picture}}</td>
<td>{{socialNetwork.icon}}</td>
<td>{{socialNetwork.citation}}</td>
+ <td>{{socialNetwork.name}} connect: </td>
+ <span id="login-{{socialNetwork.name}}">{{socialNetwork.connect()}}</span>
</tr>
</tbody>
</table>

0 comments on commit a9c3d1a

Please sign in to comment.
Something went wrong with that request. Please try again.