mirror of
https://github.com/samuelthomas2774/nxapi.git
synced 2026-03-21 18:04:10 -05:00
Add new web service APIs
This commit is contained in:
parent
2680b03c46
commit
cb3bdda283
|
|
@ -170,6 +170,7 @@ export function setupIpc(appinstance: App, ipcMain: IpcMain) {
|
|||
ipcMain.handle('nxapi:webserviceapi:copyToClipboard', (e, data: string) => webserviceipc.copyToClipboard(e, data));
|
||||
ipcMain.handle('nxapi:webserviceapi:downloadImages', (e, data: string) => webserviceipc.downloadImages(e, data));
|
||||
ipcMain.handle('nxapi:webserviceapi:completeLoading', e => webserviceipc.completeLoading(e));
|
||||
ipcMain.handle('nxapi:webserviceapi:clearUnreadFlag', e => webserviceipc.clearUnreadFlag(e));
|
||||
|
||||
store.on('update-nintendo-accounts', () => sendToAllWindows('nxapi:accounts:shouldrefresh'));
|
||||
store.on('update-discord-presence-source', () => sendToAllWindows('nxapi:discord:shouldrefresh'));
|
||||
|
|
|
|||
|
|
@ -442,4 +442,10 @@ export class WebServiceIpc {
|
|||
|
||||
debug('Web service %s, user %s, called completeLoading', webservice.name, nsoAccount.user.name);
|
||||
}
|
||||
|
||||
async clearUnreadFlag(event: IpcMainInvokeEvent): Promise<void> {
|
||||
const {nsoAccount, webservice} = this.getWindowData(event.sender);
|
||||
|
||||
debug('Web service %s, user %s, called clearUnreadFlag', webservice.name, nsoAccount.user.name);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ const ipc = {
|
|||
copyToClipboard: (data: string) => ipcRenderer.invoke('nxapi:webserviceapi:copyToClipboard', data) as Promise<void>,
|
||||
downloadImages: (data: string) => ipcRenderer.invoke('nxapi:webserviceapi:downloadImages', data) as Promise<void>,
|
||||
completeLoading: () => ipcRenderer.invoke('nxapi:webserviceapi:completeLoading') as Promise<void>,
|
||||
clearUnreadFlag: () => ipcRenderer.invoke('nxapi:webserviceapi:clearUnreadFlag') as Promise<void>,
|
||||
};
|
||||
|
||||
export default ipc;
|
||||
|
|
|
|||
|
|
@ -142,6 +142,16 @@ interface WebServiceJsApi {
|
|||
* Used by SplatNet 3.
|
||||
*/
|
||||
reloadExtension(): void;
|
||||
|
||||
/**
|
||||
* Clears the unread notifications flag.
|
||||
*/
|
||||
clearUnreadFlag(): void;
|
||||
|
||||
/**
|
||||
* Opens a URL in the default browser.
|
||||
*/
|
||||
openExternalBrowser(url: string): void;
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -339,6 +349,16 @@ function reloadExtension() {
|
|||
debug('reloadExtension called');
|
||||
}
|
||||
|
||||
function clearUnreadFlag() {
|
||||
debug('clearUnreadFlag called');
|
||||
ipc.clearUnreadFlag();
|
||||
}
|
||||
|
||||
function openExternalBrowser(url: string) {
|
||||
debug('openExternalBrowser called', url);
|
||||
window.open(url);
|
||||
}
|
||||
|
||||
const api: WebServiceJsApi = {
|
||||
invokeNativeShare,
|
||||
invokeNativeShareUrl,
|
||||
|
|
@ -356,6 +376,8 @@ const api: WebServiceJsApi = {
|
|||
completeLoading,
|
||||
closeWebView,
|
||||
reloadExtension,
|
||||
clearUnreadFlag,
|
||||
openExternalBrowser,
|
||||
};
|
||||
|
||||
window.jsBridge = api;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user