Compare commits

..

61 Commits

Author SHA1 Message Date
Ibrahim Hadeed
b11da8da0b 1.2.2 2016-05-20 17:02:45 -04:00
Ibrahim Hadeed
9987fb24da refractor Observable imports 2016-05-20 16:59:18 -04:00
Ibrahim Hadeed
bcdec67c2e refractor Observable imports 2016-05-20 16:58:57 -04:00
Ibrahim Hadeed
e391f5fa39 fix screenshot plugin - closes #169 2016-05-20 16:35:14 -04:00
Ibrahim Hadeed
5105b0a184 fixes 2016-05-20 15:34:34 -04:00
Ibrahim Hadeed
87637792ba Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-05-20 15:04:29 -04:00
Ibrahim Hadeed
eed8cb1b1d fix email type import 2016-05-20 15:04:11 -04:00
Ibrahim Hadeed
25d1d0a0cd Merge pull request #166 from rapropos/noimplicitany
type return value of globalization's stringToNumber
2016-05-20 14:56:12 -04:00
Robert Coie
2f6688c9c4 type return value of globalization's stringToNumber 2016-05-20 11:24:24 -07:00
Ibrahim Hadeed
21ffe99226 refactor(emailcomposer): create new file for the Email type
addresses #168
2016-05-20 14:08:25 -04:00
Ibrahim Hadeed
2a568d2398 fix(emailcomposer): fix isAvailable function
function now returns a promise that resolves if email composer is available, and rejects if it's not

partially fixes #168
2016-05-20 14:06:13 -04:00
Ibrahim Hadeed
3c49face4c docs(emailcomposer): fix docs
partially fixes #168
2016-05-20 13:57:00 -04:00
Ibrahim Hadeed
46564c8ca3 Merge pull request #151 from glecaros/master
Implemented wrappers for FileTransfer.
2016-05-19 21:04:48 -04:00
Ibrahim Hadeed
ccafdbac13 Merge pull request #162 from vfdev-5/master
Added Background Geolocation Cordova plugin
2016-05-19 19:37:33 -04:00
vfdev-5
d12a99c962 * Added Background-geolocation plugin : version to test 2016-05-17 23:34:14 +02:00
Ibrahim Hadeed
87751ca277 Merge pull request #157 from matiastucci/master
implement wrappers for Insomnia
2016-05-16 03:16:47 -04:00
Ibrahim Hadeed
52a6114721 Merge pull request #158 from matiastucci/patch-1
Update DEVELOPER.md
2016-05-16 03:16:04 -04:00
Mati Tucci
d561694750 Update DEVELOPER.md 2016-05-16 08:44:51 +02:00
Matias Tucci
f7ace39516 implement wrappers for Insomnia 2016-05-16 08:34:01 +02:00
vfdev-5
58b351ce13 * Fix signatures and bugs 2016-05-15 04:47:35 +02:00
vfdev-5
5c7b7e350f * Fix plugin insertion in index.ts
* Add main functions
2016-05-15 03:15:51 +02:00
glecaros
9ddde5762d Reimplemented using CordovaInstance.
Fixed wrapInstance signature to match how it is called.
2016-05-14 00:33:27 -07:00
glecaros
631d7f2d85 Added missing parameters to upload. 2016-05-14 00:33:26 -07:00
glecaros
e9739882f4 Exposed onprogress. 2016-05-14 00:33:26 -07:00
glecaros
293145257c Implemented wrappers for FileTransfer. 2016-05-14 00:33:26 -07:00
vfdev
2daca853dc * [DEV] Add some functions
* Add plugin in the index.ts
2016-05-13 15:58:43 +02:00
Ibrahim Hadeed
0f4fdda8c6 tslint + fix var name 2016-05-12 22:55:06 -04:00
Ibrahim Hadeed
38cab62d64 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-05-12 22:15:01 -04:00
Ibrahim Hadeed
58e3f0bbb9 fix(Bluetooth): make connect function an observable to maintain full functionality
closes #154
2016-05-12 22:14:27 -04:00
Ibrahim Hadeed
f055905190 Merge pull request #114 from iignatov/patch-1
Added implementation for File.readAsText() method.
2016-05-12 22:10:50 -04:00
Ibrahim Hadeed
62f71b2221 Merge pull request #122 from Barryrowe/master
Append Trailing Slash If Not Present On path Param
2016-05-12 22:06:53 -04:00
Ibrahim Hadeed
ddbd64d19a fix(calendar): add new permissions functions for Android 6 (M) devices
closes #156
2016-05-12 21:54:52 -04:00
vfdev-5
f0d5b88ec4 * Add background geolocation plugin from https://github.com/mauron85/cordova-plugin-background-geolocation 2016-05-13 01:26:05 +02:00
Ibrahim Hadeed
aa034a2081 1.2.1 2016-05-11 01:51:18 -04:00
Ibrahim Hadeed
494e55769c change interface to type in filename 2016-05-11 01:05:12 -04:00
Ibrahim Hadeed
2e68ba6fb7 add missing comma 2016-05-11 00:42:32 -04:00
perry
df1cee1fc6 copy edits from @kgindervogel 2016-05-10 17:49:21 -05:00
perry
3cdf50bf3b make doc URLs use dashes and lower case 2016-05-09 13:07:42 -05:00
perry
a631cc1d3a CI: make sure ident is set before push 2016-05-09 11:36:38 -05:00
Max Lynch
fc08e353a4 Update README.md 2016-05-09 11:01:51 -05:00
Ibrahim Hadeed
dc511a0676 Merge pull request #153 from dudeofawesome/add-typings
Add typings to hotspot.ts
2016-05-09 02:34:42 -04:00
Louis Orleans
b280c052c7 Actually exporting an interface instead of a class 2016-05-08 18:59:47 -07:00
Louis Orleans
6f50138d9e Moving interface files around for organization 2016-05-08 18:56:18 -07:00
Louis Orleans
c81b951047 Merge branch 'plugin-hotspot' into add-typings 2016-05-08 18:54:45 -07:00
Ibrahim Hadeed
b3e60eaa32 Merge pull request #155 from ZiFFeL1992/patch-1
Update install command
2016-05-08 19:26:02 -04:00
Guillermo
451cfe5cd8 Update install command
cordova -> ionic
2016-05-08 22:44:16 +02:00
Louis Orleans
116dc1a1b3 Fixing typos 2016-05-05 19:01:07 -07:00
Louis Orleans
9682ac8f11 Adding some JSDoc definitions 2016-05-05 18:06:33 -07:00
Louis Orleans
b4b131c82a Adding more typings for hotspot.ts 2016-05-05 17:57:49 -07:00
Louis Orleans
6fab67ca9f Adding some types to plugins/hotspot.ts 2016-05-05 15:50:28 -07:00
perry
3a80434a1c attempting to prevent errors in the even a commit to ionic-site is made during docgen 2016-05-05 14:50:40 -05:00
Ionitron
487aaafb15 CI tweak 2016-05-04 17:10:41 -05:00
Ionitron
73095b1211 pulling for now 2016-05-04 17:08:28 -05:00
Ionitron
a35580e0dd typo 2016-05-04 17:05:19 -05:00
Ionitron
da1cf7c3a1 trying new CI approach 2016-05-04 17:03:53 -05:00
Keith D. Moore
9d359a50e2 fix usage comments
add delay in setTimeout to ensure connection attribute has been set.
2016-04-30 14:58:46 -05:00
Ibrahim Hadeed
26dcff4db7 Merge pull request #150 from driftyco/instance-property
feat(plugin): add wrapper for instance properties
2016-04-30 13:31:59 -04:00
Ibrahim Hadeed
28d7d5ceec feat(plugin): add wrapper for instance properties
this wrapper will be able to handle get/set functions for any instance property
2016-04-30 13:31:10 -04:00
Barry Rowe
9d200e7020 Merge pull request #1 from Barryrowe/file-path-end-slash-patch
Append trailingSlash if not present on path param
2016-04-14 12:49:47 -04:00
Barry Rowe
ce2772b994 Append trailingSlash if not present on path param
In some cases the incoming ```path``` variable may not necessarily contain a trailing slash, but in cases where the directory path is manually built within the plugin this was not protected against. This shouldn't be a big issue if consumers are using ```cordova.file.*``` for the path params, but not all consumers may be using this.
2016-04-14 12:48:04 -04:00
Ignat Ignatov
96c47df151 Added implementation for readAsText() method. 2016-04-06 16:36:26 +02:00
41 changed files with 1110 additions and 167 deletions

