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;
|
||||
set downloadPath(String newval) {
|
||||
_downloadPath = newval;
|
||||
|
|
|
@ -389,7 +389,7 @@ class _MessageViewState extends State<MessageView> {
|
|||
_confirmFileSend(ctx, file.path);
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
content: Text("File size cannot exceed 10 GB"),
|
||||
content: Text(AppLocalizations.of(context)!.msgFileTooBig),
|
||||
duration: Duration(seconds: 4),
|
||||
);
|
||||
ScaffoldMessenger.of(ctx).showSnackBar(snackBar);
|
||||
|
@ -401,9 +401,8 @@ class _MessageViewState extends State<MessageView> {
|
|||
showModalBottomSheet<void>(
|
||||
context: ctx,
|
||||
builder: (BuildContext bcontext) {
|
||||
var lpath = path.toLowerCase();
|
||||
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;
|
||||
if (imagePreview == null) {
|
||||
imagePreview = new File(path);
|
||||
|
@ -418,7 +417,7 @@ class _MessageViewState extends State<MessageView> {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text("Are you sure you want to send $path?"),
|
||||
Text(AppLocalizations.of(context)!.msgConfirmSend + " $path?"),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
|
@ -437,14 +436,14 @@ class _MessageViewState extends State<MessageView> {
|
|||
Visibility(visible: showPreview, child: SizedBox(height: 10,)),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
ElevatedButton(
|
||||
child: Text("Cancel", semanticsLabel: "Cancel"),
|
||||
child: Text(AppLocalizations.of(context)!.cancel, semanticsLabel: AppLocalizations.of(context)!.cancel),
|
||||
onPressed: () {
|
||||
Navigator.pop(bcontext);
|
||||
},
|
||||
),
|
||||
SizedBox(width: 20,),
|
||||
ElevatedButton(
|
||||
child: Text("Send File", semanticsLabel: "Send File"),
|
||||
child: Text(AppLocalizations.of(context)!.btnSendFile, semanticsLabel: AppLocalizations.of(context)!.btnSendFile),
|
||||
onPressed: () {
|
||||
_sendFile(path);
|
||||
Navigator.pop(bcontext);
|
||||
|
|
|
@ -49,7 +49,6 @@ class FileBubbleState extends State<FileBubble> {
|
|||
var flagStarted = Provider.of<MessageMetadata>(context).attributes["file-downloaded"] == "true";
|
||||
var borderRadiousEh = 15.0;
|
||||
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 downloadComplete = Provider.of<ProfileInfoState>(context).downloadComplete(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());
|
||||
if (downloadComplete) {
|
||||
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) {
|
||||
setState(() {
|
||||
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));
|
||||
} else if (downloadComplete) {
|
||||
// in this case, whatever marked download.complete would have also set the path
|
||||
var lpath = path!.toLowerCase();
|
||||
if (showImagePreviews && (lpath.endsWith("jpg") || lpath.endsWith("jpeg") || lpath.endsWith("png") || lpath.endsWith("gif") || lpath.endsWith("webp") || lpath.endsWith("bmp"))) {
|
||||
if (Provider.of<Settings>(context).shouldPreview(path!)) {
|
||||
isPreview = true;
|
||||
wdgDecorations = Center(
|
||||
child: GestureDetector(
|
||||
|
@ -161,7 +159,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
]));
|
||||
}
|
||||
} 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) {
|
||||
wdgDecorations = Visibility(
|
||||
visible: widget.interactive,
|
||||
|
|
Loading…
Reference in New Issue