l10n
continuous-integration/drone/pr Build is failing
Details
continuous-integration/drone/pr Build is failing
Details
This commit is contained in:
parent
81d43554b5
commit
6390cb55a4
|
@ -228,6 +228,20 @@ class Settings extends ChangeNotifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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)
|
||||||
|
bool shouldPreview(String path) {
|
||||||
|
var lpath = path.toLowerCase();
|
||||||
|
return isExperimentEnabled(ImagePreviewsExperiment) && (
|
||||||
|
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;
|
||||||
set downloadPath(String newval) {
|
set downloadPath(String newval) {
|
||||||
_downloadPath = newval;
|
_downloadPath = newval;
|
||||||
|
|
|
@ -389,7 +389,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
_confirmFileSend(ctx, file.path);
|
_confirmFileSend(ctx, file.path);
|
||||||
} else {
|
} else {
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: Text("File size cannot exceed 10 GB"),
|
content: Text(AppLocalizations.of(context)!.msgFileTooBig),
|
||||||
duration: Duration(seconds: 4),
|
duration: Duration(seconds: 4),
|
||||||
);
|
);
|
||||||
ScaffoldMessenger.of(ctx).showSnackBar(snackBar);
|
ScaffoldMessenger.of(ctx).showSnackBar(snackBar);
|
||||||
|
@ -401,9 +401,8 @@ class _MessageViewState extends State<MessageView> {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
context: ctx,
|
context: ctx,
|
||||||
builder: (BuildContext bcontext) {
|
builder: (BuildContext bcontext) {
|
||||||
var lpath = path.toLowerCase();
|
|
||||||
var showPreview = false;
|
var showPreview = false;
|
||||||
if (Provider.of<Settings>(context, listen: false).isExperimentEnabled(ImagePreviewsExperiment) && (lpath.endsWith("jpg") || lpath.endsWith("jpeg") || lpath.endsWith("png") || lpath.endsWith("gif") || lpath.endsWith("webp") || lpath.endsWith("bmp"))) {
|
if (Provider.of<Settings>(context, listen: false).shouldPreview(path)) {
|
||||||
showPreview = true;
|
showPreview = true;
|
||||||
if (imagePreview == null) {
|
if (imagePreview == null) {
|
||||||
imagePreview = new File(path);
|
imagePreview = new File(path);
|
||||||
|
@ -418,7 +417,7 @@ class _MessageViewState extends State<MessageView> {
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Text("Are you sure you want to send $path?"),
|
Text(AppLocalizations.of(context)!.msgConfirmSend + " $path?"),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
|
@ -437,14 +436,14 @@ class _MessageViewState extends State<MessageView> {
|
||||||
Visibility(visible: showPreview, child: SizedBox(height: 10,)),
|
Visibility(visible: showPreview, child: SizedBox(height: 10,)),
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: Text("Cancel", semanticsLabel: "Cancel"),
|
child: Text(AppLocalizations.of(context)!.cancel, semanticsLabel: AppLocalizations.of(context)!.cancel),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(bcontext);
|
Navigator.pop(bcontext);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SizedBox(width: 20,),
|
SizedBox(width: 20,),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
child: Text("Send File", semanticsLabel: "Send File"),
|
child: Text(AppLocalizations.of(context)!.btnSendFile, semanticsLabel: AppLocalizations.of(context)!.btnSendFile),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_sendFile(path);
|
_sendFile(path);
|
||||||
Navigator.pop(bcontext);
|
Navigator.pop(bcontext);
|
||||||
|
|
|
@ -49,7 +49,6 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
var flagStarted = Provider.of<MessageMetadata>(context).attributes["file-downloaded"] == "true";
|
var flagStarted = Provider.of<MessageMetadata>(context).attributes["file-downloaded"] == "true";
|
||||||
var borderRadiousEh = 15.0;
|
var borderRadiousEh = 15.0;
|
||||||
var showFileSharing = Provider.of<Settings>(context).isExperimentEnabled(FileSharingExperiment);
|
var showFileSharing = Provider.of<Settings>(context).isExperimentEnabled(FileSharingExperiment);
|
||||||
var showImagePreviews = Provider.of<Settings>(context).isExperimentEnabled(ImagePreviewsExperiment);
|
|
||||||
var prettyDate = DateFormat.yMd(Platform.localeName).add_jm().format(Provider.of<MessageMetadata>(context).timestamp);
|
var prettyDate = DateFormat.yMd(Platform.localeName).add_jm().format(Provider.of<MessageMetadata>(context).timestamp);
|
||||||
var downloadComplete = Provider.of<ProfileInfoState>(context).downloadComplete(widget.fileKey());
|
var downloadComplete = Provider.of<ProfileInfoState>(context).downloadComplete(widget.fileKey());
|
||||||
var downloadInterrupted = Provider.of<ProfileInfoState>(context).downloadInterrupted(widget.fileKey());
|
var downloadInterrupted = Provider.of<ProfileInfoState>(context).downloadInterrupted(widget.fileKey());
|
||||||
|
@ -61,7 +60,7 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
var path = Provider.of<ProfileInfoState>(context).downloadFinalPath(widget.fileKey());
|
var path = Provider.of<ProfileInfoState>(context).downloadFinalPath(widget.fileKey());
|
||||||
if (downloadComplete) {
|
if (downloadComplete) {
|
||||||
var lpath = path!.toLowerCase();
|
var lpath = path!.toLowerCase();
|
||||||
if (lpath.endsWith("jpg") || lpath.endsWith("jpeg") || lpath.endsWith("png") || lpath.endsWith("gif") || lpath.endsWith("webp") || lpath.endsWith("bmp")) {
|
if (lpath.endsWith(".jpg") || lpath.endsWith(".jpeg") || lpath.endsWith(".png") || lpath.endsWith(".gif") || lpath.endsWith(".webp") || lpath.endsWith(".bmp")) {
|
||||||
if (myFile == null) {
|
if (myFile == null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
myFile = new File(path);
|
myFile = new File(path);
|
||||||
|
@ -107,8 +106,7 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
child: MessageBubbleDecoration(ackd: Provider.of<MessageMetadata>(context).ackd, errored: Provider.of<MessageMetadata>(context).error, fromMe: fromMe, prettyDate: prettyDate));
|
child: MessageBubbleDecoration(ackd: Provider.of<MessageMetadata>(context).ackd, errored: Provider.of<MessageMetadata>(context).error, fromMe: fromMe, prettyDate: prettyDate));
|
||||||
} else if (downloadComplete) {
|
} else if (downloadComplete) {
|
||||||
// in this case, whatever marked download.complete would have also set the path
|
// in this case, whatever marked download.complete would have also set the path
|
||||||
var lpath = path!.toLowerCase();
|
if (Provider.of<Settings>(context).shouldPreview(path!)) {
|
||||||
if (showImagePreviews && (lpath.endsWith("jpg") || lpath.endsWith("jpeg") || lpath.endsWith("png") || lpath.endsWith("gif") || lpath.endsWith("webp") || lpath.endsWith("bmp"))) {
|
|
||||||
isPreview = true;
|
isPreview = true;
|
||||||
wdgDecorations = Center(
|
wdgDecorations = Center(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
|
@ -161,7 +159,7 @@ class FileBubbleState extends State<FileBubble> {
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
} else if (!senderIsContact) {
|
} else if (!senderIsContact) {
|
||||||
wdgDecorations = Text("Add this account to your contacts in order to accept this file.");
|
wdgDecorations = Text(AppLocalizations.of(context)!.msgAddToAccept);
|
||||||
} else if (!widget.isAuto) {
|
} else if (!widget.isAuto) {
|
||||||
wdgDecorations = Visibility(
|
wdgDecorations = Visibility(
|
||||||
visible: widget.interactive,
|
visible: widget.interactive,
|
||||||
|
|
Loading…
Reference in New Issue