Formatting and Consolidate Image Check
continuous-integration/drone/pr Build is pending
Details
continuous-integration/drone/pr Build is pending
Details
This commit is contained in:
parent
4ea0d4261c
commit
6ba6f76ee1
|
@ -404,9 +404,12 @@ class Settings extends ChangeNotifier {
|
||||||
// checks experiment settings and file extension for image previews
|
// checks experiment settings and file extension for image previews
|
||||||
// (ignores file size; if the user manually accepts the file, assume it's okay to preview)
|
// (ignores file size; if the user manually accepts the file, assume it's okay to preview)
|
||||||
bool shouldPreview(String path) {
|
bool shouldPreview(String path) {
|
||||||
|
return isExperimentEnabled(ImagePreviewsExperiment) && isImage(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isImage(String path) {
|
||||||
var lpath = path.toLowerCase();
|
var lpath = path.toLowerCase();
|
||||||
return isExperimentEnabled(ImagePreviewsExperiment) &&
|
return (lpath.endsWith(".jpg") || lpath.endsWith(".jpeg") || lpath.endsWith(".png") || lpath.endsWith(".gif") || lpath.endsWith(".webp") || lpath.endsWith(".bmp"));
|
||||||
(lpath.endsWith(".jpg") || lpath.endsWith(".jpeg") || lpath.endsWith(".png") || lpath.endsWith(".gif") || lpath.endsWith(".webp") || lpath.endsWith(".bmp"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String get downloadPath => _downloadPath;
|
String get downloadPath => _downloadPath;
|
||||||
|
|
|
@ -163,28 +163,28 @@ class _GlobalSettingsExperimentsViewState extends State<GlobalSettingsExperiment
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported(),
|
visible: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported(),
|
||||||
child: SwitchListTile(
|
child: SwitchListTile(
|
||||||
title: Text(AppLocalizations.of(context)!.blodeuweddExperimentEnable),
|
title: Text(AppLocalizations.of(context)!.blodeuweddExperimentEnable),
|
||||||
subtitle: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported()
|
subtitle: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported()
|
||||||
? Text(AppLocalizations.of(context)!.blodeuweddDescription)
|
? Text(AppLocalizations.of(context)!.blodeuweddDescription)
|
||||||
: Text(AppLocalizations.of(context)!.blodeuweddNotSupported),
|
: Text(AppLocalizations.of(context)!.blodeuweddNotSupported),
|
||||||
value: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment),
|
value: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment),
|
||||||
onChanged: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported()
|
onChanged: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported()
|
||||||
? (bool value) {
|
? (bool value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
settings.enableExperiment(BlodeuweddExperiment);
|
settings.enableExperiment(BlodeuweddExperiment);
|
||||||
} else {
|
} else {
|
||||||
settings.disableExperiment(BlodeuweddExperiment);
|
settings.disableExperiment(BlodeuweddExperiment);
|
||||||
|
}
|
||||||
|
saveSettings(context);
|
||||||
}
|
}
|
||||||
saveSettings(context);
|
: null,
|
||||||
}
|
activeTrackColor: settings.theme.defaultButtonColor,
|
||||||
: null,
|
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
|
||||||
activeTrackColor: settings.theme.defaultButtonColor,
|
inactiveThumbColor: settings.theme.defaultButtonDisabledColor,
|
||||||
inactiveTrackColor: settings.theme.defaultButtonDisabledColor,
|
secondary: Icon(Icons.assistant, color: settings.current().mainTextColor),
|
||||||
inactiveThumbColor: settings.theme.defaultButtonDisabledColor,
|
)),
|
||||||
secondary: Icon(Icons.assistant, color: settings.current().mainTextColor),
|
|
||||||
)),
|
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment),
|
visible: Provider.of<FlwtchState>(context, listen: false).cwtch.IsBlodeuweddSupported() && settings.isExperimentEnabled(BlodeuweddExperiment),
|
||||||
child: CwtchFolderPicker(
|
child: CwtchFolderPicker(
|
||||||
|
|
|
@ -94,10 +94,7 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
|
|
||||||
var isImagePreview = false;
|
var isImagePreview = false;
|
||||||
if (path != null) {
|
if (path != null) {
|
||||||
var lpath = path.toLowerCase();
|
isImagePreview = Provider.of<Settings>(context).isImage(path);
|
||||||
if (lpath.endsWith(".jpg") || lpath.endsWith(".jpeg") || lpath.endsWith(".png") || lpath.endsWith(".gif") || lpath.endsWith(".webp") || lpath.endsWith(".bmp")) {
|
|
||||||
isImagePreview = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downloadComplete && path != null) {
|
if (downloadComplete && path != null) {
|
||||||
|
|
Loading…
Reference in New Issue