Set up documentation for the mobile conf file

This commit is contained in:
Slava Kim
2014-09-30 20:53:33 -07:00
parent f0932db7e1
commit ef29e4abae
5 changed files with 123 additions and 25 deletions

View File

@@ -3603,11 +3603,67 @@ in the `_test.js` file that was created.
<h3><span>External Packages and Plugins</span></h3>
{{#markdown}}
Meteor packages can include NPM packages and Cordova plugins by using `Npm.depends` and `Cordova.depends` in the `package.js` file.
Meteor packages can include NPM packages and Cordova plugins by using
`Npm.depends` and `Cordova.depends` in the `package.js` file.
{{/markdown}}
{{> autoApiBox "Npm.depends"}}
{{> autoApiBox "Npm.require"}}
{{> autoApiBox "Cordova.depends"}}
<h2 id="mobileconfigjs"><span>Mobile Config File</span></h2>
{{#markdown}}
If your Meteor application is targeting mobile platforms (such as iOS or
Android), you might want to configure the metadata and the process of
Phonegap/Cordova build which is used internally for mobile builds.
This configuration should be placed in a special top-level file
`mobile-config.js` which is *not* included in your application and used only for
the configuration.
The code listing below is an example of such configuration. The rest of this
section will explain the specific API commands in greater details.
// This section sets up some basic app metadata,
// the entire section is optional.
App.info({
id: 'com.matt.uber',
name: 'über',
description: 'Get über power in one button click',
author: 'Matt Development Group',
email: 'contact@matt.com',
website: 'http://matt.nu.edu'
});
// Set up resources such as icons and launch screens.
App.icons({
'iphone': 'icons/icon-60.png',
'iphone-2x': 'icons/icon-60@2x.png',
...
});
App.launchScreens({
'iphone': 'splash/Default~iphone.png',
'iphone_2x': 'splash/Default@2x~iphone.png',
...
});
// Configure Cordova's preferences
App.set('BackgroundColor', '0xff0000ff');
App.set('HideKeyboardFormAccessoryBar', true);
// Set up a particular Cordova plugin's build process
App.configurePlugin('com.phonegap.plugins.facebookconnect', {
APP_ID: '1234567890',
API_KEY: 'yoursupersecretsauce'
});
{{/markdown}}
{{> autoApiBox "App.info"}}
{{> autoApiBox "App.set"}}
{{> autoApiBox "App.configurePlugin"}}
{{> autoApiBox "App.icons"}}
{{> autoApiBox "App.launchScreens"}}
</template>

File diff suppressed because one or more lines are too long

View File

@@ -398,6 +398,14 @@ var toc = [
{name: "Package.registerBuildPlugin", id: "Package-registerBuildPlugin"}, [
{name: "Plugin.registerSourceHandler", id: "Plugin-registerSourceHandler"}
]
],
{name: "Mobile Config file", id: "mobileconfigjs"}, [
{name: "App.info", id: "App-info"},
{name: "App.set", id: "App-set"},
{name: "App.configurePlugin", id: "App-configurePlugin"},
{name: "App.icons", id: "App-icons"},
{name: "App.launchScreens", id: "App-launchScreens"}
]
],

View File

@@ -21,6 +21,12 @@
"Accounts.validateLoginAttempt",
"Accounts.validateNewUser",
"Accounts.verifyEmail",
"App",
"App.configurePlugin",
"App.icons",
"App.info",
"App.launchScreens",
"App.set",
"Assets",
"Assets.getBinary",
"Assets.getText",

View File

@@ -1123,9 +1123,10 @@ var consumeControlFile = function (controlFilePath, cordovaPath) {
var App = {
/**
* @summary Set mobile app's metadata
* @param {Object} [options] An object with keys corresponding to different
* metadata fields such as: "id", "version", "name", "description",
* "author", "email", "website".
* @param {Object} options
* @param {String} [options.id,version,name,description,author,email,website]
* A common app's metadata field. Some of this will be displayed to the
* user, others will be only used internally.
* @memberOf App
*/
info: function (options) {
@@ -1150,9 +1151,10 @@ var consumeControlFile = function (controlFilePath, cordovaPath) {
_.extend(metadata, options);
},
/**
* @summary Set a custom configuration supported by Phonegap/Cordova's
* @summary Set up a preference for the build supported by
* Phonegap/Cordova's config.xml.
* @param {String} key a preference supported by Phonegap/Cordova's
* config.xml
* @param {String} key a key supported by Phonegap/Cordova's config.xml
* @param {String} value the string value that should be used in the
* configuration
* @memberOf App
@@ -1162,8 +1164,10 @@ var consumeControlFile = function (controlFilePath, cordovaPath) {
},
/**
* @summary Set the build-time configuration for a Phonegap/Cordova plugin.
* @param {Object} config a dictionary whose key-value pairs will be used
* as the environment in the build-time of the Phonegap/Cordova project.
* @param {String} pluginName the identifier of the plugin the configuration
* corresponds to.
* @param {Object} config a set of key-value pairs, those will be used as
* the environment in the build-time of the Phonegap/Cordova project.
* @memberOf App
*/
configurePlugin: function (pluginName, config) {
@@ -1172,10 +1176,19 @@ var consumeControlFile = function (controlFilePath, cordovaPath) {
/**
* @summary Set the paths to icons to be used in mobile app.
* @param {Object} icons a dictionary with keys corresponding to different
* devices (one of "iphone", "iphone-2x", "iphone-3x", "ipad", "ipad-2x",
* "android_ldpi", "android_mdpi", "android_hdpi", "android_xhdpi") and
* values set to the location of an image relative to the project root
* directory.
* devices and values set to the location of an image relative to the
* project root directory.
*
* Valid key values:
* - `iphone`
* - `iphone-2x`
* - `iphone-3x`
* - `ipad`
* - `ipad-2x`
* - `android_ldpi`
* - `android_mdpi`
* - `android_hdpi`
* - `android_xhdpi`
* @memberOf App
*/
icons: function (icons) {
@@ -1189,18 +1202,33 @@ var consumeControlFile = function (controlFilePath, cordovaPath) {
},
/**
* @summary Set the paths to the launch screen images.
* @param {Object} launchScreens a dictionary with keys corresponding to different
* devices (one of "iphone", "iphone_2x", "iphone5", "iphone6",
* "iphone6p_portrait", "iphone6p_landscape", "ipad_portrait",
* "ipad_portrait_2x", "ipad_landscape", "ipad_landscape_2x",
* "android_ldpi_portrait", "android_ldpi_landscape",
* "android_mdpi_portrait", "android_mdpi_landscape",
* "android_hdpi_portrait", "android_hdpi_landscape",
* "android_xhdpi_portrait", "android_xhdpi_landscape") and values set
* to the location of an image relative to the project root directory.
* For the Android launch screens images should be a specially guided
* "Nine-patch" image files to show how to stretch them. See:
* https://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch.
* @param {Object} launchScreens A dictionary with keys corresponding to
* different devices and values set to the location of an image relative to
* the project root directory. For the Android launch screens images should
* be a specially guided "Nine-patch" image files to show how to stretch
* them. See:
* [Android docs](https://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch).
*
* Valid key values:
* - `iphone`
* - `iphone_2x`
* - `iphone5`
* - `iphone6`
* - `iphone6p_portrait`
* - `iphone6p_landscape`
* - `ipad_portrait`
* - `ipad_portrait_2x`
* - `ipad_landscape`
* - `ipad_landscape_2x`
* - `android_ldpi_portrait`
* - `android_ldpi_landscape`
* - `android_mdpi_portrait`
* - `android_mdpi_landscape`
* - `android_hdpi_portrait`
* - `android_hdpi_landscape`
* - `android_xhdpi_portrait`
* - `android_xhdpi_landscape`
*
* @memberOf App
*/
launchScreens: function (launchScreens) {