First run script.

This commit is contained in:
Kalila L 2020-10-05 20:40:58 -04:00
parent 46442bf5af
commit 61d4fb2ad1
2 changed files with 30 additions and 1 deletions

View file

@ -35,7 +35,8 @@ var DEFAULT_SCRIPTS_COMBINED = [
"system/audioMuteOverlay.js",
"system/inspect.js",
"system/keyboardShortcuts/keyboardShortcuts.js",
"system/checkForUpdates.js"
"system/checkForUpdates.js",
"system/onFirstRun.js"
];
var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js",

View file

@ -0,0 +1,28 @@
'use strict';
//
// onFirstRun.js
//
// Created by Kalila L. on Oct 5 2020.
// Copyright 2020 Vircadia contributors.
//
// This script triggers on first run to perform first party
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() { // BEGIN LOCAL_SCOPE
var SETTING_TO_CHECK = 'firstRun';
var DEFAULT_NAME = 'anonymous';
if (Settings.getValue('firstRun', false)) {
var selectedDisplayName = Window.prompt('Enter a display name.', MyAvatar.displayName);
if (selectedDisplayName === '') {
MyAvatar.displayName = DEFAULT_NAME;
} else {
MyAvatar.displayName = selectedDisplayName;
}
}
}());