refactor: new snjs support (#967)

This commit is contained in:
Mo
2022-04-11 12:48:19 -05:00
committed by GitHub
parent 3126d97dca
commit 3a2ff2f440
44 changed files with 569 additions and 799 deletions

View File

@@ -8,13 +8,11 @@ import {
removeFromArray,
DesktopManagerInterface,
PayloadSource,
EncryptionIntent,
CreateIntentPayloadFromObject,
InternalEventBus,
} from '@standardnotes/snjs';
import { WebAppEvent, WebApplication } from '@/ui_models/application';
import { isDesktopApplication } from '@/utils';
import { Bridge, ElectronDesktopCallbacks } from './bridge';
import { InternalEventBus } from '@standardnotes/services';
/**
* An interface used by the Desktop application to interact with SN
@@ -68,10 +66,7 @@ export class DesktopManager
* Keys are not passed into ItemParams, so the result is not encrypted
*/
convertComponentForTransmission(component: SNComponent) {
return CreateIntentPayloadFromObject(
component.payloadRepresentation(),
EncryptionIntent.FileDecrypted
);
return component.payloadRepresentation().ejected();
}
// All `components` should be installed
@@ -84,11 +79,7 @@ export class DesktopManager
return this.convertComponentForTransmission(component);
})
).then((payloads) => {
this.bridge.syncComponents(
payloads.filter(
(payload) => !payload.errorDecrypting && !payload.waitingForKey
)
);
this.bridge.syncComponents(payloads);
});
}
@@ -137,7 +128,7 @@ export class DesktopManager
return;
}
const updatedComponent = await this.application.mutator.changeAndSaveItem(
component.uuid,
component,
(m) => {
const mutator = m as ComponentMutator;
if (error) {