Add location broadcast (close #5)

This commit is contained in:
Skylar Ittner 2019-03-31 15:11:55 -06:00
parent 880725bb65
commit 7774355f67
2 changed files with 43 additions and 0 deletions

View File

@ -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: "<i class=\"fas fa-check\"></i> 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;

View File

@ -93,6 +93,30 @@
</div>
</div>
</div>
<div class="col-100 tablet-50 desktop-33">
<div class="card" id="broadcast-card">
<div class="card-header">
<div>
<i class="fas fa-street-view"></i> Broadcast Location
</div>
</div>
<div class="card-content card-content-padding">
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.
</div>
<div class="card-footer display-block">
<div class="button button-large button-fill button-round button-raised" onclick="broadcastLocation()">
Broadcast
</div>
</div>
</div>
</div>
{{/if}}
{{#if giver}}
<div class="col-100 tablet-50 desktop-33">