Skip to content

Commit 1fd1eb3

Browse files
committed
refactor: extract add extension method
1 parent 7a43b7a commit 1fd1eb3

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

lib/services/ios-project-service.ts

+13-14
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
952952
await this.prepareResources(pluginPlatformsFolderPath, pluginData, projectData);
953953
await this.prepareFrameworks(pluginPlatformsFolderPath, pluginData, projectData);
954954
await this.prepareStaticLibs(pluginPlatformsFolderPath, pluginData, projectData);
955-
//await this.prepareApplicationExtensions(pluginPlatformsFolderPath, pluginData, projectData);
956955

957956
const projectRoot = this.getPlatformData(projectData).projectRoot;
958957
await this.$cocoapodsService.applyPodfileToProject(pluginData.name, this.$cocoapodsService.getPluginPodfilePath(pluginData), projectData, projectRoot);
@@ -984,15 +983,7 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
984983
}
985984

986985
this.removeExtensions(projectData);
987-
await this.prepareExtensionsCode(path.join(projectData.getAppResourcesDirectoryPath(), this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_EXTENSION_FOLDER), projectData);
988-
const plugins = await this.getAllInstalledPlugins(projectData);
989-
for (const pluginIndex in plugins) {
990-
const pluginData = plugins[pluginIndex];
991-
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
992-
993-
const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
994-
await this.prepareExtensionsCode(extensionPath, projectData);
995-
};
986+
await this.addExtensions(projectData);
996987
}
997988
public beforePrepareAllPlugins(): Promise<void> {
998989
return Promise.resolve();
@@ -1108,6 +1099,18 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11081099
this.savePbxProj(project, projectData);
11091100
}
11101101

1102+
private async addExtensions(projectData: IProjectData): Promise<void> {
1103+
await this.prepareExtensionsCode(path.join(projectData.getAppResourcesDirectoryPath(), this.getPlatformData(projectData).normalizedPlatformName, constants.NATIVE_EXTENSION_FOLDER), projectData);
1104+
const plugins = await this.getAllInstalledPlugins(projectData);
1105+
for (const pluginIndex in plugins) {
1106+
const pluginData = plugins[pluginIndex];
1107+
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
1108+
1109+
const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
1110+
await this.prepareExtensionsCode(extensionPath, projectData);
1111+
};
1112+
}
1113+
11111114
private async prepareExtensionsCode(extensionsFolderPath: string, projectData: IProjectData): Promise<void> {
11121115
const targetUuids: string[] = [];
11131116
if(!this.$fs.exists(extensionsFolderPath)){
@@ -1216,10 +1219,6 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
12161219
}
12171220
}
12181221

1219-
// private prepareApplicationExtensions(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): Promise<void> {
1220-
1221-
// }
1222-
12231222
private removeNativeSourceCode(pluginPlatformsFolderPath: string, pluginData: IPluginData, projectData: IProjectData): void {
12241223
const project = this.createPbxProj(projectData);
12251224
const group = this.getRootGroup(pluginData.name, pluginPlatformsFolderPath);

0 commit comments

Comments
 (0)