mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 14:22:23 +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) {
|
||||
QUrl url(arguments().value(urlIndex + 1));
|
||||
if (url.scheme() == URL_SCHEME_HIFIAPP) {
|
||||
QmlCommerce commerce;
|
||||
commerce.openSystemApp(url.path());
|
||||
Setting::Handle<QVariant>("startUpApp").set(url.path());
|
||||
} else {
|
||||
addressLookupString = arguments().value(urlIndex + 1);
|
||||
}
|
||||
|
|
|
@ -47,11 +47,49 @@ QmlCommerce::QmlCommerce() {
|
|||
_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*>(
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -324,5 +324,11 @@ function AppUi(properties) {
|
|||
that.button.clicked.connect(that.onClicked);
|
||||
Script.scriptEnding.connect(that.onScriptEnding);
|
||||
GlobalServices.findableByChanged.connect(availabilityChanged);
|
||||
if (that.buttonName == Settings.getValue("startUpApp")) {
|
||||
Settings.setValue("startUpApp", "");
|
||||
Script.setTimeout(function () {
|
||||
that.open();
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
module.exports = AppUi;
|
||||
|
|
|
@ -392,8 +392,8 @@ var labels = {
|
|||
label: 'Version - ' + buildInfo.buildIdentifier,
|
||||
enabled: false
|
||||
},
|
||||
enableNotifications: {
|
||||
label: 'Enable Notifications',
|
||||
showNotifications: {
|
||||
label: 'Show Notifications',
|
||||
type: 'checkbox',
|
||||
checked: true,
|
||||
click: function() {
|
||||
|
@ -402,9 +402,9 @@ var labels = {
|
|||
}
|
||||
},
|
||||
goto: {
|
||||
label: 'Goto',
|
||||
label: 'GoTo',
|
||||
click: function() {
|
||||
StartInterface("hifiapp:hifi/tablet/TabletAddressDialog.qml");
|
||||
StartInterface("hifiapp:GOTO");
|
||||
pendingNotifications[HifiNotificationType.GOTO] = false;
|
||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||
}
|
||||
|
@ -412,7 +412,7 @@ var labels = {
|
|||
people: {
|
||||
label: 'People',
|
||||
click: function() {
|
||||
StartInterface("hifiapp:hifi/Pal.qml");
|
||||
StartInterface("hifiapp:PEOPLE");
|
||||
pendingNotifications[HifiNotificationType.PEOPLE] = false;
|
||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ var labels = {
|
|||
wallet: {
|
||||
label: 'Wallet',
|
||||
click: function() {
|
||||
StartInterface("hifiapp:hifi/commerce/wallet/Wallet.qml");
|
||||
StartInterface("hifiapp:WALLET");
|
||||
pendingNotifications[HifiNotificationType.WALLET] = false;
|
||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||
}
|
||||
|
@ -428,7 +428,7 @@ var labels = {
|
|||
marketplace: {
|
||||
label: 'Market',
|
||||
click: function() {
|
||||
StartInterface("hifiapp:hifi/commerce/purchases/Purchases.qml");
|
||||
StartInterface("hifiapp:MARKET");
|
||||
pendingNotifications[HifiNotificationType.MARKETPLACE] = false;
|
||||
updateTrayMenu(homeServer ? homeServer.state : ProcessGroupStates.STOPPED);
|
||||
}
|
||||
|
@ -502,14 +502,6 @@ function buildMenuArray(serverState) {
|
|||
menuArray.push(labels.version);
|
||||
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()) {
|
||||
menuArray.push(labels.goHome);
|
||||
menuArray.push(separator);
|
||||
|
@ -523,10 +515,18 @@ function buildMenuArray(serverState) {
|
|||
}
|
||||
menuArray.push(labels.share);
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
return menuArray;
|
||||
|
||||
}
|
||||
|
@ -551,7 +551,7 @@ function updateLabels(serverState) {
|
|||
labels.restart.enabled = false;
|
||||
}
|
||||
|
||||
labels.enableNotifications.checked = trayNotifications.enabled();
|
||||
labels.showNotifications.checked = trayNotifications.enabled();
|
||||
labels.people.visible = trayNotifications.enabled();
|
||||
labels.goto.visible = trayNotifications.enabled();
|
||||
labels.wallet.visible = trayNotifications.enabled();
|
||||
|
|
|
@ -33,7 +33,7 @@ const NotificationType = {
|
|||
MARKETPLACE: 'marketplace'
|
||||
};
|
||||
|
||||
function HifiNotification(notificationType, notificationData) {
|
||||
function HifiNotification(notificationType, notificationData, menuNotificationCallback) {
|
||||
this.type = notificationType;
|
||||
this.data = notificationData;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ HifiNotification.prototype = {
|
|||
text = "You have " + this.data + " event invitations pending."
|
||||
}
|
||||
message = "Click to open GOTO.";
|
||||
url="hifiapp:hifi/tablet/TabletAddressDialog.qml"
|
||||
url="hifiapp:GOTO"
|
||||
}
|
||||
else {
|
||||
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."
|
||||
}
|
||||
message = "Click to open PEOPLE.";
|
||||
url="hifiapp:hifi/Pal.qml"
|
||||
url="hifiapp:PEOPLE"
|
||||
}
|
||||
else {
|
||||
text = this.data.username + " is available in " + this.data.location.root.name + ".";
|
||||
|
@ -95,7 +95,7 @@ HifiNotification.prototype = {
|
|||
}
|
||||
text = this.data.message.replace(/<\/?[^>]+(>|$)/g, "");
|
||||
message = "Click to open WALLET.";
|
||||
url = "hifiapp:hifi/commerce/wallet/Wallet.qml";
|
||||
url = "hifiapp:WALLET";
|
||||
break;
|
||||
|
||||
case NotificationType.MARKETPLACE:
|
||||
|
@ -111,7 +111,7 @@ HifiNotification.prototype = {
|
|||
text = "Update available for " + this.data.base_item_title + ".";
|
||||
}
|
||||
message = "Click to open MARKET.";
|
||||
url = "hifiapp:hifi/commerce/purchases/Purchases.qml";
|
||||
url = "hifiapp:MARKET";
|
||||
break;
|
||||
}
|
||||
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.enable(this.enabled());
|
||||
|
||||
var _menuNotificationCallback = menuNotificationCallback;
|
||||
notifier.on('click', function(notifierObject, options) {
|
||||
StartInterface(options.url);
|
||||
_menuNotificationCallback(options.notificationType, false);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -175,8 +178,8 @@ HifiNotifications.prototype = {
|
|||
MARKETPLACE_NOTIFICATION_POLL_TIME_MS);
|
||||
}
|
||||
else {
|
||||
if(this.storiesTimer) {
|
||||
clearInterval(this.storiesTimer);
|
||||
if(this.storiesPollTimer) {
|
||||
clearInterval(this.storiesPollTimer);
|
||||
}
|
||||
if(this.peoplePollTimer) {
|
||||
clearInterval(this.peoplePollTimer);
|
||||
|
@ -205,13 +208,11 @@ HifiNotifications.prototype = {
|
|||
console.log("Error: unable to get " + url);
|
||||
return false;
|
||||
}
|
||||
console.log(data.body);
|
||||
var content = JSON.parse(data.body);
|
||||
if(!content || content.status != 'success') {
|
||||
console.log("Error: unable to get " + url);
|
||||
return false;
|
||||
}
|
||||
console.log(content);
|
||||
if(!content.total_entries) {
|
||||
this.menuNotificationCallback(notifyType, false);
|
||||
}
|
||||
|
@ -298,7 +299,7 @@ HifiNotifications.prototype = {
|
|||
var url = METAVERSE_SERVER_URL + STORIES_URL + '?' + options.join('&');
|
||||
console.log(url);
|
||||
|
||||
_this._pollCommon(NotificationType.STORIES,
|
||||
_this._pollCommon(NotificationType.GOTO,
|
||||
url,
|
||||
since,
|
||||
function (success, token) {
|
||||
|
@ -425,6 +426,7 @@ HifiNotifications.prototype = {
|
|||
'page=1',
|
||||
'per_page=1'
|
||||
];
|
||||
var url = METAVERSE_SERVER_URL + UPDATES_URL + '?' + options.join('&');
|
||||
request.get({
|
||||
uri: url,
|
||||
'auth': {
|
||||
|
|
Loading…
Reference in a new issue