Cannot register my capacitor plugin in any of the capacitor app
See original GitHub issueI have generated the plugin for AES256 encryption. i have installed it using npm install "foldername"
in local.But when i register that plugin in capacitor app
i have received
Argument of type 'AES256Web' is not assignable to parameter of type 'WebPlugin'. Types have separate declarations of a private property 'addWindowListener'
But i have created this plugin by extending Webplugin class
Here my web.ts file in plugin
import { WebPlugin } from '@capacitor/core'
;
import { AES256Plugin } from './definitions'
;
export class AES256Web extends WebPlugin implements AES256Plugin {
constructor() {
super({
name: 'AES256',
platforms: ['web', 'Android', 'iOS']
});
}
async encrypt(options: { secureKey: string, action: string, secureIv: string, value: string }): Promise<any> { return options; } }
const AES256 = new AES256Web(); import { registerWebPlugin } from '@capacitor/core'; registerWebPlugin(AES256);
export { AES256 };
my app.component.ts file in capacitor app
import { Component, OnInit } from '@angular/core';
import {registerWebPlugin} from "@capacitor/core";
import { AES256 } from 'cordova-plugin-aes256-encryption';
import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import {OAuth2Client} from '@byteowls/capacitor-oauth2';
@Component({ selector: 'app-root', templateUrl: 'app.component.html', styleUrls: ['app.component.scss'] })
export class AppComponent implements OnInit {
constructor( private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar
) {
this.initializeApp(); }
initializeApp() {
this.platform.ready().then(() => {
this.statusBar.styleDefault();
this.splashScreen.hide();
});
}
ngOnInit() {
registerWebPlugin(AES256);
} }
I have received this error in app.component.ts file
ngOnInit() { registerWebPlugin(AES256); }
package.json file in capacitor app
{ “name”: “Fund-Request”, “version”: “0.0.1”, “author”: “Ionic Framework”, “homepage”: “https://ionicframework.com/”, “scripts”: { “ng”: “ng”, “start”: “ng serve”, “build”: “ng build”, “test”: “ng test”, “lint”: “ng lint”, “e2e”: “ng e2e” }, “private”: true, “dependencies”: { “@angular/common”: “~8.1.2”, “@angular/compiler”: “~8.1.2”, “@angular/core”: “~8.1.2”, “@angular/forms”: “~8.1.2”, “@angular/platform-browser”: “~8.1.2”, “@angular/platform-browser-dynamic”: “~8.1.2”, “@angular/router”: “~8.1.2”, “@byteowls/capacitor-oauth2”: “1.0.0”, “@capacitor/android”: “^1.1.1”, “@capacitor/cli”: “1.1.1”, “@capacitor/core”: “1.1.1”, “@capacitor/ios”: “^1.1.1”, “@ionic-native/core”: “^5.0.0”, “@ionic-native/splash-screen”: “^5.0.0”, “@ionic-native/status-bar”: “^5.0.0”, “@ionic/angular”: “^4.7.1”, “@ionic/pro”: “2.0.4”, “capacitor-media”: “0.0.5”, “cordova-plugin-aes256-encryption”: “file:…/…/AES256/Capacitor-plugin/cordova-plugin-aes256-encryption”, “core-js”: “^2.5.4”, “rxjs”: “~6.5.1”, “tslib”: “^1.9.0”, “zone.js”: “~0.9.1”, “typescriopt”:“^3.5.4” }, “description”: “An Ionic project” }
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top GitHub Comments
I resolved the issues by removing the
web.ts
file and ignored the tsc error inside thedefinitions.ts
file.Check out my example repo: https://github.com/danielsogl/capacitor-face-id
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.