fix(KAN-65): show the installed macOS build number
CI/CD / preconditions (pull_request) Successful in 2s
Native JavaScript checks / Native launcher and release tests (pull_request) Successful in 58s
macOS checks / Native Rust tests and unsigned build (pull_request) Successful in 2m0s
CI/CD / test_and_check_app (pull_request) Successful in 6m28s
CI/CD / Publish immutable image (pull_request) Skipped
CI/CD / preconditions (pull_request) Successful in 2s
Native JavaScript checks / Native launcher and release tests (pull_request) Successful in 58s
macOS checks / Native Rust tests and unsigned build (pull_request) Successful in 2m0s
CI/CD / test_and_check_app (pull_request) Successful in 6m28s
CI/CD / Publish immutable image (pull_request) Skipped
This commit is contained in:
@@ -285,6 +285,16 @@ pub fn context<R: tauri::Runtime>() -> tauri::Context<R> {
|
||||
tauri::generate_context!()
|
||||
}
|
||||
|
||||
fn about_metadata(version: String) -> AboutMetadata<'static> {
|
||||
AboutMetadata {
|
||||
name: Some(en::APP_NAME.into()),
|
||||
version: Some(version),
|
||||
#[cfg(target_os = "macos")]
|
||||
short_version: Some(crate::metadata::build_number().into()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn builder() -> tauri::Builder<tauri::Wry> {
|
||||
tauri::Builder::default().setup(|app| {
|
||||
let (server, phase) = match Server::load(&configuration_path(app.handle())?) {
|
||||
@@ -301,12 +311,7 @@ pub fn builder() -> tauri::Builder<tauri::Wry> {
|
||||
&SubmenuBuilder::new(app, en::APP_NAME)
|
||||
.about_with_text(
|
||||
en::ABOUT,
|
||||
Some(AboutMetadata {
|
||||
name: Some(en::APP_NAME.into()),
|
||||
short_version: Some(app.package_info().version.to_string()),
|
||||
version: app.config().bundle.macos.bundle_version.clone(),
|
||||
..Default::default()
|
||||
}),
|
||||
Some(about_metadata(app.package_info().version.to_string())),
|
||||
)
|
||||
.text("check-updates", en::CHECK_UPDATES)
|
||||
.item(&MenuItem::with_id(
|
||||
@@ -439,6 +444,18 @@ pub fn builder() -> tauri::Builder<tauri::Wry> {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
#[test]
|
||||
fn about_shows_app_version_followed_by_the_actual_build_number() {
|
||||
let metadata = about_metadata("9.8.7".into());
|
||||
assert_eq!(metadata.version.as_deref(), Some("9.8.7"));
|
||||
assert_eq!(
|
||||
metadata.short_version.as_deref(),
|
||||
Some(crate::metadata::build_number())
|
||||
);
|
||||
assert_ne!(metadata.version, metadata.short_version);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn external_links_accept_only_web_urls_without_credentials() {
|
||||
for input in [
|
||||
|
||||
Reference in New Issue
Block a user