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(
|
ListTile(
|
||||||
title: const Text('Web Engine Hardening'),
|
title: const Text('Web Engine Hardening'),
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
|
|||||||
@@ -106,6 +106,8 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
bounceTrackingProtectionMode: bounceTrackingProtectionMode,
|
bounceTrackingProtectionMode: bounceTrackingProtectionMode,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final bool enablePdfJs;
|
||||||
|
|
||||||
EngineSettings({
|
EngineSettings({
|
||||||
required super.javascriptEnabled,
|
required super.javascriptEnabled,
|
||||||
required super.trackingProtectionPolicy,
|
required super.trackingProtectionPolicy,
|
||||||
@@ -127,6 +129,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
required this.dohDefaultProviderUrl,
|
required this.dohDefaultProviderUrl,
|
||||||
required this.dohExceptionsList,
|
required this.dohExceptionsList,
|
||||||
required super.fingerprintingProtectionOverrides,
|
required super.fingerprintingProtectionOverrides,
|
||||||
|
required this.enablePdfJs,
|
||||||
});
|
});
|
||||||
|
|
||||||
EngineSettings.withDefaults({
|
EngineSettings.withDefaults({
|
||||||
@@ -150,6 +153,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
String? dohDefaultProviderUrl,
|
String? dohDefaultProviderUrl,
|
||||||
List<String>? dohExceptionsList,
|
List<String>? dohExceptionsList,
|
||||||
String? fingerprintingProtectionOverrides,
|
String? fingerprintingProtectionOverrides,
|
||||||
|
bool? enablePdfJs,
|
||||||
}) : queryParameterStripping =
|
}) : queryParameterStripping =
|
||||||
queryParameterStripping ?? QueryParameterStripping.disabled,
|
queryParameterStripping ?? QueryParameterStripping.disabled,
|
||||||
bounceTrackingProtectionMode =
|
bounceTrackingProtectionMode =
|
||||||
@@ -160,6 +164,7 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
dohDefaultProviderUrl =
|
dohDefaultProviderUrl =
|
||||||
dohDefaultProviderUrl ?? BuiltInDohProviders.quad9.url,
|
dohDefaultProviderUrl ?? BuiltInDohProviders.quad9.url,
|
||||||
dohExceptionsList = dohExceptionsList ?? [],
|
dohExceptionsList = dohExceptionsList ?? [],
|
||||||
|
enablePdfJs = enablePdfJs ?? true,
|
||||||
super(
|
super(
|
||||||
javascriptEnabled: javascriptEnabled ?? true,
|
javascriptEnabled: javascriptEnabled ?? true,
|
||||||
trackingProtectionPolicy:
|
trackingProtectionPolicy:
|
||||||
@@ -220,5 +225,6 @@ class EngineSettings extends GeckoEngineSettings with FastEquatable {
|
|||||||
dohDefaultProviderUrl,
|
dohDefaultProviderUrl,
|
||||||
dohExceptionsList,
|
dohExceptionsList,
|
||||||
fingerprintingProtectionOverrides,
|
fingerprintingProtectionOverrides,
|
||||||
|
enablePdfJs,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ abstract class _$EngineSettingsCWProxy {
|
|||||||
String? fingerprintingProtectionOverrides,
|
String? fingerprintingProtectionOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
EngineSettings enablePdfJs(bool enablePdfJs);
|
||||||
|
|
||||||
/// Creates a new instance with the provided field values.
|
/// 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)`.
|
/// 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,
|
String dohDefaultProviderUrl,
|
||||||
List<String> dohExceptionsList,
|
List<String> dohExceptionsList,
|
||||||
String? fingerprintingProtectionOverrides,
|
String? fingerprintingProtectionOverrides,
|
||||||
|
bool enablePdfJs,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -200,6 +203,10 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
|||||||
fingerprintingProtectionOverrides: fingerprintingProtectionOverrides,
|
fingerprintingProtectionOverrides: fingerprintingProtectionOverrides,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
EngineSettings enablePdfJs(bool enablePdfJs) =>
|
||||||
|
call(enablePdfJs: enablePdfJs);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
/// Creates a new instance with the provided field values.
|
/// 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)`.
|
/// 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? dohDefaultProviderUrl = const $CopyWithPlaceholder(),
|
||||||
Object? dohExceptionsList = const $CopyWithPlaceholder(),
|
Object? dohExceptionsList = const $CopyWithPlaceholder(),
|
||||||
Object? fingerprintingProtectionOverrides = const $CopyWithPlaceholder(),
|
Object? fingerprintingProtectionOverrides = const $CopyWithPlaceholder(),
|
||||||
|
Object? enablePdfJs = const $CopyWithPlaceholder(),
|
||||||
}) {
|
}) {
|
||||||
return EngineSettings(
|
return EngineSettings(
|
||||||
javascriptEnabled: javascriptEnabled == const $CopyWithPlaceholder()
|
javascriptEnabled: javascriptEnabled == const $CopyWithPlaceholder()
|
||||||
@@ -337,6 +345,11 @@ class _$EngineSettingsCWProxyImpl implements _$EngineSettingsCWProxy {
|
|||||||
? _value.fingerprintingProtectionOverrides
|
? _value.fingerprintingProtectionOverrides
|
||||||
// ignore: cast_nullable_to_non_nullable
|
// ignore: cast_nullable_to_non_nullable
|
||||||
: fingerprintingProtectionOverrides as String?,
|
: 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(),
|
.toList(),
|
||||||
fingerprintingProtectionOverrides:
|
fingerprintingProtectionOverrides:
|
||||||
json['fingerprintingProtectionOverrides'] as String?,
|
json['fingerprintingProtectionOverrides'] as String?,
|
||||||
|
enablePdfJs: json['enablePdfJs'] as bool?,
|
||||||
);
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$EngineSettingsToJson(
|
Map<String, dynamic> _$EngineSettingsToJson(
|
||||||
@@ -446,6 +460,7 @@ Map<String, dynamic> _$EngineSettingsToJson(
|
|||||||
'dohProviderUrl': instance.dohProviderUrl,
|
'dohProviderUrl': instance.dohProviderUrl,
|
||||||
'dohDefaultProviderUrl': instance.dohDefaultProviderUrl,
|
'dohDefaultProviderUrl': instance.dohDefaultProviderUrl,
|
||||||
'dohExceptionsList': instance.dohExceptionsList,
|
'dohExceptionsList': instance.dohExceptionsList,
|
||||||
|
'enablePdfJs': instance.enablePdfJs,
|
||||||
};
|
};
|
||||||
|
|
||||||
const _$TrackingProtectionPolicyEnumMap = {
|
const _$TrackingProtectionPolicyEnumMap = {
|
||||||
|
|||||||
@@ -120,6 +120,10 @@ class EngineSettingsRepository extends _$EngineSettingsRepository {
|
|||||||
DriftSqlType.string,
|
DriftSqlType.string,
|
||||||
db.typeMapping,
|
db.typeMapping,
|
||||||
),
|
),
|
||||||
|
'enablePdfJs': settings['enablePdfJs']?.readAs(
|
||||||
|
DriftSqlType.bool,
|
||||||
|
db.typeMapping,
|
||||||
|
),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ final class EngineSettingsRepositoryProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
String _$engineSettingsRepositoryHash() =>
|
String _$engineSettingsRepositoryHash() =>
|
||||||
r'17a4e505320e92a90ed8b62db263c283c5eaa839';
|
r'cd087c5631faaddf1fced31569b0fd577d6030a7';
|
||||||
|
|
||||||
abstract class _$EngineSettingsRepository
|
abstract class _$EngineSettingsRepository
|
||||||
extends $StreamNotifier<EngineSettings> {
|
extends $StreamNotifier<EngineSettings> {
|
||||||
|
|||||||
Reference in New Issue
Block a user