Skip to content

Commit

Permalink
rename it to consent state
Browse files Browse the repository at this point in the history
  • Loading branch information
nplasterer committed Oct 26, 2023
1 parent 51a8d0c commit e612483
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions example/src/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ function ConversationItem({ conversation, client }: { conversation: Conversation
const navigation = useContext(NavigationContext);
const { data: messages } = useMessages({ topic: conversation.topic });
const lastMessage = messages?.[0];
let [getAllowState, setAllowState] = useState<string>();
let [getConsentState, setConsentState] = useState<string>();

conversation.allowState().then(result => {
setAllowState(result);
conversation.consentState().then(result => {
setConsentState(result);
})
const blockContact = () => client?.contacts.block([conversation.peerAddress]);

Expand All @@ -90,7 +90,7 @@ function ConversationItem({ conversation, client }: { conversation: Conversation
title="Block"
onPress={blockContact}
disabled={
getAllowState == "blocked"
getConsentState == "blocked"
}
/>
</View>
Expand All @@ -100,7 +100,7 @@ function ConversationItem({ conversation, client }: { conversation: Conversation
</Text>
<Text>{lastMessage?.senderAddress}:</Text>
<Text>{moment(lastMessage?.sent).fromNow()}</Text>
<Text style={{ fontWeight: "bold", color: "red" }}>{getAllowState}</Text>
<Text style={{ fontWeight: "bold", color: "red" }}>{getConsentState}</Text>

</View>
</View>
Expand Down
4 changes: 2 additions & 2 deletions example/src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ test("canManagePreferences", async () => {
);
await delayToPropogate();

const initialConvoState = await alixConversation.allowState();
const initialConvoState = await alixConversation.consentState();
if (initialConvoState != "allowed") {
throw new Error(`conversations created by bo should be allowed by default not ${initialConvoState}`);
}
Expand All @@ -578,7 +578,7 @@ test("canManagePreferences", async () => {
throw new Error(`contacts blocked by bo should be blocked not ${allowedState}`);
}

const convoState = await alixConversation.allowState();
const convoState = await alixConversation.consentState();
await delayToPropogate();

if (convoState != "blocked") {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Conversation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class Conversation {
}
}

async allowState(): Promise<"allowed" | "blocked" | "unknown"> {
async consentState(): Promise<"allowed" | "blocked" | "unknown"> {
return await XMTP.conversationAllowState(this.clientAddress, this.topic);
}

Expand Down

0 comments on commit e612483

Please sign in to comment.