View File

@@ -92,6 +92,10 @@ The `@Cordova` decorator has a few more options now.
`clearFunction` is used in conjunction with the `observable` option and indicates the function to be called when the Observable is disposed.
### Testing your changes
You need to run `npm run build_bundle` in the `ionic-native` project, this will create a `dist` directory. Then, you must go to your ionic application folder and replace your current `node_modules/ionic-native/dist/` with the newly generated one.
### 'Wrapping' Up
That's it! The only thing left to do is rigorously document the plugin and it's usage. Take a look at some of the other plugins for good documentation styles.

View File

@@ -8,6 +8,10 @@
Ionic Native is a curated set of wrappers for Cordova plugins that make adding any native functionality you need to your [Ionic](http://ionicframework.com/), Cordova, or Web View mobile app easy.
### Documentation
For the full Ionic Native documentation, please visit [http://ionicframework.com/docs/v2/native/](http://ionicframework.com/docs/v2/native/).
### Promises and Observables
Ionic Native wraps plugin callbacks in a Promise or [Observable](https://gist.github.com/staltz/868e7e9bc2a7b8c1f754), providing a common interface for all plugins and ensuring that native events trigger change detection in Angular 2.

View File

@@ -9,19 +9,19 @@ general:
only:
- master # ignore PRs and branches
#dependencies:
# pre:
# - ./scripts/docs/prepare.sh
# cache_directories:
# - "~/ionic-site" # cache ionic-site
dependencies:
pre:
- ./scripts/docs/prepare.sh
cache_directories:
- "~/ionic-site" # cache ionic-site
test:
override:
- echo "No tests are written at the moment. But we will attempt to build the library with the latest changes."
- npm run build_bundle
#deployment:
# staging:
# branch: master
# commands:
# - ./scripts/docs/update_docs.sh
deployment:
staging:
branch: master
commands:
- ./scripts/docs/update_docs.sh

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.2.0",
"version": "1.2.2",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"directories": {
@@ -10,7 +10,7 @@
"dist"
],
"dependencies": {
"rxjs": "5.0.0-beta.2"
"rxjs": "^5.0.0-beta.6"
},
"devDependencies": {
"browserify": "^13.0.0",
@@ -33,7 +33,7 @@
"semver": "^5.0.1",
"tslint": "^3.8.1",
"tslint-eslint-rules": "^1.3.0",
"typescript": "^1.7.5"
"typescript": "^1.8.10"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",

View File

@@ -18,7 +18,7 @@ function run {
if [ ! -d "$SITE_DIR" ]; then
echo "checking out"
cd ./scripts
./git/clone.sh --repository="driftyco/ionic-site" \
./git/clone.sh --repository="ionic-site" \
--directory="$SITE_DIR" \
--branch="master"
ls -al $SITE_DIR

View File

@@ -17,8 +17,9 @@ module.exports = function jekyll(renderDocsProcessor) {
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
docs.forEach(function(doc, i) {
docs[i].URL = doc.outputPath.replace('docs/v2//','docs/v2/')
.replace('/index.md','');
doc.outputPath = doc.outputPath.toLowerCase().replace(' ', '-');
docs[i].URL = doc.outputPath.replace('docs/v2//', 'docs/v2/')
.replace('/index.md', '');
});
docs.push({

View File

@@ -34,6 +34,11 @@ function run {
git config --global user.name "Ionitron"
git add -A
git commit -am "Automated build of native docs driftyco/$CIRCLE_PROJECT_REPONAME@$CIRCLE_SHA1"
# in case a different commit was pushed to ionic-site during doc/demo gen,
# try to rebase around it before pushing
git fetch
git rebase
git push origin master
echo "-- Updated docs for $VERSION_NAME succesfully!"

View File

@@ -17,7 +17,11 @@ function run {
if [[ "$DEPTH" != "" ]]; then
ARGS="$ARGS --depth=$DEPTH"
fi
git clone https://driftyco:$GH_TOKEN@github.com/$REPOSITORY $DIRECTORY $ARGS
git config --global user.email "hi@ionicframework.com"
git config --global user.name "Ionitron"
git clone git@github.com:driftyco/$REPOSITORY.git $DIRECTORY $ARGS
cd $DIRECTORY
git fetch origin --tags
cd ../

View File

@@ -11,6 +11,7 @@ import {AppAvailability} from './plugins/appavailability';
import {AppRate} from './plugins/apprate';
import {AppVersion} from './plugins/appversion';
import {Badge} from './plugins/badge';
import {BackgroundGeolocation} from './plugins/background-geolocation';
import {BarcodeScanner} from './plugins/barcodescanner';
import {Base64ToGallery} from './plugins/base64togallery';
import {BatteryStatus} from './plugins/batterystatus';
@@ -31,6 +32,7 @@ import {Dialogs} from './plugins/dialogs';
import {EmailComposer} from './plugins/emailcomposer';
import {Facebook} from './plugins/facebook';
import {File} from './plugins/file';
import {Transfer} from './plugins/filetransfer';
import {Flashlight} from './plugins/flashlight';
import {Geolocation} from './plugins/geolocation';
import {Globalization} from './plugins/globalization';
@@ -39,6 +41,7 @@ import {GoogleAnalytics} from './plugins/googleanalytics';
import {Hotspot} from './plugins/hotspot';
import {ImagePicker} from './plugins/imagepicker';
import {InAppBrowser} from './plugins/inappbrowser';
import {Insomnia} from './plugins/insomnia';
import {Keyboard} from './plugins/keyboard';
import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
@@ -64,6 +67,7 @@ export {
AppRate,
AppVersion,
Badge,
BackgroundGeolocation,
BarcodeScanner,
Base64ToGallery,
BatteryStatus,
@@ -93,6 +97,7 @@ export {
Hotspot,
ImagePicker,
InAppBrowser,
Insomnia,
Keyboard,
LaunchNavigator,
LocalNotifications,
@@ -104,10 +109,11 @@ export {
SocialSharing,
SpinnerDialog,
Splashscreen,
SQLite,
SQLite,
StatusBar,
Toast,
TouchID,
Transfer,
Vibration,
WebIntent
}
@@ -122,6 +128,7 @@ window['IonicNative'] = {
AppRate: AppRate,
AppVersion: AppVersion,
Badge: Badge,
BackgroundGeolocation: BackgroundGeolocation,
BarcodeScanner: BarcodeScanner,
Base64ToGallery: Base64ToGallery,
BatteryStatus: BatteryStatus,
@@ -146,7 +153,7 @@ window['IonicNative'] = {
Flashlight: Flashlight,
Geolocation: Geolocation,
Globalization: Globalization,
GoogleMaps : GoogleMaps,
GoogleMaps : GoogleMaps,
GoogleAnalytics: GoogleAnalytics,
Hotspot: Hotspot,
ImagePicker: ImagePicker,
@@ -162,10 +169,11 @@ window['IonicNative'] = {
SocialSharing: SocialSharing,
SpinnerDialog: SpinnerDialog,
Splashscreen: Splashscreen,
SQLite: SQLite,
SQLite: SQLite,
StatusBar: StatusBar,
Toast: Toast,
TouchID: TouchID,
Transfer: Transfer,
Vibration: Vibration,
WebIntent: WebIntent
};

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name AdMob
@@ -174,4 +174,4 @@ export class AdMob {
})
static onInterstitialDismiss (): Observable<any> {return; }
}
}

View File

@@ -32,19 +32,21 @@ export class AppRate {
/**
* Rating dialog preferences
*
* useLanguage {String} null - custom BCP 47 language tag
* displayAppName {String} '' - custom application title
* promptAgainForEachNewVersion {Boolean} true - show dialog again when application version will be updated
* usesUntilPrompt {Integer} 3 - count of runs of application before dialog will be displayed
* openStoreInApp {Boolean} false - leave app or no when application page opened in app store (now supported only for iOS)
* useCustomRateDialog {Boolean} false - use custom view for rate dialog
* callbacks.onButtonClicked {Function} null - call back function. called when user clicked on rate-dialog buttons
* callbacks.onRateDialogShow {Function} null - call back function. called when rate-dialog showing
* storeAppURL.ios {String} null - application id in AppStore
* storeAppURL.android {String} null - application URL in GooglePlay
* storeAppURL.blackberry {String} null - application URL in AppWorld
* storeAppURL.windows8 {String} null - application URL in WindowsStore
* customLocale {Object} null - custom locale object
* | Option | Type | Default | Description |
* |------------------------------|------------|---------|----------------------------------------------------------------------------------------|
* | useLanguage | `String` | null | custom BCP 47 language tag |
* | displayAppName | `String` | '' | custom application title |
* | promptAgainForEachNewVersion | `Boolean` | true | show dialog again when application version will be updated |
* | usesUntilPrompt | `Integer` | 3 | count of runs of application before dialog will be displayed |
* | openStoreInApp | `Boolean` | false | leave app or no when application page opened in app store (now supported only for iOS) |
* | useCustomRateDialog | `Boolean` | false | use custom view for rate dialog |
* | callbacks.onButtonClicked | `Function` | null | call back function. called when user clicked on rate-dialog buttons |
* | callbacks.onRateDialogShow | `Function` | null | call back function. called when rate-dialog showing |
* | storeAppURL.ios | `String` | null | application id in AppStore |
* | storeAppURL.android | `String` | null | application URL in GooglePlay |
* | storeAppURL.blackberry | `String` | null | application URL in AppWorld |
* | storeAppURL.windows8 | `String` | null | application URL in WindowsStore |
* | customLocale | `Object` | null | custom locale object |
* @type {{}}
*/
@CordovaProperty

View File

@@ -0,0 +1,336 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Rx';
declare var window;
export interface Location {
/**
* ID of location as stored in DB (or null)
*/
locationId: number;
/**
* Service provider
*/
serviceProvider: string;
/**
* true if location recorded as part of debug
*/
debug: boolean
/**
* UTC time of this fix, in milliseconds since January 1, 1970.
*/
time: number;
/**
* latitude, in degrees.
*/
latitude: number;
/**
* longitude, in degrees.
*/
longitude: number;
/**
* estimated accuracy of this location, in meters.
*/
accuracy: number;
/**
* speed if it is available, in meters/second over ground.
*/
speed: number;
/**
* altitude if available, in meters above the WGS 84 reference ellipsoid.
*/
altitude: number;
/**
* bearing, in degrees.
*/
bearing: number;
/**
* A Coordinates object defining the current location
*/
coords: Coordinates;
/**
* A timestamp representing the time at which the location was retrieved.
*/
timestamp: number;
}
export interface Config {
/**
* Desired accuracy in meters. Possible values [0, 10, 100, 1000]. The lower
* the number, the more power devoted to GeoLocation resulting in higher
* accuracy readings. 1000 results in lowest power drain and least accurate
* readings. @see Apple docs (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instp/CLLocationManager/desiredAccuracy)
*/
desiredAccuracy: number;
/**
* Stationary radius in meters. When stopped, the minimum distance the device
* must move beyond the stationary location for aggressive background-tracking
* to engage.
*/
stationaryRadius: number;
/**
* When enabled, the plugin will emit sounds for life-cycle events of
* background-geolocation! See debugging sounds table.
*/
debug: boolean;
/**
* The minimum distance (measured in meters) a device must move horizontally
* before an update event is generated. @see Apple docs. (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instp/CLLocationManager/distanceFilter)
*/
distanceFilter: number;
/**
* IOS, ANDROID ONLY
* Enable this in order to force a stop() when the application terminated
* (e.g. on iOS, double-tap home button, swipe away the app).
*/
stopOnTerminate?: boolean;
/**
* ANDROID, WP8 ONLY
* The minimum time interval between location updates in seconds.
* @see Android docs (http://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent))
* and the MS doc (http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.reportinterval)
* for more information
*/
locationTimeout?: number;
/**
* ANDROID ONLY
* Custom notification title in the drawer.
*/
notificationTitle?: string;
/**
* ANDROID ONLY
* Custom notification text in the drawer.
*/
notificationText?: string;
/**
* ANDROID ONLY
* The accent color to use for notification. Eg. #4CAF50.
*/
notificationIconColor?: string;
/**
* ANDROID ONLY
* The filename of a custom notification icon. See android quirks.
* NOTE: Only available for API Level >=21.
*/
notificationIcon?: string;
/**
* ANDROID ONLY
* Set location service provider @see wiki (https://github.com/mauron85/cordova-plugin-background-geolocation/wiki/Android-providers)
*/
locationService?: number;
/**
* IOS ONLY
* [AutomotiveNavigation, OtherNavigation, Fitness, Other] Presumably,
* this affects iOS GPS algorithm. @see Apple docs for more information
* (https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html#//apple_ref/occ/instp/CLLocationManager/activityType)
*/
activityType?: string;
}
/**
* @name BackgroundGeolocation
* @description
* This plugin provides foreground and background geolocation with battery-saving "circular region monitoring" and "stop detection". For
* more detail, please see https://github.com/mauron85/cordova-plugin-background-geolocation
*
* @usage
*
* ```ts
* import {BackgroundGeolocation} from 'ionic-native';
*
*
*
* // When device is ready :
* platform.ready().then(() => {
*
* // BackgroundGeolocation is highly configurable. See platform specific configuration options
* BackgroundGeolocation.configure(
* (location) => {
* console.log('[js] BackgroundGeolocation callback: ' + location.latitude + ',' + location.longitude);
*
* // IMPORTANT: You must execute the finish method here to inform the native plugin that you're finished,
* // and the background-task may be completed. You must do this regardless if your HTTP request is successful or not.
* // IF YOU DON'T, ios will CRASH YOUR APP for spending too much time in the background.
* BackgroundGeolocation.finish();
* },
* (error) => {
* console.log('BackgroundGeolocation error');
* },
* {
* desiredAccuracy: 10,
* stationaryRadius: 20,
* distanceFilter: 30,
* debug: true, // enable this hear sounds for background-geolocation life-cycle.
* stopOnTerminate: false, // enable this to clear background location settings when the app terminates
* }
* );
*
* // Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
* BackgroundGeolocation.start();
* }
*
* // If you wish to turn OFF background-tracking, call the #stop method.
* BackgroundGeolocation.stop();
*
* ```
*/
@Plugin({
plugin: 'cordova-plugin-mauron85-background-geolocation',
pluginRef: 'plugins.backgroundGeoLocation', // ????? see line 213 at https://github.com/mauron85/cordova-plugin-background-geolocation/blob/master/www/backgroundGeoLocation.js
repo: 'https://github.com/mauron85/cordova-plugin-background-geolocation'
})
export class BackgroundGeolocation {
/**
* Configure the plugin.
* Success callback will be called with one argument - Location object, which tries to mimic w3c Coordinates interface.
* See http://dev.w3.org/geo/api/spec-source.html#coordinates_interface
* Callback to be executed every time a geolocation is recorded in the background.
*
* Fail callback to be executed every time a geolocation error occurs.
*
* Options a json object of type Config
*/
@Cordova({
callbackOrder: 'reverse'
})
static configure(options: Config): Promise<Location> { return; }
/**
* Turn ON the background-geolocation system.
* The user will be tracked whenever they suspend the app.
*/
@Cordova()
static start(): Promise<any> { return; }
/**
* Turn OFF background-tracking
*/
@Cordova()
static stop(): Promise<any> { return; }
/**
* Inform the native plugin that you're finished, the background-task may be completed
* NOTE: IOS, WP only
*/
@Cordova()
static finish() { }
/**
* Force the plugin to enter "moving" or "stationary" state
* NOTE: IOS, WP only
*/
@Cordova()
static changePace(isMoving: boolean) { }
/**
* Setup configuration
*/
@Cordova({
callbackOrder: 'reverse'
})
static setConfig(options: Config): Promise<any> { return; }
/**
* Returns current stationaryLocation if available. null if not
* NOTE: IOS, WP only
*/
@Cordova()
static getStationaryLocation(): Promise<Location> { return; }
/**
* Add a stationary-region listener. Whenever the devices enters "stationary-mode",
* your #success callback will be executed with #location param containing #radius of region
* NOTE: IOS, WP only
*/
@Cordova()
static onStationary(): Promise<any> { return; }
/**
* Check if location is enabled on the device
* @returns {Promise<number>} Returns a promise with int argument that takes values 0, 1 (true).
* NOTE: ANDROID only
*/
@Cordova()
static isLocationEnabled(): Promise<number> { return; }
/**
* Display device location settings
*/
@Cordova()
static showLocationSettings() { }
/**
* Method can be used to detect user changes in location services settings.
* If user enable or disable location services then success callback will be executed.
* In case or error (SettingNotFoundException) fail callback will be executed.
* NOTE: ANDROID only
*/
@Cordova()
static watchLocationMode(): Promise<boolean> { return; }
/**
* Stop watching for location mode changes.
* NOTE: ANDROID only
*/
@Cordova()
static stopWatchingLocationMode() { }
/**
* Method will return all stored locations.
* Locations are stored when:
* - config.stopOnTerminate is false and main activity was killed
* by the system
* or
* - option.debug is true
* NOTE: ANDROID only
*/
@Cordova()
static getLocations(): Promise<any> { return; }
/**
* Delete stored location by given locationId.
* NOTE: ANDROID only
*/
@Cordova()
static deleteLocation(locationId: number): Promise<any> { return; }
/**
* Delete all stored locations.
* NOTE: ANDROID only
*/
@Cordova()
static deleteAllLocations(): Promise<any> { return; }
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name Battery Status

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name BLE

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name Bluetooth Serial
@@ -16,29 +16,27 @@ export class BluetoothSerial {
/**
* Connect to a Bluetooth device
* Returns an Observable. Subscribe to connect, unsubscribe to disconnect.
* @param macAddress_or_uuid Identifier of the remote device
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
platforms: ['Android', 'iOS', 'Windows Phone'],
observable: true,
clearFunction: 'disconnect'
})
static connect (macAddress_or_uuid: string): Promise<any> {return; }
static connect (macAddress_or_uuid: string): Observable<any> {return; }
/**
* Connect insecurely to a Bluetooth device
* Returns an Observable. Subscribe to connect, unsubscribe to disconnect.
* @param macAddress Identifier of the remote device
*/
@Cordova({
platforms: ['Android']
platforms: ['Android'],
observable: true,
clearFunction: 'disconnect'
})
static connectInsecure (macAddress: string): Promise<any> {return; }
/**
* Disconnect
*/
@Cordova({
platforms: ['Android', 'iOS', 'Windows Phone']
})
static disconnect (): Promise<any> {return; }
static connectInsecure (macAddress: string): Observable<any> {return; }
/**
* Writes data to the serial port
@@ -223,4 +221,4 @@ export class BluetoothSerial {
}
}

View File

@@ -33,6 +33,26 @@ export interface Calendar {
platforms: ['Android', 'iOS']
})
export class Calendar {
/**
* This function checks if we have permission to read/write from/to the calendar.
* The promise will resolve with `true` when:
* - You're running on iOS, or
* - You're targetting API level lower than 23, or
* - You're using Android < 6, or
* - You've already granted permission
*
* If this returns false, you should call `requestReadWritePermissions` function
*/
@Cordova()
static hasReadWritePermissions(): Promise<boolean> { return; }
/**
* Requests read/write permissions
*/
@Cordova({sync: true})
static requestReadWritePermissions(): void {}
/**
* Create a calendar. (iOS only)
*

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name DB Meter
* @description This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone.
@@ -68,4 +68,4 @@ export class DBMeter {
@Cordova()
static delete(): Promise<any> {return; }
}
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
export interface AccelerationData {
@@ -101,4 +101,4 @@ export class DeviceMotion {
static watchAcceleration(options?: AccelerometerOptions): Observable<AccelerationData> {
return;
}
}
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
export interface CompassHeading {

View File

@@ -2,7 +2,8 @@ import {Plugin, Cordova} from './plugin';
@Plugin({
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic'
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/floatinghotpot/cordova-plugin-admob'
})
export class Diagnostic {
/**
@@ -20,7 +21,7 @@ export class Diagnostic {
/**
* Checks if Wifi is connected/enabled. On iOS this returns true if the device is connected to a network by WiFi. On Android and Windows 10 Mobile this returns true if the WiFi setting is set to enabled.
* On Android this requires permission <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
* On Android this requires permission. `<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />`
*/
@Cordova()
static isWifiEnabled() {
@@ -185,4 +186,4 @@ export class Diagnostic {
}
}

View File

@@ -1,21 +1,7 @@
import {Plugin, Cordova} from './plugin';
import {Email} from './types/email.type';
declare var cordova;
/**
* Email object for Opening Email Composer
*/
export interface Email {
app?: string;
to: string | Array<string>;
cc: string | Array<string>;
bcc: string | Array<string>;
attachments: Array<any>;
subject: string;
body: string;
isHtml: boolean;
}
/**
* @name Email Composer
* @description
@@ -49,7 +35,7 @@ export interface Email {
* };
*
* // Send a text message using default options
* EmailComposer.send(email);
* EmailComposer.open(email);
*
* ```
*/
@@ -64,13 +50,13 @@ export class EmailComposer {
/**
* Verifies if sending emails is supported on the device.
*
* @param app {string?} An optional app id or uri scheme. Defaults to mailto.
* @param scope {any?} An optional scope for the promise
* @returns {Promise<boolean>} Resolves promise with boolean whether EmailComposer is available
* @param app {string?} An optional app id or uri scheme.
* @returns {Promise<boolean>} Resolves if available, rejects if not available
*/
static isAvailable (app?: string, scope?: any): Promise<boolean> {
static isAvailable (app?: string): Promise<any> {
return new Promise<boolean>((resolve, reject) => {
cordova.plugins.email.isAvailable(app, resolve, scope);
if (app) cordova.plugins.email.isAvailable(app, (isAvailable) => { if (isAvailable) resolve(); else reject(); });
else cordova.plugins.email.isAvailable((isAvailable) => { if (isAvailable) resolve(); else reject(); });
});
}

View File

@@ -20,7 +20,7 @@ import {Plugin, Cordova} from './plugin';
* Then type in the following command in your Terminal, where APP_ID and APP_NAME are the values from the Facebook Developer portal.
*
* ```bash
* cordova plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ionic plugin add cordova-plugin-facebook4 --save --variable APP_ID="123456789" --variable APP_NAME="myApplication"
* ```
*
* After, you'll need to add the native platforms you'll be using to your app in the Facebook Developer portal under your app's Settings:

View File

@@ -51,6 +51,10 @@ export class File {
rejectFn('directory cannot start with \/');
}
if (!(/\/$/.test(dir))) {
path += '/';
}
try {
var directory = path + dir;
@@ -118,7 +122,7 @@ export class File {
}
/**
* Remove a directory at a given path
* Remove a directory at a given path.
*
* @param {string} path The path to the directory
* @param {string} dirName The directory name
@@ -158,7 +162,7 @@ export class File {
}
/**
* Move a directory to a given path
* Move a directory to a given path.
*
* @param {string} path The source path to the directory
* @param {string} dirName The source directory name
@@ -252,7 +256,7 @@ export class File {
}
/**
* List files and directory from a given path
* List files and directory from a given path.
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} dirName Name of directory
@@ -351,6 +355,10 @@ export class File {
rejectFn('file cannot start with \/');
}
if (!(/\/$/.test(file))) {
path += '/';
}
try {
var directory = path + file;
@@ -462,7 +470,57 @@ export class File {
// static writeExistingFile(path: string, fileName: string, text: string): Promise<any> { return }
// static readAsText(path: string, file: string): Promise<any> { return }
/**
* Read a file as string.
*
* @param {string} path Base FileSystem. Please refer to the iOS and Android filesystems above
* @param {string} fileName Name of file to move
* @return Returns a Promise that resolves or rejects with an error.
*/
static readAsText(path: string, fileName: string): Promise<any> {
let resolveFn, rejectFn;
let promise = new Promise((resolve, reject) => {resolveFn = resolve; rejectFn = reject; });
if ((/^\//.test(fileName))) {
rejectFn('file-name cannot start with \/');
}
try {
window.resolveLocalFileSystemURL(path, function (fileSystem) {
fileSystem.getFile(fileName, {create: false}, function (fileEntry) {
fileEntry.file(function (file) {
var reader = new FileReader();
reader.onloadend = function(e) {
if (this.result !== undefined && this.result !== null) {
resolveFn(this.result);
} else if (this.error !== undefined && this.error !== null) {
rejectFn(this.error);
} else {
rejectFn({code: null, message: 'READER_ONLOADEND_ERR'});
}
};
reader.readAsText(file);
}, function (error) {
error.message = File.cordovaFileError[error.code];
rejectFn(error);
});
}, function (err) {
err.message = File.cordovaFileError[err.code];
rejectFn(err);
});
}, function (er) {
er.message = File.cordovaFileError[er.code];
rejectFn(er);
});
} catch (e) {
e.message = File.cordovaFileError[e.code];
rejectFn(e);
}
return promise;
}
// static readAsDataURL(path: string, file: string): Promise<any> { return }

194
src/plugins/filetransfer.ts Normal file
View File

@@ -0,0 +1,194 @@
import {Plugin, CordovaInstance} from './plugin';
declare var FileTransfer;
export interface FileUploadOptions {
/**
* The name of the form element.
* Defaults to 'file'.
*/
fileKey?: string;
/**
* The file name to use when saving the file on the server.
* Defaults to 'image.jpg'.
*/
fileName?: string;
/**
* The HTTP method to use - either PUT or POST.
* Defaults to POST.
*/
httpMethod?: string;
/**
* The mime type of the data to upload.
* Defaults to image/jpeg.
*/
mimeType?: string;
/**
* A set of optional key/value pairs to pass in the HTTP request.
*/
params?: { [s: string]: any; }
/**
* Whether to upload the data in chunked streaming mode.
* Defaults to true.
*/
chunkedMode?: boolean;
/**
* A map of header name/header values. Use an array to specify more
* than one value. On iOS, FireOS, and Android, if a header named
* Content-Type is present, multipart form data will NOT be used.
*/
headers?: { [s: string]: any; }
}
export interface FileUploadResult {
/**
* The number of bytes sent to the server as part of the upload.
*/
bytesSent: number;
/**
* The HTTP response code returned by the server.
*/
responseCode: number;
/**
* The HTTP response returned by the server.
*/
response: string;
/**
* The HTTP response headers by the server.
*/
headers: { [s: string]: any; }
}
export interface FileTransferError {
/**
* One of the predefined error codes listed below.
*/
code: number;
/**
* URL to the source.
*/
source: string;
/**
* URL to the target.
*/
target: string;
/**
* HTTP status code. This attribute is only available when a response
* code is received from the HTTP connection.
*/
http_status: number;
/**
* Response body. This attribute is only available when a response is received from the HTTP connection.
*/
body: string;
/**
* Either e.getMessage or e.toString.
*/
exception: string;
}
/**
* @name Transfer
* @description This plugin allows you to upload and download files.
* Example:
* Create instance:
* const fileTransfer = new Transfer();
*
* Upload a file:
* fileTransfer.upload(..).then(..).catch(..);
*
* Download a file:
* fileTransfer.download(..).then(..).catch(..);
*
* Abort active transfer:
* fileTransfer.abort();
*/
@Plugin({
plugin: 'cordova-plugin-file-transfer',
pluginRef: 'FileTransfer',
repo: 'https://github.com/apache/cordova-plugin-file-transfer'
})
export class Transfer {
public static FILE_NOT_FOUND_ERR: number = 1;
public static INVALID_URL_ERR: number = 2;
public static CONNECTION_ERR: number = 3;
public static ABORT_ERR: number = 4;
public static NOT_MODIFIED_ERR: number = 4;
private _objectInstance: any;
constructor() {
this._objectInstance = new FileTransfer();
}
/**
* Sends a file to a server.
*
* @param {string} fileUrl Filesystem URL representing the file on the device or a data URI. For backwards compatibility, this can also be the full path of the file on the device.
* @param {string} url URL of the server to receive the file, as encoded by encodeURI().
* @param {FileUploadOptions} options Optional parameters.
* @param {boolean} trustAllHosts: Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful since Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
* @return Returns a Promise that resolves to a FileUploadResult and rejects with FileTransferError.
*/
@CordovaInstance({
successIndex: 2,
errorIndex: 3
})
upload(fileUrl: string, url: string, options?: FileUploadOptions, trustAllHosts?: boolean): Promise<FileUploadResult> {
return;
}
/**
* Downloads a file from server.
*
* @param {string} source URL of the server to download the file, as encoded by encodeURI().
* @param {stirng} target Filesystem url representing the file on the device. For backwards compatibility, this can also be the full path of the file on the device.
* @param {boolean} trustAllHosts Optional parameter, defaults to false. If set to true, it accepts all security certificates. This is useful because Android rejects self-signed security certificates. Not recommended for production use. Supported on Android and iOS.
* @param {object} Optional parameters, currently only supports headers (such as Authorization (Basic Authentication), etc).
* @return Returns a Promise that resolves to a FileEntry object.
*/
@CordovaInstance({
successIndex: 2,
errorIndex: 3
})
download(source: string, target: string, trustAllHosts?: boolean, options?: { [s: string]: any; }): Promise<any> {
return;
}
/**
* Registers a listener that gets called whenever a new chunk of data is transferred.
* @param {function} Listener that takes a progress event.
*/
onProgress(listener: (event: ProgressEvent) => any): void {
this._objectInstance.onprogress = listener;
}
/**
* Aborts an in-progress transfer. The onerror callback is passed a FileTransferError
* object which has an error code of FileTransferError.ABORT_ERR.
*/
@CordovaInstance({
sync: true
})
abort(): void {}
}

View File

@@ -23,8 +23,8 @@ export class Flashlight {
/**
* Checks if the flash light is available
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flash light is available.
* Checks if the flashlight is available
* @returns {Promise<boolean>} Returns a promise that resolves with a boolean stating if the flashlight is available.
*/
@Cordova()
static available(): Promise<boolean> { return; }
@@ -37,7 +37,7 @@ export class Flashlight {
static switchOn(): Promise<boolean> { return; }
/**
* Switches the flash light off
* Switches the flashlight off
* @returns {Promise<boolean>}
*/
@Cordova()
@@ -52,7 +52,7 @@ export class Flashlight {
/**
* Checks if the flash light is turned on.
* Checks if the flashlight is turned on.
* Returns a boolean
*/
@Cordova({
@@ -60,4 +60,4 @@ export class Flashlight {
})
static isSwitchedOn(): boolean { return; }
}
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
declare var window;

View File

@@ -107,7 +107,7 @@ export class Globalization {
successIndex: 1,
errorIndex: 2
})
static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value}> {return; }
static stringToNumber(stringToConvert: string, options: {type: string}): Promise<{value:number|string}> {return; }
/**
*

View File

@@ -1,5 +1,5 @@
import {Cordova, Plugin} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
import {CordovaInstance} from './plugin';
/**
* Created by Ibrahim on 3/29/2016.

View File

@@ -1,13 +1,22 @@
import {Plugin, Cordova} from './plugin';
import {Network} from './types/network.type';
import {NetworkConfig} from './types/network-config.type';
import {ConnectionInfo} from './types/connection-info.type';
import {HotspotDevice} from './types/hotspot-device.type';
/**
* @name Hotspot
* @description
* @usage
* ```js
* import {Hotspot} from 'ionic-native';
*
* import {Hotspot, Network} from 'ionic-native';
*
* ...
* Hotspot.scanWifi().then((networks: Array<Network>) => {
* console.log(networks);
* });
* ...
*
* ```
*/
@@ -23,84 +32,191 @@ export class Hotspot {
static isAvailable(): Promise<boolean> {return; }
@Cordova()
static toggleWifi(): Promise<any> {return; }
static toggleWifi(): Promise<boolean> {return; }
/**
* Configures and starts hotspot with SSID and Password
*
* @param {string} SSID - SSID of your new Access Point
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
* @param {string} password - password for your new Access Point
*
* @return {Promise<void>} - Promise to call once hotspot is started, or reject upon failure
*/
@Cordova()
static createHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
/**
* Turns on Access Point
*
* @return {Promise<boolean>} - true if AP is started
*/
@Cordova()
static startHotspot(): Promise<boolean> {return; }
/**
* Configures hotspot with SSID and Password
*
* @param {string} SSID - SSID of your new Access Point
* @param {string} mode - encryption mode (Open, WEP, WPA, WPA_PSK)
* @param {string} password - password for your new Access Point
*
* @return {Promise<void>} - Promise to call when hotspot is configured, or reject upon failure
*/
@Cordova()
static configureHotspot(ssid: string, mode: string, password: string): Promise<void> {return; }
/**
* Turns off Access Point
*
* @return {Promise<boolean>} - Promise to turn off the hotspot, true on success, false on failure
*/
@Cordova()
static stopHotspot(): Promise<boolean> {return; }
/**
* Checks if hotspot is enabled
*
* @return {Promise<void>} - Promise that hotspot is enabled, rejected if it is not enabled
*/
@Cordova()
static isHotspotEnabled(): Promise<void> {return; }
@Cordova()
static createHotspot(ssid: string, mode: string, password: string): Promise<any> {return; }
static getAllHotspotDevices(): Promise<Array<HotspotDevice>> {return; }
/**
* Connect to a WiFi network
*
* @param {string} ssid
* SSID to connect
* @param {string} password
* password to use
*
* @return {Promise<void>}
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static connectToWifi(ssid: string, password: string): Promise<void> {return; }
/**
* Connect to a WiFi network
*
* @param {string} ssid
* SSID to connect
* @param {string} password
* Password to use
* @param {string} authentication
* Authentication modes to use (LEAP, SHARED, OPEN)
* @param {string[]} encryption
* Encryption modes to use (CCMP, TKIP, WEP104, WEP40)
*
* @return {Promise<void>}
* Promise that connection to the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static connectToWifiAuthEncrypt(ssid: string, password: string, authentication: string, encryption: Array<string>): Promise<void> {return; }
/**
* Add a WiFi network
*
* @param {string} ssid
* SSID of network
* @param {string} mode
* Authentication mode of (Open, WEP, WPA, WPA_PSK)
* @param {string} password
* Password for network
*
* @return {Promise<void>}
* Promise that adding the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static addWifiNetwork(ssid: string, mode: string, password: string): Promise<void> {return; }
/**
* Remove a WiFi network
*
* @param {string} ssid
* SSID of network
*
* @return {Promise<void>}
* Promise that removing the WiFi network was successfull, rejected if unsuccessful
*/
@Cordova()
static removeWifiNetwork(ssid: string): Promise<void> {return; }
@Cordova()
static startHotspot(): Promise<any> {return; }
static isConnectedToInternet(): Promise<boolean> {return; }
@Cordova()
static configureHotspot(ssid: string, mode: string, password: string): Promise<any> {return; }
static isConnectedToInternetViaWifi(): Promise<boolean> {return; }
@Cordova()
static stopHotspot(): Promise<any> {return; }
static isWifiOn(): Promise<boolean> {return; }
@Cordova()
static isHotspotEnabled(): Promise<any> {return; }
static isWifiSupported(): Promise<boolean> {return; }
@Cordova()
static getAllHotspotDevices(): Promise<any> {return; }
static isWifiDirectSupported(): Promise<boolean> {return; }
@Cordova()
static connectToHotspot(ssid, password): Promise<any> {return; }
static scanWifi(): Promise<Array<Network>> {return; }
@Cordova()
static connectToWifiAuthEncrypt(ssid, password, authentication, encryption): Promise<any> {return; }
static scanWifiByLevel(): Promise<Array<Network>> {return; }
@Cordova()
static addWifiNetwork(ssid, mode, password): Promise<any> {return; }
static startWifiPeriodicallyScan(interval: number, duration: number): Promise<any> {return; }
@Cordova()
static removeWifiNetwork(ssid): Promise<any> {return; }
static stopWifiPeriodicallyScan(): Promise<any> {return; }
@Cordova()
static isConnectedToInternet(): Promise<any> {return; }
static getNetConfig(): Promise<NetworkConfig> {return; }
@Cordova()
static isConnectedToInternetViaWifi(): Promise<any> {return; }
static getConnectionInfo(): Promise<ConnectionInfo> {return; }
@Cordova()
static isWifiOn(): Promise<any> {return; }
static pingHost(ip: string): Promise<string> {return; }
/**
* Gets MAC Address associated with IP Address from ARP File
*
* @param {string} ip - IP Address that you want the MAC Address of
*
* @return {Promise<string>} - A Promise for the MAC Address
*/
@Cordova()
static isWifiSupported(): Promise<any> {return; }
static getMacAddressOfHost(ip: string): Promise<string> {return; }
/**
* Checks if IP is live using DNS
*
* @param {string} ip - IP Address you want to test
*
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
static isWifiDirectSupported(): Promise<any> {return; }
static isDnsLive(ip: string): Promise<boolean> {return; }
/**
* Checks if IP is live using socket And PORT
*
* @param {string} ip - IP Address you want to test
*
* @return {Promise<boolean>} - A Promise for whether the IP Address is reachable
*/
@Cordova()
static scanWifi(): Promise<any> {return; }
static isPortLive(ip: string): Promise<boolean> {return; }
/**
* Checks if device is rooted
*
* @return {Promise<boolean>} - A Promise for whether the device is rooted
*/
@Cordova()
static scanWifiByLevel(): Promise<any> {return; }
@Cordova()
static startPeriodicallyScan(interval, duration): Promise<any> {return; }
@Cordova()
static stopPeriodicallyScan(): Promise<any> {return; }
@Cordova()
static getNetConfig(): Promise<any> {return; }
@Cordova()
static getConnectionInfo(): Promise<any> {return; }
@Cordova()
static pingHost(ip): Promise<any> {return; }
@Cordova()
static getMacAddressOfHost(ip): Promise<any> {return; }
@Cordova()
static isDnsLive(ip): Promise<any> {return; }
@Cordova()
static isPortLife(ip): Promise<any> {return; }
@Cordova()
static isRooted(): Promise<any> {return; }
static isRooted(): Promise<boolean> {return; }
}

47
src/plugins/insomnia.ts Normal file
View File

@@ -0,0 +1,47 @@
import {Plugin, Cordova} from './plugin';
/**
* @name Insomnia
* @description
* Prevent the screen of the mobile device from falling asleep.
*
* @usage
* ```js
* import {Insomnia} from 'ionic-native';
*
* Insomnia.keepAwake()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
*
* Insomnia.allowSleepAgain()
* .then(
* () => console.log('success'),
* () => console.log('error')
* );
* ```
*
*/
@Plugin({
plugin: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin.git',
pluginRef: 'plugins.insomnia',
repo: 'https://github.com/EddyVerbruggen/Insomnia-PhoneGap-Plugin',
platforms: ['Android', 'iOS', 'Windows Phone 8']
})
export class Insomnia {
/**
* Keeps awake the application
* @returns {Promise}
*/
@Cordova()
static keepAwake(): Promise<any> { return; }
/**
* Allows the application to sleep again
* @returns {Promise}
*/
@Cordova()
static allowSleepAgain(): Promise<any> { return; }
}

View File

@@ -1,5 +1,5 @@
import {Cordova, Plugin} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @name Keyboard
@@ -37,7 +37,7 @@ export class Keyboard {
static show(): void {}
/**
* Close the keyboard if open
* Close the keyboard if open.
*/
@Cordova({
sync: true,
@@ -75,4 +75,4 @@ export class Keyboard {
})
static onKeyboardHide(): Observable<any> {return; }
}
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova, CordovaProperty} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
declare var navigator: any;
@@ -25,14 +25,14 @@ declare var navigator: any;
* let connectSubscription = Network.onConnect().subscribe(() => {
* console.log('network connected!');*
* // We just got a connection but we need to wait briefly
* // before we determine the connection type. Might need to wait
*// before we determine the connection type. Might need to wait
* // prior to doing any api requests as well.
* setTimeout(() => {
* console.log(Network.connection);
* if (Network.connection === Connection.WIFI) {
* console.log('we got a wifi connection, woohoo!');
* }
* });
* }, 3000);
* });
*
* // stop connect watch

View File

@@ -6,7 +6,7 @@ declare var window;
declare var Promise;
declare var $q;
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
/**
* @private
@@ -160,7 +160,7 @@ function callInstance(pluginObj: any, methodName: string, args: any[], opts: any
return pluginObj._objectInstance[methodName].apply(pluginObj._objectInstance, args);
}
function wrapInstance (pluginObj: any, methodName: string, args: any[], opts: any = {}) {
function wrapInstance (pluginObj: any, methodName: string, opts: any = {}) {
return (...args) => {
if (opts.sync) {
return callInstance(pluginObj, methodName, args, opts);
@@ -317,3 +317,22 @@ export function CordovaProperty(target: Function, key: string, descriptor: Typed
return descriptor;
}
/**
* @private
* @param target
* @param key
* @param descriptor
* @constructor
*/
export function InstanceProperty(target: Function, key: string, descriptor: TypedPropertyDescriptor<any>) {
descriptor.get = function() {
return this._objectInstance[key];
};
descriptor.get = function(...args: any[]) {
return this._objectInstance[key] = args[0];
};
return descriptor;
}

View File

@@ -1,4 +1,5 @@
import {Cordova, Plugin} from './plugin';
declare var navigator: any;
@Plugin({
plugin: 'https://github.com/gitawego/cordova-screenshot.git',
pluginRef: 'navigator.screenshot',
@@ -8,29 +9,52 @@ export class Screenshot {
/**
* Takes screenshot and saves the image
*
*
* @param {string} format. Format can take the value of either 'jpg' or 'png'
* On ios, only 'jpg' format is supported
* @param {number} quality. Determines the quality of the screenshot.
* @param {number} quality. Determines the quality of the screenshot.
* Default quality is set to 100.
* @param {string} filename. Name of the file as stored on the storage
* @param {string} filename. Name of the file as stored on the storage
*/
@Cordova({
successIndex: 1,
errorIndex: 0
})
static save (format?: string, quality?: number, filename?: string): Promise<any> {return; }
static save (format?: string, quality?: number, filename?: string): Promise<any> {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.save(
(error, result) => {
if(error){
reject(error);
}else{
resolve(result);
}
},
format,
quality,
filename
);
}
);
}
/**
* Takes screenshot and returns the image as an URI
*
* @param {number} quality. Determines the quality of the screenshot.
*
* @param {number} quality. Determines the quality of the screenshot.
* Default quality is set to 100.
*/
@Cordova({
successIndex: 1,
errorIndex: 0
})
static URI (quality?: number): Promise<any> {return; }
}
static URI (quality?: number): Promise<any> {
return new Promise<any>(
(resolve, reject) => {
navigator.screenshot.URI(
(error, result) => {
if(error){
reject(error);
}else{
resolve(result);
}
},
quality
);
}
);
}
}

View File

@@ -1,5 +1,5 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
import {Observable} from 'rxjs/Rx';
export interface ToastOptions {
/**

View File

@@ -0,0 +1,30 @@
/**
* @name ConnectionInfo
*/
export interface ConnectionInfo {
/**
* @property {string} SSID
* The service set identifier (SSID) of the current 802.11 network.
*/
SSID: string;
/**
* @property {string} BSSID
* The basic service set identifier (BSSID) of the current access point.
*/
BSSID: string;
/**
* @property {string} linkSpeed
* The current link speed in Mbps
*/
linkSpeed: string;
/**
* @property {string} IPAddress
* The IP Address
*/
IPAddress: string;
/**
* @property {string} networkID
* Each configured network has a unique small integer ID, used to identify the network when performing operations on the supplicant.
*/
networkID: string;
}

View File

@@ -0,0 +1,13 @@
/**
* Email object for Opening Email Composer
*/
export interface Email {
app?: string;
to?: string | Array<string>;
cc?: string | Array<string>;
bcc?: string | Array<string>;
attachments?: Array<any>;
subject?: string;
body?: string;
isHtml?: boolean;
}

View File

@@ -0,0 +1,15 @@
/**
* @name HotspotDevice
*/
export interface HotspotDevice {
/**
* @property {string} ip
* Hotspot IP Address
*/
ip: string;
/**
* @property {string} mac
* Hotspot MAC Address
*/
mac: string;
}

View File

@@ -0,0 +1,21 @@
/**
* @name ConnectionInfo
*/
export interface NetworkConfig {
/**
* @property {string} deviceIPAddress - Device IP Address
*/
deviceIPAddress: string;
/**
* @property {string} deviceMacAddress - Device MAC Address
*/
deviceMacAddress: string;
/**
* @property {string} gatewayIPAddress - Gateway IP Address
*/
gatewayIPAddress: string;
/**
* @property {string} gatewayMacAddress - Gateway MAC Address
*/
gatewayMacAddress: string;
}

View File

@@ -0,0 +1,37 @@
/**
* @name Network
* @description
* Based on [ScanResult](http://developer.android.com/reference/android/net/wifi/ScanResult.html)
*/
export interface Network {
/**
* @property {string} SSID
* Human readable network name
*/
SSID: string;
/**
* @property {string} BSSID
* MAC Address of the access point
*/
BSSID: string;
/**
* @property {number (int)} frequency
* The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.
*/
frequency: number;
/**
* @property {number} level
* The detected signal level in dBm, also known as the RSSI.
*/
level: number;
/**
* @property {number} timestamp
* Timestamp in microseconds (since boot) when this result was last seen.
*/
timestamp: number;
/**
* @property {string} capabilities
* Describes the authentication, key management, and encryption schemes supported by the access point.
*/
capabilities: string;
}

View File

@@ -35,4 +35,4 @@ export class WebIntent {
@Cordova()
static sendBroadcast(options: {action: string, extras?: {option: boolean}}): Promise<any> {return; }
}
}