mirror of
https://github.com/anyproto/anytype-ts.git
synced 2025-06-08 05:57:02 +09:00
deeplinking
This commit is contained in:
parent
d77413b628
commit
fd6b87dcf2
2 changed files with 11 additions and 0 deletions
10
electron.js
10
electron.js
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue