2017-07-10 10:29:58 +00:00
|
|
|
function locationsSuggestions (params) {
|
|
|
|
var result = {title: "Send location"};
|
|
|
|
var seqArg = params["seq-arg"] ? params["seq-arg"] : "";
|
|
|
|
|
|
|
|
if (seqArg === "Dropped pin")
|
|
|
|
{
|
|
|
|
result.showBack = true;
|
|
|
|
result.height = "max";
|
|
|
|
result.markup = ['view', {},
|
|
|
|
['dropped-pin']];
|
|
|
|
}
|
|
|
|
else if (seqArg != "")
|
|
|
|
{
|
|
|
|
result.showBack = true;
|
|
|
|
result.markup = ['scroll-view', {keyboardShouldPersistTaps: "always"},
|
|
|
|
['view', {},
|
|
|
|
['places-search']]];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
result.markup = ['scroll-view', {keyboardShouldPersistTaps: "always"},
|
|
|
|
['view', {},
|
|
|
|
['current-location-map'],
|
|
|
|
['current-location'],
|
|
|
|
['separator'],
|
|
|
|
['places-nearby']]];
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-02-28 09:14:55 +00:00
|
|
|
status.command({
|
|
|
|
name: "location",
|
|
|
|
title: I18n.t('location_title'),
|
|
|
|
description: I18n.t('location_description'),
|
|
|
|
sequentialParams: true,
|
2017-07-10 10:29:58 +00:00
|
|
|
hideSendButton: true,
|
2017-05-02 14:39:02 +00:00
|
|
|
params: [{
|
|
|
|
name: "address",
|
|
|
|
type: status.types.TEXT,
|
2017-07-10 10:29:58 +00:00
|
|
|
placeholder: I18n.t('location_address'),
|
|
|
|
suggestions: locationsSuggestions
|
2017-05-02 14:39:02 +00:00
|
|
|
}],
|
2017-02-28 09:14:55 +00:00
|
|
|
preview: function (params) {
|
2017-07-10 10:29:58 +00:00
|
|
|
var address = params.address.split("&");
|
2017-02-28 09:14:55 +00:00
|
|
|
var text = status.components.text(
|
|
|
|
{
|
|
|
|
style: {
|
2017-07-10 10:29:58 +00:00
|
|
|
marginTop: 0,
|
2017-02-28 09:14:55 +00:00
|
|
|
marginHorizontal: 0,
|
2017-07-10 10:29:58 +00:00
|
|
|
fontSize: 15,
|
|
|
|
lineHeight: 23,
|
2017-02-28 09:14:55 +00:00
|
|
|
fontFamily: "font",
|
|
|
|
color: "black"
|
|
|
|
}
|
2017-07-10 10:29:58 +00:00
|
|
|
}, address[0]);
|
|
|
|
var uri = "https://api.mapbox.com/styles/v1/mapbox/streets-v10/static/" +
|
|
|
|
address[1] + "," + address[2] + ",10,20" +
|
|
|
|
"/175x58?access_token=pk.eyJ1Ijoic3RhdHVzaW0iLCJhIjoiY2oydmtnZjRrMDA3czMzcW9kemR4N2lxayJ9.Rz8L6xdHBjfO8cR3CDf3Cw";
|
2017-02-28 09:14:55 +00:00
|
|
|
|
|
|
|
var image = status.components.image(
|
|
|
|
{
|
|
|
|
source: {uri: uri},
|
|
|
|
style: {
|
2017-07-10 10:29:58 +00:00
|
|
|
borderRadius: 5
|
|
|
|
marginTop: 12
|
|
|
|
height: 58
|
2017-02-28 09:14:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2017-07-10 10:29:58 +00:00
|
|
|
return {markup: ['view', {},
|
|
|
|
text,
|
|
|
|
['view', {},
|
|
|
|
image,
|
|
|
|
['view', {style: {position: "absolute",
|
|
|
|
top: 0,
|
|
|
|
right: 0,
|
|
|
|
bottom: 0,
|
|
|
|
left: 0,
|
|
|
|
justifyContent: "center",
|
|
|
|
alignItems: "center"}},
|
|
|
|
['view', {style: {borderColor: "#628fe3",
|
|
|
|
backgroundColor: "#FFFFFF",
|
|
|
|
borderWidth: 4,
|
|
|
|
borderRadius: 8,
|
|
|
|
height: 15,
|
|
|
|
width: 15}}]]]]};
|
2017-02-28 09:14:55 +00:00
|
|
|
},
|
|
|
|
shortPreview: function (params) {
|
|
|
|
return {
|
|
|
|
markup: status.components.text(
|
|
|
|
{},
|
|
|
|
I18n.t('location_title') + ": " + params.address
|
|
|
|
)
|
|
|
|
};
|
|
|
|
}
|
2017-07-10 10:29:58 +00:00
|
|
|
});
|