63 lines
No EOL
1.9 KiB
JavaScript
63 lines
No EOL
1.9 KiB
JavaScript
// loadApplauseApp.js
|
|
//
|
|
// Loads the applause app on to a user's device while they are in the vicinity
|
|
// Created by Liv Erickson 6/18/2018
|
|
//
|
|
// Copyright 2018 High Fidelity Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
(function(){
|
|
|
|
var EVENT_NAME = "loadTest_9_7_2018";
|
|
|
|
var NOT_DONE_VOTING = "notdone";
|
|
var VOTED = "voted"; // used in feedbackApp file
|
|
|
|
var FEEDBACK_APP_LOCATION = Script.resolvePath('./feedbackApp.js?v3');
|
|
|
|
var HAS_FEEDBACK_APP_SETTING = 'io.highfidelity.feedbackEnabled.appPresent' + EVENT_NAME;
|
|
var FeedbackItem = function() {};
|
|
FeedbackItem.prototype = {
|
|
preload: function(entityID) {
|
|
|
|
var value = Settings.getValue(HAS_FEEDBACK_APP_SETTING);
|
|
|
|
if (!value) {
|
|
// never loaded feedback app before
|
|
|
|
ScriptDiscoveryService.loadScript(FEEDBACK_APP_LOCATION);
|
|
Settings.setValue(HAS_FEEDBACK_APP_SETTING, NOT_DONE_VOTING);
|
|
|
|
} else if (value === NOT_DONE_VOTING) {
|
|
// loaded feedback but hasnt voted
|
|
|
|
ScriptDiscoveryService.loadScript(FEEDBACK_APP_LOCATION);
|
|
|
|
}
|
|
},
|
|
unload: function() {
|
|
|
|
var value = Settings.getValue(HAS_FEEDBACK_APP_SETTING);
|
|
ScriptDiscoveryService.stopScript(FEEDBACK_APP_LOCATION);
|
|
|
|
}
|
|
};
|
|
return new FeedbackItem();
|
|
});
|
|
|
|
|
|
// var properties = Entities.getEntityProperties(entityID, ["name", "userData"]);
|
|
|
|
|
|
// try {
|
|
// var userData = JSON.parse(properties.userData);
|
|
|
|
// if (userData.eventName) {
|
|
// appSettingsName = HAS_FEEDBACK_APP_SETTING + eventName;
|
|
// }
|
|
|
|
// } catch (e) {
|
|
// console.error("Issue parsing userData for feedbackLoader", e);
|
|
// }
|