Compare commits

..

12 Commits

Author SHA1 Message Date
Ibby Hadeed
6a458b52cc chore(): update changelog 2017-03-28 04:45:08 -04:00
Ibby Hadeed
a1a4ef94cc 3.3.1 2017-03-28 04:44:59 -04:00
Ibby Hadeed
6e20137340 fix(contacts): fix major bug 2017-03-28 04:44:48 -04:00
Ibby Hadeed
961727ee61 fix(contacts): handle cordova_not_found errors 2017-03-28 04:37:35 -04:00
Ibby Hadeed
9c30a1d0dd fix(background-mode): add missing config options
closes #1277
2017-03-28 04:31:53 -04:00
Ibby Hadeed
ee79278503 docs(sqlite): improve echoTest and deleteDatabase docs 2017-03-28 04:27:49 -04:00
Ibby Hadeed
544e7ef4fc feat(sqlite): add SQLiteDatabaseConfig interface 2017-03-28 04:13:29 -04:00
Ibby Hadeed
01aece1fbb fix(sqlite): fixes echoTest and deleteDatabase
echoTest and deleteDatabase methods belong to the SQLite class, and not the SQLiteObject class

closes #1275
2017-03-28 04:11:19 -04:00
MobGG
a7854b7fad docs(google-map): change GoogleMapsLatLng to LatLng
change GoogleMapsLatLng to LatLng
2017-03-28 02:16:48 -04:00
Ibby Hadeed
27d3d2d1c9 chore(templates): fix variable 2017-03-27 15:07:48 -04:00
Ibby Hadeed
9074362cae fix(core): handle unexpected errors in wrapOtherPromise
fixes #1185
2017-03-27 15:00:04 -04:00
Ibby Hadeed
fd0a2e9acd fix(core): return errors from CordovaCheck decorators
fixes comment mentioned in #1268
2017-03-27 14:54:25 -04:00
9 changed files with 94 additions and 35 deletions

View File

