-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fb-view-wallet-ui-186336176' into ui
- Loading branch information
Showing
83 changed files
with
15,145 additions
and
6,439 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['@typescript-eslint'], | ||
plugins: [ | ||
'@typescript-eslint', | ||
'only-warn' | ||
], | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
], | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"declaration": true, | ||
"declarationMap": true, | ||
"sourceMap": true, | ||
"composite": true, | ||
"module": "NodeNext", | ||
"moduleResolution": "NodeNext", | ||
"paths": { | ||
"@xai-vanguard-node/core": ["../../packages/core"] | ||
} | ||
}, | ||
"include": [ | ||
"src/" | ||
], | ||
"exclude": ["node_modules"], | ||
"references": [ | ||
{ | ||
"path": "../../packages/core" | ||
} | ||
] | ||
} | ||
"extends": "../../packages/tsconfig/tsconfig.base.json", | ||
"compilerOptions": { | ||
"experimentalDecorators": true, | ||
"emitDecoratorMetadata": true, | ||
"strictPropertyInitialization": false, | ||
"rootDir": "src", | ||
"outDir": "dist", | ||
"baseUrl": ".", | ||
"paths": { | ||
"@/*": ["./src/*"], | ||
"@vanguard-node/*": ["../../packages/*/src"] | ||
} | ||
}, | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
import { app, BrowserWindow, ipcMain, shell, safeStorage } from 'electron' | ||
import os from 'os'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import express from 'express'; | ||
|
||
const isWindows = os.platform() === "win32"; | ||
|
||
// The built directory structure | ||
// | ||
// ├─┬─┬ dist | ||
|
@@ -19,6 +22,15 @@ let win: BrowserWindow | null | |
// 🚧 Use ['ENV_NAME'] avoid vite:define plugin - [email protected] | ||
const VITE_DEV_SERVER_URL = process.env['VITE_DEV_SERVER_URL'] | ||
|
||
const protocolUrl = 'xai-sentry'; | ||
if (process.defaultApp) { | ||
if (process.argv.length >= 2) { | ||
app.setAsDefaultProtocolClient(protocolUrl, process.execPath, [path.resolve(process.argv[1])]); | ||
} | ||
} else { | ||
app.setAsDefaultProtocolClient(protocolUrl); | ||
} | ||
|
||
ipcMain.on('open-external', (_, url) => { | ||
void shell.openExternal(url); | ||
}); | ||
|
@@ -63,7 +75,6 @@ ipcMain.handle('buffer-from', (_, str, encoding) => { | |
return Buffer.from(str, encoding); | ||
}); | ||
|
||
|
||
function createWindow() { | ||
win = new BrowserWindow({ | ||
width: 1920, | ||
|
@@ -119,4 +130,43 @@ app.on('ready', () => { | |
server.listen(7555); | ||
}) | ||
|
||
app.whenReady().then(createWindow) | ||
// Windows deep-link | ||
if (isWindows) { | ||
const gotTheLock = app.requestSingleInstanceLock(); | ||
if (!gotTheLock) { | ||
app.quit(); | ||
} else { | ||
app.on('second-instance', (event, commandLine) => { | ||
console.log("event:", event); | ||
|
||
// Someone tried to run a second instance, we should focus our window. | ||
if (win) { | ||
if (win.isMinimized()) win.restore(); | ||
win.focus(); | ||
} | ||
// the commandLine is array of strings in which last element is deep link url | ||
// dialog.showErrorBox('Welcome Back', `You arrived from: ${commandLine.pop()}`); | ||
win?.webContents.send("assigned-wallet", commandLine.pop()); | ||
}) | ||
|
||
// Create mainWindow, load the rest of the app, etc... | ||
app.whenReady().then(createWindow); | ||
} | ||
} else { | ||
// Mac deep-link | ||
app.whenReady().then(createWindow); | ||
app.on('open-url', (event, url) => { | ||
console.log("event:", event); | ||
|
||
const fullProtocol = "xai-sentry://"; | ||
const instruction = url.slice(fullProtocol.length, url.indexOf("?")); | ||
|
||
switch(instruction) { | ||
case "assigned-wallet": | ||
const txHash = url.slice(url.indexOf("=") + 1); | ||
win?.webContents.send("assigned-wallet", txHash); | ||
break; | ||
} | ||
}); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.