commit ae4c6b911865dbbed32cee8de7af6ed79b2c90f1
parent cf2fdf0f1c3f51e23593a56381c638eb47dff4d9
Author: triesap <triesap@radroots.dev>
Date: Tue, 20 Jan 2026 18:25:39 +0000
app: rename notifications and tangle types
- rename AppNotifications types with RadrootsApp prefix
- rename AppTangle client/error/result types
- update health checks and logging adapters
- refresh module exports for renamed types
Diffstat:
6 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/app/src/app.rs b/app/src/app.rs
@@ -30,8 +30,8 @@ use crate::{
RadrootsAppHealthReport,
RadrootsAppInitError,
RadrootsAppInitStage,
- AppNotifications,
- AppTangleClientStub,
+ RadrootsAppNotifications,
+ RadrootsAppTangleClientStub,
LogsPage,
};
@@ -81,8 +81,8 @@ fn spawn_health_checks(
let keystore = radroots_app_core::keystore::RadrootsClientWebKeystoreNostr::new(
Some(config.keystore.nostr_store),
);
- let notifications = AppNotifications::new(None);
- let tangle = AppTangleClientStub::new();
+ let notifications = RadrootsAppNotifications::new(None);
+ let tangle = RadrootsAppTangleClientStub::new();
let report = app_health_check_all_logged(
&datastore,
&keystore,
@@ -327,7 +327,7 @@ fn HomePage() -> impl IntoView {
let datastore = radroots_app_core::datastore::RadrootsClientWebDatastore::new(
Some(config.datastore.idb_config),
);
- let notifications = AppNotifications::new(None);
+ let notifications = RadrootsAppNotifications::new(None);
match notifications.request_permission().await {
Ok(permission) => {
let value = permission.as_str().to_string();
diff --git a/app/src/health.rs b/app/src/health.rs
@@ -89,9 +89,9 @@ use crate::{
app_log_entry_new,
app_log_entry_record,
app_key_maps_validate,
- AppNotifications,
+ RadrootsAppNotifications,
AppLogLevel,
- AppTangleClient,
+ RadrootsAppTangleClient,
RadrootsAppKeyMapConfig,
};
use radroots_app_core::notifications::RadrootsClientNotificationsPermission;
@@ -175,7 +175,7 @@ pub async fn app_health_check_app_data_active_key<T: RadrootsClientDatastore>(
}
pub async fn app_health_check_notifications(
- notifications: &AppNotifications,
+ notifications: &RadrootsAppNotifications,
) -> RadrootsAppHealthCheckResult {
match notifications.permission().await {
Ok(permission) => app_health_check_notifications_permission(permission),
@@ -197,7 +197,7 @@ fn app_health_check_notifications_permission(
}
pub async fn app_health_check_notifications_with_state(
- notifications: &AppNotifications,
+ notifications: &RadrootsAppNotifications,
stored_permission: Option<&str>,
) -> RadrootsAppHealthCheckResult {
if let Some(value) = stored_permission {
@@ -208,10 +208,10 @@ pub async fn app_health_check_notifications_with_state(
app_health_check_notifications(notifications).await
}
-pub fn app_health_check_tangle<T: AppTangleClient>(tangle: &T) -> RadrootsAppHealthCheckResult {
+pub fn app_health_check_tangle<T: RadrootsAppTangleClient>(tangle: &T) -> RadrootsAppHealthCheckResult {
match tangle.init() {
Ok(()) => RadrootsAppHealthCheckResult::ok(),
- Err(crate::AppTangleError::NotImplemented) => RadrootsAppHealthCheckResult::skipped(),
+ Err(crate::RadrootsAppTangleError::NotImplemented) => RadrootsAppHealthCheckResult::skipped(),
}
}
@@ -261,10 +261,10 @@ pub async fn app_health_check_keystore_access<T: RadrootsClientDatastore, K: Rad
}
}
-pub async fn app_health_check_all<T: RadrootsClientDatastore, K: RadrootsClientKeystoreNostr, G: AppTangleClient>(
+pub async fn app_health_check_all<T: RadrootsClientDatastore, K: RadrootsClientKeystoreNostr, G: RadrootsAppTangleClient>(
datastore: &T,
keystore: &K,
- notifications: &AppNotifications,
+ notifications: &RadrootsAppNotifications,
tangle: &G,
key_maps: &RadrootsAppKeyMapConfig,
) -> RadrootsAppHealthReport {
@@ -310,10 +310,10 @@ pub async fn app_health_check_all<T: RadrootsClientDatastore, K: RadrootsClientK
}
}
-pub async fn app_health_check_all_logged<T: RadrootsClientDatastore, K: RadrootsClientKeystoreNostr, G: AppTangleClient>(
+pub async fn app_health_check_all_logged<T: RadrootsClientDatastore, K: RadrootsClientKeystoreNostr, G: RadrootsAppTangleClient>(
datastore: &T,
keystore: &K,
- notifications: &AppNotifications,
+ notifications: &RadrootsAppNotifications,
tangle: &G,
key_maps: &RadrootsAppKeyMapConfig,
) -> RadrootsAppHealthReport {
@@ -703,8 +703,8 @@ mod tests {
fn health_check_all_reports_idb_errors() {
let datastore = RadrootsClientWebDatastore::new(None);
let keystore = RadrootsClientWebKeystoreNostr::new(None);
- let notifications = crate::AppNotifications::new(None);
- let tangle = crate::AppTangleClientStub::new();
+ let notifications = crate::RadrootsAppNotifications::new(None);
+ let tangle = crate::RadrootsAppTangleClientStub::new();
let key_maps = crate::app_key_maps_default();
let report = futures::executor::block_on(app_health_check_all(
&datastore,
@@ -725,7 +725,7 @@ mod tests {
#[test]
fn health_check_notifications_reports_unavailable() {
- let notifications = crate::AppNotifications::new(None);
+ let notifications = crate::RadrootsAppNotifications::new(None);
let result =
futures::executor::block_on(app_health_check_notifications(¬ifications));
assert_eq!(result.status, RadrootsAppHealthCheckStatus::Error);
@@ -744,7 +744,7 @@ mod tests {
#[test]
fn health_check_notifications_uses_stored_permission() {
- let notifications = crate::AppNotifications::new(None);
+ let notifications = crate::RadrootsAppNotifications::new(None);
let result = futures::executor::block_on(app_health_check_notifications_with_state(
¬ifications,
Some("granted"),
@@ -754,7 +754,7 @@ mod tests {
#[test]
fn health_check_tangle_reports_not_implemented() {
- let tangle = crate::AppTangleClientStub::new();
+ let tangle = crate::RadrootsAppTangleClientStub::new();
let result = app_health_check_tangle(&tangle);
assert_eq!(result.status, RadrootsAppHealthCheckStatus::Skipped);
assert!(result.message.is_none());
@@ -891,8 +891,8 @@ mod tests {
let keystore = TestKeystore {
read_result: Err(RadrootsClientKeystoreError::MissingKey),
};
- let notifications = crate::AppNotifications::new(None);
- let tangle = crate::AppTangleClientStub::new();
+ let notifications = crate::RadrootsAppNotifications::new(None);
+ let tangle = crate::RadrootsAppTangleClientStub::new();
let key_maps = crate::app_key_maps_default();
let report = futures::executor::block_on(app_health_check_all_logged(
&datastore,
diff --git a/app/src/lib.rs b/app/src/lib.rs
@@ -84,8 +84,8 @@ pub use logging::{
APP_LOG_BUFFER_MAX_ENTRIES,
APP_LOG_MAX_ENTRIES,
};
-pub use notifications::{AppNotifications, AppNotificationsError, AppNotificationsResult};
-pub use tangle::{AppTangleClient, AppTangleClientStub, AppTangleError, AppTangleResult};
+pub use notifications::{RadrootsAppNotifications, RadrootsAppNotificationsError, RadrootsAppNotificationsResult};
+pub use tangle::{RadrootsAppTangleClient, RadrootsAppTangleClientStub, RadrootsAppTangleError, RadrootsAppTangleResult};
pub use config::{
app_config_default,
app_config_from_env,
diff --git a/app/src/logging.rs b/app/src/logging.rs
@@ -27,8 +27,8 @@ use crate::{
RadrootsAppInitError,
RadrootsAppKeystoreError,
RadrootsAppKeyMapConfig,
- AppNotificationsError,
- AppTangleError,
+ RadrootsAppNotificationsError,
+ RadrootsAppTangleError,
};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
@@ -157,19 +157,19 @@ impl AppLoggableError for RadrootsAppKeystoreError {
}
}
-impl AppLoggableError for AppNotificationsError {
+impl AppLoggableError for RadrootsAppNotificationsError {
fn log_code(&self) -> &'static str {
self.message()
}
fn log_context(&self) -> Option<String> {
match self {
- AppNotificationsError::Notifications(err) => Some(err.message().to_string()),
+ RadrootsAppNotificationsError::Notifications(err) => Some(err.message().to_string()),
}
}
}
-impl AppLoggableError for AppTangleError {
+impl AppLoggableError for RadrootsAppTangleError {
fn log_code(&self) -> &'static str {
self.message()
}
diff --git a/app/src/notifications.rs b/app/src/notifications.rs
@@ -14,39 +14,39 @@ use crate::app_log_debug_emit;
use wasm_bindgen::JsValue;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum AppNotificationsError {
+pub enum RadrootsAppNotificationsError {
Notifications(RadrootsClientNotificationsError),
}
-pub type AppNotificationsResult<T> = Result<T, AppNotificationsError>;
+pub type RadrootsAppNotificationsResult<T> = Result<T, RadrootsAppNotificationsError>;
-impl AppNotificationsError {
+impl RadrootsAppNotificationsError {
pub const fn message(self) -> &'static str {
match self {
- AppNotificationsError::Notifications(err) => err.message(),
+ RadrootsAppNotificationsError::Notifications(err) => err.message(),
}
}
}
-impl std::fmt::Display for AppNotificationsError {
+impl std::fmt::Display for RadrootsAppNotificationsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.message())
}
}
-impl std::error::Error for AppNotificationsError {}
+impl std::error::Error for RadrootsAppNotificationsError {}
-impl From<RadrootsClientNotificationsError> for AppNotificationsError {
+impl From<RadrootsClientNotificationsError> for RadrootsAppNotificationsError {
fn from(err: RadrootsClientNotificationsError) -> Self {
- AppNotificationsError::Notifications(err)
+ RadrootsAppNotificationsError::Notifications(err)
}
}
-pub struct AppNotifications {
+pub struct RadrootsAppNotifications {
client: RadrootsClientWebNotifications,
}
-impl AppNotifications {
+impl RadrootsAppNotifications {
pub fn new(config: Option<RadrootsClientNotificationsConfig>) -> Self {
Self {
client: RadrootsClientWebNotifications::new(config),
@@ -81,7 +81,7 @@ impl AppNotifications {
pub async fn permission(
&self,
- ) -> AppNotificationsResult<RadrootsClientNotificationsPermission> {
+ ) -> RadrootsAppNotificationsResult<RadrootsClientNotificationsPermission> {
let _ = app_log_debug_emit("log.app.notifications.permission", "start", None);
#[cfg(not(target_arch = "wasm32"))]
{
@@ -106,12 +106,12 @@ impl AppNotifications {
pub async fn request_permission(
&self,
- ) -> AppNotificationsResult<RadrootsClientNotificationsPermission> {
+ ) -> RadrootsAppNotificationsResult<RadrootsClientNotificationsPermission> {
let _ = app_log_debug_emit("log.app.notifications.request", "start", None);
let result = self.client
.notify_init()
.await
- .map_err(AppNotificationsError::from);
+ .map_err(RadrootsAppNotificationsError::from);
if let Ok(permission) = &result {
let _ = app_log_debug_emit(
"log.app.notifications.request",
@@ -125,7 +125,7 @@ impl AppNotifications {
#[cfg(test)]
mod tests {
- use super::{AppNotifications, AppNotificationsError};
+ use super::{RadrootsAppNotifications, RadrootsAppNotificationsError};
use radroots_app_core::notifications::{
RadrootsClientNotificationsConfig,
RadrootsClientNotificationsError,
@@ -134,7 +134,7 @@ mod tests {
#[test]
fn permission_is_unavailable_on_native() {
- let app = AppNotifications::new(Some(RadrootsClientNotificationsConfig {
+ let app = RadrootsAppNotifications::new(Some(RadrootsClientNotificationsConfig {
app_name: String::from("Radroots"),
}));
let permission = futures::executor::block_on(app.permission())
@@ -144,12 +144,12 @@ mod tests {
#[test]
fn request_permission_maps_errors() {
- let app = AppNotifications::new(None);
+ let app = RadrootsAppNotifications::new(None);
let err = futures::executor::block_on(app.request_permission())
.expect_err("permission request error");
assert_eq!(
err,
- AppNotificationsError::Notifications(RadrootsClientNotificationsError::Unavailable)
+ RadrootsAppNotificationsError::Notifications(RadrootsClientNotificationsError::Unavailable)
);
assert_eq!(err.to_string(), "error.client.notifications.unavailable");
}
diff --git a/app/src/tangle.rs b/app/src/tangle.rs
@@ -3,56 +3,56 @@
use crate::app_log_debug_emit;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
-pub enum AppTangleError {
+pub enum RadrootsAppTangleError {
NotImplemented,
}
-pub type AppTangleResult<T> = Result<T, AppTangleError>;
+pub type RadrootsAppTangleResult<T> = Result<T, RadrootsAppTangleError>;
-impl AppTangleError {
+impl RadrootsAppTangleError {
pub const fn message(self) -> &'static str {
match self {
- AppTangleError::NotImplemented => "error.app.tangle.not_implemented",
+ RadrootsAppTangleError::NotImplemented => "error.app.tangle.not_implemented",
}
}
}
-impl std::fmt::Display for AppTangleError {
+impl std::fmt::Display for RadrootsAppTangleError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.message())
}
}
-impl std::error::Error for AppTangleError {}
+impl std::error::Error for RadrootsAppTangleError {}
-pub trait AppTangleClient {
- fn init(&self) -> AppTangleResult<()>;
+pub trait RadrootsAppTangleClient {
+ fn init(&self) -> RadrootsAppTangleResult<()>;
}
-pub struct AppTangleClientStub;
+pub struct RadrootsAppTangleClientStub;
-impl AppTangleClientStub {
+impl RadrootsAppTangleClientStub {
pub fn new() -> Self {
Self
}
}
-impl AppTangleClient for AppTangleClientStub {
- fn init(&self) -> AppTangleResult<()> {
+impl RadrootsAppTangleClient for RadrootsAppTangleClientStub {
+ fn init(&self) -> RadrootsAppTangleResult<()> {
let _ = app_log_debug_emit("log.app.tangle.init", "stub", None);
- Err(AppTangleError::NotImplemented)
+ Err(RadrootsAppTangleError::NotImplemented)
}
}
#[cfg(test)]
mod tests {
- use super::{AppTangleClient, AppTangleClientStub, AppTangleError};
+ use super::{RadrootsAppTangleClient, RadrootsAppTangleClientStub, RadrootsAppTangleError};
#[test]
fn tangle_stub_reports_not_implemented() {
- let client = AppTangleClientStub::new();
+ let client = RadrootsAppTangleClientStub::new();
let err = client.init().expect_err("not implemented");
- assert_eq!(err, AppTangleError::NotImplemented);
+ assert_eq!(err, RadrootsAppTangleError::NotImplemented);
assert_eq!(err.to_string(), "error.app.tangle.not_implemented");
}
}