From 6bd09409ce1eae05da3987d75076e73f9ede45d2 Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Mon, 14 Oct 2024 21:22:18 -0400 Subject: [PATCH 1/2] Make Maturity Filter persisted Make Maturity Filter persisted and with a default value (Teen & Everyone) --- scripts/system/places/places.html | 16 ++++++++++++++-- scripts/system/places/places.js | 25 +++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/scripts/system/places/places.html b/scripts/system/places/places.html index 980d8f0f1fa..fda67f4066a 100644 --- a/scripts/system/places/places.html +++ b/scripts/system/places/places.html @@ -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 = { @@ -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) { diff --git a/scripts/system/places/places.js b/scripts/system/places/places.js index b9cd49bb1fe..c636b8fccbf 100644 --- a/scripts/system/places/places.js +++ b/scripts/system/places/places.js @@ -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 = ["teen", "everyone"]; //["adult", "mature", "teen", "everyone", "unrated"]; var REQUEST_TIMEOUT = 10000; //10 seconds var httpRequest = null; @@ -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) { @@ -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(); @@ -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); } } } @@ -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) From 79793669783496a61b0897fb10e395e3d68d92cc Mon Sep 17 00:00:00 2001 From: Alezia Kurdis <60075796+AleziaKurdis@users.noreply.github.com> Date: Tue, 15 Oct 2024 21:14:50 -0400 Subject: [PATCH 2/2] Adjust the default value for maturity Adjust the default value for maturity --- scripts/system/places/places.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system/places/places.js b/scripts/system/places/places.js index c636b8fccbf..fa22d536b7f 100644 --- a/scripts/system/places/places.js +++ b/scripts/system/places/places.js @@ -20,7 +20,7 @@ var SETTING_METAVERSE_TO_FETCH = "placesAppMetaverseToFetch"; var SETTING_PINNED_METAVERSE = "placesAppPinnedMetaverse"; var SETTING_MATURITY_FILTER = "placesAppMaturityFilter"; - var DEFAULT_MATURITY = ["teen", "everyone"]; //["adult", "mature", "teen", "everyone", "unrated"]; + var DEFAULT_MATURITY = ["adult", "mature", "teen", "everyone", "unrated"]; var REQUEST_TIMEOUT = 10000; //10 seconds var httpRequest = null;