mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-23 00:05:22 +03:00
Remove ChromeOS support
This commit is contained in:
parent
5a56a6d70c
commit
fec4ab4b6a
10 changed files with 23 additions and 202 deletions
|
@ -57,28 +57,6 @@ Clipboard._configureClipboardAsNwJs = function(nwGui) {
|
|||
};
|
||||
};
|
||||
|
||||
Clipboard._configureClipboardAsChrome = function() {
|
||||
|
||||
console.log('Chrome Clipboard available');
|
||||
|
||||
this.available = true;
|
||||
this.readAvailable = false; // FIXME: for some reason the read is not working
|
||||
this.writeAvailable = true;
|
||||
|
||||
this.writeText = function(text, onSuccess, onError) {
|
||||
navigator.clipboard.writeText(text)
|
||||
.then(onSuccess)
|
||||
.catch(onError);
|
||||
};
|
||||
|
||||
this.readText = function(onSuccess, onError) {
|
||||
navigator.clipboard.readText()
|
||||
.then(onSuccess)
|
||||
.catch(onError);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
Clipboard._configureClipboardAsCordova = function() {
|
||||
|
||||
console.log('Cordova Clipboard available');
|
||||
|
@ -116,8 +94,6 @@ Clipboard._configureClipboardAsOther = function() {
|
|||
|
||||
if (GUI.isNWJS()){
|
||||
Clipboard._configureClipboardAsNwJs(GUI.nwGui);
|
||||
} else if (GUI.isChromeApp()) {
|
||||
Clipboard._configureClipboardAsChrome();
|
||||
} else if (GUI.isCordova()) {
|
||||
Clipboard._configureClipboardAsCordova();
|
||||
} else {
|
||||
|
|
|
@ -5,10 +5,6 @@
|
|||
var ConfigStorage = {
|
||||
// key can be one string, or array of strings
|
||||
get: function(key, callback) {
|
||||
if (GUI.isChromeApp()) {
|
||||
chrome.storage.local.get(key,callback);
|
||||
} else {
|
||||
//console.log('Abstraction.get',key);
|
||||
if (Array.isArray(key)) {
|
||||
var obj = {};
|
||||
key.forEach(function (element) {
|
||||
|
@ -33,19 +29,13 @@ var ConfigStorage = {
|
|||
callback({});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
// set takes an object like {'userLanguageSelect':'DEFAULT'}
|
||||
set: function(input) {
|
||||
if (GUI.isChromeApp()) {
|
||||
chrome.storage.local.set(input);
|
||||
} else {
|
||||
//console.log('Abstraction.set',input);
|
||||
Object.keys(input).forEach(function (element) {
|
||||
var tmpObj = {};
|
||||
tmpObj[element] = input[element];
|
||||
window.localStorage.setItem(element, JSON.stringify(tmpObj));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
If an id is also specified and a window with a matching id has been shown before, the remembered bounds of the window will be used instead.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
function startApplication() {
|
||||
chrome.app.window.create('main.html', {
|
||||
id: 'main-window',
|
||||
frame: 'chrome',
|
||||
innerBounds: {
|
||||
minWidth: 1024,
|
||||
minHeight: 550,
|
||||
},
|
||||
}, function (createdWindow) {
|
||||
if (getChromeVersion() >= 54) {
|
||||
createdWindow.icon = 'images/bf_icon_128.png';
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
chrome.app.runtime.onLaunched.addListener(startApplication);
|
||||
|
||||
function getChromeVersion () {
|
||||
const raw = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);
|
||||
|
||||
return raw ? parseInt(raw[2], 10) : false;
|
||||
}
|
|
@ -5,7 +5,6 @@ window.TABS = {}; // filled by individual tab js file
|
|||
|
||||
const GUI_MODES = {
|
||||
NWJS: "NW.js",
|
||||
ChromeApp: "Chrome",
|
||||
Cordova: "Cordova",
|
||||
Other: "Other",
|
||||
};
|
||||
|
@ -67,11 +66,7 @@ const GuiControl = function () {
|
|||
if (typeof cordovaApp !== 'undefined') {
|
||||
this.Mode = GUI_MODES.Cordova;
|
||||
} else {
|
||||
if (window.chrome && chrome.storage && chrome.storage.local) {
|
||||
this.Mode = GUI_MODES.ChromeApp;
|
||||
} else {
|
||||
this.Mode = GUI_MODES.Other;
|
||||
}
|
||||
this.Mode = GUI_MODES.Other;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -81,8 +76,6 @@ function GUI_checkOperatingSystem() {
|
|||
return "Windows";
|
||||
} else if (navigator.appVersion.indexOf("Mac") !== -1) {
|
||||
return "MacOS";
|
||||
} else if (navigator.appVersion.indexOf("CrOS") !== -1) {
|
||||
return "ChromeOS";
|
||||
} else if (navigator.appVersion.indexOf("Android") !== -1) {
|
||||
return "Android";
|
||||
} else if (navigator.appVersion.indexOf("Linux") !== -1) {
|
||||
|
@ -395,12 +388,10 @@ GuiControl.prototype.selectDefaultTabWhenConnected = function() {
|
|||
});
|
||||
};
|
||||
|
||||
GuiControl.prototype.isChromeApp = function () {
|
||||
return this.Mode === GUI_MODES.ChromeApp;
|
||||
};
|
||||
GuiControl.prototype.isNWJS = function () {
|
||||
return this.Mode === GUI_MODES.NWJS;
|
||||
};
|
||||
|
||||
GuiControl.prototype.isCordova = function () {
|
||||
return this.Mode === GUI_MODES.Cordova;
|
||||
};
|
||||
|
|
|
@ -14,17 +14,6 @@ function appReady() {
|
|||
CONFIGURATOR.version = data.version;
|
||||
CONFIGURATOR.gitChangesetId = data.gitChangesetId;
|
||||
|
||||
// Version in the ChromeApp's manifest takes precedence.
|
||||
if(chrome.runtime && chrome.runtime.getManifest && !GUI.isCordova()) {
|
||||
const manifest = chrome.runtime.getManifest();
|
||||
CONFIGURATOR.version = manifest.version;
|
||||
// manifest.json for ChromeApp can't have a version
|
||||
// with a prerelease tag eg 10.0.0-RC4
|
||||
// Work around is to specify the prerelease version in version_name
|
||||
if (manifest.version_name) {
|
||||
CONFIGURATOR.version = manifest.version_name;
|
||||
}
|
||||
}
|
||||
i18n.init(function() {
|
||||
startProcess();
|
||||
|
||||
|
@ -181,10 +170,6 @@ function startProcess() {
|
|||
GUI.nwGui.Shell.openExternal(url);
|
||||
});
|
||||
nwWindow.on('close', closeHandler);
|
||||
} else if (GUI.isChromeApp()) {
|
||||
chrome.app.window.onClosed.addListener(closeHandler);
|
||||
// This event does not actually get fired:
|
||||
chrome.runtime.onSuspend.addListener(closeHandler);
|
||||
} else if (GUI.isCordova()) {
|
||||
window.addEventListener('beforeunload', closeHandler);
|
||||
document.addEventListener('backbutton', function(e) {
|
||||
|
|
|
@ -116,9 +116,8 @@ TABS.vtx.initialize = function (callback) {
|
|||
// Load schema
|
||||
const urlVtxSchema = chrome.runtime.getURL(`resources/jsonschema/vtxconfig_schema-${vtxConfig.version}.json`);
|
||||
|
||||
if (GUI.isChromeApp() || GUI.isCordova()) {
|
||||
// FIXME the ChromeOs don't let us use a Schema Validator because almost all of them use eval, and/or use require
|
||||
// On android : Fetch API cannot load : URL scheme "file" is not supported
|
||||
if (GUI.isCordova()) {
|
||||
// FIXME On android : Fetch API cannot load : URL scheme "file" is not supported
|
||||
callback_valid();
|
||||
} else {
|
||||
fetch(urlVtxSchema)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue