hello.getFacebookId = function()
{
+ if(!this.isLoggedIn())
+ {
+ return null;
+ }
+
return hello('facebook').api('/me').then(function(r)
{
return r.id;
{
if (!this.facebookId)
{
+ if(!HelloService.getFacebookId())
+ {
+ return null;
+ }
+
return HelloService.getFacebookId().then(function(fbId)
{
//cant use this here bc scope or something
this.getUser(this.facebookId, true);
}
};
+
+ UserService.flushCache = function()
+ {
+ this.userCache = {};
+ this.facebookId = null;
+ };
return UserService;
}]);
\ No newline at end of file
{
UserService.getCurrentUser().then(function(user)
{
- console.log(user);
scope.welcomeMessage = 'Welcome, ' + user.displayName;
scope.quota = user.quota;
scope.quotaRemaining = user.quotaRemaining;
HelloService.on('auth.logout', function()
{
+ UserService.flushCache();
scope.welcomeMessage = '';
scope.loggedIn = false;
scope.$$phase || scope.$apply();
<ul>
<li>
{{welcomeMessage}}
- <a href="#" ng-if="loggedIn" ng-click="doLogout()">logout</a>
- <a href="#" ng-if="!loggedIn" ng-click="doLogin()">login</a>
+ <a class="de-link" ng-if="loggedIn" ng-click="doLogout()">logout</a>
+ <a class="de-link" ng-if="!loggedIn" ng-click="doLogin()">login</a>
</li>
</ul>
<div ng-if="loggedIn">
margin-right:5px;
}
-.simfileListing a {
+a {
font-weight: bold;
color: #FFB122;
text-decoration: none;
}
-.simfileListing a:hover {
+a:hover {
text-decoration: underline;
}
};
$scope.downloadFromDe = function(pack)
- {
- UserService.getCurrentUser().then(function(user)
+ {
+ if(!UserService.getCurrentUser())
{
+ $rootScope.$broadcast('message.error', 'You need to be logged in to download from DivinElegy.');
+ return;
+ }
+
+ UserService.getCurrentUser().then(function(user)
+ {
var size = filesizeBytes(pack.size);
var quotaRemaining = filesizeBytes(user.quotaRemaining);