-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate advanced Bugsee features #49
base: main
Are you sure you want to change the base?
Changes from 9 commits
4d9287a
621f58e
0f12bb3
12f2d65
0f27491
7f20a67
ac885a0
f6a6938
9906020
e7cb678
934f7f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
/// Test all Bugsee setup features | ||
Future<void> bugseeSetupTest() async { | ||
testWidgets( | ||
'Test Bugsee configuration', | ||
(tester) async {}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing this is incomplete? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes for this I've only prepared an integration test file for Bugsee we can later implement it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's not done, I would remove it. That way we don't have an incomplete test that could lead us to believe that Bugsee is tested even though it isn't. |
||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,59 @@ | ||
final class BugseeConfigurationData { | ||
import 'package:equatable/equatable.dart'; | ||
|
||
final class BugseeConfigurationData extends Equatable { | ||
/// Gets whether the Bugsee SDK is enabled or not. if [Null] it fallbacks to a new installed app so it will be enabled. | ||
final bool? isBugseeEnabled; | ||
|
||
/// Indicate whether the video capturing feature in Bugsee is enabled or not. | ||
final bool? isVideoCaptureEnabled; | ||
|
||
/// Indicate whether bugsee obscure application data in videos and images or not. | ||
final bool? isDataObscured; | ||
koukibadr marked this conversation as resolved.
Show resolved
Hide resolved
koukibadr marked this conversation as resolved.
Show resolved
Hide resolved
koukibadr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// Indicate whether logs are collected or not. | ||
final bool? isLogCollectionEnabled; | ||
|
||
/// Indicate whether logs are filtred during reports or not. | ||
final bool? isLogsFilterEnabled; | ||
|
||
/// Indicate whether attaching file in the Bugsee report is enabled or not | ||
final bool? attachLogFileEnabled; | ||
|
||
const BugseeConfigurationData({ | ||
required this.isBugseeEnabled, | ||
required this.isVideoCaptureEnabled, | ||
this.isBugseeEnabled, | ||
this.isVideoCaptureEnabled, | ||
this.isDataObscured, | ||
this.isLogCollectionEnabled, | ||
this.isLogsFilterEnabled, | ||
this.attachLogFileEnabled, | ||
}); | ||
|
||
BugseeConfigurationData copyWith({ | ||
bool? isBugseeEnabled, | ||
bool? isVideoCaptureEnabled, | ||
bool? isDataObscured, | ||
bool? isLogCollectionEnabled, | ||
bool? isLogsFilterEnabled, | ||
bool? attachLogFileEnabled, | ||
}) => | ||
BugseeConfigurationData( | ||
isBugseeEnabled: isBugseeEnabled ?? this.isBugseeEnabled, | ||
isVideoCaptureEnabled: | ||
isVideoCaptureEnabled ?? this.isVideoCaptureEnabled, | ||
isDataObscured: isDataObscured ?? this.isDataObscured, | ||
isLogCollectionEnabled: | ||
isLogCollectionEnabled ?? this.isLogCollectionEnabled, | ||
isLogsFilterEnabled: isLogsFilterEnabled ?? this.isLogsFilterEnabled, | ||
attachLogFileEnabled: attachLogFileEnabled ?? this.attachLogFileEnabled, | ||
); | ||
|
||
@override | ||
List<Object?> get props => [ | ||
isBugseeEnabled, | ||
isVideoCaptureEnabled, | ||
isDataObscured, | ||
isLogCollectionEnabled, | ||
isLogsFilterEnabled, | ||
attachLogFileEnabled, | ||
]; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import 'package:equatable/equatable.dart'; | ||
|
||
enum ConfigErrorEnum { | ||
invalidReleaseMode(error: 'Bugsee is disabled in debug mode'), | ||
invalidToken(error: 'Invalid token, cannot start Bugsee reporting'), | ||
invalidPlatform(error: 'Bugsee cannot be configured on this platform'); | ||
|
||
final String error; | ||
const ConfigErrorEnum({ | ||
required this.error, | ||
}); | ||
} | ||
|
||
final class BugseeConfigState extends Equatable { | ||
/// Indicate if the app require a restart to reactivate the bugsee configurations | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/// | ||
/// `true` only if `isConfigurationValid == true` and bugsee is turned on | ||
final bool isRestartRequired; | ||
|
||
/// Indicate if bugsee is enabled or not | ||
/// by default bugsee is enabled if `isConfigurationValid == true`. | ||
final bool isBugseeEnabled; | ||
|
||
/// Indicate whether video capturing is enabled or not. | ||
/// enabled by default if `isBugseeEnabled == true`. | ||
/// | ||
/// cannot be true if `isBugseeEnabled == false`. | ||
final bool isVideoCaptureEnabled; | ||
|
||
/// Indicate if bugsee configuration is valid | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make sure you separate the sentences with a period and start sentences with a capital letter. |
||
/// config is valid if app in release mode and the provided token is valid | ||
/// following the [bugseeTokenFormat] regex. | ||
final bool isConfigurationValid; | ||
|
||
/// Indicate whether data is obscured in report videos | ||
/// | ||
/// cannot be true if `isBugseeEnabled == false`. | ||
final bool isDataObscured; | ||
|
||
/// Indicate whether log will be collected during Bugsee reporting or not | ||
/// by default logs are collected but filterd. | ||
/// | ||
/// This value is initialized from [dotenv.env] and shared prefs storage. | ||
final bool isLogCollectionEnabled; | ||
|
||
/// Indicate whether log will be filterd or not | ||
/// by default all logs are filted using [bugseeFilterRegex] defined in [BugseeManager] | ||
/// | ||
/// This value is initialized from [dotenv.env] map and shared prefs storage. | ||
final bool isLogFilterEnabled; | ||
|
||
/// Indicate whether Bugsee will attach the log file when reporting crashes/exceptions | ||
/// or not | ||
/// | ||
/// The initial value is taken from [dotenv.env] and shared prefs. | ||
/// By default it's enabled. | ||
final bool attachLogFile; | ||
|
||
/// Indicate the configuration error type (debug, invalid token or invalid platform) | ||
final ConfigErrorEnum? configErrorEnum; | ||
|
||
const BugseeConfigState({ | ||
this.isRestartRequired = false, | ||
this.isBugseeEnabled = false, | ||
this.isVideoCaptureEnabled = false, | ||
this.isConfigurationValid = false, | ||
this.isDataObscured = false, | ||
this.isLogCollectionEnabled = false, | ||
this.isLogFilterEnabled = false, | ||
this.attachLogFile = false, | ||
this.configErrorEnum, | ||
}); | ||
|
||
BugseeConfigState copyWith({ | ||
bool? isRestartRequired, | ||
bool? isBugseeEnabled, | ||
bool? isVideoCaptureEnabled, | ||
bool? isConfigurationValid, | ||
bool? isDataObscured, | ||
bool? isLogCollectionEnabled, | ||
bool? isLogFilterEnabled, | ||
bool? attachLogFile, | ||
ConfigErrorEnum? configErrorEnum, | ||
}) => | ||
BugseeConfigState( | ||
isRestartRequired: isRestartRequired ?? this.isRestartRequired, | ||
isBugseeEnabled: isBugseeEnabled ?? this.isBugseeEnabled, | ||
isConfigurationValid: isConfigurationValid ?? this.isConfigurationValid, | ||
isDataObscured: isDataObscured ?? this.isDataObscured, | ||
isLogFilterEnabled: isLogFilterEnabled ?? this.isLogFilterEnabled, | ||
attachLogFile: attachLogFile ?? this.attachLogFile, | ||
isLogCollectionEnabled: | ||
isLogCollectionEnabled ?? this.isLogCollectionEnabled, | ||
isVideoCaptureEnabled: | ||
isVideoCaptureEnabled ?? this.isVideoCaptureEnabled, | ||
configErrorEnum: configErrorEnum ?? this.configErrorEnum, | ||
); | ||
|
||
@override | ||
List<Object?> get props => [ | ||
isRestartRequired, | ||
isBugseeEnabled, | ||
isVideoCaptureEnabled, | ||
isConfigurationValid, | ||
isDataObscured, | ||
]; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
DIAGNOSTIC_ENABLED=true
be removed? I also have the same comment for the prod file too.