From b2722a2096801522d2ff836d3f00da6b9e465e8a Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 25 Nov 2024 14:25:22 -0800 Subject: [PATCH] Update Consent record name (#439) * rename conset list entry to consent record * bump pod again --- Sources/XMTPiOS/Extensions/Ffi.swift | 6 +++--- Sources/XMTPiOS/PrivatePreferences.swift | 18 +++++++++--------- Tests/XMTPTests/ConversationTests.swift | 4 ++-- Tests/XMTPTests/DmTests.swift | 2 +- Tests/XMTPTests/GroupTests.swift | 6 +++--- XMTP.podspec | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Sources/XMTPiOS/Extensions/Ffi.swift b/Sources/XMTPiOS/Extensions/Ffi.swift index 7158547f..9ab1334d 100644 --- a/Sources/XMTPiOS/Extensions/Ffi.swift +++ b/Sources/XMTPiOS/Extensions/Ffi.swift @@ -65,7 +65,7 @@ extension EntryType { } } -extension ConsentListEntry { +extension ConsentRecord { var toFFI: FfiConsent { FfiConsent( entityType: entryType.toFFI, state: consentType.toFFI, entity: value @@ -74,7 +74,7 @@ extension ConsentListEntry { } extension FfiConsent { - var fromFfi: ConsentListEntry { - ConsentListEntry(value: self.entity, entryType: self.entityType.fromFFI, consentType: self.state.fromFFI) + var fromFfi: ConsentRecord { + ConsentRecord(value: self.entity, entryType: self.entityType.fromFFI, consentType: self.state.fromFFI) } } diff --git a/Sources/XMTPiOS/PrivatePreferences.swift b/Sources/XMTPiOS/PrivatePreferences.swift index 2362d7fd..9c6d9c03 100644 --- a/Sources/XMTPiOS/PrivatePreferences.swift +++ b/Sources/XMTPiOS/PrivatePreferences.swift @@ -8,7 +8,7 @@ public enum EntryType: String, Codable { case address, conversation_id, inbox_id } -public struct ConsentListEntry: Codable, Hashable { +public struct ConsentRecord: Codable, Hashable { public init(value: String, entryType: EntryType, consentType: ConsentState) { self.value = value @@ -17,23 +17,23 @@ public struct ConsentListEntry: Codable, Hashable { } static func address(_ address: String, type: ConsentState = .unknown) - -> ConsentListEntry + -> ConsentRecord { - ConsentListEntry(value: address, entryType: .address, consentType: type) + ConsentRecord(value: address, entryType: .address, consentType: type) } static func conversationId( conversationId: String, type: ConsentState = ConsentState.unknown - ) -> ConsentListEntry { - ConsentListEntry( + ) -> ConsentRecord { + ConsentRecord( value: conversationId, entryType: .conversation_id, consentType: type) } static func inboxId(_ inboxId: String, type: ConsentState = .unknown) - -> ConsentListEntry + -> ConsentRecord { - ConsentListEntry( + ConsentRecord( value: inboxId, entryType: .inbox_id, consentType: type) } @@ -56,7 +56,7 @@ public actor PrivatePreferences { self.ffiClient = ffiClient } - public func setConsentState(entries: [ConsentListEntry]) async throws { + public func setConsentState(entries: [ConsentRecord]) async throws { try await ffiClient.setConsentStates(records: entries.map(\.toFFI)) } @@ -88,7 +88,7 @@ public actor PrivatePreferences { } public func streamConsent() - -> AsyncThrowingStream + -> AsyncThrowingStream { AsyncThrowingStream { continuation in let ffiStreamActor = FfiStreamActor() diff --git a/Tests/XMTPTests/ConversationTests.swift b/Tests/XMTPTests/ConversationTests.swift index 10eae2be..9e724c84 100644 --- a/Tests/XMTPTests/ConversationTests.swift +++ b/Tests/XMTPTests/ConversationTests.swift @@ -211,7 +211,7 @@ class ConversationTests: XCTestCase { try await alixClient2.preferences.setConsentState( entries: [ - ConsentListEntry( + ConsentRecord( value: dm2.id, entryType: .conversation_id, consentType: .allowed @@ -259,7 +259,7 @@ class ConversationTests: XCTestCase { try await alixClient2.conversations.syncAllConversations() let alixGroup2 = try alixClient2.findGroup(groupId: alixGroup.id)! - var consentList = [ConsentListEntry]() + var consentList = [ConsentRecord]() let expectation = XCTestExpectation(description: "Stream Consent") expectation.expectedFulfillmentCount = 3 diff --git a/Tests/XMTPTests/DmTests.swift b/Tests/XMTPTests/DmTests.swift index f391b87b..62260e5b 100644 --- a/Tests/XMTPTests/DmTests.swift +++ b/Tests/XMTPTests/DmTests.swift @@ -255,7 +255,7 @@ class DmTests: XCTestCase { try await fixtures.boClient.preferences.setConsentState( entries: [ - ConsentListEntry( + ConsentRecord( value: dm.id, entryType: .conversation_id, consentType: .denied) ]) diff --git a/Tests/XMTPTests/GroupTests.swift b/Tests/XMTPTests/GroupTests.swift index 119a14f3..6c43337b 100644 --- a/Tests/XMTPTests/GroupTests.swift +++ b/Tests/XMTPTests/GroupTests.swift @@ -813,7 +813,7 @@ class GroupTests: XCTestCase { try await fixtures.boClient.preferences.setConsentState( entries: [ - ConsentListEntry( + ConsentRecord( value: fixtures.alixClient.inboxID, entryType: .inbox_id, consentType: .allowed) ]) @@ -829,7 +829,7 @@ class GroupTests: XCTestCase { try await fixtures.boClient.preferences.setConsentState( entries: [ - ConsentListEntry( + ConsentRecord( value: fixtures.alixClient.inboxID, entryType: .inbox_id, consentType: .denied) ]) @@ -845,7 +845,7 @@ class GroupTests: XCTestCase { try await fixtures.boClient.preferences.setConsentState( entries: [ - ConsentListEntry( + ConsentRecord( value: fixtures.alixClient.address, entryType: .address, consentType: .allowed) ]) diff --git a/XMTP.podspec b/XMTP.podspec index fb6e1ea0..22db4bff 100644 --- a/XMTP.podspec +++ b/XMTP.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |spec| spec.name = "XMTP" - spec.version = "3.0.9" + spec.version = "3.0.10" spec.summary = "XMTP SDK Cocoapod" spec.description = <<-DESC