From 7774355f67d181ecfb2370c95c5f4d089ef15c61 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Sun, 31 Mar 2019 15:11:55 -0600 Subject: [PATCH] Add location broadcast (close #5) --- www/js/home.js | 19 +++++++++++++++++++ www/pages/home.html | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/www/js/home.js b/www/js/home.js index ed7c04a..5d7e3cb 100644 --- a/www/js/home.js +++ b/www/js/home.js @@ -78,6 +78,25 @@ function loadQrCode(callback) { }); } +function broadcastLocation() { + getLocation(function (position) { + callAPI("broadcast", { + key: localStorage.getItem("key"), + latitude: position.coords.latitude, + longitude: position.coords.longitude + }, function (success) { + app.toast.create({ + text: " Location sent!", + closeTimeout: 2000 + }).open(); + }, function (error) { + app.dialog.alert(error, "Error"); + }); + }, function (error) { + app.dialog.alert(error, "Location Error"); + }); +} + function loadHomePage(callback) { var done = 0; var total = 2; diff --git a/www/pages/home.html b/www/pages/home.html index cfb1a39..c4c812a 100644 --- a/www/pages/home.html +++ b/www/pages/home.html @@ -93,6 +93,30 @@ + +
+
+ +
+
+ Broadcast Location +
+
+ +
+ Press the button to show your current location to nearby + givers. They will be able to send you money from the + map, even if they aren't close enough to scan your code. + Your position will be visible for one hour. The timer + will reset every time you push the button. +
+ +
+
{{/if}} {{#if giver}}