-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added READMEs and improved the packages
- Loading branch information
Sashko Stubailo
committed
Sep 6, 2014
1 parent
fb1a4ad
commit ca8eed9
Showing
15 changed files
with
138 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,40 @@ | ||
Mobile Packages | ||
=============== | ||
|
||
A repository for mobile-focused core packages and example apps of how to use them. | ||
This repository contains three simple Meteor packages that work on mobile and desktop. There are also three small example apps that demonstrate their usage. | ||
|
||
### Goals | ||
## Packages | ||
|
||
- Camera | ||
- Device Orientation | ||
- Geolocation | ||
- reload-on-resume | ||
- mobile-status-bar | ||
### Camera | ||
|
||
The package `mdg:camera` allows you to take photos on desktop and mobile with a single function call. | ||
|
||
[Read the full Camera documentation here.](packages/mdg:camera/README.md) | ||
|
||
### Geolocation | ||
|
||
The package `mdg:geolocation` provides a reactive interface to the device's GPS location. | ||
|
||
[Read the full Geolocation documentation here.](packages/mdg:geolocation/README.md) | ||
|
||
### reload-on-resume | ||
|
||
The package `mdg:reload-on-resume` delays hot code push on mobile devices until the user has closed and re-opened the app, so that their experience is not interrupted by a reload. | ||
|
||
[Read the full reload-on-resume documentation here.](packages/mdg:geolocation/README.md) | ||
|
||
## Example Apps | ||
|
||
### simple-photo | ||
|
||
This example app has one button that takes a photo and displays it on the screen. It demonstrates usage of the Camera package. | ||
|
||
### simple-map | ||
|
||
This example app uses the [Google Maps Static Maps API](https://developers.google.com/maps/documentation/staticmaps/) to show a map with a marker at your current location. It demonstrates usage of the Geolocation package. | ||
|
||
### SoLoMo | ||
|
||
This is the app that was first used to demonstrate Meteor Cordova functionality at the Meteor Devshop in August 2014. It uses the Camera, Geolocation, and reload-on-resume packages, in addition to local packages for [Ionic Framework CSS](http://ionicframework.com/) and a simple implementation of the [Google Maps Javascript API](https://developers.google.com/maps/documentation/javascript/). | ||
|
||
<img src="examples/map-photos/screenshot.jpg" width="300" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# This file contains a token that is unique to your project. | ||
# Check it into your repository along with the rest of this directory. | ||
# It can be used for purposes such as: | ||
# - ensuring you don't accidentally deploy one app on top of another | ||
# - providing package authors with aggregated statistics | ||
|
||
282sea1kd5tvnp4qkqz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,6 @@ | |
standard-app-packages | ||
autopublish | ||
insecure | ||
geolocation | ||
camera | ||
mrt:moment | ||
iron-router | ||
ionic | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../packages/mdg:geolocation |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
android |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Meteor Camera Package | ||
|
||
Add it to your [Meteor](http://meteor.com) app with `meteor add mdg:camera`. The api is super simple - there is only one function to call: | ||
|
||
### MeteorCamera.getPicture([options], callback) | ||
|
||
Prompt the user to take a photo with their device and get the picture as a Data URI in JPEG format. | ||
|
||
#### options | ||
|
||
`options` is an optional argument that is an Object with the following possible keys: | ||
|
||
- `width` An integer that specifies the minimum width of the returned photo. | ||
- `height` An integer that specifies the minimum height of the returned photo. | ||
- `quality` A number from 0 to 100 specifying the desired quality of JPEG encoding. | ||
|
||
#### callback(error, data) | ||
|
||
`callback` is a required argument that is a function that takes two arguments: | ||
|
||
- `error` A [Meteor.Error](http://docs.meteor.com/#meteor_error) with a message dependent on the reason for failure and a platform-specific error message. | ||
- `data` A base64-encoded data URI for the image taken by the camera. This parameter can be used directly in the 'src' attribute of an image tag. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Meteor Geolocation Package | ||
|
||
Add it to your [Meteor](http://meteor.com) app with `meteor add mdg:geolocation`. | ||
|
||
## API Documentation | ||
|
||
There are currently no options to set. Every method is reactive using [Tracker](http://docs.meteor.com/#tracker), and will automatically update with new location data from the device. | ||
|
||
### Geolocation.error() | ||
|
||
Returns the [position error](https://developer.mozilla.org/en-US/docs/Web/API/PositionError) that is currently preventing position updates. | ||
|
||
### Geolocation.currentLocation() | ||
|
||
Returns the [position](https://developer.mozilla.org/en-US/docs/Web/API/Position) that is reported by the device, or null if no position is available. | ||
|
||
### Geolocation.latLng() | ||
|
||
A simple shorthand for currentLocation() when all you need is the latitude and longitude. Returns an object that has `lat` and `lng` keys. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Meteor reload-on-resume Package | ||
|
||
Add it to your [Meteor](http://meteor.com) app with `meteor add mdg:reload-on-resume`. There is no API - this package changes the behavior of Meteor's hot code push feature on mobile devices only. | ||
|
||
Normally, your app will update on the user's device as soon as you push a new version. This process is always smooth in a desktop web browser, but might momentarily interrupt the user's experience if they are on a mobile device. | ||
|
||
With this package, the app will only update itself to the newest version if the user closes and re-opens the app (hence, it "reloads on resume"). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// Provide the same API on browser | ||
Reload.isWaitingForResume = function () { | ||
return false; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Package.describe({ | ||
name: "mdg:reload-on-resume", | ||
summary: "On Cordova, only allow the app to reload when the app is resumed.", | ||
version: '1.0.0' | ||
}); | ||
|
||
Package.on_use(function (api) { | ||
api.use(['reload', 'reactive-var'], 'web.cordova'); | ||
api.add_files("reload-on-resume.js", 'web.cordova'); | ||
api.add_files("browser.js", 'web.browser'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var newVersionAvailable = new ReactiveVar(false); | ||
|
||
var hasResumed = false; | ||
document.addEventListener("resume", function () { | ||
hasResumed = true; | ||
}, false); | ||
|
||
Reload._onMigrate(function (retry) { | ||
if (! newVersionAvailable) { | ||
newVersionAvailable.set(true); | ||
} | ||
|
||
if (hasResumed) { | ||
return [true, {}]; | ||
} else { | ||
document.addEventListener("resume", retry, false); | ||
return [false]; | ||
} | ||
}); | ||
|
||
/** | ||
* @summary Reactive function that returns true when there is a new version of | ||
* the app downloaded, can be used to prompt the user to close and reopen the | ||
* app to get the new version. | ||
*/ | ||
Reload.isWaitingForResume = function () { | ||
return newVersionAvailable.get(); | ||
}; |