|
本帖最后由 Qter 于 2020-10-13 18:09 编辑
- app\internal_packages\notifications\lib\items\account-error-notif.tsx
- this._onCheckAgain([erroredAccount]),
- _onCheckAgain(accounts) {
- accounts.forEach(acct => AppEnv.mailsyncBridge.forceRelaunchClient(acct));
- }
-
- app\src\flux\mailsync-bridge.ts
- async forceRelaunchClient(account: Account) {
- const keys = await KeyManager._getKeyHash();
- this._launchClient(account, keys, { force: true });
- }
- async _launchClient(account: Account, keys, { force }: { force?: boolean } = {}) {
- const client = new MailsyncProcess(this._getClientConfiguration());
- const fullAccountJSON = (await KeyManager.insertAccountSecrets(account, keys)).toJSON();
- client.account = fullAccountJSON;
- client.identity = IdentityStore.identity();
- client.sync();
- client.on('deltas', this._onIncomingMessages);
- }
- _onIncomingMessages = msgs => {
- for (const msg of msgs) {
- const models = modelJSONs.map(Utils.convertToModel);
- this._onIncomingChangeRecord(
- new DatabaseChangeRecord({
- type, // TODO BG move to "model" naming style, finding all uses might be tricky
- objectClass: modelClass,
- objects: models,
- objectsRawJSON: modelJSONs,
- })
- );
- }
- }
- app\src\mailsync-process.ts
- sync() {
- this._spawnProcess('sync');
- const msgs = outBuffer.split('\n');
- outBuffer = msgs.pop();
- this.emit('deltas', msgs);
- }
复制代码 |
|