public async getRenamedApp()

in src/utils/adapter/adapter.ts [125:148]


    public async getRenamedApp(newName: string, appOwner: string, oldName: string): Promise<adapterTypes.UpdatedApp> {
        const app = await this.getApp(appOwner, oldName);

        if (newName.indexOf('/') !== -1) {
            throw this.getCodePushError(`The new app name "${newName}" must be unqualified, not having a '/' character.`, RequestManager.ERROR_CONFLICT);
        }

        if (!this.isValidAppCenterAppName(newName)) {
            throw this.getCodePushError(`The app name "${newName}" isn't valid. It can only contain alphanumeric characters, dashes, periods, or underscores.`, RequestManager.ERROR_CONFLICT);
        }

        // If the display name was set on the existing app, then it was different than the app name. In that case, leave the display name unchanged;
        // the user can change the display name through the Mobile Center web portal if they want to rename it.
        // But if the display name and app name were the same, then rename them both.
        const updatedApp =
            app.name === app.display_name
                ? {
                    name: newName,
                    display_name: newName
                }
                : { name: newName };

        return updatedApp;
    }