UNPKG

@embrace-io/react-native

Version:
62 lines (61 loc) 2.83 kB
"use strict"; // The patches in this file are kept around for now to ease upgrading from iOS 5.x so that clients can use the uninstall // script to remove the old way of setting up the iOS SDK. Should eventually remove once enough people have upgraded Object.defineProperty(exports, "__esModule", { value: true }); exports.PATCH_IOS_OBJECTIVEC_APPDELEGATE_5X = exports.PATCH_IOS_SWIFT_APPDELEGATE_5X = exports.EMBRACE_INIT_SWIFT_5X = exports.EMBRACE_IMPORT_SWIFT_5X = exports.EMBRACE_INIT_OBJECTIVEC_5X = exports.EMBRACE_IMPORT_OBJECTIVEC_5X = void 0; const ios_1 = require("../../util/ios"); const EmbraceLogger_1 = require("../../../src/utils/EmbraceLogger"); const common_1 = require("./common"); const logger = new EmbraceLogger_1.default(console); exports.EMBRACE_IMPORT_OBJECTIVEC_5X = "#import <Embrace/Embrace.h>"; exports.EMBRACE_INIT_OBJECTIVEC_5X = "[[Embrace sharedInstance] startWithLaunchOptions:launchOptions framework:EMBAppFrameworkReactNative];"; exports.EMBRACE_IMPORT_SWIFT_5X = "import Embrace"; exports.EMBRACE_INIT_SWIFT_5X = "Embrace.sharedInstance().start(launchOptions: launchOptions, framework: .reactNative)"; exports.PATCH_IOS_SWIFT_APPDELEGATE_5X = { fileName: common_1.MAIN_CLASS_BY_LANGUAGE.swift, textsToAdd: [ { searchText: "@UIApplicationMain", textToAdd: exports.EMBRACE_IMPORT_SWIFT_5X, order: "before", breakingLine: "after", }, { searchText: /func\s+application\(\s*_\s*[^}]*\{/, textToAdd: exports.EMBRACE_INIT_SWIFT_5X, order: "after", breakingLine: "before", }, ], findFileFunction: (language, projectName) => { if (!projectName) { logger.warn("The project name is required"); return undefined; } return (0, ios_1.getAppDelegateByIOSLanguage)(projectName, language); }, }; exports.PATCH_IOS_OBJECTIVEC_APPDELEGATE_5X = { fileName: common_1.MAIN_CLASS_BY_LANGUAGE.objectivec, textsToAdd: [ { searchText: '#import "AppDelegate.h"', textToAdd: exports.EMBRACE_IMPORT_OBJECTIVEC_5X, order: "after", breakingLine: "before", }, { searchText: /(-\s*\(BOOL\)\s*application:\s*\(UIApplication\s\*\)\s*(app|application)\s+didFinishLaunchingWithOptions:\s*\(NSDictionary\s*\*\)launchOptions\s*\{\s*)/, textToAdd: exports.EMBRACE_INIT_OBJECTIVEC_5X, order: "after", breakingLine: "after", }, ], findFileFunction: (language, projectName) => { if (!projectName) { logger.warn("The project name is required"); return undefined; } return (0, ios_1.getAppDelegateByIOSLanguage)(projectName, language); }, };