Skip to content

Commit 97283d9

Browse files
authored
Merge pull request #4473 from NativeScript/kddimitrov/extensions-beta-warning
chore: add wanrning for extensions beta support
2 parents 1519b2e + 257e895 commit 97283d9

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

lib/definitions/project.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ interface ICocoaPodsPlatformManager {
570570
* Describes a service used to add and remove iOS extension
571571
*/
572572
interface IIOSExtensionsService {
573-
addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise<void>;
573+
addExtensionsFromPath(options: IAddExtensionsFromPathOptions): Promise<boolean>;
574574
removeExtensions(options: IRemoveExtensionsOptions): void;
575575
}
576576

lib/services/ios-extensions-service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ export class IOSExtensionsService implements IIOSExtensionsService {
66
private $xcode: IXcode) {
77
}
88

9-
public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise<void> {
9+
public async addExtensionsFromPath({extensionsFolderPath, projectData, platformData, pbxProjPath}: IAddExtensionsFromPathOptions): Promise<boolean> {
1010
const targetUuids: string[] = [];
11+
let addedExtensions = false;
1112
if (!this.$fs.exists(extensionsFolderPath)) {
12-
return;
13+
return false;
1314
}
1415
const project = new this.$xcode.project(pbxProjPath);
1516
project.parseSync();
@@ -23,10 +24,13 @@ export class IOSExtensionsService implements IIOSExtensionsService {
2324
.forEach(extensionFolder => {
2425
const targetUuid = this.addExtensionToProject(extensionsFolderPath, extensionFolder, project, projectData, platformData);
2526
targetUuids.push(targetUuid);
27+
addedExtensions = true;
2628
});
2729

2830
this.$fs.writeFile(pbxProjPath, project.writeSync({omitEmptyValues: true}));
2931
this.prepareExtensionSigning(targetUuids, projectData, pbxProjPath);
32+
33+
return addedExtensions;
3034
}
3135

3236
private addExtensionToProject(extensionsFolderPath: string, extensionFolder: string, project: IXcode.project, projectData: IProjectData, platformData: IPlatformData): string {

lib/services/ios-project-service.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -1108,14 +1108,20 @@ We will now place an empty obsolete compatability white screen LauncScreen.xib f
11081108
);
11091109
const platformData = this.getPlatformData(projectData);
11101110
const pbxProjPath = this.getPbxProjPath(projectData);
1111-
await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: resorcesExtensionsPath, projectData, platformData, pbxProjPath});
1111+
const addedExtensionsFromResources = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: resorcesExtensionsPath, projectData, platformData, pbxProjPath});
11121112
const plugins = await this.getAllInstalledPlugins(projectData);
1113+
let addedExtensionsFromPlugins = false;
11131114
for (const pluginIndex in plugins) {
11141115
const pluginData = plugins[pluginIndex];
11151116
const pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
11161117

11171118
const extensionPath = path.join(pluginPlatformsFolderPath, constants.NATIVE_EXTENSION_FOLDER);
1118-
await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: extensionPath, projectData, platformData, pbxProjPath});
1119+
const addedExtensionFromPlugin = await this.$iOSExtensionsService.addExtensionsFromPath({extensionsFolderPath: extensionPath, projectData, platformData, pbxProjPath});
1120+
addedExtensionsFromPlugins = addedExtensionsFromPlugins || addedExtensionFromPlugin;
1121+
}
1122+
1123+
if (addedExtensionsFromResources || addedExtensionsFromPlugins) {
1124+
this.$logger.warn("The support for iOS App Extensions is currently in Beta. For more information about the current development state and any known issues, please check the relevant GitHub issue: https://github.com/NativeScript/nativescript-cli/issues/4472");
11191125
}
11201126
}
11211127

0 commit comments

Comments
 (0)