Skip to content

Commit

Permalink
Merge pull request #1108 from MutinyWallet/add-privacy-level
Browse files Browse the repository at this point in the history
Add privacy_level to ActivityItem
  • Loading branch information
benthecarman authored Apr 4, 2024
2 parents 48ff3dc + bfe23f3 commit 5d6e348
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions mutiny-wasm/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub struct ActivityItem {
pub(crate) labels: Vec<String>,
pub(crate) contacts: Vec<TagItem>,
pub last_updated: Option<u64>,
privacy_level: String,
}

#[wasm_bindgen]
Expand Down Expand Up @@ -98,6 +99,19 @@ impl From<mutiny_core::ActivityItem> for ActivityItem {
mutiny_core::ActivityItem::ChannelClosed(_) => (false, None),
};

let privacy_level = match kind {
ActivityType::OnChain => PrivacyLevel::NotAvailable,
ActivityType::Lightning => {
if let mutiny_core::ActivityItem::Lightning(ref ln) = a {
ln.privacy_level
} else {
PrivacyLevel::NotAvailable
}
}
ActivityType::ChannelOpen => PrivacyLevel::NotAvailable,
ActivityType::ChannelClose => PrivacyLevel::NotAvailable,
};

ActivityItem {
kind,
id,
Expand All @@ -106,6 +120,7 @@ impl From<mutiny_core::ActivityItem> for ActivityItem {
labels: a.labels(),
contacts: vec![],
last_updated: a.last_updated(),
privacy_level: privacy_level.to_string(),
}
}
}
Expand Down

0 comments on commit 5d6e348

Please sign in to comment.