From f5bf847ddaffcb2a724918306950d444d3b30dc5 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sat, 8 May 2021 17:10:23 -0600 Subject: [PATCH] Add haptic feedback --- package-lock.json | 8 +++++++- package.json | 4 +++- www/assets/js/main.js | 4 ++++ www/assets/js/platform.js | 10 ++++++++++ www/pages/addresscode.html | 6 +++--- www/pages/appointment.html | 2 +- www/pages/credits.template.html | 2 +- www/pages/home.html | 4 ++-- www/pages/loyalty.html | 4 ++-- www/pages/noticeslip.html | 12 ++++++------ www/pages/noticeslipsuccess.html | 4 ++-- www/pages/rateresult.html | 2 +- www/pages/rates.html | 4 ++-- www/pages/settings.html | 18 +++++------------- 14 files changed, 49 insertions(+), 35 deletions(-) diff --git a/package-lock.json b/package-lock.json index f488482..1274004 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "com.netsyms.helenaexpress.app", - "version": "1.3.0", + "version": "1.3.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -649,6 +649,12 @@ "resolved": "https://registry.npmjs.org/cordova-plugin-theme-detection/-/cordova-plugin-theme-detection-1.3.0.tgz", "integrity": "sha512-q7jcFTwRZmbGmb/WgRn+5EyPHLLECrFegXgUQuqpnon1gZtWuyCzVTi+6P0GACIwfMVIcinS9fEJjG5sv+3FDA==" }, + "cordova-plugin-velda-devicefeedback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/cordova-plugin-velda-devicefeedback/-/cordova-plugin-velda-devicefeedback-0.0.2.tgz", + "integrity": "sha1-ZCnduHXMrCIEpAqA6juzLAovXRo=", + "dev": true + }, "cordova-plugin-whitelist": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/cordova-plugin-whitelist/-/cordova-plugin-whitelist-1.3.4.tgz", diff --git a/package.json b/package.json index e7bd56b..c0e1fbf 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "cordova-plugin-camera": { "ANDROID_SUPPORT_V4_VERSION": "27.+" }, - "cordova-plugin-x-socialsharing": {} + "cordova-plugin-x-socialsharing": {}, + "cordova-plugin-velda-devicefeedback": {} }, "platforms": [ "browser", @@ -59,6 +60,7 @@ "cordova-plugin-camera": "^5.0.1", "cordova-plugin-nativestorage": "^2.3.2", "cordova-plugin-splashscreen": "^6.0.0", + "cordova-plugin-velda-devicefeedback": "0.0.2", "cordova-plugin-x-socialsharing": "^6.0.3", "es6-promise-plugin": "^4.2.2" } diff --git a/www/assets/js/main.js b/www/assets/js/main.js index 913c8be..e6c9677 100644 --- a/www/assets/js/main.js +++ b/www/assets/js/main.js @@ -81,6 +81,10 @@ function handleBackButton() { } } +$(document).on("touchdown", ".hapticbtn,.input-clear-button,.button,.link", function () { + doHapticFeedback(); +}); + $(document).keyup(function (e) { if (e.key === "Escape" || e.keyCode == 27) { handleBackButton(); diff --git a/www/assets/js/platform.js b/www/assets/js/platform.js index 1b0efd0..e5cf02c 100644 --- a/www/assets/js/platform.js +++ b/www/assets/js/platform.js @@ -30,6 +30,10 @@ var scanBarcode = function (success, error) { app.dialog.alert("You can't scan barcodes with this device.", "Sorry!"); } +var doHapticFeedback = function () { + console.log("Haptics not enabled."); +} + var appTheme = "light"; var scanningBarcode = false; @@ -140,6 +144,12 @@ function initCordova() { // Make sure the status bar color is set properly applyColorTheme(); + if (typeof device != "undefined" && device.platform == "android") { + doHapticFeedback = function () { + window.plugins.deviceFeedback.haptic(window.plugins.deviceFeedback.VIRTUAL_KEY); + } + } + if (typeof device != "undefined" && device.platform != "browser") { setupCordovaBarcodeScanner(); } else { diff --git a/www/pages/addresscode.html b/www/pages/addresscode.html index 7bb0133..770b136 100644 --- a/www/pages/addresscode.html +++ b/www/pages/addresscode.html @@ -8,7 +8,7 @@ @@ -54,7 +54,7 @@

Present this code to the Helena Express agent.

-

Close

+

Close

diff --git a/www/pages/appointment.html b/www/pages/appointment.html index c1bde79..5e3dbeb 100644 --- a/www/pages/appointment.html +++ b/www/pages/appointment.html @@ -8,7 +8,7 @@