Skip to content
This repository has been archived by the owner on Nov 25, 2022. It is now read-only.

Commit

Permalink
Merge pull request #3 from imZack/dev
Browse files Browse the repository at this point in the history
Merge v2.0 branch
  • Loading branch information
imZack committed Aug 30, 2014
2 parents c667b6b + 822d017 commit 44416e8
Show file tree
Hide file tree
Showing 61 changed files with 117 additions and 20 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,31 @@ This project is written with [PebbleJS](https://github.com/pebble/pebblejs) on [

The backend is serving at [http://pebble-uber.yulun.me](http://pebble-uber.yulun.me/?demo=1&latitude=37.787330&longitude=-122.403871) by default, you could also host your own server! see [backend's repository](https://github.com/imZack/pebble-uber-backend)

[![](http://pblweb.com/badge/53f8aeecfa4b5cd3bd00017a/black/medium/)](https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)

Any feature requests is welcome:ok_hand: , please [create a new issue](https://github.com/imZack/pebble-uber/issues/new)

Screenshot
----------
![1](https://cloud.githubusercontent.com/assets/690703/4021109/eae078ce-2ae1-11e4-9e94-cdf370279475.png) .
![2](https://cloud.githubusercontent.com/assets/690703/4021107/eade6bec-2ae1-11e4-8c28-6b7b1507cbda.png) .
![3](https://cloud.githubusercontent.com/assets/690703/4062467/0da92fba-2e00-11e4-8cc3-c06586c96c38.png) .
![4](https://cloud.githubusercontent.com/assets/690703/4062468/0dce99a8-2e00-11e4-98b9-cd75bace0e64.png)
![1](https://cloud.githubusercontent.com/assets/690703/4021109/eae078ce-2ae1-11e4-9e94-cdf370279475.png) 
![list_ny](https://cloud.githubusercontent.com/assets/690703/4098162/1f2f09a0-3006-11e4-8e94-82d00389d9de.png) 
![list](https://cloud.githubusercontent.com/assets/690703/4098163/1f2f935c-3006-11e4-829b-7049ab356374.png) 
![list2](https://cloud.githubusercontent.com/assets/690703/4098164/1f30792a-3006-11e4-9f5d-941a506679cd.png) 
![uk_list](https://cloud.githubusercontent.com/assets/690703/4098165/22f2d166-3006-11e4-8d7e-e31785f7dc03.png) 
![uberblack](https://cloud.githubusercontent.com/assets/690703/4098149/cd9c8ea0-3005-11e4-90a3-4ce1f2138077.png) 
![ubertaxi](https://cloud.githubusercontent.com/assets/690703/4098154/d226302a-3005-11e4-9b34-fa5967811e14.png) 
![uberlux](https://cloud.githubusercontent.com/assets/690703/4098151/d20c902a-3005-11e4-9ea0-518800ed9d59.png) 

More screenshots could be found [Link](https://github.com/imZack/pebble-uber/issues/1)

Download
--------

- Pebble App Store [Link](https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)

[![](http://pblweb.com/badge/53f8aeecfa4b5cd3bd00017a/orange/medium/)](https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)
**Pebble App Store** [Link](https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)

[![](http://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=|1&chl=https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)](https://apps.getpebble.com/applications/53f8aeecfa4b5cd3bd00017a)

- PWB [Download](https://github.com/imZack/pebble-uber/releases/download/v1.4/Uber_Now.v1.4.pbw)
**Latest PWB** [Download](https://github.com/imZack/pebble-uber/releases/download/v2.0/Uber_Now.v2.0.pbw)


Reference
Expand Down
49 changes: 47 additions & 2 deletions appinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,51 @@
"projectType": "pebblejs",
"resources": {
"media": [
{
"file": "images/mono-taxi.png",
"name": "IMAGES_MONO_TAXI_PNG",
"type": "png"
},
{
"file": "images/mono-uberxl2.png",
"name": "IMAGES_MONO_UBERXL2_PNG",
"type": "png"
},
{
"file": "images/mono-uberx.png",
"name": "IMAGES_MONO_UBERX_PNG",
"type": "png"
},
{
"file": "images/mono-suv.png",
"name": "IMAGES_MONO_SUV_PNG",
"type": "png"
},
{
"file": "images/mono-pop2.png",
"name": "IMAGES_MONO_POP2_PNG",
"type": "png"
},
{
"file": "images/mono-nytaxi4.png",
"name": "IMAGES_MONO_NYTAXI4_PNG",
"type": "png"
},
{
"file": "images/mono-blacktaxi2.png",
"name": "IMAGES_MONO_BLACKTAXI2_PNG",
"type": "png"
},
{
"file": "images/mono-black.png",
"name": "IMAGES_MONO_BLACK_PNG",
"type": "png"
},
{
"file": "images/mono-lux.png",
"name": "IMAGES_MONO_LUX_PNG",
"type": "png"
},
{
"file": "images/uber-icon-28.png",
"menuIcon": true,
Expand All @@ -18,8 +63,8 @@
},
"shortName": "Uber Now",
"uuid": "6042f1f3-b387-45f4-a288-e0db3cc15e68",
"versionCode": 4,
"versionLabel": "1.4",
"versionCode": 5,
"versionLabel": "2.0",
"watchapp": {
"watchface": false
}
Expand Down
Binary file added assets/images/40x40/mono-black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-blacktaxi2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-lux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-nytaxi4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-pop2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-suv.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-taxi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-uberx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/40x40/mono-uberxl2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added assets/pwbs/Uber_Now v2.0.pbw
Binary file not shown.
File renamed without changes
Binary file removed assets/screenshots/photo.JPG
Binary file not shown.
Binary file added assets/screenshots/temp/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/temp/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/temp/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/temp/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/temp/6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/temp/7.png
Binary file added assets/screenshots/temp/8.png
Binary file added assets/screenshots/temp/uberblack.png
Binary file added assets/screenshots/temp/ubersuv.png
Binary file added assets/screenshots/temp/ubertaxi.png
Binary file added assets/screenshots/temp/uberx.png
Binary file added assets/screenshots/temp/uberxl.png
Binary file added assets/screenshots/v1.0/1.png
Binary file added assets/screenshots/v1.0/2.png
Binary file added assets/screenshots/v1.0/3.png
Binary file added assets/screenshots/v2.0/list.png
Binary file added assets/screenshots/v2.0/list2.png
Binary file added assets/screenshots/v2.0/list_ny.png
Binary file added assets/screenshots/v2.0/no_service_here.png
Binary file added assets/screenshots/v2.0/uberblack.png
Binary file added assets/screenshots/v2.0/uberexec.png
Binary file added assets/screenshots/v2.0/uberlux.png
Binary file added assets/screenshots/v2.0/ubersuv.png
Binary file added assets/screenshots/v2.0/ubert.png
Binary file added assets/screenshots/v2.0/ubertaxi.png
Binary file added assets/screenshots/v2.0/uberx.png
Binary file added assets/screenshots/v2.0/uberxl.png
Binary file added assets/screenshots/v2.0/uk_list.png
Binary file added resources/images/mono-black.png
Binary file added resources/images/mono-blacktaxi2.png
Binary file added resources/images/mono-lux.png
Binary file added resources/images/mono-nytaxi4.png
Binary file added resources/images/mono-pop2.png
Binary file added resources/images/mono-suv.png
Binary file added resources/images/mono-taxi.png
Binary file added resources/images/mono-uberx.png
Binary file added resources/images/mono-uberxl2.png
65 changes: 55 additions & 10 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
// Require libs
/* Require libs */
var UI = require('ui');
var Vector2 = require('vector2');
var ajax = require('ajax');
var Vibe = require('ui/vibe');

// Variables

/* Variables */
var APP_VERSION = "v2.0";
var isUpdating = false;
var locationOptions = {"timeout": 15000, "maximumAge": 30000,
"enableHighAccuracy": true};


/* UI Elements */
var main_window = new UI.Window();
var info_text = new UI.Text({
position: new Vector2(0, 50),
Expand All @@ -14,7 +21,6 @@ var info_text = new UI.Text({
text: 'Uber Now',
textAlign: 'center'
});

var anykey_text = new UI.Text({
position: new Vector2(0, 114),
size: new Vector2(144, 30),
Expand All @@ -23,8 +29,18 @@ var anykey_text = new UI.Text({
textAlign: 'center'
});

var locationOptions = {"timeout": 15000, "maximumAge": 30000,
"enableHighAccuracy": true};

/* Image Mapping List */
var image_list = {
uberx: "images/mono-uberx.png",
uberxl: "images/mono-uberxl2.png",
uberblack: "images/mono-black.png",
uberexec: "images/mono-black.png",
ubersuv: "images/mono-suv.png",
ubertaxi: "images/mono-taxi.png",
ubert: "images/mono-nytaxi4.png"
};


function locationSuccess(pos) {
console.log(JSON.stringify(pos.coords));
Expand All @@ -38,9 +54,17 @@ function locationError(err) {
isUpdating = false;
}

function showUber(times) {
function firstUpperCase(str) {
return str.charAt(0).toUpperCase() + str.slice(1);
}

if (times.length === 0) {
function showUber(data) {
var times = data.times;
if (times.length === 0 && data.is_available) {
info_text.text('No cars available');
info_text.font('gothic-24-bold');
return;
} else if (data.is_available === false) {
info_text.text('No cars available');
info_text.font('gothic-24-bold');
return;
Expand All @@ -49,6 +73,7 @@ function showUber(times) {
var items = [];
times.forEach(function(product) {
product.surge_multiplier = product.surge_multiplier || 1;
product.display_name = firstUpperCase(product.display_name);
var title = product.display_name;
if (product.surge_multiplier !== 1) {
title += ' *' + Number(product.surge_multiplier).toFixed(2);
Expand All @@ -57,7 +82,12 @@ function showUber(times) {
title: title,
subtitle: 'pick up time: ' +
Math.ceil(product.estimate / 60) + ' mins',
product_id: product.product_id
product: {
display_name: product.display_name,
capacity: product.capacity,
image: product.image,
description: firstUpperCase(product.description)
}
};
items.push(item);
});
Expand All @@ -68,19 +98,34 @@ function showUber(times) {
}]
});

menu.on('select', function(e) {
var product = e.item.product;
if (product.capacity && product.image && product.description) {
var image = image_list[e.item.title.toLowerCase()] ||
'images/mono-black.png';
var card = new UI.Card({
banner: image,
title: product.display_name,
body: "Capacity: " + product.capacity + '\n' + product.description,
scrollable: true
});
card.show();
}
});

menu.show();
}

function fetchUber(coords) {
var params = 'latitude=' + coords.latitude +
'&longitude=' + coords.longitude +
'&pebble=1';
'&pebble=' + APP_VERSION;
ajax({ url: 'http://pebble-uber.yulun.me/?' + params, type: 'json' },
function(data) {
info_text.text('Uber Now');
info_text.font('gothic-24-bold');
Vibe.vibrate('double');
showUber(data.times);
showUber(data);
isUpdating = false;
},
function() {
Expand Down

0 comments on commit 44416e8

Please sign in to comment.