diff --git a/src/@ionic-native/plugins/secure-storage/index.ts b/src/@ionic-native/plugins/secure-storage/index.ts index ab7a5b99f..7a9a1a82c 100644 --- a/src/@ionic-native/plugins/secure-storage/index.ts +++ b/src/@ionic-native/plugins/secure-storage/index.ts @@ -1,7 +1,5 @@ import { Injectable } from '@angular/core'; -import { CordovaInstance, Plugin, checkAvailability, IonicNativePlugin } from '@ionic-native/core'; - -declare var cordova: any; +import { CordovaInstance, Plugin, CordovaCheck, IonicNativePlugin } from '@ionic-native/core'; /** * @hidden @@ -120,13 +118,10 @@ export class SecureStorage extends IonicNativePlugin { * @param store {string} * @returns {Promise} */ + @CordovaCheck() create(store: string): Promise { - 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 { - res(new SecureStorageObject()); - } + return new Promise((res: Function, rej: Function) => { + const instance = new (SecureStorage.getPlugin())(() => res(new SecureStorageObject(instance)), rej, store); }); }