Skip to content

Commit

Permalink
added developer mode option for pre-release software update testing
Browse files Browse the repository at this point in the history
  • Loading branch information
elijahparker committed Nov 10, 2016
1 parent 5708fa3 commit b7241f4
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 24 deletions.
3 changes: 3 additions & 0 deletions interface/help.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions interface/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,16 @@ exports.back = function() {
}
}

exports.set = function(object, key, value) {
exports.set = function(object, key, value, callback) {
return {
type: "function",
fn: function(arg, cb) {
object[key] = value;
if (cb) cb();
if(callback) {
callback(cb);
} else {
cb && cb();
}
},
selected: exports.select(object, key, value)
}
Expand Down
62 changes: 42 additions & 20 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -970,30 +970,42 @@ if (VIEW_HARDWARE) {
name: "Charge Indicator LED",
value: "enabled",
help: help.chargeIndicatorMenu,
action: {
type: 'function',
fn: function(arg, cb) {
if(power.lightDisabled !== false) {
db.set('chargeLightDisabled', "no");
power.init(false);
}
cb();
}
}
action: ui.set(power, 'lightDisabled', false, function(cb){
db.set('chargeLightDisabled', "no");
power.init(false);
cb && cb();
})
}, {
name: "Charge Indicator LED",
value: "disabled",
help: help.chargeIndicatorMenu,
action: {
type: 'function',
fn: function(arg, cb) {
if(power.lightDisabled !== true) {
db.set('chargeLightDisabled', "yes");
power.init(true);
}
cb();
}
}
action: ui.set(power, 'lightDisabled', true, function(cb){
db.set('chargeLightDisabled', "yes");
power.init(true);
cb && cb();
})
}]
}

var developerModeMenu = {
name: "Developer Mode",
type: "options",
items: [{
name: "Developer Mode",
value: "disabled",
help: help.developerModeMenu,
action: ui.set(updates, 'developerMode', false, function(cb){
db.set('developerMode', "no");
cb && cb();
})
}, {
name: "Developer Mode",
value: "enabled",
help: help.developerModeMenu,
action: ui.set(updates, 'developerMode', true, function(cb){
db.set('developerMode', "yes");
cb && cb();
})
}]
}

Expand Down Expand Up @@ -1100,6 +1112,10 @@ if (VIEW_HARDWARE) {
name: "Factory Reset",
action: factoryResetConfirmMenu,
help: help.eraseAllSettingsMenu
}, {
name: "Developer Mode",
action: developerModeMenu,
help: help.developerModeMenu
}, ]
}

Expand Down Expand Up @@ -1429,6 +1445,12 @@ db.get('chargeLightDisabled', function(err, en) {
}
});

db.get('developerMode', function(err, en) {
if(!err) {
updates.developerMode = (en == "yes");
}
});

db.get('gps', function(err, en) {
if(!err) {
power.gps(en == "yes");
Expand Down
4 changes: 2 additions & 2 deletions system/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if(installs.indexOf('current') !== -1) {
exports.version = current;
}

exports.includeBeta = false;
exports.developerMode = false;
var cachedVersions = null;
exports.getVersions = function(callback){
if(cachedVersions) {
Expand All @@ -111,7 +111,7 @@ exports.getVersions = function(callback){
}
var list = [];
for(var i = 0; i < res.length; i++) {
if(!res[i].prerelease || exports.includeBeta) list.push({
if(!res[i].prerelease || exports.developerMode) list.push({
version: res[i].tag_name,
description: res[i].name,
notes: res[i].body,
Expand Down

0 comments on commit b7241f4

Please sign in to comment.