@@ -28,6 +28,7 @@ abstract interface class BugseeManager {
2828 /// [BUGSEE_TOKEN] in the env using `--dart-define` or `launch.json` on vscode
2929 Future <void > initialize ({
3030 String ? bugseeToken,
31+ bool isMock,
3132 required Logger logger,
3233 required LoggerManager loggerManager,
3334 required BugseeRepository bugseeRepository,
@@ -118,6 +119,7 @@ final class _BugseeManager implements BugseeManager {
118119 @override
119120 Future <void > initialize ({
120121 String ? bugseeToken,
122+ bool isMock = false ,
121123 required Logger logger,
122124 required LoggerManager loggerManager,
123125 required BugseeRepository bugseeRepository,
@@ -145,6 +147,11 @@ final class _BugseeManager implements BugseeManager {
145147 launchOptions = _initializeLaunchOptions ();
146148 _isBugSeeInitialized = false ;
147149
150+ if (isMock) {
151+ _initializeBugsee (bugseeToken ?? '' );
152+ return ;
153+ }
154+
148155 if (kDebugMode) {
149156 _currentState = _currentState.copyWith (
150157 isConfigurationValid: false ,
@@ -163,15 +170,12 @@ final class _BugseeManager implements BugseeManager {
163170 );
164171 return ;
165172 }
173+ _initializeBugsee (bugseeToken);
174+ }
166175
167- _currentState = _currentState.copyWith (
168- isLogFilterEnabled: configurationData.isLogsFilterEnabled,
169- isLogCollectionEnabled: configurationData.isLogCollectionEnabled,
170- attachLogFile: configurationData.attachLogFileEnabled,
171- );
172-
176+ void _initializeBugsee (String bugseeToken) async {
173177 if (configurationData.isBugseeEnabled ?? true ) {
174- await _launchBugseeLogger (bugseeToken);
178+ _isBugSeeInitialized = await _launchBugseeLogger (bugseeToken);
175179 }
176180
177181 _currentState = _currentState.copyWith (
@@ -180,10 +184,14 @@ final class _BugseeManager implements BugseeManager {
180184 isVideoCaptureEnabled: _isBugSeeInitialized &&
181185 (configurationData.isVideoCaptureEnabled ?? true ),
182186 isDataObscured: configurationData.isDataObscured,
187+ isLogFilterEnabled: configurationData.isLogsFilterEnabled,
188+ isLogCollectionEnabled: configurationData.isLogCollectionEnabled,
189+ attachLogFile: configurationData.attachLogFileEnabled,
183190 );
184191 }
185192
186- Future _launchBugseeLogger (String bugseeToken) async {
193+ Future <bool > _launchBugseeLogger (String bugseeToken) async {
194+ bool isInitialized = false ;
187195 HttpOverrides .global = Bugsee .defaultHttpOverrides;
188196 await Bugsee .launch (
189197 bugseeToken,
@@ -193,16 +201,17 @@ final class _BugseeManager implements BugseeManager {
193201 "BUGSEE: not initialized, verify bugsee token configuration" ,
194202 );
195203 }
196- _isBugSeeInitialized = isBugseeLaunched;
204+ isInitialized = isBugseeLaunched;
197205 },
198206 launchOptions: launchOptions,
199207 );
200- if (_currentState.isLogFilterEnabled ) {
208+ if (configurationData.isLogsFilterEnabled ?? false ) {
201209 Bugsee .setLogFilter (_filterBugseeLogs);
202210 }
203- if (_currentState.attachLogFile ) {
211+ if (configurationData.attachLogFileEnabled ?? false ) {
204212 Bugsee .setAttachmentsCallback (_attachLogFile);
205213 }
214+ return isInitialized;
206215 }
207216
208217 BugseeLaunchOptions ? _initializeLaunchOptions () {
0 commit comments