fix(secure-storage): reject the promise if the plugin doesn't exist (#1562)

This commit is contained in:
Elias Boukamza 2017-05-17 12:45:54 +02:00 committed by Ibby Hadeed
parent 4c8deb2bed
commit d5919d1736

View File

@ -8,7 +8,7 @@ declare var cordova: any;
*/ */
export class SecureStorageObject { export class SecureStorageObject {
constructor(private _objectInstance?: any) { } constructor(private _objectInstance: any) { }
/** /**
* Gets a stored item * Gets a stored item
@ -125,7 +125,7 @@ export class SecureStorage extends IonicNativePlugin {
if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) { if (checkAvailability('cordova.plugins.SecureStorage', null, 'SecureStorage') === true) {
const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store); const instance = new cordova.plugins.SecureStorage(() => res(new SecureStorageObject(instance)), rej, store);
} else { } else {
res(new SecureStorageObject()); rej('SecureStorage failure: cordova plugin is not available');
} }
}); });
} }