-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ABW-3756] Add preferences for AuthorizedDapp (#206)
* Add preferences for AuthorizedDapp * bump version * add to AuthorizedDappDetailed * Updates on Swift code * Remove serde from AuthorizedDappDetailed
- Loading branch information
1 parent
d7501c8
commit dda428b
Showing
14 changed files
with
246 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...n/Extensions/Methods/Profile+Supporting+Types/AuthorizedDappDetailed+Wrap+Functions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// File.swift | ||
// | ||
// | ||
// Created by Matias Bzurovski on 29/8/24. | ||
// | ||
|
||
import Foundation | ||
import SargonUniFFI | ||
|
||
extension AuthorizedDappDetailed { | ||
public mutating func showDeposits(_ show: Bool) { | ||
preferences.deposits = show ? .visible : .hidden | ||
} | ||
|
||
public var isDepositsVisible: Bool { | ||
preferences.deposits == .visible | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "sargon" | ||
version = "1.1.7" | ||
version = "1.1.8" | ||
edition = "2021" | ||
build = "build.rs" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
.../v100/networks/network/authorized_dapp/preferences/authorized_dapp_preference_deposits.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
use crate::prelude::*; | ||
|
||
/// Indicates whether the Wallet should show direct deposit claims for the given Dapp. | ||
#[derive( | ||
Serialize, | ||
Deserialize, | ||
FromRepr, | ||
Clone, | ||
Copy, | ||
Debug, | ||
PartialEq, | ||
Eq, | ||
Hash, | ||
PartialOrd, | ||
Ord, | ||
enum_iterator::Sequence, | ||
derive_more::Display, | ||
uniffi::Enum, | ||
)] | ||
#[serde(rename_all = "camelCase")] | ||
pub enum AuthorizedDappPreferenceDeposits { | ||
Hidden, | ||
Visible, | ||
} | ||
|
||
impl Default for AuthorizedDappPreferenceDeposits { | ||
fn default() -> Self { | ||
Self::Visible | ||
} | ||
} | ||
|
||
impl HasSampleValues for AuthorizedDappPreferenceDeposits { | ||
fn sample() -> Self { | ||
Self::Visible | ||
} | ||
|
||
fn sample_other() -> Self { | ||
Self::Hidden | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[allow(clippy::upper_case_acronyms)] | ||
type SUT = AuthorizedDappPreferenceDeposits; | ||
|
||
#[test] | ||
fn equality() { | ||
assert_eq!(SUT::sample(), SUT::sample()); | ||
assert_eq!(SUT::sample_other(), SUT::sample_other()); | ||
} | ||
|
||
#[test] | ||
fn inequality() { | ||
assert_ne!(SUT::sample(), SUT::sample_other()); | ||
} | ||
|
||
#[test] | ||
fn test_default() { | ||
assert_eq!(SUT::Visible, SUT::default()); | ||
} | ||
|
||
#[test] | ||
fn json_roundtrip() { | ||
assert_json_value_eq_after_roundtrip(&SUT::Visible, json!("visible")); | ||
assert_json_roundtrip(&SUT::Visible); | ||
} | ||
} |
Oops, something went wrong.