2016-05-28 05:05:27 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
2019-03-05 03:03:12 +08:00
|
|
|
import { Account } from 'mailspring-exports';
|
2018-02-03 06:33:52 +08:00
|
|
|
import { buildGmailAccountFromAuthResponse, buildGmailAuthURL } from './onboarding-helpers';
|
2016-05-28 05:05:27 +08:00
|
|
|
|
2017-10-07 03:45:21 +08:00
|
|
|
import OAuthSignInPage from './oauth-signin-page';
|
2019-03-05 03:03:12 +08:00
|
|
|
import * as OnboardingActions from './onboarding-actions';
|
2017-09-11 13:45:48 +08:00
|
|
|
import AccountProviders from './account-providers';
|
2016-05-28 05:05:27 +08:00
|
|
|
|
2019-03-05 03:03:12 +08:00
|
|
|
export default class AccountSettingsPageGmail extends React.Component<{ account: Account }> {
|
2017-09-27 02:33:08 +08:00
|
|
|
static displayName = 'AccountSettingsPageGmail';
|
2016-05-28 05:05:27 +08:00
|
|
|
|
2019-03-05 03:03:12 +08:00
|
|
|
_gmailAuthUrl = buildGmailAuthURL();
|
2016-05-28 05:05:27 +08:00
|
|
|
|
2017-09-11 03:04:22 +08:00
|
|
|
onSuccess(account) {
|
2017-09-26 06:44:20 +08:00
|
|
|
OnboardingActions.finishAndAddAccount(account);
|
2016-05-28 05:05:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2017-09-27 02:33:08 +08:00
|
|
|
const providerConfig = AccountProviders.find(a => a.provider === this.props.account.provider);
|
|
|
|
const { headerIcon } = providerConfig;
|
|
|
|
const goBack = () => OnboardingActions.moveToPreviousPage();
|
2016-05-28 05:05:27 +08:00
|
|
|
|
|
|
|
return (
|
2016-08-26 01:44:23 +08:00
|
|
|
<OAuthSignInPage
|
2017-01-24 23:34:07 +08:00
|
|
|
serviceName="Google"
|
2017-01-19 09:44:22 +08:00
|
|
|
providerAuthPageUrl={this._gmailAuthUrl}
|
2018-02-03 06:33:52 +08:00
|
|
|
buildAccountFromAuthResponse={buildGmailAccountFromAuthResponse}
|
2017-01-24 23:34:07 +08:00
|
|
|
iconName={headerIcon}
|
2016-08-26 01:44:23 +08:00
|
|
|
onSuccess={this.onSuccess}
|
2017-01-19 09:44:22 +08:00
|
|
|
onTryAgain={goBack}
|
2016-08-26 01:44:23 +08:00
|
|
|
/>
|
2016-05-28 05:05:27 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|