Skip to content

Commit

Permalink
Merge pull request #459 from RocketChat/cordova-facebook-login
Browse files Browse the repository at this point in the history
Cordova facebook login
  • Loading branch information
rodrigok committed Aug 13, 2015
2 parents 4414ffe + 55593cf commit 08634ff
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
3 changes: 2 additions & 1 deletion .meteor/cordova-plugins
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
com.ionic.keyboard@https://github.com/driftyco/ionic-plugin-keyboard/tarball/66926f5e25fcd71b65799adaf12fa0b2df65ce78
com.ionic.keyboard@https://github.com/driftyco/ionic-plugin-keyboard/tarball/66926f5e25fcd71b65799adaf12fa0b2df65ce78
com.phonegap.plugins.facebookconnect@https://github.com/Wizcorp/phonegap-facebook-plugin/tarball/0e61babb65bc1716b957b6294c7fdef3ce6ace79
31 changes: 20 additions & 11 deletions client/views/login/services.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,26 @@ Template.loginServices.events
'click .external-login': ->
return unless this.service?

loginWithService = "loginWith" + (if this.service is 'meteor-developer' then 'MeteorDeveloperAccount' else _.capitalize(this.service))
# login with native facebook app
if Meteor.isCordova and this.service is 'facebook'
facebookConnectPlugin.login ["public_profile"], ->
FlowRouter.go 'index'
, (error) ->
console.log JSON.stringify error, null, ' '
toastr.error error.errorCode + ' - ' + error.errorMessage
return
else
loginWithService = "loginWith" + (if this.service is 'meteor-developer' then 'MeteorDeveloperAccount' else _.capitalize(this.service))

serviceConfig = {}
serviceConfig = {}

Meteor[loginWithService] serviceConfig, (error) ->
if error?.error is 'github-no-public-email'
alert t("github_no_public_email")
return
Meteor[loginWithService] serviceConfig, (error) ->
if error?.error is 'github-no-public-email'
alert t("github_no_public_email")
return

console.log error
if error
toastr.error error.message
return
FlowRouter.go 'index'
console.log error
if error
toastr.error error.message
return
FlowRouter.go 'index'
10 changes: 5 additions & 5 deletions mobile-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ App.setPreference('StatusBarBackgroundColor', '#000000');
App.setPreference('ShowSplashScreenSpinner', false);
App.accessRule('*');

// // Pass preferences for a particular PhoneGap/Cordova plugin
// App.configurePlugin('com.phonegap.plugins.facebookconnect', {
// APP_ID: '1234567890',
// API_KEY: 'supersecretapikey'
// });
// Pass preferences for a particular PhoneGap/Cordova plugin
App.configurePlugin('com.phonegap.plugins.facebookconnect', {
APP_NAME: 'Rocket.Chat',
APP_ID: '835103589938459'
});

0 comments on commit 08634ff

Please sign in to comment.