impierce / identity-wallet

A Tauri-based Identity Wallet for people to manage Decentralized Identities and Verifiable Credentials.
https://www.impierce.com
Apache License 2.0
17 stars 4 forks source link

Add `History` struct for ergonomic history updates #164

Open nanderstabel opened 3 months ago

nanderstabel commented 3 months ago

Description

As introduced in the description of this PR: https://github.com/impierce/identity-wallet/pull/157#issue-2187559727 in order to make updates to the AppStates history field a bit more ergonomic, we should implement a similar approach to history to what we currently have implemented for connections.

connections changed from a Vec<Connection> to pub struct Connections(Vec<Connection>) including some method implementations.

Similarly we should change pub history: Vec<HistoryEvent> to pub history: History where History:

 pub struct History(Vec<HistoryEvent>);

It should have (at least the following) methods implemented:

pub struct History(Vec<HistoryEvent>);

impl History {
    pub fn append_connection_added_event(&mut self, connection: &Connection) {
        unimplemented!();
    }
    pub fn append_credentials_added_event(&mut self, connection: &Connection, credentials: Vec<HistoryCredential>) {
        unimplemented!();
    }
    pub fn append_credentials_shared_event(&mut self, connection: &Connection, credentials: Vec<HistoryCredential>) {
        unimplemented!();
    }
}

Motivation

Resources

157

To-do List