11import { exec } from "./IBGCordova" ;
22import registry from "./ArgsRegistry" ;
33import bugReporting from "./BugReporting" ;
4+ import ArgsRegistry from "./ArgsRegistry" ;
45
56namespace Instabug {
67 export const welcomeMessageMode = registry . welcomeMessageMode ;
@@ -11,6 +12,7 @@ namespace Instabug {
1112 export const locale = registry . locale ;
1213
1314 /**
15+ * @deprecated This method is deprecated and will be removed in a future version. Use `init` instead.
1416 * Starts the SDK.
1517 * This is the main SDK method that does all the magic. This is the only
1618 * method that SHOULD be called.
@@ -32,6 +34,31 @@ namespace Instabug {
3234 exec ( "IBGPlugin" , "start" , [ token , invocationEvents ] , success , error ) ;
3335 } ;
3436
37+ /**
38+ * Initializes the Instabug SDK with additional configurations.
39+ *
40+ * @param token The token that identifies the app, available on your dashboard.
41+ * @param invocationEvents An array of invocation events that trigger the SDK's UI.
42+ * @param logLevel The level of detail in logs that you want to print.
43+ * @param success Callback on function success.
44+ * @param error Callback on function error.
45+ */
46+ export const init = (
47+ token : string ,
48+ invocationEvents : bugReporting . invocationEvents [ ] ,
49+ logLevel : ArgsRegistry . logLeve ,
50+ success ?: ( ) => void ,
51+ error ?: ( err : any ) => void
52+ ) => {
53+ exec (
54+ "IBGPlugin" , // Plugin name
55+ "init" , // Action name
56+ [ token , invocationEvents , logLevel ] , // Arguments
57+ success ,
58+ error
59+ ) ;
60+ } ;
61+
3562 /**
3663 * Shows default Instabug prompt.
3764 *
@@ -379,22 +406,6 @@ export const setReproStepsConfig = (
379406 exec ( "IBGPlugin" , "logOut" , [ ] , success , error ) ;
380407 } ;
381408
382- /**
383- * Enable/Disable debug logs from Instabug SDK
384- * Default state: disabled
385- *
386- * @param isDebugEnabled a boolean to control whether debug logs should be printed or not into LogCat.
387- * @param success callback on function success.
388- * @param error callback on function error.
389- */
390- export const setDebugEnabled = (
391- isDebugEnabled : boolean ,
392- success ?: ( ) => void ,
393- error ?: ( err : any ) => void
394- ) => {
395- exec ( "IBGPlugin" , "setDebugEnabled" , [ isDebugEnabled ] , success , error ) ;
396- } ;
397-
398409 /**
399410 * Sets the SDK's locale.
400411 * Use to change the SDK's UI to different language.
0 commit comments