diff --git a/flutter/lib/desktop/pages/desktop_home_page.dart b/flutter/lib/desktop/pages/desktop_home_page.dart index d458402d3..e48dda51d 100644 --- a/flutter/lib/desktop/pages/desktop_home_page.dart +++ b/flutter/lib/desktop/pages/desktop_home_page.dart @@ -48,6 +48,7 @@ class _DesktopHomePageState extends State var watchIsInputMonitoring = false; var watchIsCanRecordAudio = false; Timer? _updateTimer; + bool isCardClosed = false; @override Widget build(BuildContext context) { @@ -321,14 +322,15 @@ class _DesktopHomePageState extends State } Future buildHelpCards() async { - if (updateUrl.isNotEmpty) { + if (updateUrl.isNotEmpty && !isCardClosed) { return buildInstallCard( "Status", "There is a newer version of ${bind.mainGetAppNameSync()} ${bind.mainGetNewVersion()} available.", "Click to download", () async { final Uri url = Uri.parse('https://rustdesk.com/download'); await launchUrl(url); - }); + }, + closeButton: true); } if (systemError.isNotEmpty) { return buildInstallCard("", systemError, "", () {}); @@ -394,11 +396,20 @@ class _DesktopHomePageState extends State Widget buildInstallCard(String title, String content, String btnText, GestureTapCallback onPressed, - {String? help, String? link}) { - return Container( - margin: EdgeInsets.only(top: 20), - child: Container( - decoration: BoxDecoration( + {String? help, String? link, bool? closeButton}) { + + void closeCard() { + setState(() { + isCardClosed = true; + }); + } + + return Stack( + children: [ + Container( + margin: EdgeInsets.only(top: 20), + child: Container( + decoration: BoxDecoration( gradient: LinearGradient( begin: Alignment.centerLeft, end: Alignment.centerRight, @@ -467,6 +478,21 @@ class _DesktopHomePageState extends State )).marginOnly(top: 6)), ] : []))), + ), + if (closeButton != null && closeButton == true) + Positioned( + top: 18, + right: 0, + child: IconButton( + icon: Icon( + Icons.close, + color: Colors.white, + size: 20, + ), + onPressed: closeCard, + ), + ), + ], ); } diff --git a/flutter/lib/desktop/pages/desktop_setting_page.dart b/flutter/lib/desktop/pages/desktop_setting_page.dart index 2f5180bf6..035a21f41 100644 --- a/flutter/lib/desktop/pages/desktop_setting_page.dart +++ b/flutter/lib/desktop/pages/desktop_setting_page.dart @@ -329,6 +329,10 @@ class _GeneralState extends State<_General> { message: translate('software_render_tip'), child: _OptionCheckBox(context, "Always use software rendering", 'allow-always-software-render'), + )); + children.add( + _OptionCheckBox(context, 'Check for software update on startup','enable-check-update', + isServer: false, )); if (bind.mainShowOption(key: 'allow-linux-headless')) { children.add(_OptionCheckBox( diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs index 69f6f507c..dbbe0d707 100644 --- a/src/flutter_ffi.rs +++ b/src/flutter_ffi.rs @@ -1,3 +1,5 @@ +use hbb_common::config::Config; + #[cfg(not(any(target_os = "android", target_os = "ios")))] use crate::common::get_default_sound_input; use crate::{ @@ -1074,6 +1076,9 @@ pub fn main_get_last_remote_id() -> String { } pub fn main_get_software_update_url() -> String { + if (get_local_option("enable-check-update".to_string()) != "N") { + crate::common::check_software_update(); + } crate::common::SOFTWARE_UPDATE_URL.lock().unwrap().clone() } diff --git a/src/lang/ar.rs b/src/lang/ar.rs index c65adef0a..9b00da2a6 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 1d01bea6b..868440bfa 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cn.rs b/src/lang/cn.rs index 1a10b8bd1..0d9e5a29d 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", "超时(分钟)"), ("auto_disconnect_option_tip", "自动关闭不活跃的会话"), ("Connection failed due to inactivity", "由于长时间无操作, 连接被自动断开"), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 457dae517..857672eff 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/da.rs b/src/lang/da.rs index 6ea628cee..d7151ee2f 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/de.rs b/src/lang/de.rs index d44a1e98c..70a1e81ef 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", "Zeitüberschreitung in Minuten"), ("auto_disconnect_option_tip", "Automatisches Schließen eingehender Sitzungen bei Inaktivität des Benutzers"), ("Connection failed due to inactivity", "Automatische Trennung der Verbindung aufgrund von Inaktivität"), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/el.rs b/src/lang/el.rs index 710751331..b098452f6 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 7df5c3fa7..ea1d597d4 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/es.rs b/src/lang/es.rs index 1053dcf73..8299e609e 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fa.rs b/src/lang/fa.rs index 1fd0be295..98d0c4087 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 565bd5d42..51d690bf3 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/hu.rs b/src/lang/hu.rs index df19e7bbe..5ee56c422 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/id.rs b/src/lang/id.rs index 663fd87f3..cd4d2dc74 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", "Batasan Waktu dalam Menit"), ("auto_disconnect_option_tip", "Secara otomatis akan menutup sesi ketika pengguna tidak beraktivitas"), ("Connection failed due to inactivity", "Secara otomatis akan terputus ketik tidak ada aktivitas."), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/it.rs b/src/lang/it.rs index 54a96a18d..4b22c87a6 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", "Timeout in minuti"), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", "Connessione non riuscita a causa di inattività"), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 1ecb8d9e2..017637e48 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ko.rs b/src/lang/ko.rs index ad05b326f..f1f6c7311 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/kz.rs b/src/lang/kz.rs index e3fec6c5e..53fa177df 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/lt.rs b/src/lang/lt.rs index 4c9cae2b7..465508005 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 43f277a0a..4ae999878 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 71c216429..e9b03faea 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", "Czas bezczynności w minutach"), ("auto_disconnect_option_tip", "Automatycznie rozłącz sesje przychodzące przy braku aktywności użytkownika"), ("Connection failed due to inactivity", "Automatycznie rozłącz przy bezczynności"), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 72a16d62b..6a3f43800 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index f11435d67..7a58fc4bc 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ro.rs b/src/lang/ro.rs index d4cccc796..9557a4031 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ru.rs b/src/lang/ru.rs index 6be1274fd..fad79043f 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 0b58db74d..c7d68b4fe 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sl.rs b/src/lang/sl.rs index 2c82b35da..cf2e29428 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sq.rs b/src/lang/sq.rs index 32dc09f05..30cb24abe 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sr.rs b/src/lang/sr.rs index 43ead1444..f193a720b 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/sv.rs b/src/lang/sv.rs index 867fa9fcc..a0fb40efe 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/template.rs b/src/lang/template.rs index 397d6d380..03b69bcf6 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/th.rs b/src/lang/th.rs index c5e4d5fbb..dc430be2b 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 28b8d385a..2bce33d47 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 104370258..b13c024a8 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 7147445e0..4301b3b1d 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); } diff --git a/src/lang/vn.rs b/src/lang/vn.rs index 9b910955e..3d0f5c455 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -554,5 +554,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Timeout in minutes", ""), ("auto_disconnect_option_tip", ""), ("Connection failed due to inactivity", ""), + ("Check for software update on startup", ""), ].iter().cloned().collect(); }