react-native-nitro-screen-recorder
Version:
A library to capture screen recordings with react-native powered by NitroModules.
52 lines (48 loc) • 2.33 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _FileManager = require("./FileManager");
var _iosConstants = require("./iosConstants");
// project `ios/${BROADCAST_EXT_TARGET_NAME}` directory
const entitlementsFileName = `${_iosConstants.BROADCAST_EXT_TARGET_NAME}.entitlements`;
const plistFileName = `${_iosConstants.BROADCAST_EXT_TARGET_NAME}-Info.plist`;
class BEUpdaterManager {
extensionPath = '';
constructor(iosPath) {
this.extensionPath = `${iosPath}/${_iosConstants.BROADCAST_EXT_TARGET_NAME}`;
}
/**
* Injects the real App Group identifier into the entitlements file so the
* Broadcast Upload Extension can share storage with the main app.
*/
async updateEntitlements(groupIdentifier) {
const entitlementsFilePath = `${this.extensionPath}/${entitlementsFileName}`;
let entitlementsFile = await _FileManager.FileManager.readFile(entitlementsFilePath);
entitlementsFile = entitlementsFile.replace(_iosConstants.GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);
await _FileManager.FileManager.writeFile(entitlementsFilePath, entitlementsFile);
}
/**
* Makes CFBundleVersion of the Broadcast Extension match the host app’s
* build number to avoid App Store validation errors.
*/
async updateInfoPlist(version, groupIdentifier) {
const plistFilePath = `${this.extensionPath}/${plistFileName}`;
let plistFile = await _FileManager.FileManager.readFile(plistFilePath);
plistFile = plistFile.replace(_iosConstants.BUNDLE_VERSION_TEMPLATE_REGEX, version).replace(_iosConstants.GROUP_IDENTIFIER_TEMPLATE_REGEX, groupIdentifier);
await _FileManager.FileManager.writeFile(plistFilePath, plistFile);
}
/**
* Syncs CFBundleShortVersionString (marketing version) with the main app so
* TestFlight/App Store show a single coherent version.
*/
async updateBundleShortVersion(version) {
const plistFilePath = `${this.extensionPath}/${plistFileName}`;
let plistFile = await _FileManager.FileManager.readFile(plistFilePath);
plistFile = plistFile.replace(_iosConstants.BUNDLE_SHORT_VERSION_TEMPLATE_REGEX, version);
await _FileManager.FileManager.writeFile(plistFilePath, plistFile);
}
}
exports.default = BEUpdaterManager;
//# sourceMappingURL=BEUpdateManager.js.map