mirror of
https://github.com/betaflight/betaflight-configurator.git
synced 2025-07-25 17:25:16 +03:00
Cordova integration and android platform : - Added cordova directory with required config - Added cordova applications generation in gulpfile - Added cordova development instructions - Used cordova plugins to simulate missing chrome api plugins (chrome.serial and chrome.fileSystem) - Added cordova clipboard support - Added android operating system and Cordova gui mode - Fixed some css and js files to make them working on Android as well as on computers - Added --skipdep argument to accelerate cordova build (gulp task) - Added a webview helper to help people to update the webview app of their device New options tab : - Added options tab replacing the options dropdown - Added option to switch between phones UI and computers UI Mobile interface and global interface improvements : - Simplified the structure of the header with flex css - Made headerbar and tab container responsive (compact headerbar and side menu) - All tabs are adapted to mobile interface (except firmware flasher) - The servos and adjustments tabs are not fully adapted but are "usable" - Improved header bar animation - Improved log expandation animation - Added swipe gesture to toggle side menu Fixes during the development : - Logo position - Dark mode - Auto connection - Error messages (cordova_chromeapi.js) - Responsive grid - Testing - Disconnection - Width of boxes inside the OSD tab - Fixed cli tab - OSD tab - Motor stop switch - White spaces in boxes - Dialogs size - Connect button state - Prevent tablet with a height larger than 575px to switch to computers ui - Fixed logging tab - Fixed code smell - Fixed yarn cordova plugin install issue - Fixed content_wrapper - Fixed vibrations when scrolling - Fixed scrolling bar alignment - Fixed dialogReportProblem height - Fixed rates logo - Fixed auto connection default value (true) - Fixed D to D max - Fixed dialogs Added required messages in locales/en/messages.json file Requested changes
67 lines
2 KiB
JavaScript
67 lines
2 KiB
JavaScript
'use strict';
|
|
|
|
const cordovaUI = {
|
|
uiZoom: 1,
|
|
canChangeUI: true,
|
|
init: async function() {
|
|
const self = this;
|
|
const screenWidth = $(window).width();
|
|
const screenHeight = $(window).height();
|
|
let length;
|
|
let orientation;
|
|
if (screenWidth > screenHeight) {
|
|
length = screenWidth;
|
|
orientation = 'landscape';
|
|
} else {
|
|
length = screenHeight;
|
|
orientation = 'portrait';
|
|
}
|
|
if (length < 1024) {
|
|
self.uiZoom = length/1024;
|
|
}
|
|
if (screenWidth > 575 && screenHeight > 575) {
|
|
self.canChangeUI = false;
|
|
}
|
|
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
|
if (result.cordovaForceComputerUI === undefined) {
|
|
if ((orientation === 'landscape' && screenHeight <= 575)
|
|
|| (orientation === 'portrait' && screenWidth <= 575)) {
|
|
ConfigStorage.set({'cordovaForceComputerUI': false});
|
|
} else {
|
|
ConfigStorage.set({'cordovaForceComputerUI': true});
|
|
}
|
|
}
|
|
});
|
|
self.set();
|
|
},
|
|
set: function() {
|
|
const self = this;
|
|
ConfigStorage.get('cordovaForceComputerUI', function (result) {
|
|
if (result.cordovaForceComputerUI) {
|
|
window.screen.orientation.lock('landscape');
|
|
$('body').css('zoom', self.uiZoom);
|
|
} else {
|
|
window.screen.orientation.lock('portrait');
|
|
$('body').css('zoom', 1);
|
|
}
|
|
});
|
|
},
|
|
};
|
|
|
|
const cordovaApp = {
|
|
initialize: function() {
|
|
this.bindEvents();
|
|
},
|
|
bindEvents: function() {
|
|
document.addEventListener('deviceready', this.onDeviceReady, false);
|
|
},
|
|
onDeviceReady: function() {
|
|
$('.open_firmware_flasher, .tab_firmware_flasher').hide();
|
|
cordovaUI.init();
|
|
navigator.splashscreen.hide();
|
|
cordovaChromeapi.init();
|
|
appReady();
|
|
},
|
|
};
|
|
|
|
cordovaApp.initialize();
|