-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbugsee_config_state.dart
More file actions
108 lines (94 loc) · 3.69 KB
/
bugsee_config_state.dart
File metadata and controls
108 lines (94 loc) · 3.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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 {
/// Indicates if the app requires a restart to reactivate the Bugsee configurations.
///
/// `true` only if `isConfigurationValid == true` and Bugsee is turned on
final bool isRestartRequired;
/// Indicates if Bugsee is enabled or not.
/// by default Bugsee is enabled if `isConfigurationValid == true`.
final bool isBugseeEnabled;
/// Indicates whether video capturing is enabled or not.
/// enabled by default if `isBugseeEnabled == true`.
///
/// Cannot be true if `isBugseeEnabled == false`.
final bool isVideoCaptureEnabled;
/// Indicates if Bugsee configuration is valid.
///
/// Configuration is valid if app in release mode and the provided token is valid
/// following the [bugseeTokenFormat] regex.
final bool isConfigurationValid;
/// Indicates whether data is obscured in report videos.
///
/// Cannot be true if `isBugseeEnabled == false`.
final bool isDataObscured;
/// Indicates 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;
/// Indicates 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;
/// Indicates whether Bugsee will attach the log file when
/// reporting crashes/exception or not.
///
/// The initial value is taken from [dotenv.env] and shared preferences.
final bool attachLogFile;
/// Indicates the configuration error type and message
/// (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,
];
}