Skip to content

Commit

Permalink
update the react native side
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Nov 25, 2024
1 parent b0e98ef commit fefbcdb
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
10 changes: 5 additions & 5 deletions example/src/tests/groupTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import {
Group,
GroupUpdatedContent,
GroupUpdatedCodec,
ConsentListEntry,
DecodedMessage,
ConsentRecord,
} from '../../../src/index'

export const groupTests: Test[] = []
Expand Down Expand Up @@ -1185,7 +1185,7 @@ test('can group consent', async () => {
)

await bo.preferences.setConsentState(
new ConsentListEntry(group.id, 'conversation_id', 'denied')
new ConsentRecord(group.id, 'conversation_id', 'denied')
)
const isDenied = await bo.preferences.conversationConsentState(group.id)
assert(isDenied === 'denied', `bo group should be denied but was ${isDenied}`)
Expand Down Expand Up @@ -1219,7 +1219,7 @@ test('can allow and deny a inbox id', async () => {
)

await bo.preferences.setConsentState(
new ConsentListEntry(alix.inboxId, 'inbox_id', 'allowed')
new ConsentRecord(alix.inboxId, 'inbox_id', 'allowed')
)

let alixMember = (await boGroup.members()).find(
Expand All @@ -1243,7 +1243,7 @@ test('can allow and deny a inbox id', async () => {
)

await bo.preferences.setConsentState(
new ConsentListEntry(alix.inboxId, 'inbox_id', 'denied')
new ConsentRecord(alix.inboxId, 'inbox_id', 'denied')
)

alixMember = (await boGroup.members()).find(
Expand All @@ -1261,7 +1261,7 @@ test('can allow and deny a inbox id', async () => {
)

await bo.preferences.setConsentState(
new ConsentListEntry(alix.address, 'address', 'allowed')
new ConsentRecord(alix.address, 'address', 'allowed')
)

isAddressAllowed = await bo.preferences.addressConsentState(alix.address)
Expand Down
18 changes: 11 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ import { EventEmitter, NativeModulesProxy } from 'expo-modules-core'
import { Client } from '.'
import XMTPModule from './XMTPModule'
import { Address, InboxId, XMTPEnvironment } from './lib/Client'
import {
ConsentListEntry,
ConsentListEntryType,
ConsentState,
} from './lib/ConsentListEntry'
import { ConsentRecord, ConsentState, ConsentType } from './lib/ConsentRecord'
import {
DecryptedLocalAttachment,
EncryptedLocalAttachment,
Expand Down Expand Up @@ -957,7 +953,7 @@ export async function syncConsent(inboxId: InboxId): Promise<void> {
export async function setConsentState(
inboxId: InboxId,
value: string,
entryType: ConsentListEntryType,
entryType: ConsentType,
consentType: ConsentState
): Promise<void> {
return await XMTPModule.setConsentState(
Expand Down Expand Up @@ -1001,6 +997,10 @@ export async function updateConversationConsent(
return XMTPModule.updateConversationConsent(inboxId, conversationId, state)
}

export function subscribeToConsent(inboxId: InboxId) {
return XMTPModule.subscribeToConsent(inboxId)
}

export function subscribeToConversations(
inboxId: InboxId,
type: ConversationType
Expand All @@ -1022,6 +1022,10 @@ export async function subscribeToMessages(
return await XMTPModule.subscribeToMessages(inboxId, id)
}

export function unsubscribeFromConsent(inboxId: InboxId) {
return XMTPModule.unsubscribeFromConsent(inboxId)
}

export function unsubscribeFromConversations(inboxId: InboxId) {
return XMTPModule.unsubscribeFromConversations(inboxId)
}
Expand Down Expand Up @@ -1075,7 +1079,7 @@ export { Client } from './lib/Client'
export * from './lib/ContentCodec'
export { Conversation, ConversationVersion } from './lib/Conversation'
export { XMTPPush } from './lib/XMTPPush'
export { ConsentListEntry, DecodedMessage, MessageDeliveryStatus, ConsentState }
export { ConsentRecord, DecodedMessage, MessageDeliveryStatus, ConsentState }
export { Group } from './lib/Group'
export { Dm } from './lib/Dm'
export { Member } from './lib/Member'
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib/Conversation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ConsentState } from './ConsentListEntry'
import { ConsentState } from './ConsentRecord'
import { ConversationSendPayload, MessageId, MessagesOptions } from './types'
import { DefaultContentTypes } from './types/DefaultContentType'
import * as XMTP from '../index'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Dm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InboxId } from './Client'
import { ConsentState } from './ConsentListEntry'
import { ConsentState } from './ConsentRecord'
import { ConversationVersion, ConversationBase } from './Conversation'
import { DecodedMessage } from './DecodedMessage'
import { Member } from './Member'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Group.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InboxId } from './Client'
import { ConsentState } from './ConsentListEntry'
import { ConsentState } from './ConsentRecord'
import { ConversationBase, ConversationVersion } from './Conversation'
import { DecodedMessage } from './DecodedMessage'
import { Member } from './Member'
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Member.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, InboxId } from './Client'
import { ConsentState } from './ConsentListEntry'
import { ConsentState } from './ConsentRecord'

export type PermissionLevel = 'member' | 'admin' | 'super_admin'

Expand Down
2 changes: 1 addition & 1 deletion src/lib/PrivatePreferences.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Address, Client, InboxId } from './Client'
import { ConsentListEntry, ConsentState } from './ConsentListEntry'
import { ConsentListEntry, ConsentState } from './ConsentRecord'

Check failure on line 2 in src/lib/PrivatePreferences.ts

View workflow job for this annotation

GitHub Actions / test

Module '"./ConsentRecord"' has no exported member 'ConsentListEntry'.

Check failure on line 2 in src/lib/PrivatePreferences.ts

View workflow job for this annotation

GitHub Actions / lint

Module '"./ConsentRecord"' has no exported member 'ConsentListEntry'.
import * as XMTPModule from '../index'
import { ConversationId } from '../index'
import { getAddress } from '../utils/address'
Expand Down

0 comments on commit fefbcdb

Please sign in to comment.