mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 13:12:39 +02:00
navigation to market / my purchases from message dialog links
This commit is contained in:
parent
4ce8e29d97
commit
bcb373618f
4 changed files with 51 additions and 22 deletions
|
@ -431,7 +431,10 @@ Rectangle {
|
|||
|
||||
popup.showGetWearables(function() {
|
||||
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://AvatarIsland'})
|
||||
})
|
||||
}, function(link) {
|
||||
console.debug('link clicked', link);
|
||||
emitSendToScript({'method' : 'navigate', 'url' : link})
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -675,6 +678,9 @@ Rectangle {
|
|||
onClicked: {
|
||||
popup.showBuyAvatars(function() {
|
||||
emitSendToScript({'method' : 'navigate', 'url' : 'hifi://BodyMart'})
|
||||
}, function(link) {
|
||||
console.debug('link clicked', link);
|
||||
emitSendToScript({'method' : 'navigate', 'url' : link})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ Rectangle {
|
|||
|
||||
property var onButton2Clicked;
|
||||
property var onButton1Clicked;
|
||||
property var onLinkClicked;
|
||||
|
||||
function open() {
|
||||
visible = true;
|
||||
|
@ -110,6 +111,11 @@ Rectangle {
|
|||
height: paintedHeight;
|
||||
verticalAlignment: Text.AlignTop;
|
||||
wrapMode: Text.WordWrap;
|
||||
|
||||
onLinkActivated: {
|
||||
if(onLinkClicked)
|
||||
onLinkClicked(link);
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
|
|
|
@ -18,12 +18,12 @@ MessageBox {
|
|||
|
||||
property url getWearablesUrl: '../../../images/samples/hifi-place-77312e4b-6f48-4eb4-87e2-50444d8e56d1.png'
|
||||
|
||||
function showGetWearables(callback) {
|
||||
function showGetWearables(callback, linkCallback) {
|
||||
popup.button2text = 'AvatarIsland'
|
||||
popup.button1text = 'CANCEL'
|
||||
popup.titleText = 'Get Wearables'
|
||||
popup.bodyText = 'Buy wearables from <a href="https://fake.link">Marketplace</a>' + '\n' +
|
||||
'Wear wearable from <a href="https://fake.link">My Purchases</a>' + '\n' +
|
||||
popup.bodyText = 'Buy wearables from <a href="app://marketplace">Marketplace</a>' + '\n' +
|
||||
'Wear wearable from <a href="app://purchases">My Purchases</a>' + '\n' +
|
||||
'You can visit the domain “AvatarIsland”' + '\n' +
|
||||
'to get wearables'
|
||||
|
||||
|
@ -34,6 +34,14 @@ MessageBox {
|
|||
if(callback)
|
||||
callback();
|
||||
}
|
||||
|
||||
popup.onLinkClicked = function(link) {
|
||||
popup.close();
|
||||
|
||||
if(linkCallback)
|
||||
linkCallback(link);
|
||||
}
|
||||
|
||||
popup.open();
|
||||
}
|
||||
|
||||
|
@ -70,13 +78,13 @@ MessageBox {
|
|||
|
||||
property url getAvatarsUrl: '../../../images/samples/hifi-place-get-avatars.png'
|
||||
|
||||
function showBuyAvatars(callback) {
|
||||
function showBuyAvatars(callback, linkCallback) {
|
||||
popup.button2text = 'BodyMart'
|
||||
popup.button1text = 'CANCEL'
|
||||
popup.titleText = 'Get Avatars'
|
||||
|
||||
popup.bodyText = 'Buy avatars from <a href="https://fake.link">Marketplace</a>' + '\n' +
|
||||
'Wear avatars from <a href="https://fake.link">My Purchases</a>' + '\n' +
|
||||
popup.bodyText = 'Buy avatars from <a href="app://marketplace">Marketplace</a>' + '\n' +
|
||||
'Wear avatars from <a href="app://purchases">My Purchases</a>' + '\n' +
|
||||
'You can visit the domain “BodyMart”' + '\n' +
|
||||
'to get avatars'
|
||||
|
||||
|
@ -87,6 +95,14 @@ MessageBox {
|
|||
if(callback)
|
||||
callback();
|
||||
}
|
||||
|
||||
popup.onLinkClicked = function(link) {
|
||||
popup.close();
|
||||
|
||||
if(linkCallback)
|
||||
linkCallback(link);
|
||||
}
|
||||
|
||||
popup.open();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,20 +47,6 @@ function getMyAvatarWearables() {
|
|||
}
|
||||
|
||||
return wearablesArray;
|
||||
|
||||
/*
|
||||
var getAttachedModelEntities = function() {
|
||||
var resultEntities = [];
|
||||
Entities.findEntitiesByType('Model', MyAvatar.position, 100).forEach(function(entityID) {
|
||||
if (isEntityBeingWorn(entityID)) {
|
||||
resultEntities.push({properties : entityID});
|
||||
}
|
||||
});
|
||||
return resultEntities;
|
||||
};
|
||||
|
||||
return getAttachedModelEntities();
|
||||
*/
|
||||
}
|
||||
|
||||
function getMyAvatar() {
|
||||
|
@ -114,6 +100,10 @@ var currentAvatar = null;
|
|||
var selectedAvatarEntityGrabbable = false;
|
||||
var selectedAvatarEntity = null;
|
||||
|
||||
var MARKETPLACE_PURCHASES_QML_PATH = "hifi/commerce/purchases/Purchases.qml";
|
||||
var MARKETPLACE_URL = Account.metaverseServerURL + "/marketplace";
|
||||
var MARKETPLACES_INJECT_SCRIPT_URL = Script.resolvePath("../html/js/marketplacesInject.js");
|
||||
|
||||
function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml.
|
||||
console.debug('fromQml: message = ', JSON.stringify(message, null, '\t'))
|
||||
|
||||
|
@ -191,7 +181,18 @@ function fromQml(message) { // messages are {method, params}, like json-rpc. See
|
|||
break;
|
||||
case 'navigate':
|
||||
console.debug('avatarapp.js: navigate: ', message.url);
|
||||
AddressManager.handleLookupString(message.url, false);
|
||||
if(message.url.indexOf('app://') === 0) {
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system")
|
||||
|
||||
if(message.url === 'app://marketplace') {
|
||||
tablet.gotoWebScreen(MARKETPLACE_URL, MARKETPLACES_INJECT_SCRIPT_URL);
|
||||
} else if(message.url === 'app://purchases') {
|
||||
tablet.pushOntoStack(MARKETPLACE_PURCHASES_QML_PATH);
|
||||
}
|
||||
|
||||
} else if(message.url.indexOf('hifi://') === 0) {
|
||||
AddressManager.handleLookupString(message.url, false);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
print('Unrecognized message from AvatarApp.qml:', JSON.stringify(message));
|
||||
|
|
Loading…
Reference in a new issue