refactor: new snjs support (#967)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user