diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 2833f3834..71effd797 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -4,6 +4,7 @@ import 'dart:math'; import 'dart:typed_data'; import 'dart:ui' as ui; +import 'package:bot_toast/bot_toast.dart'; import 'package:desktop_multi_window/desktop_multi_window.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -269,6 +270,8 @@ class FfiModel with ChangeNotifier { var name = evt['name']; if (name == 'msgbox') { handleMsgBox(evt, sessionId, peerId); + } else if (name == 'toast') { + handleToast(evt, sessionId, peerId); } else if (name == 'set_multiple_windows_session') { handleMultipleWindowsSession(evt, sessionId, peerId); } else if (name == 'peer_info') { @@ -595,6 +598,37 @@ class FfiModel with ChangeNotifier { } } + handleToast(Map evt, SessionID sessionId, String peerId) { + final type = evt['type'] ?? 'info'; + final text = evt['text'] ?? ''; + final durMsc = evt['dur_msec'] ?? 2000; + final duration = Duration(milliseconds: durMsc); + if ((text).isEmpty) { + BotToast.showLoading( + duration: duration, + clickClose: true, + allowClick: true, + ); + } else { + if (type.contains('error')) { + BotToast.showText( + contentColor: Colors.red, + text: translate(text), + duration: duration, + clickClose: true, + onlyOne: true, + ); + } else { + BotToast.showText( + text: translate(text), + duration: duration, + clickClose: true, + onlyOne: true, + ); + } + } + } + /// Show a message box with [type], [title] and [text]. showMsgBox(SessionID sessionId, String type, String title, String text, String link, bool hasRetry, OverlayDialogManager dialogManager, diff --git a/src/lang/ar.rs b/src/lang/ar.rs index 879414cd6..6cae020b6 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/be.rs b/src/lang/be.rs index 501438fd0..7e9f928ae 100644 --- a/src/lang/be.rs +++ b/src/lang/be.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/bg.rs b/src/lang/bg.rs index cf972ee76..9f6282e75 100644 --- a/src/lang/bg.rs +++ b/src/lang/bg.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 4001c1e6e..64748c9ac 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 17b3ba159..5ad91ada8 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", "下载"), ("Upload folder", "上传文件夹"), ("Upload files", "上传文件"), + ("Clipboard is synchronized", "剪贴板已同步"), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 8404ee3e4..8db1470b9 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index c59f3efc9..f867cac46 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index f54cddac9..73e57183d 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", "Herunterladen"), ("Upload folder", "Ordner hochladen"), ("Upload files", "Dateien hochladen"), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index eaa31c55f..625867c34 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index e7daf0ff7..217b37a6a 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index bd7e4df15..70bd9d9e5 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/et.rs b/src/lang/et.rs index 131e3b215..8187759d5 100644 --- a/src/lang/et.rs +++ b/src/lang/et.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eu.rs b/src/lang/eu.rs index 267431efd..f8ba679a7 100644 --- a/src/lang/eu.rs +++ b/src/lang/eu.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index c070f18e2..cf5ce0f0f 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 2fa41f3fe..0fd093688 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/he.rs b/src/lang/he.rs index 5d5e4637e..e36252afe 100644 --- a/src/lang/he.rs +++ b/src/lang/he.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hr.rs b/src/lang/hr.rs index 378f0e909..e2480eb63 100644 --- a/src/lang/hr.rs +++ b/src/lang/hr.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index 8aaaa3a13..00c56edfb 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 44703afc6..2f95411f0 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index b791276b9..8fff93a6e 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", "Download"), ("Upload folder", "Cartella upload"), ("Upload files", "File upload"), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 41fcca10c..dbc40b789 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index 5c9660560..966ac9009 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 3b5aba5e4..d62bbc393 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index c6915aab3..bc7d856b1 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lv.rs b/src/lang/lv.rs index 4a24a38a0..fa266ac2e 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nb.rs b/src/lang/nb.rs index a5b501aa4..d91eb9325 100644 --- a/src/lang/nb.rs +++ b/src/lang/nb.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 6263cccb8..b780ce7da 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 8479949b3..8e9989084 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index a30692c42..4c01d0b62 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index 45dc2259b..240fae99a 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 506876865..26858b134 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 4bc1516d1..d011eae60 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index dabec3ed3..28e322460 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index f834687c7..e7f624816 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index acc5a627f..58dc1ed55 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 0ade32f81..d38d20e9e 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 5dd93ea4e..cfbac29b9 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index eb62d5621..1c4606e94 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index deb7f9741..2dbb564e8 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 656feb0ef..9bdbec110 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 1f96700b0..b37949206 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", "下載"), ("Upload folder", "上傳資料夾"), ("Upload files", "上傳檔案"), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/uk.rs b/src/lang/uk.rs index 35ffa1c29..2bce8cc81 100644 --- a/src/lang/uk.rs +++ b/src/lang/uk.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index d07225ba0..9693d35c3 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -651,5 +651,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Download", ""), ("Upload folder", ""), ("Upload files", ""), + ("Clipboard is synchronized", ""), ].iter().cloned().collect(); }