From 46d12e51e610bc61a732053785c3147ef3f27b24 Mon Sep 17 00:00:00 2001 From: danvleju-rdx <163979791+danvleju-rdx@users.noreply.github.com> Date: Tue, 19 Nov 2024 19:19:21 +0200 Subject: [PATCH] Add isDeleted for EntityBaseProtocol (#271) * wip * bump --- Cargo.lock | 4 ++-- apple/Sources/Sargon/Protocols/EntityProtocol.swift | 4 ++++ apple/Tests/Utils/EntityProtocolTest.swift | 4 ++++ crates/sargon-uniffi/Cargo.toml | 2 +- crates/sargon/Cargo.toml | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 66b07b1c6..75d878f5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2759,7 +2759,7 @@ dependencies = [ [[package]] name = "sargon" -version = "1.1.54" +version = "1.1.55" dependencies = [ "actix-rt", "aes-gcm", @@ -2814,7 +2814,7 @@ dependencies = [ [[package]] name = "sargon-uniffi" -version = "1.1.54" +version = "1.1.55" dependencies = [ "actix-rt", "assert-json-diff", diff --git a/apple/Sources/Sargon/Protocols/EntityProtocol.swift b/apple/Sources/Sargon/Protocols/EntityProtocol.swift index feef7ad51..40b8a9333 100644 --- a/apple/Sources/Sargon/Protocols/EntityProtocol.swift +++ b/apple/Sources/Sargon/Protocols/EntityProtocol.swift @@ -32,6 +32,10 @@ extension EntityBaseProtocol { public var id: ID { address } public var networkID: NetworkID { networkId } + public var isDeleted: Bool { + flags.contains(.tombstonedByUser) + } + public var isHidden: Bool { flags.contains(.hiddenByUser) } diff --git a/apple/Tests/Utils/EntityProtocolTest.swift b/apple/Tests/Utils/EntityProtocolTest.swift index f3266d963..393b2a402 100644 --- a/apple/Tests/Utils/EntityProtocolTest.swift +++ b/apple/Tests/Utils/EntityProtocolTest.swift @@ -39,6 +39,10 @@ class EntityBaseTest: Test { func test_is_hidden() { XCTAssertFalse(SUT.sample.isHidden) } + + func test_is_deleted() { + XCTAssertFalse(SUT.sample.isDeleted) + } func test_hasAuthenticationSigningKey() { eachSample { sut in diff --git a/crates/sargon-uniffi/Cargo.toml b/crates/sargon-uniffi/Cargo.toml index 39a1f75af..39e26826c 100644 --- a/crates/sargon-uniffi/Cargo.toml +++ b/crates/sargon-uniffi/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sargon-uniffi" # Don't forget to update version in crates/sargon/Cargo.toml -version = "1.1.54" +version = "1.1.55" edition = "2021" build = "build.rs" diff --git a/crates/sargon/Cargo.toml b/crates/sargon/Cargo.toml index 1bd4fb341..d6d802cea 100644 --- a/crates/sargon/Cargo.toml +++ b/crates/sargon/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "sargon" # Don't forget to update version in crates/sargon-uniffi/Cargo.toml -version = "1.1.54" +version = "1.1.55" edition = "2021" build = "build.rs"