Skip to content

Commit

Permalink
feat(electron): deprecate injectCapacitor method (#1671)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Jun 17, 2019
1 parent 5252f8f commit e3cf60e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions electron/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function getURLFileContents(path) {
}

const injectCapacitor = async function(url) {
console.warn('\nWARNING: injectCapacitor method is deprecated and will be removed in next major release. Check release notes for migration instructions\n')
try {
let urlFileContents = await getURLFileContents(url.substr(url.indexOf('://') + 3));
let pathing = path.join(url.substr(url.indexOf('://') + 3), '../../node_modules/@capacitor/electron/dist/electron-bridge.js');
Expand Down Expand Up @@ -89,7 +90,7 @@ class CapacitorSplashScreen {
});
}

init() {
init(inject = true) {
let rootPath = app.getAppPath();


Expand Down Expand Up @@ -120,7 +121,11 @@ class CapacitorSplashScreen {
this.splashWindow.webContents.on('dom-ready', async () => {
this.splashWindow.show();
setTimeout(async () => {
this.mainWindowRef.loadURL(await injectCapacitor(`file://${rootPath}/app/index.html`), {baseURLForDataURL: `file://${rootPath}/app/`});
if (inject) {
this.mainWindowRef.loadURL(await injectCapacitor(`file://${rootPath}/app/index.html`), {baseURLForDataURL: `file://${rootPath}/app/`});
} else {
this.mainWindowRef.loadURL(`file://${rootPath}/app/index.html`);
}
}, 4500);
});

Expand Down

0 comments on commit e3cf60e

Please sign in to comment.