Add update password setting, add animation toggle option,

embed Roboto font, remove extra font files, 
hide splashscreen after deviceready, 
add source credits and privacy policy viewers
Framework7
Skylar Ittner 7 years ago
parent 46b00a08b8
commit 6e5f45ef0a

@ -57,12 +57,13 @@
<splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536" />
</platform>
<preference name="SplashScreenDelay" value="3000" />
<preference name="AutoHideSplashScreen" value="false" />
<engine name="android" spec="^6.2.3" />
<engine name="browser" spec="^4.1.0" />
<plugin name="cordova-plugin-console" spec="git+https://github.com/apache/cordova-plugin-console.git" />
<plugin name="cordova-plugin-device" spec="git+https://github.com/apache/cordova-plugin-device.git" />
<plugin name="cordova-plugin-dialogs" spec="git+https://github.com/apache/cordova-plugin-dialogs.git" />
<plugin name="cordova-plugin-headercolor" spec="^1.0.0" />
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
<plugin name="cordova-plugin-splashscreen" spec="git+https://github.com/apache/cordova-plugin-splashscreen.git" />
<plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
<plugin name="cordova-plugin-whitelist" spec="^1.3.2" />

@ -5,4 +5,5 @@ cordova-plugin-console=https://github.com/apache/cordova-plugin-console.git
cordova-plugin-whitelist=https://github.com/apache/cordova-plugin-whitelist.git
phonegap-plugin-barcodescanner=https://github.com/phonegap/phonegap-plugin-barcodescanner.git
cordova-plugin-statusbar=https://github.com/apache/cordova-plugin-statusbar.git
cordova-plugin-headercolor=https://github.com/tomloprod/cordova-plugin-headercolor.git
cordova-plugin-headercolor=https://github.com/tomloprod/cordova-plugin-headercolor.git
cordova-plugin-inappbrowser=https://github.com/apache/cordova-plugin-inappbrowser.git

@ -8,13 +8,13 @@
"license": "netsyms-business-license",
"dependencies": {
"cordova-android": "^6.2.3",
"cordova-browser": "^4.1.0",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "git+https://github.com/apache/cordova-plugin-console.git",
"cordova-plugin-device": "git+https://github.com/apache/cordova-plugin-device.git",
"cordova-plugin-dialog": "0.0.1",
"cordova-plugin-dialogs": "git+https://github.com/apache/cordova-plugin-dialogs.git",
"cordova-plugin-headercolor": "^1.0.0",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-splashscreen": "git+https://github.com/apache/cordova-plugin-splashscreen.git",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-whitelist": "^1.3.2",
@ -29,11 +29,11 @@
"cordova-plugin-dialogs": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-headercolor": {}
"cordova-plugin-headercolor": {},
"cordova-plugin-inappbrowser": {}
},
"platforms": [
"android",
"browser"
"android"
]
}
}

@ -1,4 +1,4 @@
@import url("https://fonts.googleapis.com/css?family=Roboto:300,400,500,700");/*!
@import url("roboto-font.css");/*!
* bootswatch v3.3.7
* Homepage: http://bootswatch.com
* Copyright 2012-2017 Thomas Park

File diff suppressed because one or more lines are too long

@ -0,0 +1,80 @@
/*
Roboto font family
Downloaded from Google Web Fonts
Apache 2.0 License
*/
/* Normal */
/*@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/Roboto-Thin.ttf) format('truetype');
}*/
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/Roboto-Light.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/Roboto-Regular.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/Roboto-Medium.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/Roboto-Bold.ttf) format('truetype');
}
/*@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/Roboto-Black.ttf) format('truetype');
}*/
/* Italic */
/*@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 100;
src: local('Roboto Thin Italic'), local('Roboto-ThinItalic'), url(../fonts/Roboto-ThinItalic.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 300;
src: local('Roboto Light Italic'), local('Roboto-LightItalic'), url(../fonts/Roboto-LightItalic.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 400;
src: local('Roboto Italic'), local('Roboto-Italic'), url(../fonts/Roboto-Italic.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 500;
src: local('Roboto Medium Italic'), local('Roboto-MediumItalic'), url(../fonts/Roboto-MediumItalic.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 700;
src: local('Roboto Bold Italic'), local('Roboto-BoldItalic'), url(../fonts/Roboto-BoldItalic.ttf) format('truetype');
}
@font-face {
font-family: 'Roboto';
font-style: italic;
font-weight: 900;
src: local('Roboto Black Italic'), local('Roboto-BlackItalic'), url(../fonts/Roboto-BlackItalic.ttf) format('truetype');
}*/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 434 KiB

