Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: handling delete conversation #50

Open
wants to merge 8 commits into
base: feat/fc-18-leave-conversation
Choose a base branch
from

Conversation

danhmaisgt
Copy link
Contributor

@danhmaisgt danhmaisgt commented Jul 9, 2024

Usage:

import {useConversation} from 'rn-firebase-chat'

const {deleteConversation} = useConversation()

await deleteConversation(conversationId, true)

@danhmaisgt danhmaisgt changed the title feat: handling delete conversation [DRAFT] feat: handling delete conversation Jul 15, 2024
@loc-nguyenthien loc-nguyenthien force-pushed the feature/adding_setting_prefix_for_firestore branch 3 times, most recently from 24e6fa4 to fa9ccdf Compare July 19, 2024 03:37
Base automatically changed from feature/adding_setting_prefix_for_firestore to master July 23, 2024 06:28
@danhmaisgt danhmaisgt changed the title [DRAFT] feat: handling delete conversation feat: handling delete conversation Jul 24, 2024
});

/** Delete all messages of the conversation */
const messageBatch = firestore().batch();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we need delete all message?

@@ -52,5 +52,14 @@ export const chatReducer = (
...state,
listConversation: newListConversation,
};
case ChatActionKind.DELETE_CONVERSATION:
Copy link
Contributor

@huydosgtech huydosgtech Aug 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this related to listConversation, so we should rename action more meaning like as UPDATE_LIST_CONVERSATION

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this name is ok, if you want it to be clearer, how about DELETE_CONVERSATION_IN_LIST?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's good to me

await userConversation.delete();
if (!forAllMembers) return true;

/** Delete latest message of that conversation for all other partners */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we split the function even smaller?

@danhmaisgt danhmaisgt force-pushed the feat/delete-conversation branch from c87b7f9 to c95adaa Compare October 15, 2024 07:10
@danhmaisgt danhmaisgt changed the base branch from master to feat/fc-18-leave-conversation October 15, 2024 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants