|
本帖最后由 Qter 于 2020-10-12 15:16 编辑
- app\internal_packages\onboarding\lib\onboarding-actions.ts
- export const finishAndAddAccount = Reflux.createAction('finishAndAddAccount');
- finishAndAddAccount.sync = true;
- app\internal_packages\onboarding\lib\onboarding-store.ts
- this.listenTo(OnboardingActions.finishAndAddAccount, this._onFinishAndAddAccount);
- _onFinishAndAddAccount = async account => {
- try {
- "onboarding-store _onFinishAndAddAccount account: {"id":"b800a344","metadata":[],"name":"15313159857","provider":"imap","emailAddress":"15313159857@139.com","settings":{"imap_host":"imap.139.com","imap_port":143,"imap_username":"15313159857@139.com","imap_password":"1111","imap_security":"none","imap_allow_insecure_ssl":false,"smtp_host":"smtp.139.com","smtp_port":25,"smtp_username":"15313159857@139.com","smtp_password":"1111","smtp_security":"none","smtp_allow_insecure_ssl":false},"label":"15313159857@139.com","autoaddress":{"type":"bcc","value":""},"aliases":[],"syncState":"ok","authedAt":1602299324.14,"__cls":"Account"}", source: /F:/github/office/Mailspring/app/internal_packages/onboarding/lib/onboarding-store.ts (73)
- AccountStore.addAccount(account);
- }
-
- }
- app\src\flux\stores\account-store.ts
- addAccount = async account => {
- const cleanAccount = await KeyManager.extractAccountSecrets(account);
- this._loadAccounts();
- this._save();
- }
- app\internal_packages\onboarding\lib\decorators\create-page-for-form.tsx
- _renderButton() {
- onClick={this.onSubmit}
- }
- this.onConnect();
- console.log("create-page-for-form account:" + JSON.stringify(account));
- finalizeAndValidateAccount(account)
- .then(validated => {
- OnboardingActions.moveToPage('account-onboarding-success');
- OnboardingActions.finishAndAddAccount(validated);
- })
-
- app\internal_packages\onboarding\lib\onboarding-helpers.ts
- export async function finalizeAndValidateAccount(account: Account) {
- console.log("onboarding-helpers finalizeAndValidateAccount set:" + JSON.stringify(AppEnv.getLoadSettings()));
- const proc = new MailsyncProcess(AppEnv.getLoadSettings());
- proc.identity = IdentityStore.identity();
- proc.account = account;
- await proc.test();
- }
- app\src\mailsync-process.ts
- test() {
- return this._spawnAndWait('test');
- }
-
- _spawnAndWait(mode, { onData }: { onData?: (data: any) => void } = {}) {
- this._spawnProcess(mode);
- this._proc.stdout.on('data', data => {
- console.log("_spawnAndWait on stdout data:" + data)
- buffer += data;
- if (onData) onData(data);
- });
- }
-
- _spawnProcess(mode) {
- console.log("_spawnProcess : " + this.binaryPath + " args:"+ JSON.stringify(args) + " env:" + JSON.stringify(env))
- this._proc = spawn(this.binaryPath, args, { env });
- }
复制代码 |
|