From fb3dfa428e89c20d84390f8e031761d642dfdb2e Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Wed, 12 Aug 2015 17:38:58 -0300 Subject: [PATCH] native cordova facebook login --- .meteor/cordova-plugins | 3 ++- client/views/login/services.coffee | 31 +++++++++++++++++++----------- mobile-config.js | 10 +++++----- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.meteor/cordova-plugins b/.meteor/cordova-plugins index 029983507c2e..8ebbb282b3be 100644 --- a/.meteor/cordova-plugins +++ b/.meteor/cordova-plugins @@ -1 +1,2 @@ -com.ionic.keyboard@https://github.com/driftyco/ionic-plugin-keyboard/tarball/66926f5e25fcd71b65799adaf12fa0b2df65ce78 \ No newline at end of file +com.ionic.keyboard@https://github.com/driftyco/ionic-plugin-keyboard/tarball/66926f5e25fcd71b65799adaf12fa0b2df65ce78 +com.phonegap.plugins.facebookconnect@0.11.0 diff --git a/client/views/login/services.coffee b/client/views/login/services.coffee index 0112f2a12c2c..b70288a7b79b 100644 --- a/client/views/login/services.coffee +++ b/client/views/login/services.coffee @@ -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' diff --git a/mobile-config.js b/mobile-config.js index cacad969310f..da228bc83842 100644 --- a/mobile-config.js +++ b/mobile-config.js @@ -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' -// }); \ No newline at end of file +// Pass preferences for a particular PhoneGap/Cordova plugin +App.configurePlugin('com.phonegap.plugins.facebookconnect', { + APP_NAME: 'Rocket.Chat', + APP_ID: '835103589938459' +});