Compare commits

...

23 Commits

Author SHA1 Message Date
Ibby Hadeed f69d1755c6 chore(changelog): update changelog 2016-06-27 08:43:32 -04:00
Ibby Hadeed 3ddb728043 1.3.2 2016-06-27 08:42:56 -04:00
Ibby Hadeed ab2816e214 chore(build): remove github-release command 2016-06-27 08:42:12 -04:00
Ibby Hadeed a5f3d7a9bd fix(build): disable emitDecoratorMetadata option in tsconfig
closes #251
2016-06-27 08:41:10 -04:00
Ibby Hadeed e52c1f0cae chore(): update changelog 2016-06-26 13:06:49 -04:00
Ibby Hadeed def3914abe chore(): fix circleci test commands 2016-06-26 13:02:20 -04:00
Ibby Hadeed 677b676c77 1.3.1 2016-06-26 12:58:05 -04:00
Ibrahim Hadeed 3936f81d8f chore(build): update build process, commands, and packages
* chore(build): change build commands + tools

* refactor(sqlite): tslint

* chore(tsconfig): update tsconfig & change build command

* chore(build): change build commands
2016-06-26 12:54:14 -04:00
Ibrahim Hadeed ade3edace4 refractor(diagnostic): add return types and cleanup return statement
* refractor(): set return type, and clean up the return statement

* docs(): cleanup docs

* docs(): fix repo link
2016-06-26 11:50:13 -04:00
Ibby Hadeed 4251d1fba5 Merge branch 'master' of https://github.com/driftyco/ionic-native 2016-06-26 11:15:13 -04:00
Ibby Hadeed d2b2be6a70 fix(3dtouch): fix implementation for onHomeIconPressed function
closes #232
2016-06-26 11:14:48 -04:00
Lasse Brudeskar Vikås 88ed4e121f docs(backgroundmode): fix usage markdown
Added missing grave accents.
2016-06-24 11:36:31 -04:00
Guillermo 17da427a9d feat(googlemaps): add GoogleMapsLatLngBounds class
* Add GoogleMapsLatLngBounds (needs testing)

* Reformat googlemaps to match .editorconfig rules

