mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-18 00:54:21 +01:00
make UserAccount cloneable
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -375,6 +375,7 @@ fn get_acc_from_storage(user_account_serializable: UserAccountSerializable) -> O
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct AccountData {
|
||||
pub(crate) relay: AccountRelayData,
|
||||
pub(crate) muted: AccountMutedData,
|
||||
|
||||
@@ -3,11 +3,13 @@ use std::collections::HashSet;
|
||||
use enostr::Pubkey;
|
||||
use nostrdb::{Filter, Ndb, Note, NoteKey, Subscription, Transaction};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Contacts {
|
||||
pub filter: Filter,
|
||||
pub(super) state: ContactState,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum ContactState {
|
||||
Unreceived,
|
||||
Received {
|
||||
|
||||
@@ -5,6 +5,7 @@ use tracing::{debug, error};
|
||||
|
||||
use crate::Muted;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct AccountMutedData {
|
||||
pub filter: Filter,
|
||||
pub muted: Arc<Muted>,
|
||||
|
||||
@@ -7,6 +7,7 @@ use url::Url;
|
||||
|
||||
use crate::{AccountData, RelaySpec};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct AccountRelayData {
|
||||
pub filter: Filter,
|
||||
pub local: BTreeSet<RelaySpec>, // used locally but not advertised
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::{
|
||||
AccountData, IsFollowing,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct UserAccount {
|
||||
pub key: Keypair,
|
||||
pub wallet: Option<ZapWallet>,
|
||||
|
||||
@@ -60,6 +60,16 @@ pub struct Wallet {
|
||||
balance: Option<Promise<Result<u64, NwcError>>>,
|
||||
}
|
||||
|
||||
impl Clone for Wallet {
|
||||
fn clone(&self) -> Self {
|
||||
Self {
|
||||
uri: self.uri.clone(),
|
||||
wallet: self.wallet.clone(),
|
||||
balance: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WalletSerializable {
|
||||
pub uri: String,
|
||||
@@ -236,7 +246,7 @@ fn construct_global_wallet(wallet_handler: &TokenHandler) -> Option<ZapWallet> {
|
||||
Some(wallet)
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ZapWallet {
|
||||
pub wallet: Wallet,
|
||||
pub default_zap: DefaultZapMsats,
|
||||
|
||||
@@ -4,7 +4,7 @@ use crate::get_current_wallet;
|
||||
|
||||
const DEFAULT_ZAP_MSATS: u64 = 10_000;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct DefaultZapMsats {
|
||||
pub msats: Option<u64>,
|
||||
pub pending: PendingDefaultZapState,
|
||||
@@ -83,7 +83,7 @@ impl TokenSerializable for UserZapMsats {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct PendingDefaultZapState {
|
||||
pub amount_sats: String,
|
||||
pub error_message: Option<DefaultZapError>,
|
||||
@@ -110,7 +110,7 @@ fn msats_to_sats_string(msats: u64) -> String {
|
||||
(msats / 1000).to_string()
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum DefaultZapError {
|
||||
InvalidUserInput,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user