-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.0' into production
- Loading branch information
Showing
165 changed files
with
19,502 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<widget id="com.georgegarside.tdaconnect" version="1.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | ||
<name>TDA Connect</name> | ||
<description> | ||
Thomas Deacon Academy Desktop Connection App | ||
</description> | ||
<author email="[email protected]" href="https://georgegarside.com/"> | ||
George Garside | ||
</author> | ||
<content src="index.html" /> | ||
<access origin="*" /> | ||
<preference name="DisallowOverscroll" value="true" /> | ||
</widget> |
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,196 @@ | ||
<!-- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
--> | ||
# Cordova Hooks | ||
|
||
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. Hook scripts could be defined by adding them to the special predefined folder (`/hooks`) or via configuration files (`config.xml` and `plugin.xml`) and run serially in the following order: | ||
* Application hooks from `/hooks`; | ||
* Application hooks from `config.xml`; | ||
* Plugin hooks from `plugins/.../plugin.xml`. | ||
|
||
__Remember__: Make your scripts executable. | ||
|
||
__Note__: `.cordova/hooks` directory is also supported for backward compatibility, but we don't recommend using it as it is deprecated. | ||
|
||
## Supported hook types | ||
The following hook types are supported: | ||
|
||
after_build/ | ||
after_compile/ | ||
after_docs/ | ||
after_emulate/ | ||
after_platform_add/ | ||
after_platform_rm/ | ||
after_platform_ls/ | ||
after_plugin_add/ | ||
after_plugin_ls/ | ||
after_plugin_rm/ | ||
after_plugin_search/ | ||
after_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed | ||
after_prepare/ | ||
after_run/ | ||
after_serve/ | ||
before_build/ | ||
before_compile/ | ||
before_docs/ | ||
before_emulate/ | ||
before_platform_add/ | ||
before_platform_rm/ | ||
before_platform_ls/ | ||
before_plugin_add/ | ||
before_plugin_ls/ | ||
before_plugin_rm/ | ||
before_plugin_search/ | ||
before_plugin_install/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being installed | ||
before_plugin_uninstall/ <-- Plugin hooks defined in plugin.xml are executed exclusively for a plugin being uninstalled | ||
before_prepare/ | ||
before_run/ | ||
before_serve/ | ||
pre_package/ <-- Windows 8 and Windows Phone only. | ||
|
||
## Ways to define hooks | ||
### Via '/hooks' directory | ||
To execute custom action when corresponding hook type is fired, use hook type as a name for a subfolder inside 'hooks' directory and place you script file here, for example: | ||
|
||
# script file will be automatically executed after each build | ||
hooks/after_build/after_build_custom_action.js | ||
|
||
|
||
### Config.xml | ||
|
||
Hooks can be defined in project's `config.xml` using `<hook>` elements, for example: | ||
|
||
<hook type="before_build" src="scripts/appBeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/appBeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/appBeforePluginInstall.js" /> | ||
|
||
<platform name="wp8"> | ||
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/wp8/appWP8BeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/wp8/appWP8BeforePluginInstall.js" /> | ||
... | ||
</platform> | ||
|
||
<platform name="windows8"> | ||
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.bat" /> | ||
<hook type="before_build" src="scripts/windows8/appWin8BeforeBuild.js" /> | ||
<hook type="before_plugin_install" src="scripts/windows8/appWin8BeforePluginInstall.js" /> | ||
... | ||
</platform> | ||
|
||
### Plugin hooks (plugin.xml) | ||
|
||
As a plugin developer you can define hook scripts using `<hook>` elements in a `plugin.xml` like that: | ||
|
||
<hook type="before_plugin_install" src="scripts/beforeInstall.js" /> | ||
<hook type="after_build" src="scripts/afterBuild.js" /> | ||
|
||
<platform name="wp8"> | ||
<hook type="before_plugin_install" src="scripts/wp8BeforeInstall.js" /> | ||
<hook type="before_build" src="scripts/wp8BeforeBuild.js" /> | ||
... | ||
</platform> | ||
|
||
`before_plugin_install`, `after_plugin_install`, `before_plugin_uninstall` plugin hooks will be fired exclusively for the plugin being installed/uninstalled. | ||
|
||
## Script Interface | ||
|
||
### Javascript | ||
|
||
If you are writing hooks in Javascript you should use the following module definition: | ||
```javascript | ||
module.exports = function(context) { | ||
... | ||
} | ||
``` | ||
|
||
You can make your scipts async using Q: | ||
```javascript | ||
module.exports = function(context) { | ||
var Q = context.requireCordovaModule('q'); | ||
var deferral = new Q.defer(); | ||
|
||
setTimeout(function(){ | ||
console.log('hook.js>> end'); | ||
deferral.resolve(); | ||
}, 1000); | ||
|
||
return deferral.promise; | ||
} | ||
``` | ||
|
||
`context` object contains hook type, executed script full path, hook options, command-line arguments passed to Cordova and top-level "cordova" object: | ||
```json | ||
{ | ||
"hook": "before_plugin_install", | ||
"scriptLocation": "c:\\script\\full\\path\\appBeforePluginInstall.js", | ||
"cmdLine": "The\\exact\\command\\cordova\\run\\with arguments", | ||
"opts": { | ||
"projectRoot":"C:\\path\\to\\the\\project", | ||
"cordova": { | ||
"platforms": ["wp8"], | ||
"plugins": ["com.plugin.withhooks"], | ||
"version": "0.21.7-dev" | ||
}, | ||
"plugin": { | ||
"id": "com.plugin.withhooks", | ||
"pluginInfo": { | ||
... | ||
}, | ||
"platform": "wp8", | ||
"dir": "C:\\path\\to\\the\\project\\plugins\\com.plugin.withhooks" | ||
} | ||
}, | ||
"cordova": {...} | ||
} | ||
|
||
``` | ||
`context.opts.plugin` object will only be passed to plugin hooks scripts. | ||
|
||
You can also require additional Cordova modules in your script using `context.requireCordovaModule` in the following way: | ||
```javascript | ||
var Q = context.requireCordovaModule('q'); | ||
``` | ||
|
||
__Note__: new module loader script interface is used for the `.js` files defined via `config.xml` or `plugin.xml` only. | ||
For compatibility reasons hook files specified via `/hooks` folders are run via Node child_process spawn, see 'Non-javascript' section below. | ||
|
||
### Non-javascript | ||
|
||
Non-javascript scripts are run via Node child_process spawn from the project's root directory and have the root directory passes as the first argument. All other options are passed to the script using environment variables: | ||
|
||
* CORDOVA_VERSION - The version of the Cordova-CLI. | ||
* CORDOVA_PLATFORMS - Comma separated list of platforms that the command applies to (e.g.: android, ios). | ||
* CORDOVA_PLUGINS - Comma separated list of plugin IDs that the command applies to (e.g.: org.apache.cordova.file, org.apache.cordova.file-transfer) | ||
* CORDOVA_HOOK - Path to the hook that is being executed. | ||
* CORDOVA_CMDLINE - The exact command-line arguments passed to cordova (e.g.: cordova run ios --emulate) | ||
|
||
If a script returns a non-zero exit code, then the parent cordova command will be aborted. | ||
|
||
## Writing hooks | ||
|
||
We highly recommend writing your hooks using Node.js so that they are | ||
cross-platform. Some good examples are shown here: | ||
|
||
[http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/](http://devgirl.org/2013/11/12/three-hooks-your-cordovaphonegap-project-needs/) | ||
|
||
Also, note that even if you are working on Windows, and in case your hook scripts aren't bat files (which is recommended, if you want your scripts to work in non-Windows operating systems) Cordova CLI will expect a shebang line as the first line for it to know the interpreter it needs to use to launch the script. The shebang line should match the following example: | ||
|
||
#!/usr/bin/env [name_of_interpreter_executable] |
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,5 @@ | ||
*.mode1v3 | ||
*.perspectivev3 | ||
*.pbxuser | ||
.DS_Store | ||
build/ |
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,41 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
#import "CDVAvailability.h" | ||
|
||
#import "CDVPlugin.h" | ||
#import "CDVViewController.h" | ||
#import "CDVCommandDelegate.h" | ||
#import "CDVURLProtocol.h" | ||
#import "CDVInvokedUrlCommand.h" | ||
|
||
#import "CDVDebug.h" | ||
#import "CDVPluginResult.h" | ||
#import "CDVWhitelist.h" | ||
#import "CDVLocalStorage.h" | ||
#import "CDVScreenOrientationDelegate.h" | ||
#import "CDVTimer.h" | ||
|
||
#import "NSArray+Comparisons.h" | ||
#import "NSData+Base64.h" | ||
#import "NSDictionary+Extensions.h" | ||
#import "NSMutableArray+QueueAdditions.h" | ||
#import "UIDevice+Extensions.h" | ||
|
||
#import "CDVJSON.h" |
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,92 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
#import "CDVAvailabilityDeprecated.h" | ||
|
||
#define __CORDOVA_IOS__ | ||
|
||
#define __CORDOVA_0_9_6 906 | ||
#define __CORDOVA_1_0_0 10000 | ||
#define __CORDOVA_1_1_0 10100 | ||
#define __CORDOVA_1_2_0 10200 | ||
#define __CORDOVA_1_3_0 10300 | ||
#define __CORDOVA_1_4_0 10400 | ||
#define __CORDOVA_1_4_1 10401 | ||
#define __CORDOVA_1_5_0 10500 | ||
#define __CORDOVA_1_6_0 10600 | ||
#define __CORDOVA_1_6_1 10601 | ||
#define __CORDOVA_1_7_0 10700 | ||
#define __CORDOVA_1_8_0 10800 | ||
#define __CORDOVA_1_8_1 10801 | ||
#define __CORDOVA_1_9_0 10900 | ||
#define __CORDOVA_2_0_0 20000 | ||
#define __CORDOVA_2_1_0 20100 | ||
#define __CORDOVA_2_2_0 20200 | ||
#define __CORDOVA_2_3_0 20300 | ||
#define __CORDOVA_2_4_0 20400 | ||
#define __CORDOVA_2_5_0 20500 | ||
#define __CORDOVA_2_6_0 20600 | ||
#define __CORDOVA_2_7_0 20700 | ||
#define __CORDOVA_2_8_0 20800 | ||
#define __CORDOVA_2_9_0 20900 | ||
#define __CORDOVA_3_0_0 30000 | ||
#define __CORDOVA_3_1_0 30100 | ||
#define __CORDOVA_3_2_0 30200 | ||
#define __CORDOVA_3_3_0 30300 | ||
#define __CORDOVA_3_4_0 30400 | ||
#define __CORDOVA_3_4_1 30401 | ||
#define __CORDOVA_3_5_0 30500 | ||
#define __CORDOVA_3_6_0 30600 | ||
#define __CORDOVA_3_7_0 30700 | ||
#define __CORDOVA_3_8_0 30800 | ||
#define __CORDOVA_NA 99999 /* not available */ | ||
|
||
/* | ||
#if CORDOVA_VERSION_MIN_REQUIRED >= __CORDOVA_1_7_0 | ||
// do something when its at least 1.7.0 | ||
#else | ||
// do something else (non 1.7.0) | ||
#endif | ||
*/ | ||
#ifndef CORDOVA_VERSION_MIN_REQUIRED | ||
#define CORDOVA_VERSION_MIN_REQUIRED __CORDOVA_3_8_0 | ||
#endif | ||
|
||
/* | ||
Returns YES if it is at least version specified as NSString(X) | ||
Usage: | ||
if (IsAtLeastiOSVersion(@"5.1")) { | ||
// do something for iOS 5.1 or greater | ||
} | ||
*/ | ||
#define IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending) | ||
|
||
/* Return the string version of the decimal version */ | ||
#define CDV_VERSION [NSString stringWithFormat:@"%d.%d.%d", \ | ||
(CORDOVA_VERSION_MIN_REQUIRED / 10000), \ | ||
(CORDOVA_VERSION_MIN_REQUIRED % 10000) / 100, \ | ||
(CORDOVA_VERSION_MIN_REQUIRED % 10000) % 100] | ||
|
||
// Enable this to log all exec() calls. | ||
#define CDV_ENABLE_EXEC_LOGGING 0 | ||
#if CDV_ENABLE_EXEC_LOGGING | ||
#define CDV_EXEC_LOG NSLog | ||
#else | ||
#define CDV_EXEC_LOG(...) do {} while (NO) | ||
#endif |
38 changes: 38 additions & 0 deletions
38
platforms/ios/CordovaLib/Classes/CDVAvailabilityDeprecated.h
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,38 @@ | ||
/* | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
*/ | ||
|
||
|
||
#import <UIKit/UIKit.h> | ||
|
||
#ifdef __clang__ | ||
#define CDV_DEPRECATED(version, msg) __attribute__((deprecated("Deprecated in Cordova " #version ". " msg))) | ||
#else | ||
#define CDV_DEPRECATED(version, msg) __attribute__((deprecated())) | ||
#endif | ||
|
||
static inline BOOL CDV_IsIPad(void) CDV_DEPRECATED(3.7.0, "This will be removed in 4.0.0"); | ||
static inline BOOL CDV_IsIPhone5(void) CDV_DEPRECATED(3.7.0, "This will be removed in 4.0.0"); | ||
|
||
static inline BOOL CDV_IsIPad(void) { | ||
return [[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad; | ||
} | ||
|
||
static inline BOOL CDV_IsIPhone5(void) { | ||
return ([[UIScreen mainScreen] bounds].size.width == 568 && [[UIScreen mainScreen] bounds].size.height == 320) || ([[UIScreen mainScreen] bounds].size.height == 568 && [[UIScreen mainScreen] bounds].size.width == 320); | ||
} |
Oops, something went wrong.