Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Places App.: Persisted Maturity Filter and Default value for Newbies. #1164

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions scripts/system/places/places.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@
if (message.channel === channel && message.action === "CURRENT_LOCATION") {
currentLocation = message.data;
displayCurrentLocation();
}
}
if (message.channel === channel && message.action === "MATURITY_FILTER") {
maturityFilter = message.filter;
displayMaturityFilter();
}
});

var goSignal = {
Expand Down Expand Up @@ -600,8 +604,16 @@
maturityFilter = arrayRemove(maturityFilter, targeted);
}
loadRecordsUpTo = NUMBER_OF_RECORDS_PER_LOAD;

var messageSent = {
"channel": channel,
"action": "SET_MATURITY_FILTER",
"filter": maturityFilter
};
EventBridge.emitWebEvent(JSON.stringify(messageSent));

displayMaturityFilter();
generateContent();
generateContent();
}

function filterSearchField(targeted) {
Expand Down
25 changes: 23 additions & 2 deletions scripts/system/places/places.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
var metaverseServers = [];
var SETTING_METAVERSE_TO_FETCH = "placesAppMetaverseToFetch";
var SETTING_PINNED_METAVERSE = "placesAppPinnedMetaverse";
var SETTING_MATURITY_FILTER = "placesAppMaturityFilter";
var DEFAULT_MATURITY = ["adult", "mature", "teen", "everyone", "unrated"];
var REQUEST_TIMEOUT = 10000; //10 seconds

var httpRequest = null;
Expand Down Expand Up @@ -78,8 +80,8 @@
if (messageObj.action === "READY_FOR_CONTENT" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
sendPersistedMaturityFilter();
transmitPortalList();

sendCurrentLocationToUI();

} else if (messageObj.action === "TELEPORT" && (n - timestamp) > INTERCALL_DELAY) {
Expand All @@ -88,17 +90,23 @@

if (messageObj.address.length > 0) {
Window.location = messageObj.address;
}
}

} else if (messageObj.action === "GO_HOME" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
if (LocationBookmarks.getHomeLocationAddress()) {
location.handleLookupString(LocationBookmarks.getHomeLocationAddress());
} else {
Window.location = "file:///~/serverless/tutorial.json";
}
} else if (messageObj.action === "GO_BACK" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
location.goBack();
} else if (messageObj.action === "GO_FORWARD" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
location.goForward();
} else if (messageObj.action === "PIN_META" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
Expand All @@ -122,6 +130,10 @@
}
metaverseServers.push(newMs);
savePinnedMetaverseSetting();
} else if (messageObj.action === "SET_MATURITY_FILTER" && (n - timestamp) > INTERCALL_DELAY) {
d = new Date();
timestamp = d.getTime();
Settings.setValue(SETTING_MATURITY_FILTER, messageObj.filter);
}
}
}
Expand Down Expand Up @@ -224,6 +236,15 @@

};

function sendPersistedMaturityFilter() {
var messageSent = {
"channel": channel,
"action": "MATURITY_FILTER",
"filter": Settings.getValue(SETTING_MATURITY_FILTER, DEFAULT_MATURITY)
};
tablet.emitScriptEvent(messageSent);
}

function getFederationData() {
/*
//If federation.json is got from the Metaverse Server (not implemented yet)
Expand Down
Loading