Compare commits

..

14 Commits

Author SHA1 Message Date
Ibby Hadeed
2245bb8050 chore(): update changelog 2017-05-17 11:19:57 -04:00
Ibby Hadeed
e14e00edba 3.9.2 2017-05-17 11:19:55 -04:00
Ibby Hadeed
22102a7e4a fix(core): decorators should define enumerable properties 2017-05-17 11:19:35 -04:00
Ibby Hadeed
6416c2544c fix(action-sheet): destructiveButtonLast is optional 2017-05-17 11:07:34 -04:00
Ibby Hadeed
73a510f9c2 refactor(): remove unused import 2017-05-17 10:54:58 -04:00
Ibby Hadeed
b8b605db5e chore(): update changelog 2017-05-17 10:54:25 -04:00
Ibby Hadeed
12168d991a 3.9.1 2017-05-17 10:54:22 -04:00
Ibby Hadeed
93a119bf4b fix(core): fix issues when clearing observables 2017-05-17 10:54:09 -04:00
Ibby Hadeed
a7c62de389 refactor(core): otherPromise in wrapInstance shouldn't check for error 2017-05-17 10:47:39 -04:00
Ibby Hadeed
8aca6718e1 refactor(core): wrapInstance should return promise as-is
instance based method never throw errors like regular ones do
2017-05-17 10:46:47 -04:00
Ibby Hadeed
1ec4bdef8f docs(): update interface names 2017-05-17 10:36:05 -04:00
Ibby Hadeed
d6ed87d7cc fix merge conflict 2017-05-17 08:12:36 -04:00
Ibby Hadeed
55f3f37760 chore(): update changelog 2017-05-17 08:10:34 -04:00
Ibby Hadeed
4f547dae30 3.9.0 2017-05-17 08:10:31 -04:00
7 changed files with 71 additions and 36 deletions

View File

