install/upgrade/update help card
This commit is contained in:
parent
f6410ba61b
commit
bb8540b040
@ -14,6 +14,7 @@ import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tray_manager/tray_manager.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import '../widgets/button.dart';
|
||||
|
||||
@ -302,28 +303,29 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
Widget buildHelpCards() {
|
||||
if (Platform.isWindows) {
|
||||
if (!bind.mainIsInstalled()) {
|
||||
return buildInstallCard();
|
||||
return buildInstallCard(
|
||||
"", "install_tip", "Install", bind.mainGotoInstall);
|
||||
} else if (bind.mainIsInstalledLowerVersion()) {
|
||||
return buildUpgradeCard();
|
||||
return buildInstallCard("Status", "Your installation is lower version.",
|
||||
"Click to upgrade", bind.mainUpdateMe);
|
||||
}
|
||||
}
|
||||
if (updateUrl.isNotEmpty) {
|
||||
return buildUpdateCard();
|
||||
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');
|
||||
await launchUrl(url);
|
||||
});
|
||||
}
|
||||
if (Platform.isMacOS) {}
|
||||
if (bind.mainIsInstalledLowerVersion()) {}
|
||||
return Container();
|
||||
}
|
||||
|
||||
Widget buildUpdateCard() {
|
||||
return Container();
|
||||
}
|
||||
|
||||
Widget buildUpgradeCard() {
|
||||
return Container();
|
||||
}
|
||||
|
||||
Widget buildInstallCard() {
|
||||
Widget buildInstallCard(String title, String content, String btnText,
|
||||
GestureTapCallback onPressed) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
child: Container(
|
||||
@ -340,27 +342,40 @@ class _DesktopHomePageState extends State<DesktopHomePage>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
translate("install_tip"),
|
||||
style: TextStyle(
|
||||
height: 1.5,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 13),
|
||||
).marginOnly(bottom: 20),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Button(
|
||||
padding: 8,
|
||||
isOutline: true,
|
||||
text: 'Install',
|
||||
textColor: Colors.white,
|
||||
borderColor: Colors.white,
|
||||
textSize: 20,
|
||||
radius: 10,
|
||||
onTap: () {})
|
||||
]),
|
||||
],
|
||||
children: (title.isNotEmpty
|
||||
? <Widget>[
|
||||
Center(
|
||||
child: Text(
|
||||
translate(title),
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15),
|
||||
).marginOnly(bottom: 6)),
|
||||
]
|
||||
: <Widget>[]) +
|
||||
<Widget>[
|
||||
Text(
|
||||
translate(content),
|
||||
style: TextStyle(
|
||||
height: 1.5,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.normal,
|
||||
fontSize: 13),
|
||||
).marginOnly(bottom: 20),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: [
|
||||
Button(
|
||||
padding: 8,
|
||||
isOutline: true,
|
||||
text: translate(btnText),
|
||||
textColor: Colors.white,
|
||||
borderColor: Colors.white,
|
||||
textSize: 20,
|
||||
radius: 10,
|
||||
onTap: onPressed,
|
||||
)
|
||||
]),
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ use crate::ui_interface::get_sound_inputs;
|
||||
use crate::ui_interface::{
|
||||
self, change_id, check_mouse_time, check_super_user_permission, discover, forget_password,
|
||||
get_api_server, get_app_name, get_async_job_status, get_connect_status, get_fav, get_id,
|
||||
get_lan_peers, get_langs, get_license, get_local_option, get_mouse_time, get_option,
|
||||
get_options, get_peer, get_peer_option, get_socks, get_uuid, get_version, has_hwcodec,
|
||||
has_rendezvous_service, is_can_screen_recording, is_installed, is_installed_daemon,
|
||||
is_installed_lower_version, is_process_trusted, is_rdp_service_open, is_share_rdp,
|
||||
post_request, send_to_cm, set_local_option, set_option, set_options, set_peer_option,
|
||||
set_permanent_password, set_socks, store_fav, test_if_valid_server, update_temporary_password,
|
||||
using_public_server,
|
||||
get_lan_peers, get_langs, get_license, get_local_option, get_mouse_time, get_new_version,
|
||||
get_option, get_options, get_peer, get_peer_option, get_socks, get_uuid, get_version,
|
||||
goto_install, has_hwcodec, has_rendezvous_service, is_can_screen_recording, is_installed,
|
||||
is_installed_daemon, is_installed_lower_version, is_process_trusted, is_rdp_service_open,
|
||||
is_share_rdp, post_request, send_to_cm, set_local_option, set_option, set_options,
|
||||
set_peer_option, set_permanent_password, set_socks, store_fav, test_if_valid_server, update_me,
|
||||
update_temporary_password, using_public_server,
|
||||
};
|
||||
use crate::{
|
||||
client::file_trait::FileManager,
|
||||
@ -477,6 +477,9 @@ pub fn main_get_app_name() -> String {
|
||||
get_app_name()
|
||||
}
|
||||
|
||||
pub fn main_get_app_name_sync() -> SyncReturn<String> {
|
||||
SyncReturn(get_app_name())
|
||||
}
|
||||
pub fn main_get_license() -> String {
|
||||
get_license()
|
||||
}
|
||||
@ -1007,6 +1010,20 @@ pub fn main_is_rdp_service_open() -> SyncReturn<bool> {
|
||||
SyncReturn(is_rdp_service_open())
|
||||
}
|
||||
|
||||
pub fn main_goto_install() -> SyncReturn<bool> {
|
||||
goto_install();
|
||||
SyncReturn(true)
|
||||
}
|
||||
|
||||
pub fn main_get_new_version() -> SyncReturn<String> {
|
||||
SyncReturn(get_new_version())
|
||||
}
|
||||
|
||||
pub fn main_update_me() -> SyncReturn<bool> {
|
||||
update_me("".to_owned());
|
||||
SyncReturn(true)
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub mod server_side {
|
||||
use jni::{
|
||||
|
Loading…
x
Reference in New Issue
Block a user