Allow sending errors to Sentry
This commit is contained in:
@@ -13,6 +13,7 @@ enum ColorSchemeSettings { light, dark, system }
|
||||
abstract class Settings with _$Settings {
|
||||
const factory Settings({
|
||||
@Default(ColorSchemeSettings.system) ColorSchemeSettings colorScheme,
|
||||
@Default(null) String? sentryDsn,
|
||||
}) = _Settings;
|
||||
|
||||
factory Settings.fromJson(Map<String, Object?> json) =>
|
||||
@@ -45,4 +46,6 @@ class SettingsCubit extends Cubit<SettingsWrapper> {
|
||||
|
||||
await _prefs.setString("settings", jsonEncode(settings.toJson()));
|
||||
}
|
||||
|
||||
String? get sentryDsn => state.settings.sentryDsn;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ Settings _$SettingsFromJson(Map<String, dynamic> json) {
|
||||
/// @nodoc
|
||||
mixin _$Settings {
|
||||
ColorSchemeSettings get colorScheme => throw _privateConstructorUsedError;
|
||||
String? get sentryDsn => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
@@ -34,7 +35,7 @@ abstract class $SettingsCopyWith<$Res> {
|
||||
factory $SettingsCopyWith(Settings value, $Res Function(Settings) then) =
|
||||
_$SettingsCopyWithImpl<$Res, Settings>;
|
||||
@useResult
|
||||
$Res call({ColorSchemeSettings colorScheme});
|
||||
$Res call({ColorSchemeSettings colorScheme, String? sentryDsn});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -49,7 +50,7 @@ class _$SettingsCopyWithImpl<$Res, $Val extends Settings>
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? colorScheme = null}) {
|
||||
$Res call({Object? colorScheme = null, Object? sentryDsn = freezed}) {
|
||||
return _then(
|
||||
_value.copyWith(
|
||||
colorScheme:
|
||||
@@ -57,6 +58,11 @@ class _$SettingsCopyWithImpl<$Res, $Val extends Settings>
|
||||
? _value.colorScheme
|
||||
: colorScheme // ignore: cast_nullable_to_non_nullable
|
||||
as ColorSchemeSettings,
|
||||
sentryDsn:
|
||||
freezed == sentryDsn
|
||||
? _value.sentryDsn
|
||||
: sentryDsn // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
)
|
||||
as $Val,
|
||||
);
|
||||
@@ -72,7 +78,7 @@ abstract class _$$SettingsImplCopyWith<$Res>
|
||||
) = __$$SettingsImplCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({ColorSchemeSettings colorScheme});
|
||||
$Res call({ColorSchemeSettings colorScheme, String? sentryDsn});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@@ -86,7 +92,7 @@ class __$$SettingsImplCopyWithImpl<$Res>
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({Object? colorScheme = null}) {
|
||||
$Res call({Object? colorScheme = null, Object? sentryDsn = freezed}) {
|
||||
return _then(
|
||||
_$SettingsImpl(
|
||||
colorScheme:
|
||||
@@ -94,6 +100,11 @@ class __$$SettingsImplCopyWithImpl<$Res>
|
||||
? _value.colorScheme
|
||||
: colorScheme // ignore: cast_nullable_to_non_nullable
|
||||
as ColorSchemeSettings,
|
||||
sentryDsn:
|
||||
freezed == sentryDsn
|
||||
? _value.sentryDsn
|
||||
: sentryDsn // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -102,7 +113,10 @@ class __$$SettingsImplCopyWithImpl<$Res>
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$SettingsImpl implements _Settings {
|
||||
const _$SettingsImpl({this.colorScheme = ColorSchemeSettings.system});
|
||||
const _$SettingsImpl({
|
||||
this.colorScheme = ColorSchemeSettings.system,
|
||||
this.sentryDsn = null,
|
||||
});
|
||||
|
||||
factory _$SettingsImpl.fromJson(Map<String, dynamic> json) =>
|
||||
_$$SettingsImplFromJson(json);
|
||||
@@ -110,10 +124,13 @@ class _$SettingsImpl implements _Settings {
|
||||
@override
|
||||
@JsonKey()
|
||||
final ColorSchemeSettings colorScheme;
|
||||
@override
|
||||
@JsonKey()
|
||||
final String? sentryDsn;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Settings(colorScheme: $colorScheme)';
|
||||
return 'Settings(colorScheme: $colorScheme, sentryDsn: $sentryDsn)';
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -122,12 +139,14 @@ class _$SettingsImpl implements _Settings {
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$SettingsImpl &&
|
||||
(identical(other.colorScheme, colorScheme) ||
|
||||
other.colorScheme == colorScheme));
|
||||
other.colorScheme == colorScheme) &&
|
||||
(identical(other.sentryDsn, sentryDsn) ||
|
||||
other.sentryDsn == sentryDsn));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, colorScheme);
|
||||
int get hashCode => Object.hash(runtimeType, colorScheme, sentryDsn);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@@ -142,8 +161,10 @@ class _$SettingsImpl implements _Settings {
|
||||
}
|
||||
|
||||
abstract class _Settings implements Settings {
|
||||
const factory _Settings({final ColorSchemeSettings colorScheme}) =
|
||||
_$SettingsImpl;
|
||||
const factory _Settings({
|
||||
final ColorSchemeSettings colorScheme,
|
||||
final String? sentryDsn,
|
||||
}) = _$SettingsImpl;
|
||||
|
||||
factory _Settings.fromJson(Map<String, dynamic> json) =
|
||||
_$SettingsImpl.fromJson;
|
||||
@@ -151,6 +172,8 @@ abstract class _Settings implements Settings {
|
||||
@override
|
||||
ColorSchemeSettings get colorScheme;
|
||||
@override
|
||||
String? get sentryDsn;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$SettingsImplCopyWith<_$SettingsImpl> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
|
||||
@@ -14,11 +14,13 @@ _$SettingsImpl _$$SettingsImplFromJson(Map<String, dynamic> json) =>
|
||||
json['colorScheme'],
|
||||
) ??
|
||||
ColorSchemeSettings.system,
|
||||
sentryDsn: json['sentryDsn'] as String? ?? null,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$SettingsImplToJson(_$SettingsImpl instance) =>
|
||||
<String, dynamic>{
|
||||
'colorScheme': _$ColorSchemeSettingsEnumMap[instance.colorScheme]!,
|
||||
'sentryDsn': instance.sentryDsn,
|
||||
};
|
||||
|
||||
const _$ColorSchemeSettingsEnumMap = {
|
||||
|
||||
Reference in New Issue
Block a user