Remove cruft and refactor

This commit is contained in:
Kerry Ivan Kurian 2018-09-20 14:50:27 -07:00
parent ae4352f450
commit c1cc031bd0

View file

@ -45,8 +45,9 @@ Rectangle {
function installResourceObj(resourceObj) { function installResourceObj(resourceObj) {
if ("application" == resourceObj["assetType"]) { if ("application" == resourceObj["assetType"]) {
Commerce.installApp(resourceObj["resource"]); Commerce.installApp(resourceObj["resource"]);
} else {
print("Cannot install resource object type " + resourceObj["assetType"]);
} }
// XXX support other asset types here
} }
function addAllInstalledAppsToList() { function addAllInstalledAppsToList() {
@ -63,14 +64,16 @@ Rectangle {
return httpPattern.test(resource) ? resource : "file:///" + resource; return httpPattern.test(resource) ? resource : "file:///" + resource;
} }
function rezEntity(itemHref, itemType) { function rezEntity(resource, entityType) {
sendToScript({
method: 'tester_rezClicked',
itemHref: toUrl(resource),
itemType: entityType});
} }
Component.onCompleted: { Component.onCompleted: {
// On startup, list includes all tester-installed assets. // On startup, list includes all tester-installed assets.
addAllInstalledAppsToList(); addAllInstalledAppsToList();
// XXX support other asset types here
} }
ListView { ListView {
@ -99,21 +102,18 @@ Rectangle {
urlHandler.handleUrl("hifi://localhost/0,0,0"); urlHandler.handleUrl("hifi://localhost/0,0,0");
Commerce.replaceContentSet(toUrl(resource), ""); Commerce.replaceContentSet(toUrl(resource), "");
break; break;
case "entity or wearable": case "entity":
print("going to rez " + toUrl(resource)); case "wearable":
sendToScript({ rezEntity(resource, assetType);
method: 'tester_rezClicked',
itemHref: toUrl(resource),
itemType: "entity"});
break; break;
default:
print("Marketplace item tester unsupported assetType " + assetType);
} }
// XXX support other resource types here.
}, },
"trash": function(){ "trash": function(){
if ("application" == assetType) { if ("application" == assetType) {
Commerce.uninstallApp(resource); Commerce.uninstallApp(resource);
} }
// XXX support other resource types here.
resourceListModel.remove(index); resourceListModel.remove(index);
} }
} }