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