Skip to content

Commit

Permalink
fix: inject cordova files if a cordova plugin is present (#7363)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile authored Mar 21, 2024
1 parent 318c316 commit ce9d505
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions cli/src/util/iosplugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
} from '@ionic/utils-fs';
import { resolve } from 'path';

import { getCordovaPlugins } from '../cordova';
import type { Config } from '../definitions';
import type { Plugin } from '../plugin';

Expand Down Expand Up @@ -75,5 +76,9 @@ export async function generateIOSPackageJSON(
): Promise<void> {
const fileList = await getPluginFiles(plugins);
const classList = await findPluginClasses(fileList);
const cordovaPlugins = await getCordovaPlugins(config, 'ios');
if (cordovaPlugins.length > 0) {
classList.push('CDVPlugin');
}
writePluginJSON(config, classList);
}
5 changes: 3 additions & 2 deletions ios/Capacitor/Capacitor/CapacitorBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,11 @@ open class CapacitorBridge: NSObject, CAPBridgeProtocol {

for plugin in registrationList.packageClassList {
if let pluginClass = NSClassFromString(plugin) {
if class_getSuperclass(pluginClass) == CDVPlugin.self {
if pluginClass == CDVPlugin.self {
injectCordovaFiles = true
} else {
pluginList.append(pluginClass)
}
pluginList.append(pluginClass)
}
}
}
Expand Down

0 comments on commit ce9d505

Please sign in to comment.