* Fix imports
2016-06-23 06:31:57 -04:00
Guillermo abf4983597 chore(): add .editorconfig (#238) 2016-06-22 18:25:06 -04:00
Max Lynch f1c8ce35e8 fix(sqlite): resolve race condition, add comments (#235) 2016-06-20 17:23:26 -04:00
dustinromey 32661b791a docs(deeplinks): fix repo link 2016-06-20 15:17:28 -04:00
Nogueron Matthieu d42780daca docs(toast): fix parameter type (#230)
In the usage example the duration was displayed as a number instead of the actual string parameter.
2016-06-16 05:07:44 -04:00
Francis Clavette e8a108d92d Changed SafariViewController show return type (#228)
Changed it to `Promise<any>` as in the example. Was `void`.
2016-06-16 05:06:54 -04:00
Ibrahim Hadeed 9e0f569eba refractor(globalization): remove whitespace
closes #227
2016-06-15 18:17:02 -04:00
Zachary Keeton 48ffcaeb61 feat(printer): add printer plugin (#225)
* feat(printer): add printer plugin

* Fixed function implementations. Removed unnecessary reference.
2016-06-15 11:39:01 -04:00
Ibrahim Hadeed 4c6006b2e4 Merge pull request #221 from nickgal/barcode_callback_order
fix barcode scanner callback order
2016-06-13 19:27:38 -04:00
Nick Gal 18b86e8c46 fix barcode scanner callback order 2016-06-13 13:44:11 -07:00
Ibrahim Hadeed b96f066329 Update CHANGELOG.md 2016-06-13 14:26:52 -04:00
18 changed files with 968 additions and 960 deletions
+15
View File
@@ -0,0 +1,15 @@
# http://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
insert_final_newline = false
trim_trailing_whitespace = false
+40 -7
View File
@@ -1,11 +1,20 @@
<a name="1.3.0"></a>
# [1.3.0](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.0) (2016-06-13)
<a name="1.3.2"></a>
## [1.3.2](https://github.com/driftyco/ionic-native/compare/v1.3.1...v1.3.2) (2016-06-27)
### Breaking Changes
* **calendar** plugin has been fully rewritten
### Bug Fixes
* **build:** disable emitDecoratorMetadata option in tsconfig ([a5f3d7a](https://github.com/driftyco/ionic-native/commit/a5f3d7a)), closes [#251](https://github.com/driftyco/ionic-native/issues/251)
<a name="1.3.1"></a>
## [1.3.1](https://github.com/driftyco/ionic-native/compare/v1.2.4...v1.3.1) (2016-06-26)
### Bug Fixes
* **3dtouch:** fix implementation for onHomeIconPressed function ([d2b2be6](https://github.com/driftyco/ionic-native/commit/d2b2be6)), closes [#232](https://github.com/driftyco/ionic-native/issues/232)
* **barcodescanner:** add missing options param ([4fdcbb5](https://github.com/driftyco/ionic-native/commit/4fdcbb5)), closes [#180](https://github.com/driftyco/ionic-native/issues/180)
* **base64togallery:** method is now static ([be7b9e2](https://github.com/driftyco/ionic-native/commit/be7b9e2)), closes [#212](https://github.com/driftyco/ionic-native/issues/212)
* **batterystatus:** correct plugin name on npm ([66b7fa6](https://github.com/driftyco/ionic-native/commit/66b7fa6))
@@ -14,13 +23,28 @@
* **deviceorientation:** cancelFunction renamed to clearFunction ([8dee02e](https://github.com/driftyco/ionic-native/commit/8dee02e))
* **geolocation:** fix watchPosition() ([4a8650e](https://github.com/driftyco/ionic-native/commit/4a8650e)), closes [#164](https://github.com/driftyco/ionic-native/issues/164)
* **googlemaps:** isAvailable() returns boolean, not an instance of GoogleMap ([a53ae8f](https://github.com/driftyco/ionic-native/commit/a53ae8f))
* **sqlite:** resolve race condition, add comments ([#235](https://github.com/driftyco/ionic-native/issues/235)) ([f1c8ce3](https://github.com/driftyco/ionic-native/commit/f1c8ce3)), closes [#235](https://github.com/driftyco/ionic-native/issues/235)
### Features
* **angular1:** Support Angular 1 ([af8fbde](https://github.com/driftyco/ionic-native/commit/af8fbde))
* **barcodescanner:** add encode function ([e73f57f](https://github.com/driftyco/ionic-native/commit/e73f57f)), closes [#115](https://github.com/driftyco/ionic-native/issues/115)
* **deeplinks:** Add Ionic Deeplinks Plugin ([c93cbed](https://github.com/driftyco/ionic-native/commit/c93cbed))
* **brightntess:** Add brightness plugin
* **googlemaps:** add GoogleMapsLatLngBounds class ([17da427](https://github.com/driftyco/ionic-native/commit/17da427))
* **printer:** add printer plugin ([#225](https://github.com/driftyco/ionic-native/issues/225)) ([48ffcae](https://github.com/driftyco/ionic-native/commit/48ffcae))
<a name="1.2.4"></a>
## [1.2.4](https://github.com/driftyco/ionic-native/compare/v1.2.3...v1.2.4) (2016-06-01)
<a name="1.2.3"></a>
## [1.2.3](https://github.com/driftyco/ionic-native/compare/v1.2.2...v1.2.3) (2016-06-01)
<a name="1.2.2"></a>
## [1.2.2](https://github.com/driftyco/ionic-native/compare/v1.2.1...v1.2.2) (2016-05-20)
@@ -42,12 +66,17 @@
* **contacts:** plugin rewrite ([aada893](https://github.com/driftyco/ionic-native/commit/aada893))
### Features
* **plugin:** add wrapper for instance properties ([28d7d5c](https://github.com/driftyco/ionic-native/commit/28d7d5c))
<a name="1.2.0"></a>
# [1.2.0](https://github.com/driftyco/ionic-native/compare/v1.1.0...v1.2.0) (2016-04-30)
### Bug Fixes
* **BluetoohSerial:** add missing plugin reference ([317437b](https://github.com/driftyco/ionic-native/commit/317437b))
@@ -62,6 +91,7 @@
* **spinnerdialog:** fix functionality ([66f0e03](https://github.com/driftyco/ionic-native/commit/66f0e03))
* **vibration:** fix plugin reference ([beeb075](https://github.com/driftyco/ionic-native/commit/beeb075)), closes [#106](https://github.com/driftyco/ionic-native/issues/106)
### Features
* **camera:** add camera constants ([ce02d82](https://github.com/driftyco/ionic-native/commit/ce02d82)), closes [#129](https://github.com/driftyco/ionic-native/issues/129)
@@ -78,6 +108,7 @@
* **toast:** add new features to toast plugin ([ed7e783](https://github.com/driftyco/ionic-native/commit/ed7e783))
* **webintent:** add plugin to index ([f357b56](https://github.com/driftyco/ionic-native/commit/f357b56))
### Performance Improvements
* **ionicnative:** instance wrapper cleanup and optimization ([5a8d48e](https://github.com/driftyco/ionic-native/commit/5a8d48e))
@@ -112,6 +143,7 @@
* fix options params ([c71f8d4](https://github.com/driftyco/ionic-native/commit/c71f8d4))
* remove confirm callback, not needed. ([662d8ce](https://github.com/driftyco/ionic-native/commit/662d8ce))
### Features
* **batterystatus:** complete functionality ([e7a09d9](https://github.com/driftyco/ionic-native/commit/e7a09d9))
@@ -155,12 +187,13 @@
* **geolocation:** call correct clearFunction ([9e86a40](https://github.com/driftyco/ionic-native/commit/9e86a40))
* **plugin:** return originalMethod return value ([240f0f8](https://github.com/driftyco/ionic-native/commit/240f0f8))
* **plugin:** use call for id based clearFunction ([c2fdf39](https://github.com/driftyco/ionic-native/commit/c2fdf39))
* datepicker plugin, pluginref, and @Cordova wrapper ([499ead3](https://github.com/driftyco/ionic-native/commit/499ead3))
* datepicker plugin, pluginref, and [@Cordova](https://github.com/Cordova) wrapper ([499ead3](https://github.com/driftyco/ionic-native/commit/499ead3))
### Features
* **DatePicker:** Added DatePicker ([5afa58f](https://github.com/driftyco/ionic-native/commit/5afa58f))
* **plugin:** add sync option to @Cordova for sync functions ([17e3827](https://github.com/driftyco/ionic-native/commit/17e3827))
* **plugin:** add sync option to [@Cordova](https://github.com/Cordova) for sync functions ([17e3827](https://github.com/driftyco/ionic-native/commit/17e3827))
* **plugin:** call clearFunction with original fn args ([8f27fc9](https://github.com/driftyco/ionic-native/commit/8f27fc9))
* add app version plugin ([20cb01f](https://github.com/driftyco/ionic-native/commit/20cb01f))
* add app version plugin ([8b78521](https://github.com/driftyco/ionic-native/commit/8b78521))
+2 -2
View File
@@ -94,11 +94,11 @@ The `@Cordova` decorator has a few more options now.
### 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.
You need to run `npm run build` 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.
### Cleaning the code
You need to run `gulp tslint` to analyze the code and ensure it's consitency with the repository style. Fix any errors before submitting a PR.
You need to run `npm run tslint` to analyze the code and ensure it's consistency with the repository style. Fix any errors before submitting a PR.
### 'Wrapping' Up
+1 -1
View File
@@ -18,7 +18,7 @@ dependencies:
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
- npm run build
deployment:
staging:
+14 -8
View File
@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "1.3.0",
"version": "1.3.2",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"main": "dist/index.js",
"files": [
@@ -10,18 +10,19 @@
"rxjs": "^5.0.0-beta.6"
},
"devDependencies": {
"browserify": "^13.0.0",
"browserify": "^13.0.1",
"canonical-path": "0.0.2",
"conventional-changelog": "^1.1.0",
"conventional-changelog-cli": "^1.2.0",
"conventional-github-releaser": "^1.1.3",
"cpr": "^1.0.0",
"cz-conventional-changelog": "^1.1.5",
"cz-conventional-changelog": "^1.1.6",
"dgeni": "^0.4.2",
"dgeni-packages": "^0.10.18",
"glob": "^6.0.4",
"gulp": "~3.9.0",
"gulp": "^3.9.1",
"gulp-rename": "^1.2.2",
"gulp-tslint": "^5.0.0",
"gulp-uglify": "^1.5.3",
"gulp-uglify": "^1.5.4",
"lodash": "3.10.1",
"minimist": "^1.1.3",
"mkdirp": "^0.5.1",
@@ -34,8 +35,13 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc --module commonjs --sourcemap --outDir dist/ --experimentalDecorators -d typings/es6-shim/es6-shim.d.ts src/index.ts --target ES5",
"build_bundle": "npm run-script build && browserify dist/index.js > dist/ionic.native.js && gulp minify:dist"
"tslint": "./node_modules/.bin/gulp tslint",
"watch": "./node_modules/.bin/tsc -w",
"build": "npm run tslint && npm run build:js && npm run build:bundle && npm run build:minify",
"build:js": "./node_modules/.bin/tsc",
"build:bundle": "./node_modules/.bin/browserify dist/index.js > dist/ionic.native.js",
"build:minify": "./node_modules/.bin/gulp minify:dist",
"changelog": "./node_modules/.bin/conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},
"repository": {
"type": "git",
+3
View File
@@ -52,6 +52,7 @@ import {LaunchNavigator} from './plugins/launchnavigator';
import {LocalNotifications} from './plugins/localnotifications';
import {MediaPlugin} from './plugins/media';
import {Network, Connection} from './plugins/network';
import {Printer} from './plugins/printer';
import {Push} from './plugins/push';
import {SafariViewController} from './plugins/safari-view-controller';
import {Screenshot} from './plugins/screenshot';
@@ -85,6 +86,7 @@ export * from './plugins/inappbrowser';
export * from './plugins/launchnavigator';
export * from './plugins/localnotifications';
export * from './plugins/media';
export * from './plugins/printer';
export * from './plugins/push';
export * from './plugins/safari-view-controller';
export * from './plugins/sms';
@@ -183,6 +185,7 @@ window['IonicNative'] = {
LocalNotifications: LocalNotifications,
MediaPlugin: MediaPlugin,
Network: Network,
Printer: Printer,
Push: Push,
SafariViewController: SafariViewController,
Screenshot: Screenshot,
+10 -1
View File
@@ -1,5 +1,6 @@
import {Plugin, Cordova} from './plugin';
import {Observable} from 'rxjs/Observable';
declare var window: any;
/**
* @name 3DTouch
* @description
@@ -85,7 +86,15 @@ export class ThreeDeeTouch {
@Cordova({
observable: true
})
static onHomeIconPressed(): Observable<any> {return; }
static onHomeIconPressed(): Observable<any> {
return new Observable(observer => {
if (window.ThreeDeeTouch && window.ThreeDeeTouch.onHomeIconPressed) window.ThreeDeeTouch.onHomeIconPressed = observer.next.bind(observer);
else {
observer.error('3dTouch plugin is not available.');
observer.complete();
}
});
}
/**
* UIWebView and WKWebView (the webviews powering Cordova apps) don't allow the fancy new link preview feature of iOS9.
+2 -1
View File
@@ -8,8 +8,9 @@ import {Plugin, Cordova} from './plugin';
*@usage
* ```js
* import {BackgroundMode} from 'ionic-native';
*
*
* BackgroundMode.enable();
* ```
*/
@Plugin({
plugin: 'de.appplant.cordova.plugin.background-mode',
+3 -1
View File
@@ -37,7 +37,9 @@ export class BarcodeScanner {
* Open the barcode scanner.
* @return Returns a Promise that resolves with scanner data, or rejects with an error.
*/
@Cordova()
@Cordova({
callbackOrder: 'reverse'
})
static scan(options?: any): Promise<any> { return; }
/**
+1 -1
View File
@@ -34,7 +34,7 @@ export interface DeeplinkMatch {
@Plugin({
plugin: 'ionic-plugin-deeplinks',
pluginRef: 'IonicDeeplink',
repo: 'https://github.com/driftyo/ionic-plugin-deeplinks',
repo: 'https://github.com/driftyco/ionic-plugin-deeplinks',
platforms: ['iOS', 'Android']
})
export class Deeplinks {
+21 -113
View File
@@ -3,187 +3,95 @@ import {Plugin, Cordova} from './plugin';
@Plugin({
plugin: 'cordova.plugins.diagnostic',
pluginRef: 'cordova.plugins.diagnostic',
repo: 'https://github.com/floatinghotpot/cordova-plugin-admob'
repo: 'https://github.com/dpa99c/cordova-diagnostic-plugin'
})
export class Diagnostic {
/**
* Checks if app is able to access device location.
*/
@Cordova()
static isLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isLocationEnabled(): Promise<any> {return; }
/**
* 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" />`
*/
@Cordova()
static isWifiEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isWifiEnabled(): Promise<any> {return; }
/*
/**
* Checks if the device has a camera. On Android this returns true if the device has a camera. On iOS this returns true if both the device has a camera AND the application is authorized to use it. On Windows 10 Mobile this returns true if both the device has a rear-facing camera AND the
* application is authorized to use it.
*/
@Cordova()
static isCameraEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isCameraEnabled(): Promise<any> {return; }
/*
/**
* Checks if the device has Bluetooth capabilities and if so that Bluetooth is switched on (same on Android, iOS and Windows 10 Mobile)
* On Android this requires permission <uses-permission android:name="android.permission.BLUETOOTH" />
*/
@Cordova()
static isBluetoothEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isBluetoothEnabled(): Promise<any> {return; }
/*
/**
* Returns the location authorization status for the application.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*
* mode - (iOS-only / optional) location authorization mode: "always" or "when_in_use". If not specified, defaults to "when_in_use".
*/
@Cordova()
static requestLocationAuthorization(mode?: string) {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<string>((res, rej) => {});
}
static requestLocationAuthorization(mode?: string): Promise<any> {return; }
/*
/**
* Checks if the application is authorized to use location.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return GRANTED status as permissions are already granted at installation time.
*/
@Cordova()
static isLocationAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isLocationAuthorized(): Promise<any> {return; }
/*
/**
* Checks if camera hardware is present on device.
*/
@Cordova()
static isCameraPresent() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isCameraPresent(): Promise<any> {return; }
/*
/**
* Checks if the application is authorized to use the camera.
* Note for Android: this is intended for Android 6 / API 23 and above. Calling on Android 5 / API 22 and below will always return TRUE as permissions are already granted at installation time.
*/
@Cordova()
static isCameraAuthorized() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
/*
static isCameraAuthorized(): Promise<any> {return; }
/**
* Checks if location mode is set to return high-accuracy locations from GPS hardware.
* Returns true if Location mode is enabled and is set to either:
* - Device only = GPS hardware only (high accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isGpsLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isGpsLocationEnabled(): Promise<any> {return; }
/*
/**
* Checks if location mode is set to return low-accuracy locations from network triangulation/WiFi access points.
* Returns true if Location mode is enabled and is set to either:
* - Battery saving = network triangulation and Wifi network IDs (low accuracy)
* - High accuracy = GPS hardware, network triangulation and Wifi network IDs (high and low accuracy)
*/
@Cordova()
static isNetworkLocationEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isNetworkLocationEnabled(): Promise<any> {return; }
/**
*
* Checks if remote (push) notifications are enabled.
* On iOS 8+, returns true if app is registered for remote notifications AND "Allow Notifications" switch is ON AND alert style is not set to "None" (i.e. "Banners" or "Alerts").
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRegisteredForRemoteNotifications().
*/
@Cordova()
static isRemoteNotificationsEnabled() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isRemoteNotificationsEnabled(): Promise<any> {return; }
/**
*
* Indicates if the app is registered for remote (push) notifications on the device.
* On iOS 8+, returns true if the app is registered for remote notifications and received its device token, or false if registration has not occurred, has failed, or has been denied by the user. Note that user preferences for notifications in the Settings app will not affect this.
* On iOS <=7, returns true if app is registered for remote notifications AND alert style is not set to "None" (i.e. "Banners" or "Alerts") - same as isRemoteNotificationsEnabled().
*/
@Cordova()
static isRegisteredForRemoteNotifications() {
// This Promise is replaced by one from the @Cordova decorator that wraps
// the plugin's callbacks. We provide a dummy one here so TypeScript
// knows that the correct return type is Promise, because there's no way
// for it to know the return type from a decorator.
// See https://github.com/Microsoft/TypeScript/issues/4881
return new Promise<boolean>((res, rej) => {});
}
static isRegisteredForRemoteNotifications(): Promise<any> {return; }
}
+2 -2
View File
@@ -14,7 +14,7 @@ import {Plugin, Cordova} from './plugin';
@Plugin({
plugin: 'cordova-plugin-globalization',
pluginRef: 'navigator.globalization',
repo: 'https: //github.com/apache/cordova-plugin-globalization'
repo: 'https://github.com/apache/cordova-plugin-globalization'
})
export class Globalization {
@@ -125,4 +125,4 @@ export class Globalization {
@Cordova()
static getCurrencyPattern(currencyCode: string): Promise<{pattern: string, code: string, fraction: number, rounding: number, decimal: number, grouping: string}> {return; }
}
}
+699 -791
View File
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
import {Plugin, Cordova} from './plugin';
declare var cordova: any;
export interface PrintOptions {
/**
* The name of the print job and the document
*/
name?: string;
/**
* The network URL of the printer.
* Only supported on iOS.
*/
printerId?: string;
/**
* Specifies the duplex mode to use for the print job.
* Either double-sided (duplex:true) or single-sided (duplex:false).
* Double-sided by default.
* Only supported on iOS
*/
duplex?: boolean;
/**
* The orientation of the printed content, portrait or landscape
* Portrait by default.
*/
landscape?: boolean;
/**
* If your application only prints black text, setting this property to true can result in better performance in many cases.
* False by default.
*/
grayscale?: boolean;
/**
* The Size and position of the print view
*/
bounds?: number[] | any;
}
@Plugin({
plugin: 'de.appplant.cordova.plugin.printer',
pluginRef: 'cordova.plugins.printer',
repo: 'https://github.com/katzer/cordova-plugin-printer.git',
platforms: ['Android', 'iOS']
})
export class Printer {
/**
* Checks whether to device is capable of printing.
*/
@Cordova()
static isAvailable(): Promise<boolean> { return; }
/**
* Sends content to the printer.
* @param {content} The content to print. Can be a URL or an HTML string. If a HTML DOM Object is provided, its innerHtml property value will be used.
* @param {options} The options to pass to the printer
*/
@Cordova()
static print(content: string | HTMLElement, options?: PrintOptions): Promise<any> { return; }
}
+2 -2
View File
@@ -59,7 +59,7 @@ export class SafariViewController {
@Cordova({
callbackOrder: 'reverse'
})
static show(options?: SafariViewControllerOptions): void {}
static show(options?: SafariViewControllerOptions): Promise<any> {return; }
/**
* Hides Safari View Controller
@@ -98,4 +98,4 @@ export interface SafariViewControllerOptions {
enterReaderModeIfAvailable?: boolean;
tintColor?: string;
transition?: string;
}
}
+76 -8
View File
@@ -2,6 +2,30 @@ import {CordovaInstance, Plugin, Cordova} from './plugin';
declare var sqlitePlugin;
/**
* @name SQLite
*
* @description
* Access SQLite databases on the device.
*
* @usage
*
* ```ts
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
* db.openDatabse({
* name: 'data.db',
* location: 'default' // the location field is required
* }).then(() => {
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
*
* }, (err) => {
* console.error('Unable to execute sql', err);
* })
* }, (err) => {
* console.error('Unable to open database', err);
* });
* ```
*
*/
@Plugin({
pluginRef: 'sqlitePlugin',
@@ -15,13 +39,44 @@ export class SQLite {
return this._objectInstance.databaseFeatures;
}
constructor (config: any) {
new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, resolve, reject);
}).then(
db => this._objectInstance = db,
error => console.warn(error)
);
constructor () {}
/**
* Open or create a SQLite database file.
*
* See the plugin docs for an explanation of all options: https://github.com/litehelpers/Cordova-sqlite-storage#opening-a-database
*
* @param config the config for opening the database.
* @usage
*
* ```ts
* import { SQLite } from 'ionic-native';
*
* let db = new SQLite();
* db.openDatabse({
* name: 'data.db',
* location: 'default' // the location field is required
* }).then(() => {
* db.executeSql('create table danceMoves(name VARCHAR(32))', {}).then(() => {
*
* }, (err) => {
* console.error('Unable to execute sql', err);
* })
* }, (err) => {
* console.error('Unable to open database', err);
* });
* ```
*/
openDatabase (config: any): Promise<any> {
return new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, db => {
this._objectInstance = db;
resolve(db);
}, error => {
console.warn(error);
reject(error);
});
});
}
@CordovaInstance({
@@ -48,6 +103,19 @@ export class SQLite {
})
start (): void {}
/**
* Execute SQL on the opened database. Note, you must call `openDatabase` first, and
* ensure it resolved and successfully opened the database.
*
* @usage
*
* ```ts
* db.executeSql('SELECT FROM puppies WHERE type = ?', ['cavalier']).then((resultSet) => {
* // Access the items through resultSet.rows
* // resultSet.rows.item(i)
* }, (err) => {})
* ```
*/
@CordovaInstance()
executeSql (statement: string, params: any): Promise<any> {return; }
@@ -104,4 +172,4 @@ export class SQLite {
@Cordova()
static deleteDatabase (first): Promise<any> {return; }
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ export interface ToastOptions {
*
*
*
* Toast.show("I'm a toast", 5000, "center").subscribe(
* Toast.show("I'm a toast", "5000", "center").subscribe(
* toast => {
* console.log(toast);
* }
+12 -21
View File
@@ -1,23 +1,14 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"noImplicitAny": false,
"rootDir": ".",
"sourceMap": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"filesGlob": [
"**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"sourceMap": true,
"declaration": true,
"experimentalDecorators": true,
"outDir": "dist"
},
"files": [
"typings/es6-shim/es6-shim.d.ts",
"src/index.ts"
]
}