Skip to content

Commit

Permalink
mionr change
Browse files Browse the repository at this point in the history
  • Loading branch information
powerful23 committed Mar 22, 2018
1 parent ca558e4 commit 54c9dc2
Show file tree
Hide file tree
Showing 31 changed files with 915 additions and 399 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
* Enhancement: Customize endpoint userId and attributes #437
* Enhancement: Analytics turn on/off #479
* Bug Fix: Retrieving credentials only once when reloading page #486
* aws-amplify - v0.1.37@beta
* Enhancement: dding `onError` support for withGoogle Federated login #475
* aws-amplify-react - v0.1.37@beta
* Enhancement: adding `onError` support for withGoogle Federated login #475

## 03/19/2018
* aws-amplify - v0.2.11
Expand Down
52 changes: 52 additions & 0 deletions packages/aws-amplify-react/dist/Auth/Greetings.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ var Greetings = function (_AuthPiece) {
var _this = _possibleConstructorReturn(this, (Greetings.__proto__ || Object.getPrototypeOf(Greetings)).call(this, props));

_this.signOut = _this.signOut.bind(_this);
_this.googleSignOut = _this.googleSignOut.bind(_this);
_this.facebookSignOut = _this.facebookSignOut.bind(_this);
_this.checkUser = _this.checkUser.bind(_this);
_this.onHubCapsule = _this.onHubCapsule.bind(_this);

Expand Down Expand Up @@ -89,6 +91,8 @@ var Greetings = function (_AuthPiece) {
function signOut() {
var _this2 = this;

this.googleSignOut();
this.facebookSignOut();
_awsAmplify.Auth.signOut().then(function () {
return _this2.changeState('signedOut');
})['catch'](function (err) {
Expand All @@ -98,6 +102,54 @@ var Greetings = function (_AuthPiece) {

return signOut;
}()
}, {
key: 'googleSignOut',
value: function () {
function googleSignOut() {
var auth2 = window.gapi && window.gapi.auth2 ? window.gapi.auth2 : null;
if (!auth2) {
return Promise.resolve(null);
}

auth2.getAuthInstance().then(function (googleAuth) {
if (!googleAuth) {
logger.debug('google Auth undefined');
return Promise.resolve(null);
}

logger.debug('google signing out');
return googleAuth.signOut();
});
}

return googleSignOut;
}()
}, {
key: 'facebookSignOut',
value: function () {
function facebookSignOut() {
var fb = window.FB;
if (!fb) {
logger.debug('FB sdk undefined');
return Promise.resolve(null);
}

fb.getLoginStatus(function (response) {
if (response.status === 'connected') {
return new Promise(function (res, rej) {
logger.debug('facebook signing out');
fb.logout(function (response) {
res(response);
});
});
} else {
return Promise.resolve(null);
}
});
}

return facebookSignOut;
}()
}, {
key: 'checkUser',
value: function () {
Expand Down
4 changes: 4 additions & 0 deletions packages/aws-amplify-react/dist/Auth/Provider/withGoogle.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ function withGoogle(Comp) {
var _this2 = this;

var ga = window.gapi.auth2.getAuthInstance();
var onError = this.props.onError;

ga.signIn().then(function (googleUser) {
return _this2.federatedSignIn(googleUser);
}, function (error) {
if (onError) onError(error);else throw error;
});
}

Expand Down
2 changes: 1 addition & 1 deletion packages/aws-amplify-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aws-amplify-react",
"version": "0.1.35",
"version": "0.1.37",
"description": "AWS Amplify is a JavaScript library for Frontend and mobile developers building cloud-enabled applications.",
"main": "dist/index.js",
"scripts": {
Expand Down
Loading

0 comments on commit 54c9dc2

Please sign in to comment.