1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

deeplinking

This commit is contained in:
Andrew Simachev 2021-09-17 10:30:52 +03:00
parent d77413b628
commit fd6b87dcf2
2 changed files with 11 additions and 0 deletions

View file

@ -19,6 +19,7 @@ const keytar = require('keytar');
const bindings = require('bindings');
const envPath = path.join(__dirname, 'electron', 'env.json');
const systemVersion = process.getSystemVersion();
const protocol = 'anytype';
const TIMEOUT_UPDATE = 600 * 1000;
const MIN_WIDTH = 752;
@ -29,6 +30,8 @@ const CONFIG_NAME = 'devconfig';
let env = {};
try { env = JSON.parse(fs.readFileSync(envPath)); } catch (e) {};
app.setAsDefaultProtocolClient(protocol);
let isUpdating = false;
let userPath = app.getPath('userData');
let tmpPath = path.join(userPath, 'tmp');
@ -734,6 +737,13 @@ app.on('activate', () => {
win ? win.show() : createWindow();
});
app.on('open-url', (e, url) => {
if (process.platform == 'win32') {
url = process.argv.slice(1);
};
send('route', url.replace(`${protocol}://`, ''));
});
function send () {
if (win) {
win.webContents.send.apply(win.webContents, arguments);

View file

@ -380,6 +380,7 @@ class App extends React.Component<Props, State> {
});
ipcRenderer.on('route', (e: any, route: string) => {
console.log('ROUTE', route);
history.push(route);
});