Skip to content

Commit

Permalink
Update Consent record name (#439)
Browse files Browse the repository at this point in the history
* rename conset list entry to consent record

* bump pod again
  • Loading branch information
nplasterer authored Nov 25, 2024
1 parent ff69eaf commit b2722a2
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Sources/XMTPiOS/Extensions/Ffi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ extension EntryType {
}
}

extension ConsentListEntry {
extension ConsentRecord {
var toFFI: FfiConsent {
FfiConsent(
entityType: entryType.toFFI, state: consentType.toFFI, entity: value
Expand All @@ -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)
}
}
18 changes: 9 additions & 9 deletions Sources/XMTPiOS/PrivatePreferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}

Expand All @@ -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))
}

Expand Down Expand Up @@ -88,7 +88,7 @@ public actor PrivatePreferences {
}

public func streamConsent()
-> AsyncThrowingStream<ConsentListEntry, Error>
-> AsyncThrowingStream<ConsentRecord, Error>
{
AsyncThrowingStream { continuation in
let ffiStreamActor = FfiStreamActor()
Expand Down
4 changes: 2 additions & 2 deletions Tests/XMTPTests/ConversationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class ConversationTests: XCTestCase {

try await alixClient2.preferences.setConsentState(
entries: [
ConsentListEntry(
ConsentRecord(
value: dm2.id,
entryType: .conversation_id,
consentType: .allowed
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Tests/XMTPTests/DmTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ class DmTests: XCTestCase {

try await fixtures.boClient.preferences.setConsentState(
entries: [
ConsentListEntry(
ConsentRecord(
value: dm.id, entryType: .conversation_id,
consentType: .denied)
])
Expand Down
6 changes: 3 additions & 3 deletions Tests/XMTPTests/GroupTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
])
Expand All @@ -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)
])
Expand All @@ -845,7 +845,7 @@ class GroupTests: XCTestCase {

try await fixtures.boClient.preferences.setConsentState(
entries: [
ConsentListEntry(
ConsentRecord(
value: fixtures.alixClient.address, entryType: .address,
consentType: .allowed)
])
Expand Down
2 changes: 1 addition & 1 deletion XMTP.podspec
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit b2722a2

Please sign in to comment.