@@ -1,3 +1,48 @@
<a name="3.9.2"></a>
## [3.9.2](https://github.com/driftyco/ionic-native/compare/v3.9.1...v3.9.2) (2017-05-17)
### Bug Fixes
* **action-sheet:** destructiveButtonLast is optional ([6416c25](https://github.com/driftyco/ionic-native/commit/6416c25))
* **core:** decorators should define enumerable properties ([22102a7](https://github.com/driftyco/ionic-native/commit/22102a7))
<a name="3.9.1"></a>
## [3.9.1](https://github.com/driftyco/ionic-native/compare/v3.9.0...v3.9.1) (2017-05-17)
### Bug Fixes
* **core:** fix issues when clearing observables ([93a119b](https://github.com/driftyco/ionic-native/commit/93a119b))
<a name="3.9.0"></a>
# [3.9.0](https://github.com/driftyco/ionic-native/compare/v3.8.1...v3.9.0) (2017-05-17)
### Bug Fixes
* **android-permissions:** fix PERMISSION property and add requestPermission ([ebf4028](https://github.com/driftyco/ionic-native/commit/ebf4028)), closes [#1574](https://github.com/driftyco/ionic-native/issues/1574)
* **app-preferences:** suite is sync ([3cb8383](https://github.com/driftyco/ionic-native/commit/3cb8383)), closes [#1321](https://github.com/driftyco/ionic-native/issues/1321)
* **background-mode:** configure doesn't return anything ([92ef4f0](https://github.com/driftyco/ionic-native/commit/92ef4f0)), closes [#1457](https://github.com/driftyco/ionic-native/issues/1457)
* **in-app-browser:** fix on method ([975a65d](https://github.com/driftyco/ionic-native/commit/975a65d)), closes [#1446](https://github.com/driftyco/ionic-native/issues/1446)
* **media:** create should return null if plugin is not available ([d68618f](https://github.com/driftyco/ionic-native/commit/d68618f))
* **media:** create will always return MediaObject even if plugin doesnt exist ([ee4b61e](https://github.com/driftyco/ionic-native/commit/ee4b61e))
* **printer:** fix implementation and add pick method ([55071c0](https://github.com/driftyco/ionic-native/commit/55071c0))
* **push:** fix types ([ca76593](https://github.com/driftyco/ionic-native/commit/ca76593)), closes [#1331](https://github.com/driftyco/ionic-native/issues/1331)
* **secure-storage:** reject the promise if the plugin doesn't exist (#1562) ([d5919d1](https://github.com/driftyco/ionic-native/commit/d5919d1))
### Features
* **linkedin:** add getActiveSession method ([4c8deb2](https://github.com/driftyco/ionic-native/commit/4c8deb2)), closes [#1570](https://github.com/driftyco/ionic-native/issues/1570)
* **printer:** add check method ([991f2f0](https://github.com/driftyco/ionic-native/commit/991f2f0))
<a name="3.8.1"></a>
## [3.8.1](https://github.com/driftyco/ionic-native/compare/v3.8.0...v3.8.1) (2017-05-16)

View File

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

View File

@@ -135,7 +135,8 @@ export function InstanceCheck(opts: CordovaCheckOptions = {}) {
return getPromise(() => { });
}
}
},
enumerable: true
};
};
}
@@ -159,7 +160,8 @@ export function CordovaCheck(opts: CordovaCheckOptions = {}) {
}
return Promise.reject(check && check.error);
}
}
},
enumerable: true
};
};
}
@@ -239,7 +241,8 @@ export function Cordova(opts: CordovaOptions = {}) {
return {
value: function(...args: any[]) {
return wrap(this, methodName, opts).apply(this, args);
}
},
enumerable: true
};
};
}
@@ -254,7 +257,8 @@ export function CordovaInstance(opts: any = {}) {
return {
value: function(...args: any[]) {
return wrapInstance(this, methodName, opts).apply(this, args);
}
},
enumerable: true
};
};
}
@@ -312,7 +316,8 @@ export function CordovaFunctionOverride(opts: any = {}) {
return {
value: function(...args: any[]) {
return overrideFunction(this, methodName, opts);
}
},
enumerable: true
};
};
}
@@ -348,7 +353,8 @@ export function CordovaFiniteObservable(opts: CordovaFiniteObservableOptions = {
wrappedSubscription.unsubscribe();
};
});
}
},
enumerable: true
};
};
}

View File

@@ -1,4 +1,4 @@
import { get, getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
import { getPlugin, getPromise, cordovaWarn, pluginWarn } from './util';
import { checkReady } from './bootstrap';
import { CordovaOptions } from './decorators';
@@ -177,11 +177,11 @@ function wrapObservable(pluginObj: any, methodName: string, args: any[], opts: a
if (opts.clearWithArgs) {
return callCordovaPlugin(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return get(window, pluginObj.constructor.getPluginRef())[opts.clearFunction].call(pluginObj, pluginResult);
return callCordovaPlugin(pluginObj, opts.clearFunction, []);
}
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
console.warn(e);
}
};
});
@@ -276,12 +276,12 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
return () => {
try {
if (opts.clearWithArgs) {
return pluginObj._objectInstance[opts.clearFunction].apply(pluginObj._objectInstance, args);
return callInstance(pluginObj, opts.clearFunction, args, opts, observer.next.bind(observer), observer.error.bind(observer));
}
return pluginObj._objectInstance[opts.clearFunction].call(pluginObj, pluginResult);
return callInstance(pluginObj, opts.clearFunction, []);
} catch (e) {
console.warn('Unable to clear the previous observable watch for', pluginObj.constructor.getPluginName(), methodName);
console.error(e);
console.warn(e);
}
};
});
@@ -290,23 +290,16 @@ export function wrapInstance(pluginObj: any, methodName: string, opts: any = {})
return getPromise((resolve: Function, reject: Function) => {
let result = callInstance(pluginObj, methodName, args, opts, resolve, reject);
if (result && !result.error) {
if (result && !!result.then) {
result.then(resolve, reject);
} else {
reject();
}
});
} else {
let pluginResult: any, rej: Function;
const p = getPromise((resolve: Function, reject: Function) => {
pluginResult = callInstance(pluginObj, methodName, args, opts, resolve, reject);
rej = reject;
});
if (pluginResult && pluginResult.error) {
p.catch(() => { });
typeof rej === 'function' && rej(pluginResult.error);
}
return p;
return getPromise((resolve: Function, reject: Function) => callInstance(pluginObj, methodName, args, opts, resolve, reject));
}
};

View File

@@ -51,7 +51,7 @@ export interface ActionSheetOptions {
/**
* Choose if destructive button will be the last
*/
destructiveButtonLast: boolean;
destructiveButtonLast?: boolean;
}
/**

View File

@@ -853,14 +853,14 @@ export class Marker {
/**
* Set the marker position.
* @param latLng {GoogleMapLatLng}
* @param latLng {LatLng}
*/
@CordovaInstance({ sync: true })
setPosition(latLng: LatLng): void { return; }
/**
* Return the marker position.
* @return {Promise<GoogleMapLatLng>}
* @return {Promise<LatLng>}
*/
@CordovaInstance()
getPosition(): Promise<LatLng> { return; }

View File

@@ -120,17 +120,8 @@ export class SecureStorage extends IonicNativePlugin {
*/
@CordovaCheck()
create(store: string): Promise<SecureStorageObject> {
<<<<<<< HEAD
return new Promise((res: Function, rej: Function) => {
const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store);
=======
return new Promise((res, rej) => {
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
} else {
rej('SecureStorage failure: cordova plugin is not available');
}
>>>>>>> 5145395dd7bea7d2fb81b11b356a4a7497c607e7
});
}