diff --git a/cmake/macros/SetPackagingParameters.cmake b/cmake/macros/SetPackagingParameters.cmake index dce419a0e4..297382b4e5 100644 --- a/cmake/macros/SetPackagingParameters.cmake +++ b/cmake/macros/SetPackagingParameters.cmake @@ -37,6 +37,7 @@ macro(SET_PACKAGING_PARAMETERS) set(BUILD_VERSION ${RELEASE_NUMBER}) set(BUILD_ORGANIZATION "High Fidelity") set(HIGH_FIDELITY_PROTOCOL "hifi") + set(HIGH_FIDELITY_APP_PROTOCOL "hifiapp") set(INTERFACE_BUNDLE_NAME "Interface") set(INTERFACE_ICON_PREFIX "interface") diff --git a/cmake/modules/MacOSXBundleInfo.plist.in b/cmake/modules/MacOSXBundleInfo.plist.in index a06fac092f..b9558cf361 100644 --- a/cmake/modules/MacOSXBundleInfo.plist.in +++ b/cmake/modules/MacOSXBundleInfo.plist.in @@ -42,6 +42,14 @@ hifi + + CFBundleURLName + ${MACOSX_BUNDLE_BUNDLE_NAME} APP URL + CFBundleURLSchemes + + hifiapp + + NSHighResolutionCapable diff --git a/cmake/templates/CPackProperties.cmake.in b/cmake/templates/CPackProperties.cmake.in index a38c3d5361..cb6474b010 100644 --- a/cmake/templates/CPackProperties.cmake.in +++ b/cmake/templates/CPackProperties.cmake.in @@ -27,6 +27,7 @@ set(DS_EXEC_NAME "@DS_EXEC_NAME@") set(AC_DISPLAY_NAME "Assignment Client") set(AC_EXEC_NAME "@AC_EXEC_NAME@") set(HIGH_FIDELITY_PROTOCOL "@HIGH_FIDELITY_PROTOCOL@") +set(HIGH_FIDELITY_APP_PROTOCOL "@HIGH_FIDELITY_APP_PROTOCOL@") set(PRODUCTION_BUILD "@PRODUCTION_BUILD@") set(PR_BUILD "@PR_BUILD@") set(BUILD_ORGANIZATION "@BUILD_ORGANIZATION@") diff --git a/server-console/src/main.js b/server-console/src/main.js index d1b3dd2dd3..04e77315bc 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -108,7 +108,16 @@ const ipcMain = electron.ipcMain; function isInterfaceInstalled() { - return interfacePath; + if (osType == "Darwin") { + // In OSX Sierra, the app translocation process moves + // the executable to a random location before starting it + // which makes finding the interface near impossible using + // relative paths. For now, as there are no server-only + // installs, we just assume the interface is installed here + return true; + } else { + return interfacePath; + } } function isServerInstalled() { @@ -377,7 +386,7 @@ LogWindow.prototype = { }; function visitSandboxClicked() { - if (interfacePath) { + if (isInterfaceInstalled()) { StartInterface('hifi://localhost'); } else { // show an error to say that we can't go home without an interface instance @@ -906,6 +915,9 @@ app.on('ready', function() { tray.popUpContextMenu(tray.menu); }); + if (isInterfaceInstalled()) { + trayNotifications.startPolling(); + } updateTrayMenu(ProcessGroupStates.STOPPED); maybeInstallDefaultContentSet(onContentLoaded); diff --git a/server-console/src/modules/hf-app.js b/server-console/src/modules/hf-app.js index 3db48bd9c4..af6c38cdb3 100644 --- a/server-console/src/modules/hf-app.js +++ b/server-console/src/modules/hf-app.js @@ -7,6 +7,7 @@ const path = require('path'); const argv = require('yargs').argv; const hfprocess = require('./hf-process'); const osHomeDir = require('os-homedir'); +const childProcess = require('child_process'); const Process = hfprocess.Process; const binaryType = argv.binaryType; @@ -53,17 +54,35 @@ const buildInfo = exports.getBuildInfo(); const interfacePath = pathFinder.discoveredPath("interface", binaryType, buildInfo.releaseType); exports.startInterface = function(url) { - var argArray = []; - // check if we have a url parameter to include - if (url) { - argArray = ["--url", url]; + if (osType === 'Darwin') { + if (!url) { + log.debug("No URL given for startInterface"); + return; + } + + // do this as a workaround for app translocation on osx, which makes + // it nearly impossible to find the interface executable + var bundle_id = 'com.highfidelity.interface-dev'; + if (buildInfo.releaseType == 'PR') { + bundle_id = 'com.highfidelity.interface-pr'; + } else if (buildInfo.releaseType == 'PRODUCTION') { + bundle_id = 'com.highfidelity.interface'; + } + childProcess.exec('open -b ' + bundle_id + ' --args --url ' + url); + } else { + var argArray = []; + + // check if we have a url parameter to include + if (url) { + argArray = ["--url", url]; + } + console.log("Starting with " + url); + // create a new Interface instance - Interface makes sure only one is running at a time + var pInterface = new Process('Interface', interfacePath, argArray); + pInterface.detached = true; + pInterface.start(); } - console.log("Starting with " + url); - // create a new Interface instance - Interface makes sure only one is running at a time - var pInterface = new Process('Interface', interfacePath, argArray); - pInterface.detached = true; - pInterface.start(); } exports.isInterfaceRunning = function(done) { diff --git a/server-console/src/modules/hf-notifications.js b/server-console/src/modules/hf-notifications.js index c69c81aff2..13c5a6d8fa 100644 --- a/server-console/src/modules/hf-notifications.js +++ b/server-console/src/modules/hf-notifications.js @@ -143,7 +143,6 @@ function HifiNotifications(config, menuNotificationCallback) { this.walletSince = new Date(this.config.get("walletNotifySince", "1970-01-01T00:00:00.000Z")); this.marketplaceSince = new Date(this.config.get("marketplaceNotifySince", "1970-01-01T00:00:00.000Z")); - this.enable(this.enabled()); this.pendingNotifications = []; @@ -193,6 +192,9 @@ HifiNotifications.prototype = { enabled: function () { return !this.config.get("disableTrayNotifications", false); }, + startPolling: function () { + this.enable(this.enabled()); + }, stopPolling: function () { this.config.set("storiesNotifySince", this.storiesSince.toISOString()); this.config.set("peopleNotifySince", this.peopleSince.toISOString());