This repository has been archived on 2025-09-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
repertory-ui/src/renderer/ipc/PinnedIPC.js
2021-03-10 21:14:32 -06:00

65 lines
1.6 KiB
JavaScript

const Constants = require('../../constants');
const helpers = require('../../helpers');
const addListeners = (ipcMain, { standardIPCReply }) => {
ipcMain.on(Constants.IPC_Get_Directory_Items, (event, data) => {
helpers
.grabDirectoryItems(
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
});
ipcMain.on(Constants.IPC_Get_Pinned_Files, (event, data) => {
helpers
.grabDirectoryItems(
data.Path,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((data) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {
Items: data.items,
});
})
.catch((e) => {
standardIPCReply(event, Constants.IPC_Get_Directory_Items_Reply, {}, e);
});
});
ipcMain.on(Constants.IPC_Get_Pinned_Files_Status, (event, data) => {});
ipcMain.on(Constants.IPC_Set_Pinned + '_sync', (event, data) => {
helpers
.setPinned(
data.Path,
data.Pinned,
data.Version,
data.Provider,
data.Remote,
data.S3
)
.then((success) => {
event.returnValue = success;
})
.catch((e) => {
event.returnValue = false;
});
});
};
module.exports = { addListeners };