Commit c1894ab2 authored by Troy A. Griffitts's avatar Troy A. Griffitts

Fixed permissions on newer Android devices. Reverted https to http for INTF...

Fixed permissions on newer Android devices. Reverted https to http for INTF calls. Added vertical margin for book/chapter select buttons.
parent d9537aec
......@@ -107,7 +107,7 @@ refreshiosimages:
cordova-icon --icon=res/swordlogo-1024.png
cordova-splash --splash=res/swordlogo-1024.png
setup: clearplugins refreshplatform addplugins updatelocales
setup: clearplugins refreshplatform addplugins refreshlocales
# one last refresh platform to get the plugin patches deployed
make refreshplatform
......@@ -117,6 +117,7 @@ setup: clearplugins refreshplatform addplugins updatelocales
#
addplugins:
cordova plugin add cordova-plugin-inappbrowser || true
cordova plugin add cordova-plugin-android-permissions || true
cordova plugin add cordova-plugin-file || true
cordova plugin add cordova-plugin-globalization || true
cordova plugin add cordova-custom-config || true
......@@ -137,6 +138,7 @@ addplugins:
clearplugins:
cordova plugin remove cordova-plugin-inappbrowser || true
cordova plugin remove cordova-plugin-file || true
cordova plugin remove cordova-plugin-android-permissions || true
cordova plugin remove cordova-plugin-globalization || true
cordova plugin remove cordova-plugin-whitelist || true
cordova plugin remove cordova-custom-config || true
......@@ -149,7 +151,7 @@ clearplugins:
cordova plugin remove com-sarriaroman-photoviewer || true
cordova plugin remove cordova-plugin-x-toast || true
updatelocales:
refreshlocales:
rm -rf www/bundledResources/locales.d
mkdir -p www/bundledResources/locales.d
cd www/bundledResources/uilocales.d/; for i in $$(ls); do cp -f ../../../../sword/locales.d/$$i ../locales.d/; done || true
......
<?xml version='1.0' encoding='utf-8'?>
<widget id="org.crosswire.bishop" version="1.3.4" 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.3.5" 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
......@@ -53,6 +53,7 @@
<icon height="40" src="res/swordlogo-40.png" width="40" />
</platform>
<plugin name="cordova-plugin-file" />
<plugin name="cordova-plugin-android-permissions" />
<plugin name="cordova-plugin-inappbrowser" />
<plugin name="cordova-plugin-globalization" />
<plugin name="cordova-custom-config" />
......
......@@ -432,7 +432,10 @@ table.nobottom td, table.nobottom th {
border: 1px solid #000;
color: #EEEEEE;
text-align: center;
margin:0px;
margin-left:0px;
margin-right:0px;
margin-top:1px;
margin-bottom:1px;
}
.ntBook {
......
......@@ -48,6 +48,7 @@ console.log('using localFixup instead of real SWORD plugin');
getAvailableLocales : function(callback) { callback([]); },
setJavascript : function(x) { },
translate : function(x, y, callback) { callback?callback(x):y(x); },
setGlobalOption : function(x, y, callback) { if (callback) callback(); },
setDefaultLocale : function(x, callback) { callback(); }
},
installMgr : {
......@@ -96,9 +97,10 @@ console.log('clicked key: ' + key);
}
return false;
},
activeWindow : null,
initialize: function() {
initialize: function() {
// for old browsers which don't yet support string.startsWith
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
......@@ -113,6 +115,7 @@ if (typeof cordova == 'undefined') app.localFixup(); else console.log('Using rea
$(document).on('click','a', app.handleAnchorClickEvents);
$(document).scroll(app.preventBodyScroll);
},
handleIntent: function(intent) {
console.log('**** Received Intent. Object: ' + JSON.stringify(intent));
if (intent.extras) {
......@@ -161,13 +164,14 @@ console.log('**** mod doesn\'t exist: ' + mods[i]);
document.addEventListener("menubutton", function() { app.currentWindow.openMenu(); }, false);
},
onDeviceReady: function() {
var afterPermissions = function() {
app.noCSSTransitions = (typeof device !== 'undefined' && device.platform && device.platform == 'Android' && device.version.startsWith('4.'));
app.bindEvents();
app.main();
window.addEventListener("message", function(event) {
console.log('received message event: ' + event);
var msg = event.data;
console.log('message: ' + msg);
console.log('message: ' + msg);
if (msg.action == 'preparingImage') {
SWORD.mgr.translate('Preparing image for image viewer...', function(t) {
window.plugins.toast.showLongCenter(t);
......@@ -184,25 +188,25 @@ console.log('message: ' + msg);
// showImageURL for remote images doesn't seem to work
if (!msg.imageData) {
console.log('showing image by url: ' + msg.imageURL);
console.log('showing image by url: ' + msg.imageURL);
SWORD.mgr.translate('Preparing image for image viewer...', function(t) {
window.plugins.toast.showLongCenter(t);
});
imageTools.getImageData(msg.imageURL, function(imageData) {
SWORD.mgr.translate('Loading image into image viewer...', function(t) {
window.plugins.toast.showLongCenter(t);
console.log('showing image with showImageBase64: ' + imageData.substring(0,5)+'...');
console.log('showing image with showImageBase64: ' + imageData.substring(0,5)+'...');
PhotoViewer.show('data:image/png;base64,'+imageData, msg.name, options);
// FullScreenImage.showImageBase64(imageData, msg.name, 'png');
// FullScreenImage.showImageBase64(imageData, msg.name, 'png');
});
});
}
else {
SWORD.mgr.translate('Loading image into image viewer...', function(t) {
window.plugins.toast.showLongCenter(t);
console.log('showing image by data: ' + msg.imageData.substring(0,10));
console.log('showing image by data: ' + msg.imageData.substring(0,10));
PhotoViewer.show('data:image/png;base64,'+msg.imageData, msg.name, options);
// FullScreenImage.showImageBase64(msg.imageData, msg.name, msg.type);
// FullScreenImage.showImageBase64(msg.imageData, msg.name, msg.type);
});
}
}
......@@ -220,6 +224,16 @@ console.log('showing image by data: ' + msg.imageData.substring(0,10));
}
);
}
};
// before anything, ask for permissions
console.log('*********** checking permissions ***********************');
cordova.plugins.permissions.checkPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, function(permStatus) {
if (!permStatus.hasPermission) {
console.log('*********** asking for permissions ***********************');
cordova.plugins.permissions.requestPermission(cordova.plugins.permissions.WRITE_EXTERNAL_STORAGE, afterPermissions, afterPermissions);
}
else afterPermissions();
});
},
handleBackButton: function() {
if (app.backFunction) {
......@@ -413,6 +427,7 @@ console.log('closing topbar');
app.updateUIKeyText();
SWORD.mgr.getModInfoList(function(mods) {
app.mods = mods;
console.log('********* setting app.mods = ' + JSON.stringify(app.mods));
app.setupMenu(function() {
var showingGospelParallels = window.localStorage.getItem('showingGospelParallels');
......@@ -515,7 +530,7 @@ console.log('loading: showingGospelParallels: ' + showingGospelParallels);
getCurrentMod3: function() {
return window.localStorage.getItem('currentMod3');
},
getCurrentKey: function() { var v = window.localStorage.getItem('currentKey'); if (!v) v = "James 1:19"; return v; },
getCurrentKey: function() { var v = window.localStorage.getItem('currentKey'); if (!v || v == 'undefined') v = "James 1:19"; return v; },
_lastVerseKey: null,
updateUIKeyText: function() {
......@@ -573,15 +588,22 @@ console.log('****************** ------------- ***********************');
// first time check
var firstCheck = function() {
SWORD.mgr.getModInfoList(function(mods) {
app.mods = mods;
console.log('********* setting app.mods = ' + JSON.stringify(app.mods));
console.log('firstTime check. mods.length: ' + mods.length);
app.firstTime = !mods.length;
console.log('app.firstTime: ' + app.firstTime);
var prefBibleExists = $.grep(mods, function(m) { return m.name == app.preferredBible; }).length;
console.log('*********** prefBibleExists: ' + prefBibleExists);
var mainMod = app.getCurrentMod1();
console.log('*********** mainMod: ' + mainMod);
var mainModIsBible = $.grep(mods, function(m) { return m.name == mainMod && m.category == SWORD.CATEGORY_BIBLES; }).length;
var modBibles = $.grep(mods, function(m) { return m.category == SWORD.CATEGORY_BIBLES; });
if (!mainModIsBible && modBibles.length) app.setCurrentMod1(prefBibleExists ? app.preferredBible : bibleMods[0].name);
app.show();
});
};
app.getLastAppVersion(function(lastVersion) {
if (lastVersion != app.version) {
var installBundledResources = function() {
app.copyBundledResources('', '', function() {
// since we currently just nuke any top-level bundled resource folder, we can do this for mods.d/
// and modules/ or else other installed modules would be killed. We've added an exception for these
......@@ -604,9 +626,13 @@ console.log('app.firstTime: ' + app.firstTime);
});
});
});
};
app.getLastAppVersion(function(lastVersion) {
if (lastVersion != app.version) {
installBundledResources();
}
else firstCheck();
});
},
setLastAppVersion : function(callback) {
......@@ -658,6 +684,7 @@ console.log('ERROR copying: '+JSON.stringify(err));
};
console.log('checking to see if destination already exists: '+destBundle.toURL() + ':'+entries[i].name);
destBundle.getDirectory(entries[i].name, {create:false,exclusive:false}, function(existing) {
console.log('existing: ' + JSON.stringify(existing));
// let's not remove module files if we are delivering with preinstalled mods
// later, it might be good to have some logic which doesn't overwrite files which
// might be newer / updated
......@@ -668,6 +695,7 @@ console.log('removing: '+entries[i].name + '['+existing.fullPath+']');
}
else copy();
}, function() {
console.log('destination not retrievable. trying to copy...');
copy();
});
};
......@@ -885,6 +913,7 @@ console.log('************ received ' + locales.length + ' locales.');
buildLocaleNames(0, function() {
if (!mainMod && mods.length) {
console.log('*********** mods : ' + JSON.stringify(mods));
var prefBibleExists = $.grep(mods, function(m) { return m.name == app.preferredBible; }).length;
console.log('*********** prefBibleExists: ' + prefBibleExists);
app.setCurrentMod1(prefBibleExists ? app.preferredBible : mods[0].name);
......@@ -1735,6 +1764,8 @@ console.log('About: showing modules, count: ' + app.mods.length);
var ciphered = app.mods[i].cipherKey !== undefined;
t += '<h4>' + app.mods[i].name + ' - ' + app.mods[i].description + '<button id="modAboutButton_' + app.mods[i].name + '" style="float:right;" onclick="event.stopPropagation(); app.showModuleAbout(\''+app.mods[i].name+'\', \'modAboutDiv_'+app.mods[i].name+'\', this); return false;">About</button></h4>' + (ciphered?('<button onclick="app.changeCipher(\''+app.mods[i].name+'\', \'' + app.mods[i].cipherKey + '\'); return false;">CipherKey: ' + app.mods[i].cipherKey + '</button><br/><br/>'):'') + '<div id="modAboutDiv_'+app.mods[i].name+'"></div>';
}
t += '<br/>';
t += '<br/>';
t += '</div>';
t += '<br/>';
t += '<br/>';
......
......@@ -363,7 +363,7 @@ console.log('*** wordStudy begin');
detail : 'page',
limit : limit
};
var url = 'https://ntvmr.uni-muenster.de/community/vmr/api/metadata/liste/search/';
var url = 'http://ntvmr.uni-muenster.de/community/vmr/api/metadata/liste/search/';
console.log('****** Making request to: ' + url +'; params: '+JSON.stringify(postData));
SWORD.httpUtils.makeRequest(url, $.param(postData), function(o) {
console.log('****** Returned from request to: ' + url);
......@@ -403,7 +403,7 @@ console.log('****** iterating pages.');
if ($(this).find("transcription").length) {
transURL = $(this).find('transcription').attr("uri");
}
var mssURL = 'https://ntvmr.uni-muenster.de/manuscript-workspace?docID=' + $(m).attr("docID")+"&pageID="+$(this).attr("pageID");
var mssURL = 'http://ntvmr.uni-muenster.de/manuscript-workspace?docID=' + $(m).attr("docID")+"&pageID="+$(this).attr("pageID");
//t += '<tr><td><a href="'+ mssURL + '" target="NTVMR">' + $(m).attr("gaNum") + '</a></td>';
t += '<tr><td>' + $(m).attr("gaNum").replace(/\([^)]*\)/g, '') + '</td>';
t += '<td>' + $(m).find("originYear").text() + '</td>';
......@@ -427,7 +427,7 @@ console.log('****** iterating pages.');
});
console.log('****** done iterating manuscripts.');
t += '</tbody></table>';
t += '<div class="copyLine"><br/><span data-english="This dataset is by no means exhaustive and is growing rapidly. Check back soon for more results.">This dataset is by no means exhaustive and is growing rapidly. Check back soon for more results.</span><br/><br/><span data-english="Courtesy of">Courtesy of</span> <a href="https://egora.uni-muenster.de/intf/index_en.shtml">Institut für Neutestamentliche Textforschung</a></div>';
t += '<div class="copyLine"><br/><span data-english="This dataset is by no means exhaustive and is growing rapidly. Check back soon for more results.">This dataset is by no means exhaustive and is growing rapidly. Check back soon for more results.</span><br/><br/><span data-english="Courtesy of">Courtesy of</span> <a href="http://egora.uni-muenster.de/intf/index_en.shtml">Institut für Neutestamentliche Textforschung</a></div>';
console.log('****** setting result to UI.');
t += '<br/>';
t += '<br/>';
......@@ -473,7 +473,7 @@ console.log('variantGraph showing...');
format : 'graph'
}
var url = 'https://ntvmr.uni-muenster.de/community/vmr/api/collate/';
var url = 'http://ntvmr.uni-muenster.de/community/vmr/api/collate/';
console.log('requesting from INTF...');
SWORD.httpUtils.makeRequest(url, $.param(postData), function(o) {
console.log('received response from INTF...');
......@@ -504,7 +504,7 @@ console.log('variantGraph showing...');
regUserID: 'intfadmin',
format : 'atable'
}
var url = 'https://ntvmr.uni-muenster.de/community/vmr/api/collate/';
var url = 'http://ntvmr.uni-muenster.de/community/vmr/api/collate/';
SWORD.httpUtils.makeRequest(url, $.param(postData), function(o) {
$(target).html(o);
});
......@@ -514,8 +514,8 @@ console.log('variantGraph showing...');
if (!target) target = '#client';
verseStudy.closeMenus();
var verseKey = app.getCurrentVerseKey();
// var url = 'https://apokalypse.isbtf.de/community/vmr/api/variant/apparatus/get/?format=html&indexContent='+verseKey.osisRef;
var url = 'https://ntvmr.uni-muenster.de/community/vmr/api/variant/apparatus/get/?format=html&includeBaseline=ECM&indexContent='+verseKey.osisRef;
// var url = 'http://apokalypse.isbtf.de/community/vmr/api/variant/apparatus/get/?format=html&indexContent='+verseKey.osisRef;
var url = 'http://ntvmr.uni-muenster.de/community/vmr/api/variant/apparatus/get/?format=html&includeBaseline=ECM&indexContent='+verseKey.osisRef;
$(target).html('<iframe class="client decmcontainer" src="'+url+'"/>');
},
......
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