diff --git a/src/components/SignInButtons/Apple/index.android.js b/src/components/SignInButtons/Apple/index.android.js index a2361255eeb7..8af886c7ec4c 100644 --- a/src/components/SignInButtons/Apple/index.android.js +++ b/src/components/SignInButtons/Apple/index.android.js @@ -13,8 +13,9 @@ function appleSignInRequest() { responseType: appleAuthAndroid.ResponseType.ALL, scope: appleAuthAndroid.Scope.ALL, }); - return appleAuthAndroid.signIn() - .then(response => response.id_token) + return appleAuthAndroid + .signIn() + .then((response) => response.id_token) .catch((e) => { Log.error('Request to sign in with Apple failed. Error: ', e); throw e; @@ -24,12 +25,17 @@ function appleSignInRequest() { const AppleSignIn = () => { const handleSignIn = () => { appleSignInRequest() - .then(token => Session.beginAppleSignIn(token)) + .then((token) => Session.beginAppleSignIn(token)) .catch((e) => { Log.error('Apple authentication failed', e); }); }; - return } />; + return ( + } + /> + ); }; AppleSignIn.displayName = 'AppleSignIn'; diff --git a/src/components/SignInButtons/Apple/index.desktop.js b/src/components/SignInButtons/Apple/index.desktop.js index 5b5cef6d67be..19784f797625 100644 --- a/src/components/SignInButtons/Apple/index.desktop.js +++ b/src/components/SignInButtons/Apple/index.desktop.js @@ -6,7 +6,12 @@ const AppleSignIn = () => { const handleSignIn = () => { // handlesignin }; - return } />; + return ( + } + /> + ); }; AppleSignIn.displayName = 'AppleSignIn'; diff --git a/src/components/SignInButtons/Apple/index.ios.js b/src/components/SignInButtons/Apple/index.ios.js index 89c2c3029c95..1e5a6f01de1e 100644 --- a/src/components/SignInButtons/Apple/index.ios.js +++ b/src/components/SignInButtons/Apple/index.ios.js @@ -6,31 +6,38 @@ import AppleLogoIcon from '../../../../assets/images/signIn/apple-logo.svg'; import * as Session from '../../../libs/actions/Session'; function appleSignInRequest() { - return appleAuth.performRequest({ - requestedOperation: appleAuth.Operation.LOGIN, + return appleAuth + .performRequest({ + requestedOperation: appleAuth.Operation.LOGIN, - // FULL_NAME must come first, see https://github.com/invertase/react-native-apple-authentication/issues/293 - requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL], - }) - .then(response => appleAuth.getCredentialStateForUser(response.user) - .then((credentialState) => { + // FULL_NAME must come first, see https://github.com/invertase/react-native-apple-authentication/issues/293 + requestedScopes: [appleAuth.Scope.FULL_NAME, appleAuth.Scope.EMAIL], + }) + .then((response) => + appleAuth.getCredentialStateForUser(response.user).then((credentialState) => { if (credentialState !== appleAuth.State.AUTHORIZED) { Log.error('Authentication failed. Original response: ', response); throw new Error('Authentication failed'); } return response.identityToken; - })); + }), + ); } const AppleSignIn = () => { const handleSignIn = () => { appleSignInRequest() - .then(token => Session.beginAppleSignIn(token)) + .then((token) => Session.beginAppleSignIn(token)) .catch((e) => { Log.error('Apple authentication failed', e); }); }; - return } />; + return ( + } + /> + ); }; AppleSignIn.displayName = 'AppleSignIn'; diff --git a/src/components/SignInButtons/Apple/index.website.js b/src/components/SignInButtons/Apple/index.website.js index dbedd54561cb..eb1b3d04b2ee 100644 --- a/src/components/SignInButtons/Apple/index.website.js +++ b/src/components/SignInButtons/Apple/index.website.js @@ -7,7 +7,9 @@ import APPLE_CONFIG from './AppleConfig'; const propTypes = {...withLocalizePropTypes}; const $appleButtonContainerStyle = { - width: 40, height: 40, marginRight: 20, + width: 40, + height: 40, + marginRight: 20, }; const AppleSignIn = (props) => { @@ -54,7 +56,6 @@ const AppleSignIn = (props) => { data-type="sign in" /> - ); }; diff --git a/src/components/SignInButtons/ButtonBase.js b/src/components/SignInButtons/ButtonBase.js index 709e17c1ec2c..5ff85c0abdc3 100644 --- a/src/components/SignInButtons/ButtonBase.js +++ b/src/components/SignInButtons/ButtonBase.js @@ -7,7 +7,10 @@ const style = { }; const ButtonBase = ({onPress, icon}) => ( - + {icon} ); diff --git a/src/libs/actions/Session/index.js b/src/libs/actions/Session/index.js index 867a7c778718..bbc1e495a0db 100644 --- a/src/libs/actions/Session/index.js +++ b/src/libs/actions/Session/index.js @@ -265,8 +265,8 @@ function handleAppleAuthApiResponse(token) { const {optimisticData, successData, failureData} = generateResponseData(); // eslint-disable-next-line rulesdir/no-api-side-effects-method API.makeRequestWithSideEffects('AuthenticateApple', {token}, {optimisticData, successData, failureData}) - .then(apiResponse => Log.info('API response: ', apiResponse)) - .catch(apiError => Log.error('API Callback error: ', apiError)); + .then((apiResponse) => Log.info('API response: ', apiResponse)) + .catch((apiError) => Log.error('API Callback error: ', apiError)); } /** @@ -722,65 +722,77 @@ function authenticatePusher(socketID, channelName, callback) { * Request a new validation link / magic code to unlink an unvalidated secondary login from a primary login */ function requestUnlinkValidationLink() { - const optimisticData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - isLoading: true, - errors: null, - message: null, - }, - }]; - const successData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - isLoading: false, - message: Localize.translateLocal('unlinkLoginForm.linkSent'), - }, - }]; - const failureData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - isLoading: false, - }, - }]; + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + isLoading: true, + errors: null, + message: null, + }, + }, + ]; + const successData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + isLoading: false, + message: Localize.translateLocal('unlinkLoginForm.linkSent'), + }, + }, + ]; + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + isLoading: false, + }, + }, + ]; API.write('RequestUnlinkValidationLink', {email: credentials.login}, {optimisticData, successData, failureData}); } function unlinkLogin(accountID, validateCode) { - const optimisticData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - ...CONST.DEFAULT_ACCOUNT_DATA, - isLoading: true, - }, - }]; - const successData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - isLoading: false, - message: Localize.translateLocal('unlinkLoginForm.succesfullyUnlinkedLogin'), + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + ...CONST.DEFAULT_ACCOUNT_DATA, + isLoading: true, + }, }, - }, - { - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.CREDENTIALS, - value: { - login: '', - }, - }]; - const failureData = [{ - onyxMethod: Onyx.METHOD.MERGE, - key: ONYXKEYS.ACCOUNT, - value: { - isLoading: false, - }, - }]; + ]; + const successData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + isLoading: false, + message: Localize.translateLocal('unlinkLoginForm.succesfullyUnlinkedLogin'), + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.CREDENTIALS, + value: { + login: '', + }, + }, + ]; + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: ONYXKEYS.ACCOUNT, + value: { + isLoading: false, + }, + }, + ]; API.write('UnlinkLogin', {accountID, validateCode}, {optimisticData, successData, failureData}); } diff --git a/src/pages/signin/LoginForm.js b/src/pages/signin/LoginForm.js index 2bab18acce81..87f2f08ff2e5 100755 --- a/src/pages/signin/LoginForm.js +++ b/src/pages/signin/LoginForm.js @@ -214,11 +214,12 @@ class LoginForm extends React.Component { isAlertVisible={!_.isEmpty(serverErrorText)} containerStyles={[styles.mh0]} /> -