mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 14:54:12 +00:00
Merge pull request #114 from manojVivek/browser-extension
Browser extension, app support #78
This commit is contained in:
commit
d464c1780d
3 changed files with 50 additions and 0 deletions
1
desktop-app/.prettierignore
Normal file
1
desktop-app/.prettierignore
Normal file
|
@ -0,0 +1 @@
|
|||
build/entitlements.mac.plist
|
|
@ -23,6 +23,7 @@ import installExtension, {
|
|||
REDUX_DEVTOOLS,
|
||||
} from 'electron-devtools-installer';
|
||||
import devtron from 'devtron';
|
||||
import fs from 'fs';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
|
@ -41,6 +42,7 @@ export default class AppUpdater {
|
|||
}
|
||||
|
||||
let mainWindow = null;
|
||||
let urlToOpen = null;
|
||||
|
||||
let httpAuthCallbacks = {};
|
||||
|
||||
|
@ -67,11 +69,44 @@ const installExtensions = async () => {
|
|||
}
|
||||
};
|
||||
|
||||
const openUrl = url => {
|
||||
mainWindow.webContents.send(
|
||||
'address-change',
|
||||
url.replace('responsively://', '')
|
||||
);
|
||||
mainWindow.show();
|
||||
};
|
||||
|
||||
/**
|
||||
* Add event listeners...
|
||||
*/
|
||||
|
||||
app.on('will-finish-launching', () => {
|
||||
if (['win32', 'darwin'].includes(process.platform)) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient('responsively', process.execPath, [
|
||||
path.resolve(process.argv[1]),
|
||||
]);
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient('responsively');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.on('open-url', async (event, url) => {
|
||||
log.info('Open-url', url);
|
||||
if (mainWindow) {
|
||||
openUrl(url);
|
||||
} else {
|
||||
urlToOpen = url;
|
||||
}
|
||||
});
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
['win32', 'darwin'].includes(process.platform) &&
|
||||
app.removeAsDefaultProtocolClient('responsively');
|
||||
}
|
||||
// Respect the OSX convention of having the application in memory even
|
||||
// after all windows have been closed
|
||||
if (process.platform !== 'darwin') {
|
||||
|
@ -144,6 +179,10 @@ const createWindow = async () => {
|
|||
});
|
||||
|
||||
mainWindow.once('ready-to-show', () => {
|
||||
if (urlToOpen) {
|
||||
openUrl(urlToOpen);
|
||||
urlToOpen = null;
|
||||
}
|
||||
mainWindow.show();
|
||||
});
|
||||
|
||||
|
|
|
@ -97,6 +97,16 @@
|
|||
"category": "public.app-category.developer-tools",
|
||||
"entitlements": "build/entitlements.mac.plist",
|
||||
"entitlementsInherit": "build/entitlements.mac.plist",
|
||||
"extendInfo": {
|
||||
"CFBundleURLTypes": [
|
||||
{
|
||||
"CFBundleURLSchemes": [
|
||||
"responsively"
|
||||
],
|
||||
"CFBundleURLName": "app.responsively"
|
||||
}
|
||||
]
|
||||
},
|
||||
"icon": "resources/icon.icns",
|
||||
"target": [
|
||||
"dmg"
|
||||
|
|
Loading…
Reference in a new issue