mirror of
https://github.com/lubosz/overte.git
synced 2025-04-23 09:33:45 +02:00
remove comments / dead code
This commit is contained in:
parent
ce322a4794
commit
d9daa3495a
6 changed files with 5 additions and 176 deletions
|
@ -38,7 +38,6 @@ Column {
|
|||
// sendToScript doesn't get wired until after everything gets created. So we have to queue fillDestinations on nextTick.
|
||||
property string labelText: actions;
|
||||
property string filter: '';
|
||||
// FIXME onFilterChanged: filterChoicesByText();
|
||||
property var goFunction: null;
|
||||
property var http: null;
|
||||
|
||||
|
@ -51,7 +50,7 @@ Column {
|
|||
'include_actions=' + actions,
|
||||
'restriction=' + (Account.isLoggedIn() ? 'open,hifi' : 'open'),
|
||||
'require_online=true',
|
||||
'protocol=' + Window.protocolSignature()
|
||||
'protocol=' + encodeURIComponent(Window.protocolSignature())
|
||||
];
|
||||
endpoint: '/api/v1/user_stories?' + options.join('&');
|
||||
itemsPerPage: 3;
|
||||
|
@ -60,12 +59,7 @@ Column {
|
|||
};
|
||||
listModelName: actions;
|
||||
listView: scroll;
|
||||
searchFilter: filter; // FIXME .toUpperCase().split(/\s+/).filter(identity).join(' ');
|
||||
/* FIXME searchItemTest: function (text, item) {
|
||||
return searchFilter.split().every(function (word) {
|
||||
return item.searchText.indexOf(word) >= 0;
|
||||
});
|
||||
};*/ //HRS FIXME remove when endpoint works.
|
||||
searchFilter: filter;
|
||||
}
|
||||
|
||||
function resolveUrl(url) {
|
||||
|
@ -93,127 +87,8 @@ Column {
|
|||
description: description,
|
||||
online_users: data.details.connections || data.details.concurrency || 0,
|
||||
drillDownToPlace: false
|
||||
|
||||
//searchText: [name].concat(tags, description || []).join(' ').toUpperCase() // FIXME remove
|
||||
};
|
||||
}
|
||||
function identity(x) {
|
||||
return x;
|
||||
}
|
||||
/* FIXME
|
||||
property var allStories: [];
|
||||
property var placeMap: ({}); // Used for making stacks.
|
||||
property int requestId: 0;
|
||||
function handleError(url, error, data, cb) { // cb(error) and answer truthy if needed, else falsey
|
||||
if (!error && (data.status === 'success')) {
|
||||
return;
|
||||
}
|
||||
if (!error) { // Create a message from the data
|
||||
error = data.status + ': ' + data.error;
|
||||
}
|
||||
if (typeof(error) === 'string') { // Make a proper Error object
|
||||
error = new Error(error);
|
||||
}
|
||||
error.message += ' in ' + url; // Include the url.
|
||||
cb(error);
|
||||
return true;
|
||||
}
|
||||
function getUserStoryPage(pageNumber, cb, cb1) { // cb(error) after all pages of domain data have been added to model
|
||||
// If supplied, cb1 will be run after the first page IFF it is not the last, for responsiveness.
|
||||
var options = [
|
||||
'now=' + new Date().toISOString(),
|
||||
'include_actions=' + actions,
|
||||
'restriction=' + (Account.isLoggedIn() ? 'open,hifi' : 'open'),
|
||||
'require_online=true',
|
||||
'protocol=' + protocol,
|
||||
'page=' + pageNumber
|
||||
];
|
||||
var url = metaverseBase + 'user_stories?' + options.join('&');
|
||||
var thisRequestId = ++requestId;
|
||||
http.request(url, function (error, data) {
|
||||
if (thisRequestId !== requestId) {
|
||||
error = 'stale';
|
||||
}
|
||||
if (handleError(url, error, data, cb)) {
|
||||
return; // abandon stale requests
|
||||
}
|
||||
allStories = allStories.concat(data.user_stories.map(makeModelData));
|
||||
if ((data.current_page < data.total_pages) && (data.current_page <= 10)) { // just 10 pages = 100 stories for now
|
||||
if ((pageNumber === 1) && cb1) {
|
||||
cb1();
|
||||
}
|
||||
return getUserStoryPage(pageNumber + 1, cb);
|
||||
}
|
||||
cb();
|
||||
});
|
||||
}
|
||||
function fillDestinations() { // Public
|
||||
console.debug('Feed::fillDestinations()');
|
||||
//suggestions.getFirstPage();
|
||||
}
|
||||
function report(label, error) {
|
||||
console.log(label, actions, error || 'ok', allStories.length, 'filtered to', suggestions.count);
|
||||
}
|
||||
var filter = makeFilteredStoryProcessor(), counter = 0;
|
||||
allStories = [];
|
||||
suggestions.clear();
|
||||
placeMap = {};
|
||||
getUserStoryPage(1, function (error) {
|
||||
allStories.slice(counter).forEach(filter);
|
||||
report('user stories update', error);
|
||||
root.visible = !!suggestions.count;
|
||||
}, function () { // If there's more than a page, put what we have in the model right away, keeping track of how many are processed.
|
||||
allStories.forEach(function (story) {
|
||||
counter++;
|
||||
filter(story);
|
||||
root.visible = !!suggestions.count;
|
||||
});
|
||||
report('user stories');
|
||||
});
|
||||
}
|
||||
function makeFilteredStoryProcessor() { // answer a function(storyData) that adds it to suggestions if it matches
|
||||
var words = filter.toUpperCase().split(/\s+/).filter(identity);
|
||||
function suggestable(story) {
|
||||
// We could filter out places we don't want to suggest, such as those where (story.place_name === AddressManager.placename) or (story.username === Account.username).
|
||||
return true;
|
||||
}
|
||||
function matches(story) {
|
||||
if (!words.length) {
|
||||
return suggestable(story);
|
||||
}
|
||||
return words.every(function (word) {
|
||||
return story.searchText.indexOf(word) >= 0;
|
||||
});
|
||||
}
|
||||
function addToSuggestions(place) {
|
||||
var collapse = ((actions === 'concurrency,snapshot') && (place.action !== 'concurrency')) || (place.action === 'announcement');
|
||||
if (collapse) {
|
||||
var existing = placeMap[place.place_name];
|
||||
if (existing) {
|
||||
existing.drillDownToPlace = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
suggestions.append(place);
|
||||
if (collapse) {
|
||||
placeMap[place.place_name] = suggestions.get(suggestions.count - 1);
|
||||
} else if (place.action === 'concurrency') {
|
||||
suggestions.get(suggestions.count - 1).drillDownToPlace = true; // Don't change raw place object (in allStories).
|
||||
}
|
||||
}
|
||||
return function (story) {
|
||||
if (matches(story)) {
|
||||
addToSuggestions(story);
|
||||
}
|
||||
};
|
||||
}
|
||||
function filterChoicesByText() {
|
||||
suggestions.clear();
|
||||
placeMap = {};
|
||||
allStories.forEach(makeFilteredStoryProcessor());
|
||||
root.visible = !!suggestions.count;
|
||||
}
|
||||
*/
|
||||
|
||||
RalewayBold {
|
||||
id: label;
|
||||
|
|
|
@ -49,7 +49,6 @@ Rectangle {
|
|||
id: connectionsUserModel;
|
||||
http: http;
|
||||
endpoint: "/api/v1/users?filter=connections";
|
||||
//FIXME localSort: true;
|
||||
property var sortColumn: connectionsTable.getColumn(connectionsTable.sortIndicatorColumn);
|
||||
sortProperty: switch (sortColumn && sortColumn.role) {
|
||||
case 'placeName':
|
||||
|
|
|
@ -404,9 +404,6 @@ Item {
|
|||
return data.users;
|
||||
};
|
||||
searchFilter: filterBar.text;
|
||||
/* FIXME searchItemTest: function (text, item) {
|
||||
return item.username.toLowerCase().indexOf(text.toLowerCase()) !== -1;
|
||||
};*/ //HRS FIXME remove when endpoint works.
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
|
|
|
@ -41,7 +41,7 @@ Rectangle {
|
|||
property int numUpdatesAvailable: 0;
|
||||
// Style
|
||||
color: hifi.colors.white;
|
||||
function getPurchases() { // FIXME: use the new purchasesModel.getFirstPage
|
||||
function getPurchases() {
|
||||
root.activeView = "purchasesMain";
|
||||
root.installedApps = Commerce.getInstalledApps();
|
||||
purchasesModel.getFirstPage();
|
||||
|
@ -576,32 +576,6 @@ Rectangle {
|
|||
sendToScript({ method: 'purchases_updateWearables' });
|
||||
|
||||
return data.assets;
|
||||
|
||||
/*
|
||||
var processedInventory = processInventoryResult(data.assets);
|
||||
|
||||
if (purchasesModel.processResult(result.status, processedInventory)) {
|
||||
var currentId;
|
||||
for (var i = 0; i < purchasesModel.count; i++) {
|
||||
currentId = purchasesModel.get(i).id;
|
||||
purchasesModel.setProperty(i, 'cardBackVisible', false);
|
||||
purchasesModel.setProperty(i, 'isInstalled', ((root.installedApps).indexOf(currentId) > -1));
|
||||
purchasesModel.setProperty(i, 'wornEntityID', '');
|
||||
}
|
||||
|
||||
// Client-side filter of "Updatable" items
|
||||
// FIXME - this MUST be serverside (what if we don't have the
|
||||
// page containing an updatable item on the client?)
|
||||
if (filterBar.primaryFilter_displayName === "Updatable") {
|
||||
for (var i = 0; i < purchasesModel.count; i++) {
|
||||
if (purchasesModel.get(i).upgrade_url === "") {
|
||||
purchasesModel.remove(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -979,17 +953,6 @@ Rectangle {
|
|||
//
|
||||
// FUNCTION DEFINITIONS START
|
||||
//
|
||||
/* fixme remove
|
||||
function processInventoryResult(inventory) { // HRS FIXME remove
|
||||
for (var i = 0; i < inventory.length; i++) {
|
||||
if (inventory[i].status.length > 1) {
|
||||
console.log("WARNING: Inventory result index " + i + " has a status of length >1!")
|
||||
}
|
||||
inventory[i].status = inventory[i].status[0];
|
||||
inventory[i].categories = inventory[i].categories.join(';');
|
||||
}
|
||||
return inventory;
|
||||
} */
|
||||
|
||||
function updateCurrentlyWornWearables(wearables) {
|
||||
for (var i = 0; i < purchasesModel.count; i++) {
|
||||
|
|
|
@ -769,12 +769,10 @@ Rectangle {
|
|||
// NOP
|
||||
break;
|
||||
case 'updateConnections':
|
||||
console.log('Wallet.qml updateConnections');// HRS FIXME
|
||||
sendMoney.updateConnections(message.connections);
|
||||
break;
|
||||
case 'selectRecipient':
|
||||
case 'updateSelectedRecipientUsername':
|
||||
console.log('Wallet.qml updateSelectedRecipientUsername'); // HRS FIXME
|
||||
sendMoney.fromScript(message);
|
||||
break;
|
||||
case 'http.response':
|
||||
|
|
|
@ -63,7 +63,7 @@ Item {
|
|||
property bool delayedClear: false;
|
||||
function resetModel() {
|
||||
if (!delayedClear) { finalModel.clear(); }
|
||||
currentPageToRetrieve = 1; console.log('fixme resetModel set currentPageToRetrieve to 1', listModelName);
|
||||
currentPageToRetrieve = 1;
|
||||
retrievedAtLeastOnePage = false;
|
||||
copyOfItems = [];
|
||||
}
|
||||
|
@ -144,7 +144,6 @@ Item {
|
|||
// If it is a path starting with slash, add the metaverseServer domain.
|
||||
var url = /^\//.test(endpoint) ? (Account.metaverseServerURL + endpoint) : endpoint;
|
||||
var parameters = [
|
||||
// FIXME: handle sort, tag parameters
|
||||
'per_page=' + itemsPerPage,
|
||||
'page=' + currentPageToRetrieve
|
||||
];
|
||||
|
@ -162,8 +161,7 @@ Item {
|
|||
|
||||
// Start the show by retrieving data according to `getPage()`.
|
||||
// It can be custom-defined by this item's Parent.
|
||||
property var getFirstPage: function (delayClear) { getFirstPageInternal(delayClear); }
|
||||
function getFirstPageInternal(delayClear) {
|
||||
property var getFirstPage: function (delayClear) {
|
||||
delayedClear = !!delayClear;
|
||||
resetModel();
|
||||
requestPending = true;
|
||||
|
@ -180,7 +178,6 @@ Item {
|
|||
// onAtYEndChanged: if (theList.atYEnd && !theList.atYBeginning) { thisPSFListModelId.getNextPage(); }
|
||||
// ...}
|
||||
property var getNextPage: function () {
|
||||
console.log('fixme getNextPage', listModelName, requestPending, currentPageToRetrieve);
|
||||
if (requestPending || currentPageToRetrieve < 0) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue