@sentry/wizard
Version:
Sentry wizard helping you to configure your project
48 lines (47 loc) • 1.53 kB
TypeScript
/**
* Looks in src/main/java or src/main/kotlin for the specified {@link packageName} and
* {@link activityName} by concatenating them. For example:
*
* src/
* main/
* java/ or kotlin/
* my.package.name/
* ui/
* MainActivity.kt
*
* src/main/java can contain both .java and .kt sources, whilst src/main/kotlin only .kt
*
* @param appDir
* @param packageName
* @param activityName
* @returns path to the Main Activity
*/
export declare function findActivitySourceFile(appDir: string, packageName: string, activityName: string): string | undefined;
/**
* Patches Main Activity with the test error code snippet by the specified path {@link activityFile}.
* Finds activity's `onCreate` method, adds the snippet and necessary imports.
*
* ```kotlin
* import something
* import something.something
* import io.sentry.Sentry <-- this is added by us
*
* override fun onCreate(savedInstanceState: Bundle?) {
* super.onCreate(savedInstanceState)
* // the snippet goes here <--
* doSomething()
* }
* ```
*
* @param activityFile
* @returns true if successfully patched, false otherwise
*/
export declare function patchMainActivity(activityFile: string | undefined): boolean;
/**
* Returns the string index of the last import statement in the given code file.
* Works for both Java and Kotlin import statements.
*
* @param sourceCode
* @returns the insert index, or 0 if none found.
*/
export declare function getLastImportLineLocation(sourceCode: string): number;