@ -1,5 +1,13 @@
userinfo = null;
$(document).ready(function () {
document.addEventListener("deviceready", function () {
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#1976d2");
}
// Enable/disable jQuery animations depending on user preference
$.fx.off = !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true");
/* Fade out alerts */
$(".alert .close").click(function (e) {
$(this).parent().fadeOut("slow");
@ -12,12 +20,7 @@ $(document).ready(function () {
} else {
openscreen("setup1");
}
});
document.addEventListener("deviceready", function () {
if (cordova.platformId == 'android') {
StatusBar.backgroundColorByHexString("#1976d2");
}
setTimeout(navigator.splashscreen.hide, 1000);
}, false);
/**
@ -56,9 +59,9 @@ function getuserinfo(callback) {
*/
function openscreen(screenname, effect) {
if (effect === 'FADE') {
$('#content-zone').fadeOut('slow', function () {
$('#content-zone').fadeOut(300, function () {
$('#content-zone').load("views/" + screenname + ".html", function () {
$('#content-zone').fadeIn('slow');
$('#content-zone').fadeIn(300);
});
});
} else if (effect === 'SLIDE') {
@ -97,9 +100,10 @@ function openfragment(fragment, target, effect) {
* "settings" for settings, "app" for a custom title, or anything else for
* a simple one.
* @param String title The title to show if type == "app"
* @param String returnscreen Where to go back to. Defaults to "home".
* @returns {undefined}
*/
function setnavbar(type, title) {
function setnavbar(type, title, returnscreen) {
var navbar = $('#navbar-header');
if (type == false) {
$('#navbar').css('display', 'none');
@ -113,15 +117,21 @@ function setnavbar(type, title) {
}
$('#navbar').css('display', 'initial');
$('#content-zone').css('margin-top', '75px');
if (returnscreen === undefined) {
returnscreen = "home";
_returnscreen = null;
} else {
_returnscreen = returnscreen;
}
switch (type) {
case "home":
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right" onclick="openscreen(\'settings\')"><img src="icons/ic_settings.svg" alt="" /></span>');
navbar.html('<span class="navbar-brand" style="color: white;">Business</span><span class="navbar-brand pull-right" onclick="openscreen(\'settings\', \'FADE\')"><img src="icons/ic_settings.svg" alt="" /></span>');
break;
case "settings":
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand" style="color: white;" onclick="openscreen(\'home\')">Settings</span>');
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand" style="color: white;" onclick="openscreen(\'home\')">Settings</span>');
break;
case "app":
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand" style="color: white;" onclick="openscreen(\'home\')">' + title + '</span>');
navbar.html('<span class="navbar-brand pull-left" style="color: white;" onclick="openscreen(\'home\', \'FADE\')"><img src="icons/ic_arrow-back.svg" /></span><span class="navbar-brand" style="color: white;" onclick="openscreen(\'' + returnscreen + '\')">' + title + '</span>');
break;
default:
navbar.html('<span class="navbar-brand" style="color: white;">Business</span>');
@ -141,8 +151,12 @@ function setnavbar(type, title) {
* @returns {undefined}
*/
function openapp(id, api, url, icon, title, injectcode, shownavbar) {
$('#content-zone').load("views/app.html", function () {
launchapp(id, api, url, icon, title, injectcode, shownavbar);
$('#content-zone').fadeOut(300, function () {
$('#content-zone').load("views/app.html", function () {
$('#content-zone').fadeIn(300, function () {
launchapp(id, api, url, icon, title, injectcode, shownavbar);
});
});
});
}
@ -168,9 +182,22 @@ function closemodal(modalselector) {
$(modalselector).modal(hide);
}
function restartApplication() {
navigator.splashscreen.show();
// We're doing the timeout so we don't run afoul of server-side rate limiting
setTimeout(function () {
window.location = "index.html";
}, 3000);
}
// Handle back button to close things
document.addEventListener("backbutton", function (event) {
if (localStorage.getItem("setupcomplete")) {
openscreen("home");
if (_returnscreen != null) {
openscreen(_returnscreen, "FADE");
_returnscreen = null;
} else {
openscreen("home", "FADE");
}
}
}, false);

@ -63,6 +63,7 @@ function togglemenu() {
}
$(document).ready(function () {
$.fx.off = %%JQUERYFXOFF%%;
var pages = $('#navbar-collapse .navbar-nav').html();
var user = $('#navbar-collapse .navbar-right').html();
//$('body').append("<div id='swipe-nav'><div id='swipe-header'></div>\n<ul id='swipe-pages'>" + pages + "</ul>\n<ul id='swipe-user'>" + user + "</ul></div>");

@ -32,6 +32,7 @@
$.get("css/sidemenu.css", function (style) {
$('#appframe').contents().find('head').append("<style>" + style + "</style>");
$.get("js/sidemenu.js", function (script) {
script = script.replace("%%JQUERYFXOFF%%", !(localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true"));
script = script.replace("%%USERNAME%%", userinfo.realname);
script = script.replace("%%LOGO%%", icon);
$('#appframe').contents().find('body').append("<script>" + script + "<\/script>");

File diff suppressed because it is too large Load Diff

@ -1,14 +1,30 @@
<div class="list-group">
<div class="list-group-item" onclick="openportal()">
<b>Open Portal</b>
<p>Manage your account.</p>
<b>Open Portal</b>
<p>Manage your account.</p>
</div>
</div>
<div class="list-group">
<div class="list-group-item" onclick="updatepassword()">
<b>Update Password</b>
<p>Enter your new password if you changed it from Portal.</p>
</div>
<div class="list-group-item" onclick="deleteall()">
<b>Log out and unpair</b>
<p>Forget all stored user data and open the setup tool.</p>
<b>Log out</b>
<p>Forget all cached account data (including sync key) and open the setup tool.</p>
</div>
</div>
<div class="list-group">
<div class="list-group-item" onclick="toggleAnimations()">
<b>Turn animations <span id="animations_offon_label">off</span></b>
</div>
<div class="list-group-item" onclick="openscreen('credits', 'FADE')">
<b>Credits and Open Source</b>
</div>
<div class="list-group-item" onclick="cordova.InAppBrowser.open('https://biz.netsyms.com/mobile-privacy-policy/', '_blank', 'location=yes');">
<b>Privacy Policy</b>
</div>
</div>
@ -16,24 +32,77 @@
setnavbar("settings");
function deleteall() {
navigator.notification.confirm("Really wipe user data? You will need to resync the app with Portal to use it again.", function (result) {
if (result != 1) {
return;
}
// Wipe localStorage
localStorage.removeItem("setupcomplete");
localStorage.removeItem("username");
localStorage.removeItem("portalurl");
localStorage.removeItem("key");
localStorage.clear();
// force-reload app
navigator.notification.alert("Connection data and credentials erased.", function () {
document.location.href = "index.html";
}, "App Reset", 'Continue');
}, "Are you sure?");
navigator.notification.confirm("Really wipe user data? You will need to resync the app with Portal to use it again.", function (result) {
if (result != 1) {
return;
}
// Wipe localStorage
localStorage.removeItem("setupcomplete");
localStorage.removeItem("username");
localStorage.removeItem("portalurl");
localStorage.removeItem("key");
localStorage.clear();
// force-reload app
navigator.notification.alert("Connection data and credentials erased.", function () {
restartApplication();
}, "App Reset", 'Continue');
}, "Are you sure?");
}
/**
* Open Portal in an iframe.
* @returns {undefined}
*/
function openportal() {
openapp("portal", "/mobile/index.php", localStorage.getItem("portalurl").replace("/mobile/index.php", ""), "/static/img/logo.svg", "Portal", false, true);
}
function toggleAnimations() {
if (localStorage.getItem("animations") === null || localStorage.getItem("animations") === "true") {
localStorage.setItem("animations", "false");
$.fx.off = true;
$('#animations_offon_label').text("on");
navigator.notification.alert("Animations turned off.", null, "Setting updated", "Dismiss");
} else {
localStorage.setItem("animations", "true");
$.fx.off = false;
$('#animations_offon_label').text("off");
navigator.notification.alert("Animations turned on.", null, "Setting updated", "Dismiss");
}
}
/**
* Prompts the user to enter their password, then checks the password and
* saves or displays an error.
* @returns {undefined}
*/
function updatepassword() {
navigator.notification.prompt("Re-enter your password.", function (results) {
if (results.buttonIndex == 1) {
$.post(localStorage.getItem("portalurl"), {
username: localStorage.getItem("username"),
key: localStorage.getItem("key"),
password: results.input1,
action: "check_password"
}, function (data) {
if (data.status === 'OK') {
localStorage.setItem("password", results.input1);
localStorage.setItem("setupcomplete", true);
navigator.notification.alert("Saved password updated.", function () {
// Reload app just to be safe
restartApplication();
}, "Success", 'Continue');
} else {
navigator.notification.alert(data.msg, null, "Error", 'Dismiss');
}
}, "json").fail(function () {
navigator.notification.alert("Could not connect to the server. Try again later.", null, "Error", 'Dismiss');
});
}
}, "Update Password", ["Save", "Cancel"]);
}
if (localStorage.getItem("animations") === "false") {
$('#animations_offon_label').text("on");
}
</script>

Loading…
Cancel
Save