Commit 40e1ee67 authored by Troy A. Griffitts's avatar Troy A. Griffitts

Fixed double SWORD reInit call causing trouble and fixed "Please wait..."...

Fixed double SWORD reInit call causing trouble and fixed "Please wait..." messages to show better before work is started
parent 4eea5eb4
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.crosswire.bishop" version="1.5.0" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<widget id="org.crosswire.bishop" version="1.5.1" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools">
<name>Bishop</name>
<description>
A Bible Study App from CrossWire
......
var app = {
version: '1.5.0', // change version here and in config.xml, near top
version: '1.5.1', // change version here and in config.xml, near top
backFunction: null,
enableBibleSync : true,
enableGospelParallels : true,
......@@ -741,29 +741,40 @@ console.log('setting default app theme: ' + app.defaultTheme);
});
},
cacheModsFromSWORD : function(callback) {
console.log('******************** getting new mod info list ********************************');
SWORD.mgr.getModInfoList(function(mods) {
app.mods = mods;
var enrichMods = function(i) {
if (i >= app.mods.length) return (callback) ? callback() : false;
SWORD.mgr.getModuleByName(app.mods[i].name, function(mod) {
if (!mod) {
console.log('******************* serious error has occured. Could not lookup module: ' + app.mods[i].name);
return enrichMods(++i);
}
mod.getConfigEntry('Description_'+app.getAppLocale(), function(descLocale) {
app.mods[i].descriptionLocale = descLocale;
mod.getConfigEntry('ShortPromo_'+app.getAppLocale(), function(spLocale) {
app.mods[i].shortPromoLocale = spLocale;
enrichMods(++i);
});
});
});
};
console.log('******************** enriching new mod info list ********************************');
enrichMods(0);
});
},
reInitSWORD : function(callback) {
console.log('******************** SWORD reInit ********************************');
// until we have a SWORD.mgr.reInit
// setting an extraConfig forces a re-init and will pick up newly copied resources
var buffer = '[bishop]\n';
buffer += 'reInitOn=' + new Date();
console.log('******************** Adding extra config to force reinit ********************************');
SWORD.mgr.addExtraConfig(buffer, function() {
SWORD.mgr.getModInfoList(function(mods) {
app.mods = mods;
var enrichMods = function(i) {
if (i >= app.mods.length) return (callback) ? callback() : false;
SWORD.mgr.getModuleByName(app.mods[i].name, function(mod) {
mod.getConfigEntry('Description_'+app.getAppLocale(), function(descLocale) {
app.mods[i].descriptionLocale = descLocale;
mod.getConfigEntry('ShortPromo_'+app.getAppLocale(), function(spLocale) {
app.mods[i].shortPromoLocale = spLocale;
enrichMods(++i);
});
});
});
};
enrichMods(0);
});
app.cacheModsFromSWORD(callback);
});
},
......
......@@ -113,9 +113,9 @@ var installMgr = {
$('#client').scrollTop(installMgr.lastScrollTop);
installMgr.lastScrollTop = 0;
return (callback) ? callback() : false;
}, 20);
}, 200);
});
}, 20);
}, 200);
});
},
setCipher: function(modName, cipher, callback) {
......@@ -255,8 +255,15 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
// only refesh source list if no subsequent processing callback
if (callback) callback();
else {
app.reInitSWORD(function() {
$('#client').html('<h2 data-english="Please wait...">Please wait...</h2>');
app.setAppLocale(false, function() {
setTimeout(function() {
// don't reinit SWORD as this is forced after install remote module
// but we do need to update our cache and enrich our mod info list
app.cacheModsFromSWORD(function() {
installMgr.modSourceChanged();
}, true);
}, 500);
});
}
}
......@@ -265,7 +272,7 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
});
});
});
}, 100);
}, 200);
},
setDisclaimerAccepted: function() {
installMgr.isDisclaimerAccepted = true;
......@@ -335,6 +342,9 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
});
},
showRemoteModules: function(sourceName, callback) {
$('#client').html('<h2 data-english="Please wait...">Please wait...</h2>');
app.setAppLocale(false, function() {
setTimeout(function() {
SWORD.installMgr.getRemoteModInfoList(sourceName, function(modInfoList) {
var enrichMods = function(i) {
if (i >= modInfoList.length) {
......@@ -352,6 +362,8 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
};
enrichMods(0);
});
}, 200);
});
},
modSourceChanged: function() {
var sourceName = $('#modSource').val();
......@@ -411,7 +423,7 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
setTimeout(function() {
$('#client').scrollTop(0);
}, 20);
}, 200);
return;
}
SWORD.installMgr.getRemoteModInfoList(srcs[i], function(sourceMods) {
......@@ -479,6 +491,6 @@ console.log('**** installMgr.installModule. disclaimer accepted. installing modu
});
});
});
}, 100);
}, 200);
},
};
Markdown is supported
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