@@ -1,3 +1,23 @@
<a name="3.3.1"></a>
## [3.3.1](https://github.com/driftyco/ionic-native/compare/v3.3.0...v3.3.1) (2017-03-28)
### Bug Fixes
* **background-mode:** add missing config options ([9c30a1d](https://github.com/driftyco/ionic-native/commit/9c30a1d)), closes [#1277](https://github.com/driftyco/ionic-native/issues/1277)
* **contacts:** fix major bug ([6e20137](https://github.com/driftyco/ionic-native/commit/6e20137))
* **contacts:** handle cordova_not_found errors ([961727e](https://github.com/driftyco/ionic-native/commit/961727e))
* **core:** handle unexpected errors in wrapOtherPromise ([9074362](https://github.com/driftyco/ionic-native/commit/9074362)), closes [#1185](https://github.com/driftyco/ionic-native/issues/1185)
* **core:** return errors from CordovaCheck decorators ([fd0a2e9](https://github.com/driftyco/ionic-native/commit/fd0a2e9)), closes [#1268](https://github.com/driftyco/ionic-native/issues/1268)
* **sqlite:** fixes echoTest and deleteDatabase ([01aece1](https://github.com/driftyco/ionic-native/commit/01aece1)), closes [#1275](https://github.com/driftyco/ionic-native/issues/1275)
### Features
* **sqlite:** add SQLiteDatabaseConfig interface ([544e7ef](https://github.com/driftyco/ionic-native/commit/544e7ef))
<a name="3.3.0"></a>
# [3.3.0](https://github.com/driftyco/ionic-native/compare/v3.2.4...v3.3.0) (2017-03-27)

View File

@@ -1,6 +1,6 @@
{
"name": "ionic-native",
"version": "3.3.0",
"version": "3.3.1",
"description": "Native plugin wrappers for Cordova and Ionic with TypeScript, ES6+, Promise and Observable support",
"license": "MIT",
"devDependencies": {

View File

@@ -2,7 +2,7 @@ import { Plugin } from '@ionic-native/core';
import { Injectable } from '@angular/core';
/**
* @name Plugin Name
* @name $Plugin_Name
* @description
*
* @usage

View File

@@ -1,6 +1,7 @@
import { instanceAvailability, checkAvailability, wrap, wrapInstance, overrideFunction } from './plugin';
import { getPlugin, getPromise } from './util';
import { Observable } from 'rxjs/Observable';
import 'rxjs/observable/throw';
export interface PluginConfig {
/**
@@ -145,15 +146,16 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
return (pluginObj: Object, methodName: string, descriptor: TypedPropertyDescriptor<any>): TypedPropertyDescriptor<any> => {
return {
value: function(...args: any[]): any {
if (checkAvailability(pluginObj) === true) {
const check = checkAvailability(pluginObj);
if (check === true) {
return descriptor.value.apply(this, args);
} else {
if (opts.sync) {
return;
return null;
} else if (opts.observable) {
return new Observable<any>(() => {});
return Observable.throw(new Error(check && check.error));
}
return getPromise(() => {});
return Promise.reject(check && check.error);
}
}
};

View File

@@ -152,11 +152,16 @@ function wrapPromise(pluginObj: any, methodName: string, args: any[], opts: any
function wrapOtherPromise(pluginObj: any, methodName: string, args: any[], opts: any= {}) {
return getPromise((resolve, reject) => {
let pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult && pluginResult.error) {
reject(pluginResult.error);
const pluginResult = callCordovaPlugin(pluginObj, methodName, args, opts);
if (pluginResult) {
if (pluginResult.error) {
reject(pluginResult.error);
} else if (pluginResult.then) {
pluginResult.then(resolve).catch(reject);
}
} else {
reject({ error: 'unexpected_error' });
}
pluginResult.then(resolve).catch(reject);
});
}

View File

@@ -13,26 +13,37 @@ export interface BackgroundModeConfiguration {
*/
title?: String;
/**
* The text that scrolls itself on statusbar
*/
ticker?: String;
/**
* Description of background task
*/
text?: String;
/**
* if true plugin will not display a notification. Default is false.
* This will look for <icon name>.png in platforms/android/res/drawable|mipmap
*/
silent?: boolean;
icon?: string;
color?: string;
/**
* By default the app will come to foreground when taping on the notification. If false, plugin wont come to foreground when tapped.
*/
resume?: boolean;
hidden?: boolean;
bigText?: boolean;
/**
* The text that scrolls itself on statusbar
*/
ticker?: String;
/**
* if true plugin will not display a notification. Default is false.
*/
silent?: boolean;
}
/**

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability } from '@ionic-native/core';
import { CordovaInstance, InstanceProperty, Plugin, getPromise, InstanceCheck, checkAvailability, CordovaCheck } from '@ionic-native/core';
declare var window: any,
navigator: any;
@@ -72,7 +72,7 @@ export class Contact implements IContactProperties {
@InstanceProperty urls: IContactField[];
constructor() {
if (checkAvailability(navigator.contacts, 'create', 'Contacts') === true) {
if (checkAvailability('navigator.contacts', 'create', 'Contacts') === true) {
this._objectInstance = navigator.contacts.create();
}
}
@@ -309,6 +309,7 @@ export class Contacts {
* @param options {IContactFindOptions} Optional options for the query
* @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
*/
@CordovaCheck()
find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]> {
return getPromise((resolve, reject) => {
navigator.contacts.find(fields, (contacts) => {
@@ -321,6 +322,7 @@ export class Contacts {
* Select a single Contact.
* @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
*/
@CordovaCheck()
pickContact(): Promise<Contact> {
return getPromise((resolve, reject) => {
navigator.contacts.pickContact((contact) => resolve(processContact(contact)), reject);

View File

@@ -406,7 +406,7 @@ export class GoogleMap {
* map.one(GoogleMapsEvent.MAP_READY).then(() => console.log('Map is ready!'));
*
* // create LatLng object
* let ionic: LatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
* let ionic: LatLng = new LatLng(43.0741904,-89.3809802);
*
* // create CameraPosition
* let position: CameraPosition = {

View File

@@ -4,6 +4,21 @@ import { Cordova, CordovaInstance, Plugin, CordovaCheck, InstanceProperty } from
declare var sqlitePlugin;
export interface SQLiteDatabaseConfig {
/**
* Name of the database. Example: 'my.db'
*/
name: string;
/**
* Location of the database. Example: 'default'
*/
location: string;
/**
* iOS Database Location. Example: 'Library'
*/
iosDatabaseLocation: string;
}
/**
* @hidden
*/
@@ -124,19 +139,6 @@ export class SQLiteObject {
})
abortFromQ(sqlerror): void { }
/**
* @returns {Promise<any>}
*/
@Cordova()
echoTest(): Promise<any> { return; }
/**
* @param first
* @returns {Promise<any>}
*/
@Cordova()
deleteDatabase(first): Promise<any> { return; }
}
/**
@@ -173,6 +175,8 @@ export class SQLiteObject {
*
* @classes
* SQLiteObject
* @interfaces
* SQLiteDatabaseConfig
*/
@Plugin({
pluginName: 'SQLite',
@@ -188,14 +192,29 @@ export class SQLite {
*
* 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.
* @param config {SQLiteDatabaseConfig} database configuration
* @return Promise<SQLiteObject>
*/
@CordovaCheck()
create(config: any): Promise<SQLiteObject> {
create(config: SQLiteDatabaseConfig): Promise<SQLiteObject> {
return new Promise((resolve, reject) => {
sqlitePlugin.openDatabase(config, db => resolve(new SQLiteObject(db)), reject);
});
}
/**
* Verify that both the Javascript and native part of this plugin are installed in your application
* @returns {Promise<any>}
*/
@Cordova()
echoTest(): Promise<any> { return; }
/**
* Deletes a database
* @param config {SQLiteDatabaseConfig} database configuration
* @returns {Promise<any>}
*/
@Cordova()
deleteDatabase(config: SQLiteDatabaseConfig): Promise<any> { return; }
}