setting enable pdfjs
This commit is contained in:
@@ -463,6 +463,22 @@ class WebEngineSettingsScreen extends HookConsumerWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SwitchListTile.adaptive(
|
||||
title: const Text('Built-in PDF Viewer'),
|
||||
subtitle: const Text(
|
||||
'Open PDF files directly in the browser without downloading',
|
||||
),
|
||||
secondary: const Icon(MdiIcons.filePdfBox),
|
||||
value: engineSettings.enablePdfJs,
|
||||
onChanged: (value) async {
|
||||
await ref
|
||||
.read(saveEngineSettingsControllerProvider.notifier)
|
||||
.save(
|
||||
(currentSettings) =>
|
||||
currentSettings.copyWith.enablePdfJs(value),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('Web Engine Hardening'),
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
|
||||
@@ -106,6 +106,8 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
bounceTrackingProtectionMode: bounceTrackingProtectionMode,
|
||||
);
|
||||
|
||||
final bool enablePdfJs;
|
||||
|
||||
EngineSettings({
|
||||
required super.javascriptEnabled,
|
||||
required super.trackingProtectionPolicy,
|
||||
@@ -127,6 +129,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
required this.dohDefaultProviderUrl,
|
||||
required this.dohExceptionsList,
|
||||
required super.fingerprintingProtectionOverrides,
|
||||
required this.enablePdfJs,
|
||||
});
|
||||
|
||||
EngineSettings.withDefaults({
|
||||
@@ -150,6 +153,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
String? dohDefaultProviderUrl,
|
||||
List<String>? dohExceptionsList,
|
||||
String? fingerprintingProtectionOverrides,
|
||||
bool? enablePdfJs,
|
||||
}) : queryParameterStripping =
|
||||
queryParameterStripping ?? QueryParameterStripping.disabled,
|
||||
bounceTrackingProtectionMode =
|
||||
@@ -160,6 +164,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
dohDefaultProviderUrl =
|
||||
dohDefaultProviderUrl ?? BuiltInDohProviders.quad9.url,
|
||||
dohExceptionsList = dohExceptionsList ?? [],
|
||||
enablePdfJs = enablePdfJs ?? true,
|
||||
super(
|
||||
javascriptEnabled: javascriptEnabled ?? true,
|
||||
trackingProtectionPolicy:
|
||||
@@ -220,5 +225,6 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
||||
dohDefaultProviderUrl,
|
||||
dohExceptionsList,
|
||||
fingerprintingProtectionOverrides,
|
||||
enablePdfJs,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -65,6 +65,8 @@ abstract class _$EngineSettingsCWProxy {
|
||||
String? fingerprintingProtectionOverrides,
|
||||
);
|
||||
|
||||
EngineSettings enablePdfJs(bool enablePdfJs);
|
||||
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `EngineSettings(...).copyWith.fieldName(value)`.
|
||||
///
|
||||
@@ -93,6 +95,7 @@ abstract class _$EngineSettingsCWProxy {
|
||||
String dohDefaultProviderUrl,
|
||||
List<String> dohExceptionsList,
|
||||
String? fingerprintingProtectionOverrides,
|
||||
bool enablePdfJs,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -200,6 +203,10 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
fingerprintingProtectionOverrides: fingerprintingProtectionOverrides,
|
||||
);
|
||||
|
||||
@override
|
||||
EngineSettings enablePdfJs(bool enablePdfJs) =>
|
||||
call(enablePdfJs: enablePdfJs);
|
||||
|
||||
@override
|
||||
/// Creates a new instance with the provided field values.
|
||||
/// Passing `null` to a nullable field nullifies it, while `null` for a non-nullable field is ignored. To update a single field use `EngineSettings(...).copyWith.fieldName(value)`.
|
||||
@@ -231,6 +238,7 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
Object? dohDefaultProviderUrl = const $CopyWithPlaceholder(),
|
||||
Object? dohExceptionsList = const $CopyWithPlaceholder(),
|
||||
Object? fingerprintingProtectionOverrides = const $CopyWithPlaceholder(),
|
||||
Object? enablePdfJs = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return EngineSettings(
|
||||
javascriptEnabled: javascriptEnabled == const $CopyWithPlaceholder()
|
||||
@@ -337,6 +345,11 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
||||
? _value.fingerprintingProtectionOverrides
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: fingerprintingProtectionOverrides as String?,
|
||||
enablePdfJs:
|
||||
enablePdfJs == const $CopyWithPlaceholder() || enablePdfJs == null
|
||||
? _value.enablePdfJs
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: enablePdfJs as bool,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -408,6 +421,7 @@ EngineSettings _$EngineSettingsFromJson(Map<String, dynamic> json) =>
|
||||
.toList(),
|
||||
fingerprintingProtectionOverrides:
|
||||
json['fingerprintingProtectionOverrides'] as String?,
|
||||
enablePdfJs: json['enablePdfJs'] as bool?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$EngineSettingsToJson(
|
||||
@@ -446,6 +460,7 @@ Map<String, dynamic> _$EngineSettingsToJson(
|
||||
'dohProviderUrl': instance.dohProviderUrl,
|
||||
'dohDefaultProviderUrl': instance.dohDefaultProviderUrl,
|
||||
'dohExceptionsList': instance.dohExceptionsList,
|
||||
'enablePdfJs': instance.enablePdfJs,
|
||||
};
|
||||
|
||||
const _$TrackingProtectionPolicyEnumMap = {
|
||||
|
||||
@@ -120,6 +120,10 @@ class EngineSettingsRepository extends _$EngineSettingsRepository {
|
||||
DriftSqlType.string,
|
||||
db.typeMapping,
|
||||
),
|
||||
'enablePdfJs': settings['enablePdfJs']?.readAs(
|
||||
DriftSqlType.bool,
|
||||
db.typeMapping,
|
||||
),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ final class EngineSettingsRepositoryProvider
|
||||
}
|
||||
|
||||
String _$engineSettingsRepositoryHash() =>
|
||||
r'17a4e505320e92a90ed8b62db263c283c5eaa839';
|
||||
r'cd087c5631faaddf1fced31569b0fd577d6030a7';
|
||||
|
||||
abstract class _$EngineSettingsRepository
|
||||
extends $StreamNotifier<EngineSettings> {
|
||||
|
||||
Reference in New Issue
Block a user