diff --git a/library/include/updater.h b/library/include/updater.h index b8e578f..7cd9473 100644 --- a/library/include/updater.h +++ b/library/include/updater.h @@ -150,6 +150,11 @@ SHOREBIRD_EXPORT void shorebird_free_string(const char *c_string); SHOREBIRD_EXPORT void shorebird_free_update_result(struct UpdateResult *result); +/** + * Check for an update. Returns true if an update is available. + */ +SHOREBIRD_EXPORT bool shorebird_check_for_update(void); + /** * Check for an update on the first non-null channel of: * 1. `c_channel` diff --git a/library/src/c_api/mod.rs b/library/src/c_api/mod.rs index 5c553a2..5d03ca7 100644 --- a/library/src/c_api/mod.rs +++ b/library/src/c_api/mod.rs @@ -274,6 +274,16 @@ pub unsafe extern "C" fn shorebird_free_update_result(result: *mut UpdateResult) } } +/// Check for an update. Returns true if an update is available. +#[no_mangle] +pub extern "C" fn shorebird_check_for_update() -> bool { + log_on_error( + || updater::check_for_downloadable_update(None), + "checking for update", + false, + ) +} + /// Check for an update on the first non-null channel of: /// 1. `c_channel` /// 2. The channel specified in shorebird.yaml