Commit d96c3f3c authored by Eric Seigne's avatar Eric Seigne
Browse files

merge nosqlite + debug iPad

parent b0ddffac
......@@ -146,5 +146,5 @@
</feature>
</platform>
<plugin name="cordova-plugin-calendar" />
<preference name="OverrideUserAgent" value="Mozilla/5.0 OpenNDF/1.6.6 iOS" />
<preference name="OverrideUserAgent" value="Mozilla/5.0 OpenNDF/1.6.6 Android" />
</widget>
......@@ -2,10 +2,10 @@
#pour etre sur d'avoir les plugins ope
for plugin in cordova-plugin-advanced-http cordova-plugin-app-version cordova-plugin-camera cordova-plugin-console cordova-plugin-crop cordova-plugin-device cordova-plugin-file cordova-plugin-file-opener2 cordova-plugin-fullscreen cordova-plugin-inappbrowser cordova-plugin-insomnia cordova-plugin-network-information cordova-plugin-whitelist cordova-plugin-wkwebview-file-xhr cordova-sqlite-storage
for plugin in cordova-plugin-advanced-http cordova-plugin-app-version cordova-plugin-camera cordova-plugin-console cordova-plugin-crop cordova-plugin-device cordova-plugin-file cordova-plugin-file-opener2 cordova-plugin-fullscreen cordova-plugin-inappbrowser cordova-plugin-insomnia cordova-plugin-network-information cordova-plugin-whitelist cordova-plugin-wkwebview-file-xhr
do
cordova plugin rm $plugin
cordova plugin add $plugin
cordova plugin rm $plugin
cordova plugin add $plugin
done
#plugin special non dispo dans les depots npm
......
......@@ -286,53 +286,7 @@
// storeConfig.createIndex('value', 'value', { unique: false });
myDebug("SQL : create config ok");
storeConfig.transaction.oncomplete = function (event) {
//Migration des données depuis SQLite ?
if (typeof window.sqlitePlugin != 'undefined') {
globalDB = window.sqlitePlugin.openDatabase({
name: 'doliscan.db',
location: 'default',
androidDatabaseProvider: 'system'
}, function () {
myDebug("SQL : migration 1");
$('#loadingStep').text('Data Migration 1');
globalDB.readTransaction(function (t) {
$('#loadingStep').text('Data Migration 2');
myDebug("SQL : select ...");
t.executeSql('SELECT * FROM config WHERE value IS NOT NULL;', [],
function (tx, rs) {
let nbRes = rs.rows.length;
// myDebug("SQL : select * from config -> " + nbRes);
let i = 0;
for (i = 0; i < nbRes; i++) {
let k = rs.rows.item(i).key;
let v = rs.rows.item(i).value;
//Mise a jour uniquement si non vide
if (v !== null && v != "") {
// localStorage.setItem(k, v);
localStoreData(k, v);
myDebug(' (c) SQL select localStorage ' + k + ' -> ' + v);
}
else {
myDebug(' (c) SQL select localStorage ' + k + ' -> null on ne fait donc pas le localStorage :-)');
}
}
//le SQL s'est déroulé ...
myDebug("SQL : read OK");
$('#loadingStep').text('Data Migration 3a');
switchLoginOrMenu();
}, function (tx, error) {
myDebug(" SQL Error " + error.message);
$('#loadingStep').text('Data Migration 3b');
switchLoginOrMenu();
});
});
$('#loadingStep').text('Data Migration 4');
myDebug("SQL : end data migration");
});
}
$('#loadingStep').text('Etape 5a');
switchLoginOrMenu();
}
......
......@@ -2,7 +2,7 @@
* (c) Éric Seigne <eric.seigne@cap-rel.fr> - 2019-2020 - GNU AGPLv3
* full source code in src/ subfolder, this file is minifyed
*/
var globalDevMode=false;var globalMyCamera;var globalpictureSource;var globaldestinationType;var globalNetworkResponse=Date.now();var globalCurrentPage="";var globalCurrentTitle="";var globalDB=null;var globalIndexDB=null;var databaseEngine='IndexDB';var databaseName='doliscanDB';var databaseVersion=1;var switchLoginOrMenuNb=0;var globalTenMinuts=60*10*1000;var globalCompatibleWithAPIVersion=4;var globalDoliScanDomain="";var globalLastInsertId="";var globalSyncInProgress=false;var globalPictureFileName="";var globalAppVersion="1.6.6";var dataLDF="";var dataIK="";var globalMyNavigator=undefined;var globalResumable=undefined;var globalProgressBar=undefined;var globalTypeFrais="";var globalVehiculeEd=undefined;var globalSrvKeys=['email','api_token','firstname','name','adresse','cp','ville','pays','send_copy_to','compta_email','compta_ik','compta_peage','compta_hotel','compta_train','compta_carburant','compta_taxi','compta_restauration','compta_divers','compta_compteperso','compta_tvadeductible','official_app_version','official_app_message','mode_simple'];function errorHandlerCustomFile(title,message){myDebug('errorHandlerCustomFile : '+title+' -- message follow:');myDebug(message);}
var globalDevMode=true;var globalMyCamera;var globalpictureSource;var globaldestinationType;var globalNetworkResponse=Date.now();var globalCurrentPage="";var globalCurrentTitle="";var globalDB=null;var globalIndexDB=null;var databaseEngine='IndexDB';var databaseName='doliscanDB';var databaseVersion=1;var switchLoginOrMenuNb=0;var globalTenMinuts=60*10*1000;var globalCompatibleWithAPIVersion=4;var globalDoliScanDomain="";var globalLastInsertId="";var globalSyncInProgress=false;var globalPictureFileName="";var globalAppVersion="1.6.6";var dataLDF="";var dataIK="";var globalMyNavigator=undefined;var globalResumable=undefined;var globalProgressBar=undefined;var globalTypeFrais="";var globalVehiculeEd=undefined;var globalSrvKeys=['email','api_token','firstname','name','adresse','cp','ville','pays','send_copy_to','compta_email','compta_ik','compta_peage','compta_hotel','compta_train','compta_carburant','compta_taxi','compta_restauration','compta_divers','compta_compteperso','compta_tvadeductible','official_app_version','official_app_message','mode_simple'];function errorHandlerCustomFile(title,message){myDebug('errorHandlerCustomFile : '+title+' -- message follow:');myDebug(message);}
function loadCustomCSS(){if((typeof cordova=='undefined')||(cordova===null)||(cordova=="")){return;}
if((typeof cordova.file=='undefined')||(cordova.file===null)||(cordova.file=="")){return;}
if((typeof cordova.file.cacheDirectory=='undefined')||(cordova.file.cacheDirectory===null)||(cordova.file.cacheDirectory=="")){return;}
......@@ -182,7 +182,7 @@ function carouselPassword(){let carousel=document.getElementById('carousel');if(
function updateLocalUserFromServerSuccessMessage(code){ons.notification.alert('Données sauvegardées, vous pouvez revenir au menu principal...',{title:"Succès #1"});}
function updateLocalUserFromServerSuccess(resultBool){if(globalMyNavigator===undefined){globalMyNavigator=document.getElementById('myNavigator');}
if(globalMyNavigator!==undefined){gotoPage('menu.html');}}
function updateLocalUserFromServer(result,callback){myDebug("=== updateLocalUserFromServer / "+callback+"===");removeCustomFiles();let ret=false;if((typeof result!='undefined')&&(result!==null)&&(result!="")){for(let key of globalSrvKeys){myDebug("updateLocalUserFromServer: on cherche "+key);if((typeof result.data!='undefined')&&(result.data!==null)&&(result.data!="")){if((typeof result.data[key]!='undefined')&&(result.data[key]!==null)&&(result.data[key]!="")){myDebug(" valeur non nulle on la stocke : "+key+" = "+result.data[key]);localStoreData(key,result.data[key]);ret=true;}}
function updateLocalUserFromServer(result,callback){myDebug("=== updateLocalUserFromServer / "+callback+"===");let ret=false;if((typeof result!='undefined')&&(result!==null)&&(result!="")){for(let key of globalSrvKeys){myDebug("updateLocalUserFromServer: on cherche "+key);if((typeof result.data!='undefined')&&(result.data!==null)&&(result.data!="")){if((typeof result.data[key]!='undefined')&&(result.data[key]!==null)&&(result.data[key]!="")){myDebug(" valeur non nulle on la stocke : "+key+" = "+result.data[key]);localStoreData(key,result.data[key]);ret=true;}}
else{if((typeof result[key]!='undefined')&&(result[key]!==null)&&(result[key]!="")){localStoreData(key,result[key]);ret=true;}}}
myDebug(" on cherche si on a des vehicules ...");myDebug(result.vehicules);if((typeof result.vehicules!='undefined')&&(result.vehicules!==null)&&(result.vehicules!="")){myDebug(" on a des vehicules ...");localStoreData("vehicules",null);localStoreData("vehiculesPro",null);result.vehicules.forEach((v,key)=>{let storageKey="vehiculesPro"
if(v.is_perso)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment