Skip to content

Commit

Permalink
Fix user settings loading in QRCode activity
Browse files Browse the repository at this point in the history
  • Loading branch information
llaske committed Apr 3, 2018
1 parent 5f0d7f0 commit 9005a92
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions activities/QRCode.activity/js/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ define(["sugar-web/activity/activity","sugar-web/datastore", "sugar-web/env", "w
});

// Get settings
var userSettings = datastore.localStorage.getValue('sugar_settings');
var userText = document.getElementById("user-text");
userText.value = userSettings.name;
userText.addEventListener('keyup', function() {
var text = userText.value.toLowerCase();
if (text.indexOf("http://") == 0 || text.indexOf("https://") == 0) {
Expand Down Expand Up @@ -225,10 +223,11 @@ define(["sugar-web/activity/activity","sugar-web/datastore", "sugar-web/env", "w
});

// Initialize code
generateCode(userSettings.name);
env.getEnvironment(function(err, environment) {
if (!environment.objectId) {
console.log("New instance");
userText.value = environment.user.name;
generateCode(environment.user.name);
} else {
activity.getDatastoreObject().loadAsText(function(error, metadata, data) {
if (error==null && data!=null) {
Expand Down

0 comments on commit 9005a92

Please sign in to comment.