1- import { NativeModules , Platform } from 'react-native' ;
2- import type { ISDKOptions } from './types/sdk-options' ;
3- import type { UserFeedbackOptions , UserFeedbackResult } from './user-feedback' ;
4- import { DefaultUserFeedbackOptions } from './user-feedback' ;
5- import type { DeviceKeyValue } from './types/device' ;
6- import type { ILogEntry } from './types/log' ;
7- import { StringFormatter } from './string-formatter' ;
8- import { LogLevel } from "./types/log" ;
9- import { OverrideConsoleMethods } from "./override-console-methods" ;
10- import { PrintToConsole } from "./print-to-console" ;
11- import { SDKOptions } from "./sdk-options" ;
1+ import { NativeModules , Platform } from 'react-native' ;
2+ import type { ISDKOptions } from './types/sdk-options' ;
3+ import type { UserFeedbackOptions , UserFeedbackResult } from './user-feedback' ;
4+ import { DefaultUserFeedbackOptions } from './user-feedback' ;
5+ import type { DeviceKeyValue } from './types/device' ;
6+ import type { ILogEntry } from './types/log' ;
7+ import { StringFormatter } from './string-formatter' ;
8+ import { LogLevel } from "./types/log" ;
9+ import { OverrideConsoleMethods } from "./override-console-methods" ;
10+ import { PrintToConsole } from "./print-to-console" ;
11+ import { SDKOptions } from "./sdk-options" ;
1212
1313const LINKING_ERROR =
1414 `The package '@bugfender/rn-bugfender' doesn't seem to be linked. Make sure: \n\n` +
15- Platform . select ( { ios : "- You have run 'pod install'\n" , default : '' } ) +
15+ Platform . select ( { ios : "- You have run 'pod install'\n" , default : '' } ) +
1616 '- You rebuilt the app after installing the package\n' +
1717 '- You are not using Expo managed workflow\n' ;
1818
@@ -38,41 +38,44 @@ class BugfenderClass {
3838 if ( ! this . initialized ) {
3939 const validatedOptions = this . sdkOptions . init ( options ) ;
4040
41- // Needs to be executed prior initialization
41+ // region before init
4242 if ( typeof options . deviceName !== 'undefined' ) {
4343 RnBugfender . overrideDeviceName ( options . deviceName ) ;
4444 }
45-
46- // Library initialization
47- Platform . OS === 'ios'
48- ? RnBugfender . activateLogger ( validatedOptions . appKey )
49- : RnBugfender . init ( validatedOptions . appKey , false ) ;
50-
5145 if ( typeof validatedOptions . apiURL !== 'undefined' ) {
5246 RnBugfender . setApiUrl ( validatedOptions . apiURL ) ;
5347 }
54-
5548 if ( typeof validatedOptions . baseURL !== 'undefined' ) {
5649 RnBugfender . setBaseUrl ( validatedOptions . baseURL ) ;
5750 }
51+ // endregion before init
52+
53+ // region init
54+ Platform . OS === 'ios'
55+ ? RnBugfender . activateLogger ( validatedOptions . appKey )
56+ : RnBugfender . init ( validatedOptions . appKey , validatedOptions . printToConsole ?? false ) ;
57+
58+ if ( validatedOptions . overrideConsoleMethods ) {
59+ this . overrideConsoleMethods . init ( this . stringFormatter ) ;
60+ }
5861
62+ this . printToConsole . init ( validatedOptions . printToConsole ?? true ) ;
63+ // endregion init
64+
65+ // region after init
5966 if ( validatedOptions . enableLogcatLogging ) {
6067 RnBugfender . enableLogcatLogging ( ) ;
6168 }
62-
6369 if ( validatedOptions . logUIEvents ) {
6470 RnBugfender . enableUIEventLogging ( ) ;
6571 }
66-
6772 if ( validatedOptions . registerErrorHandler ) {
6873 RnBugfender . enableCrashReporting ( ) ;
6974 }
70-
71- if ( validatedOptions . overrideConsoleMethods ) {
72- this . overrideConsoleMethods . init ( this . stringFormatter ) ;
73- }
74-
75- this . printToConsole . init ( validatedOptions . printToConsole ?? true ) ;
75+ RnBugfender . setMaximumLocalStorageSize (
76+ validatedOptions . maximumLocalStorageSize
77+ ) ;
78+ // endregion after init
7679
7780 this . initialized = true ;
7881 }
0 commit comments