mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-08-04 15:18:58 +00:00
feat: warn user that adb isn't installed when installing the wivrn apk (#31)
This commit is contained in:
parent
551769baf6
commit
dd3eedba3c
3 changed files with 32 additions and 6 deletions
9
src/dependencies/adb_dep.rs
Normal file
9
src/dependencies/adb_dep.rs
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
use crate::depcheck::{DepType, Dependency};
|
||||||
|
|
||||||
|
pub fn adb_dep() -> Dependency {
|
||||||
|
Dependency {
|
||||||
|
name: "adb".into(),
|
||||||
|
dep_type: DepType::Executable,
|
||||||
|
filename: "adb".into(),
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,3 +2,4 @@ pub mod monado_deps;
|
||||||
pub mod libsurvive_deps;
|
pub mod libsurvive_deps;
|
||||||
pub mod basalt_deps;
|
pub mod basalt_deps;
|
||||||
pub mod wivrn_deps;
|
pub mod wivrn_deps;
|
||||||
|
pub mod adb_dep;
|
||||||
|
|
|
@ -3,7 +3,7 @@ use crate::{
|
||||||
downloader::download_file,
|
downloader::download_file,
|
||||||
paths::wivrn_apk_download_path,
|
paths::wivrn_apk_download_path,
|
||||||
profile::{Profile, XRServiceType},
|
profile::{Profile, XRServiceType},
|
||||||
runner::{Runner, RunnerStatus},
|
runner::{Runner, RunnerStatus}, depcheck::check_dependency, dependencies::adb_dep::adb_dep,
|
||||||
};
|
};
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use relm4::prelude::*;
|
use relm4::prelude::*;
|
||||||
|
@ -24,6 +24,8 @@ pub struct InstallWivrnBox {
|
||||||
download_thread: Option<JoinHandle<Result<(), reqwest::Error>>>,
|
download_thread: Option<JoinHandle<Result<(), reqwest::Error>>>,
|
||||||
#[tracker::do_not_track]
|
#[tracker::do_not_track]
|
||||||
install_runner: Option<Runner>,
|
install_runner: Option<Runner>,
|
||||||
|
#[tracker::do_not_track]
|
||||||
|
adb_missing_dialog: adw::MessageDialog,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -170,12 +172,17 @@ impl SimpleComponent for InstallWivrnBox {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Self::Input::DownloadWivrn => {
|
Self::Input::DownloadWivrn => {
|
||||||
|
if !check_dependency(adb_dep()) {
|
||||||
|
self.adb_missing_dialog.present();
|
||||||
|
}
|
||||||
|
else {
|
||||||
self.set_install_wivrn_status(InstallWivrnStatus::InProgress);
|
self.set_install_wivrn_status(InstallWivrnStatus::InProgress);
|
||||||
self.download_thread = Some(download_file(
|
self.download_thread = Some(download_file(
|
||||||
"https://github.com/Meumeu/WiVRn/releases/latest/download/WiVRn-oculus-release.apk".into(),
|
"https://github.com/Meumeu/WiVRn/releases/latest/download/WiVRn-oculus-release.apk".into(),
|
||||||
wivrn_apk_download_path()
|
wivrn_apk_download_path()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Self::Input::InstallWivrnApk => {
|
Self::Input::InstallWivrnApk => {
|
||||||
let mut runner = get_adb_install_runner(&wivrn_apk_download_path());
|
let mut runner = get_adb_install_runner(&wivrn_apk_download_path());
|
||||||
runner.start();
|
runner.start();
|
||||||
|
@ -192,11 +199,20 @@ impl SimpleComponent for InstallWivrnBox {
|
||||||
root: &Self::Root,
|
root: &Self::Root,
|
||||||
sender: ComponentSender<Self>,
|
sender: ComponentSender<Self>,
|
||||||
) -> ComponentParts<Self> {
|
) -> ComponentParts<Self> {
|
||||||
|
let adb_missing_dialog = adw::MessageDialog::builder()
|
||||||
|
.modal(true)
|
||||||
|
.transient_for(root.root().unwrap().downcast_ref::<gtk::Window>().unwrap())
|
||||||
|
.title("ADB is not installed")
|
||||||
|
.body("Please install ADB on your computer to install WiVRn on your Android headset")
|
||||||
|
.hide_on_close(true)
|
||||||
|
.build();
|
||||||
|
|
||||||
let model = Self {
|
let model = Self {
|
||||||
selected_profile: init.selected_profile,
|
selected_profile: init.selected_profile,
|
||||||
install_wivrn_status: InstallWivrnStatus::Done(None),
|
install_wivrn_status: InstallWivrnStatus::Done(None),
|
||||||
download_thread: None,
|
download_thread: None,
|
||||||
install_runner: None,
|
install_runner: None,
|
||||||
|
adb_missing_dialog,
|
||||||
tracker: 0,
|
tracker: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue