mirror of
https://github.com/overte-org/overte.git
synced 2025-06-19 07:00:00 +02:00
Modify --url hifiapp: behavior to trigger through appUI when first
starting interface. Also, menu names and order follow UX documentation.
This commit is contained in:
parent
61cbee72af
commit
d5baadbefa
5 changed files with 76 additions and 31 deletions
|
@ -3429,8 +3429,7 @@ void Application::handleSandboxStatus(QNetworkReply* reply) {
|
||||||
if (urlIndex != -1) {
|
if (urlIndex != -1) {
|
||||||
QUrl url(arguments().value(urlIndex + 1));
|
QUrl url(arguments().value(urlIndex + 1));
|
||||||
if (url.scheme() == URL_SCHEME_HIFIAPP) {
|
if (url.scheme() == URL_SCHEME_HIFIAPP) {
|
||||||
QmlCommerce commerce;
|
Setting::Handle<QVariant>("startUpApp").set(url.path());
|
||||||
commerce.openSystemApp(url.path());
|
|
||||||
} else {
|
} else {
|
||||||
addressLookupString = arguments().value(urlIndex + 1);
|
addressLookupString = arguments().value(urlIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,11 +47,49 @@ QmlCommerce::QmlCommerce() {
|
||||||
_appsPath = PathUtils::getAppDataPath() + "Apps/";
|
_appsPath = PathUtils::getAppDataPath() + "Apps/";
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlCommerce::openSystemApp(const QString& appPath) {
|
|
||||||
|
|
||||||
|
|
||||||
|
void QmlCommerce::openSystemApp(const QString& appName) {
|
||||||
|
static QMap<QString, QString> systemApps {
|
||||||
|
{"GOTO", "hifi/tablet/TabletAddressDialog.qml"},
|
||||||
|
{"PEOPLE", "hifi/Pal.qml"},
|
||||||
|
{"WALLET", "hifi/commerce/wallet/Wallet.qml"},
|
||||||
|
{"MARKET", "/marketplace.html"}
|
||||||
|
};
|
||||||
|
|
||||||
|
static QMap<QString, QString> systemInject{
|
||||||
|
{"MARKET", "/scripts/system/html/js/marketplacesInject.js"}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
auto tablet = dynamic_cast<TabletProxy*>(
|
auto tablet = dynamic_cast<TabletProxy*>(
|
||||||
DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
DependencyManager::get<TabletScriptingInterface>()->getTablet("com.highfidelity.interface.tablet.system"));
|
||||||
tablet->loadQMLSource(appPath);
|
|
||||||
|
QMap<QString, QString>::const_iterator appPathIter = systemApps.find(appName);
|
||||||
|
if (appPathIter != systemApps.end()) {
|
||||||
|
if (appPathIter->contains(".qml", Qt::CaseInsensitive)) {
|
||||||
|
tablet->loadQMLSource(*appPathIter);
|
||||||
|
}
|
||||||
|
else if (appPathIter->contains(".html", Qt::CaseInsensitive)) {
|
||||||
|
QMap<QString, QString>::const_iterator injectIter = systemInject.find(appName);
|
||||||
|
if (appPathIter == systemInject.end()) {
|
||||||
|
tablet->gotoWebScreen(NetworkingConstants::METAVERSE_SERVER_URL().toString() + *appPathIter);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
QString inject = "file:///" + qApp->applicationDirPath() + *injectIter;
|
||||||
|
tablet->gotoWebScreen(NetworkingConstants::METAVERSE_SERVER_URL().toString() + *appPathIter, inject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qCDebug(commerce) << "Attempted to open unknown type of URL!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qCDebug(commerce) << "Attempted to open unknown APP!";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
DependencyManager::get<HMDScriptingInterface>()->openTablet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,5 +324,11 @@ function AppUi(properties) {
|
||||||
that.button.clicked.connect(that.onClicked);
|
that.button.clicked.connect(that.onClicked);
|
||||||
Script.scriptEnding.connect(that.onScriptEnding);
|
Script.scriptEnding.connect(that.onScriptEnding);
|
||||||
GlobalServices.findableByChanged.connect(availabilityChanged);
|
GlobalServices.findableByChanged.connect(availabilityChanged);
|
||||||
|
if (that.buttonName == Settings.getValue("startUpApp")) {
|
||||||
|
Settings.setValue("startUpApp", "");
|
||||||
|
Script.setTimeout(function () {
|
||||||
|
that.open();
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
module.exports = AppUi;
|
module.exports = AppUi;
|
||||||
|
|
|
@ -392,8 +392,8 @@ var labels = {
|
||||||
label: 'Version - ' + buildInfo.buildIdentifier,
|
label: 'Version - ' + buildInfo.buildIdentifier,
|
||||||
enabled: false
|
enabled: false
|
||||||
},
|
},
|
||||||
enableNotifications: {
|
showNotifications: {
|
||||||
label: 'Enable Notifications',
|
label: 'Show Notifications',
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
checked: true,
|
checked: true,
|
||||||
click: function() {
|
click: function() {
|
||||||
|
@ -402,9 +402,9 @@ var labels = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
goto: {
|
goto: {
|
||||||
label: 'Goto',
|
label: 'GoTo',
|
||||||
click: function() {
|
click: function() {
|
||||||
StartInterface("hifiapp:hifi/tablet/TabletAddressDialog.qml");
|
StartInterface("hifiapp:GOTO");
|
||||||
pendingNotifications[HifiNotificationType.GOTO] = false;
|
pendingNotifications[HifiNotificationType.GOTO] = false;
|
||||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||||
}
|
}
|
||||||
|
@ -412,7 +412,7 @@ var labels = {
|
||||||
people: {
|
people: {
|
||||||
label: 'People',
|
label: 'People',
|
||||||
click: function() {
|
click: function() {
|
||||||
StartInterface("hifiapp:hifi/Pal.qml");
|
StartInterface("hifiapp:PEOPLE");
|
||||||
pendingNotifications[HifiNotificationType.PEOPLE] = false;
|
pendingNotifications[HifiNotificationType.PEOPLE] = false;
|
||||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||||
}
|
}
|
||||||
|
@ -420,7 +420,7 @@ var labels = {
|
||||||
wallet: {
|
wallet: {
|
||||||
label: 'Wallet',
|
label: 'Wallet',
|
||||||
click: function() {
|
click: function() {
|
||||||
StartInterface("hifiapp:hifi/commerce/wallet/Wallet.qml");
|
StartInterface("hifiapp:WALLET");
|
||||||
pendingNotifications[HifiNotificationType.WALLET] = false;
|
pendingNotifications[HifiNotificationType.WALLET] = false;
|
||||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@ var labels = {
|
||||||
marketplace: {
|
marketplace: {
|
||||||
label: 'Market',
|
label: 'Market',
|
||||||
click: function() {
|
click: function() {
|
||||||
StartInterface("hifiapp:hifi/commerce/purchases/Purchases.qml");
|
StartInterface("hifiapp:MARKET");
|
||||||
pendingNotifications[HifiNotificationType.MARKETPLACE] = false;
|
pendingNotifications[HifiNotificationType.MARKETPLACE] = false;
|
||||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||||
}
|
}
|
||||||
|
@ -502,14 +502,6 @@ function buildMenuArray(serverState) {
|
||||||
menuArray.push(labels.version);
|
menuArray.push(labels.version);
|
||||||
menuArray.push(separator);
|
menuArray.push(separator);
|
||||||
}
|
}
|
||||||
if(isInterfaceInstalled()) {
|
|
||||||
menuArray.push(labels.enableNotifications);
|
|
||||||
menuArray.push(labels.goto);
|
|
||||||
menuArray.push(labels.people);
|
|
||||||
menuArray.push(labels.wallet);
|
|
||||||
menuArray.push(labels.marketplace);
|
|
||||||
menuArray.push(separator);
|
|
||||||
}
|
|
||||||
if(isServerInstalled() && isInterfaceInstalled()) {
|
if(isServerInstalled() && isInterfaceInstalled()) {
|
||||||
menuArray.push(labels.goHome);
|
menuArray.push(labels.goHome);
|
||||||
menuArray.push(separator);
|
menuArray.push(separator);
|
||||||
|
@ -523,10 +515,18 @@ function buildMenuArray(serverState) {
|
||||||
}
|
}
|
||||||
menuArray.push(labels.share);
|
menuArray.push(labels.share);
|
||||||
menuArray.push(separator);
|
menuArray.push(separator);
|
||||||
|
if(isInterfaceInstalled()) {
|
||||||
|
menuArray.push(labels.goto);
|
||||||
|
menuArray.push(labels.people);
|
||||||
|
menuArray.push(labels.wallet);
|
||||||
|
menuArray.push(labels.marketplace);
|
||||||
|
menuArray.push(separator);
|
||||||
|
menuArray.push(labels.showNotifications);
|
||||||
|
menuArray.push(separator);
|
||||||
|
}
|
||||||
menuArray.push(labels.quit);
|
menuArray.push(labels.quit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return menuArray;
|
return menuArray;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -551,7 +551,7 @@ function updateLabels(serverState) {
|
||||||
labels.restart.enabled = false;
|
labels.restart.enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
labels.enableNotifications.checked = trayNotifications.enabled();
|
labels.showNotifications.checked = trayNotifications.enabled();
|
||||||
labels.people.visible = trayNotifications.enabled();
|
labels.people.visible = trayNotifications.enabled();
|
||||||
labels.goto.visible = trayNotifications.enabled();
|
labels.goto.visible = trayNotifications.enabled();
|
||||||
labels.wallet.visible = trayNotifications.enabled();
|
labels.wallet.visible = trayNotifications.enabled();
|
||||||
|
|
|
@ -33,7 +33,7 @@ const NotificationType = {
|
||||||
MARKETPLACE: 'marketplace'
|
MARKETPLACE: 'marketplace'
|
||||||
};
|
};
|
||||||
|
|
||||||
function HifiNotification(notificationType, notificationData) {
|
function HifiNotification(notificationType, notificationData, menuNotificationCallback) {
|
||||||
this.type = notificationType;
|
this.type = notificationType;
|
||||||
this.data = notificationData;
|
this.data = notificationData;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ HifiNotification.prototype = {
|
||||||
text = "You have " + this.data + " event invitations pending."
|
text = "You have " + this.data + " event invitations pending."
|
||||||
}
|
}
|
||||||
message = "Click to open GOTO.";
|
message = "Click to open GOTO.";
|
||||||
url="hifiapp:hifi/tablet/TabletAddressDialog.qml"
|
url="hifiapp:GOTO"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
text = this.data.username + " " + this.data.action_string + " in " + this.data.place_name + ".";
|
text = this.data.username + " " + this.data.action_string + " in " + this.data.place_name + ".";
|
||||||
|
@ -72,7 +72,7 @@ HifiNotification.prototype = {
|
||||||
text = this.data + " of your connections are online."
|
text = this.data + " of your connections are online."
|
||||||
}
|
}
|
||||||
message = "Click to open PEOPLE.";
|
message = "Click to open PEOPLE.";
|
||||||
url="hifiapp:hifi/Pal.qml"
|
url="hifiapp:PEOPLE"
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
text = this.data.username + " is available in " + this.data.location.root.name + ".";
|
text = this.data.username + " is available in " + this.data.location.root.name + ".";
|
||||||
|
@ -95,7 +95,7 @@ HifiNotification.prototype = {
|
||||||
}
|
}
|
||||||
text = this.data.message.replace(/<\/?[^>]+(>|$)/g, "");
|
text = this.data.message.replace(/<\/?[^>]+(>|$)/g, "");
|
||||||
message = "Click to open WALLET.";
|
message = "Click to open WALLET.";
|
||||||
url = "hifiapp:hifi/commerce/wallet/Wallet.qml";
|
url = "hifiapp:WALLET";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NotificationType.MARKETPLACE:
|
case NotificationType.MARKETPLACE:
|
||||||
|
@ -111,7 +111,7 @@ HifiNotification.prototype = {
|
||||||
text = "Update available for " + this.data.base_item_title + ".";
|
text = "Update available for " + this.data.base_item_title + ".";
|
||||||
}
|
}
|
||||||
message = "Click to open MARKET.";
|
message = "Click to open MARKET.";
|
||||||
url = "hifiapp:hifi/commerce/purchases/Purchases.qml";
|
url = "hifiapp:MARKET";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
notifier.notify({
|
notifier.notify({
|
||||||
|
@ -136,8 +136,11 @@ function HifiNotifications(config, menuNotificationCallback) {
|
||||||
this.marketplaceSince = new Date(this.config.get("marketplaceNotifySince", "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.enable(this.enabled());
|
||||||
|
|
||||||
|
var _menuNotificationCallback = menuNotificationCallback;
|
||||||
notifier.on('click', function(notifierObject, options) {
|
notifier.on('click', function(notifierObject, options) {
|
||||||
StartInterface(options.url);
|
StartInterface(options.url);
|
||||||
|
_menuNotificationCallback(options.notificationType, false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,8 +178,8 @@ HifiNotifications.prototype = {
|
||||||
MARKETPLACE_NOTIFICATION_POLL_TIME_MS);
|
MARKETPLACE_NOTIFICATION_POLL_TIME_MS);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(this.storiesTimer) {
|
if(this.storiesPollTimer) {
|
||||||
clearInterval(this.storiesTimer);
|
clearInterval(this.storiesPollTimer);
|
||||||
}
|
}
|
||||||
if(this.peoplePollTimer) {
|
if(this.peoplePollTimer) {
|
||||||
clearInterval(this.peoplePollTimer);
|
clearInterval(this.peoplePollTimer);
|
||||||
|
@ -205,13 +208,11 @@ HifiNotifications.prototype = {
|
||||||
console.log("Error: unable to get " + url);
|
console.log("Error: unable to get " + url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(data.body);
|
|
||||||
var content = JSON.parse(data.body);
|
var content = JSON.parse(data.body);
|
||||||
if(!content || content.status != 'success') {
|
if(!content || content.status != 'success') {
|
||||||
console.log("Error: unable to get " + url);
|
console.log("Error: unable to get " + url);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console.log(content);
|
|
||||||
if(!content.total_entries) {
|
if(!content.total_entries) {
|
||||||
this.menuNotificationCallback(notifyType, false);
|
this.menuNotificationCallback(notifyType, false);
|
||||||
}
|
}
|
||||||
|
@ -298,7 +299,7 @@ HifiNotifications.prototype = {
|
||||||
var url = METAVERSE_SERVER_URL + STORIES_URL + '?' + options.join('&');
|
var url = METAVERSE_SERVER_URL + STORIES_URL + '?' + options.join('&');
|
||||||
console.log(url);
|
console.log(url);
|
||||||
|
|
||||||
_this._pollCommon(NotificationType.STORIES,
|
_this._pollCommon(NotificationType.GOTO,
|
||||||
url,
|
url,
|
||||||
since,
|
since,
|
||||||
function (success, token) {
|
function (success, token) {
|
||||||
|
@ -425,6 +426,7 @@ HifiNotifications.prototype = {
|
||||||
'page=1',
|
'page=1',
|
||||||
'per_page=1'
|
'per_page=1'
|
||||||
];
|
];
|
||||||
|
var url = METAVERSE_SERVER_URL + UPDATES_URL + '?' + options.join('&');
|
||||||
request.get({
|
request.get({
|
||||||
uri: url,
|
uri: url,
|
||||||
'auth': {
|
'auth': {
|
||||||
|
|
Loading…
Reference in a new issue