-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding support for the "tag" property in the "configuration" layer to…
… restrict visibility to the people with the given tag. Also, caching results for getLayersMap
- Loading branch information
Showing
6 changed files
with
40 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,22 @@ | ||
import {getLayersMap} from "../LayersFlattener"; | ||
import {Properties} from "../Properties"; | ||
|
||
/** | ||
* Initialize the configuration button in the menu | ||
*/ | ||
export function initConfiguration(assetsUrl?: string | undefined): void { | ||
WA.ui.registerMenuCommand("Configure the room", () => { | ||
assetsUrl = assetsUrl ?? process.env.ASSETS_URL ?? ""; | ||
WA.nav.openCoWebSite(assetsUrl + "configuration.html", true); | ||
}); | ||
export async function initConfiguration(assetsUrl?: string | undefined): Promise<void> { | ||
const layers = await getLayersMap(); | ||
|
||
const configurationLayer = layers.get("configuration"); | ||
|
||
if (configurationLayer) { | ||
const properties = new Properties(configurationLayer.properties); | ||
const tag = properties.getString('tag'); | ||
if (!tag || WA.player.tags.includes(tag)) { | ||
WA.ui.registerMenuCommand("Configure the room", () => { | ||
assetsUrl = assetsUrl ?? process.env.ASSETS_URL ?? ""; | ||
WA.nav.openCoWebSite(assetsUrl + "configuration.html", true); | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters