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: Remove XMTP DB drop and clean XMTP stuff #1550

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thierryskoda
Copy link
Collaborator

@thierryskoda thierryskoda commented Jan 17, 2025

Summary by CodeRabbit

Based on the comprehensive summary, here are the release notes:

  • Code Organization

    • Restructured XMTP client type imports into a more modular directory structure
    • Moved client-related types and utilities into a new client subdirectory
  • Feature Changes

    • Removed XmtpEngine class and related synchronization logic
    • Eliminated reconnecting state management in chat store
  • Dependency Management

    • Updated import paths across multiple files to reflect new module organization
    • Simplified client installation and connection management
  • Performance

    • Streamlined error handling in sync and client management processes

The changes primarily focus on internal code organization and cleanup, with minimal user-facing impact.

Copy link
Contributor

coderabbitai bot commented Jan 17, 2025

Walkthrough

This pull request involves a comprehensive restructuring of the XMTP client-related modules and types. The primary changes include removing the XmtpEngine class, reorganizing import paths for various client types, and simplifying the client management logic. The modifications affect multiple files across the project, focusing on modularizing and streamlining the XMTP client interactions.

Changes

File Change Summary
App.tsx Removed xmtpEngine import and initialization
components/XmtpEngine.tsx Entire class and engine removed
Multiple files Updated import paths from @/utils/xmtpRN/client.types to @/utils/xmtpRN/client/client.types
data/store/chatStore.ts Removed reconnecting state and related methods
utils/xmtpRN/client/client-installations.ts Significant refactoring of client installation management
utils/xmtpRN/client/client.ts Added new client management functions

Sequence Diagram

sequenceDiagram
    participant App
    participant ClientManager
    participant XMTPClient
    
    App->>ClientManager: Request XMTP Client
    ClientManager->>XMTPClient: Create Client
    XMTPClient-->>ClientManager: Client Instance
    ClientManager-->>App: Provide Client
Loading

Possibly related PRs

Suggested reviewers

  • alexrisch
  • technoplato

Poem

🐰 A Rabbit's Ode to Code Refactoring 🐰

Imports dance, paths rearrange,
XmtpEngine fades, structures change
Modules slim, types realigned
Cleaner code, more refined
Hop along the refactor's way! 🌟

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

Performance Comparison Report

  • Current: d8a8ee8 - 2025-01-17 21:59:51Z
  • Baseline: main (90733b7) - 2025-01-17 21:58:43Z

Significant Changes To Duration

There are no entries

Meaningless Changes To Duration

Show entries
Name Type Duration Count
Avatar Image 10 runs render 1.0 ms → 0.9 ms (-0.1 ms, -10.0%) 1 → 1
Avatar Image 50 runs render 0.6 ms → 0.6 ms (+0.0 ms, +3.2%) 1 → 1
Empty Avatar 10 runs render 1.1 ms → 1.0 ms (-0.1 ms, -9.1%) 1 → 1
Empty Avatar 50 runs render 1.0 ms → 1.0 ms (-0.0 ms, -2.0%) 1 → 1
Text Component with color prop - 10 runs render 0.5 ms → 0.8 ms (+0.3 ms, +60.0%) 🔴 1 → 1
Text Component with default props - 10 runs render 0.8 ms → 0.8 ms 1 → 1
Text Component with translation key - 10 runs render 0.6 ms → 0.6 ms 1 → 1
Text Component with weight and size - 10 runs render 0.9 ms → 0.5 ms (-0.4 ms, -44.4%) 🟢 1 → 1
Show details
Name Type Duration Count
Avatar Image 10 runs render Baseline
Mean: 1.0 ms
Stdev: 0.5 ms (47.1%)
Runs: 1 1 1 1 1 1 0 1 2 1
Warmup runs: 1

Current
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 1 0 1 1 1 1 1 1 1
Warmup runs: 0
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Avatar Image 50 runs render Baseline
Mean: 0.6 ms
Stdev: 0.5 ms (85.5%)
Runs: 1 0 1 0 1 1 0 0 1 0 0 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 0 1 1 0 1 1 1 2 1 0 0 1 1 0 1 1 0 1 1 0 0
Warmup runs: 1

Current
Mean: 0.6 ms
Stdev: 0.5 ms (75.8%)
Runs: 1 1 1 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 10 runs render Baseline
Mean: 1.1 ms
Stdev: 0.3 ms (28.7%)
Runs: 1 1 1 1 2 1 1 1 1 1
Warmup runs: 2

Current
Mean: 1.0 ms
Stdev: 0.0 ms (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Warmup runs: 2
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Empty Avatar 50 runs render Baseline
Mean: 1.0 ms
Stdev: 0.1 ms (14.4%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Warmup runs: 1

Current
Mean: 1.0 ms
Stdev: 0.2 ms (20.6%)
Runs: 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with color prop - 10 runs render Baseline
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 0 1 0 1 0 1 1 1 0
Warmup runs: 1

Current
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 1 1 0 1 1 1 0 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with default props - 10 runs render Baseline
Mean: 0.8 ms
Stdev: 0.4 ms (52.7%)
Runs: 1 1 1 1 1 1 1 0 1 0
Warmup runs: 4

Current
Mean: 0.8 ms
Stdev: 0.6 ms (79.1%)
Runs: 1 1 0 2 1 1 1 0 0 1
Warmup runs: 3
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with translation key - 10 runs render Baseline
Mean: 0.6 ms
Stdev: 0.5 ms (86.1%)
Runs: 0 1 0 1 1 0 0 1 1 1
Warmup runs: 1

Current
Mean: 0.6 ms
Stdev: 0.5 ms (86.1%)
Runs: 1 1 1 0 1 1 0 1 0 0
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:
Text Component with weight and size - 10 runs render Baseline
Mean: 0.9 ms
Stdev: 0.3 ms (35.1%)
Runs: 1 0 1 1 1 1 1 1 1 1
Warmup runs: 1

Current
Mean: 0.5 ms
Stdev: 0.5 ms (105.4%)
Runs: 0 0 0 1 0 1 0 1 1 1
Warmup runs: 1
Baseline
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Current
Mean: 1
Stdev: 0 (0.0%)
Runs: 1 1 1 1 1 1 1 1 1 1
Render issues:

Render Count Changes

There are no entries

Render Issues

There are no entries

Added Scenarios

There are no entries

Removed Scenarios

There are no entries

Generated by 🚫 dangerJS against 35a51ec

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
utils/xmtpRN/client/client-installations.ts (1)

Line range hint 26-37: Add error handling for signWithInstallationKey

Consider adding error handling around client.signWithInstallationKey(message) to manage potential exceptions during the signing process and prevent unhandled promise rejections.

Apply this diff to include error handling:

 export async function getInstallationKeySignature(
   account: string,
   message: string
 ): Promise<InstallationSignature> {
   const client = (await getXmtpClient(account)) as ConverseXmtpClientType;
   if (!client) throw new Error("Client not found");

+  let raw;
+  try {
     raw = await client.signWithInstallationKey(message);
+  } catch (error) {
+    throw new Error(`Failed to sign with installation key: ${error.message}`);
+  }

   return {
     installationPublicKey: client.installationId,
     installationKeySignature: Buffer.from(raw).toString("hex"),
   };
 }
utils/xmtpRN/client/client.ts (2)

33-43: Add error handling for Client.build

Wrapping the Client.build call in a try-catch block will handle any potential errors during client instantiation, enhancing robustness.

Apply this diff to implement error handling:

 export const getXmtpClientFromAddress = async (address: string) => {
   const dbDirectory = await getDbDirectory();
   const dbEncryptionKey = await getDbEncryptionKey();

+  try {
     return Client.build(address, {
       env,
       codecs,
       dbDirectory,
       dbEncryptionKey,
     });
+  } catch (error) {
+    throw new Error(`Failed to build XMTP client: ${error.message}`);
+  }
 };

49-53: Handle errors in reconnectXmtpClientsDbConnections

Errors from c.reconnectLocalDatabase() might go unhandled. Adding error handling ensures any issues are logged and managed appropriately.

Apply this diff to handle potential errors:

 export const reconnectXmtpClientsDbConnections = async () => {
   await Promise.all(
     Object.values(xmtpClientByAccount).map(async (c) => {
+      try {
         await c.reconnectLocalDatabase();
+      } catch (error) {
+        logger.error(`Failed to reconnect client ${c.address}: ${error.message}`);
+      }
     })
   );
 };
utils/xmtpRN/sync.ts (1)

Line range hint 15-34: Prevent potential recursion in getXmtpClient

The recursive call to getXmtpClient(account) could lead to stack overflows in extreme cases. Refactor to use iteration or await the existing promises without recursion.

Apply this diff to modify the control flow:

 export const getXmtpClient = async (
   account: string
 ): Promise<ConverseXmtpClientType> => {
   const lowerCaseAccount = account.toLowerCase();
   if (account && xmtpClientByAccount[lowerCaseAccount]) {
     return xmtpClientByAccount[lowerCaseAccount];
   }
   const alreadyInstantiating = instantiatingClientForAccount[lowerCaseAccount];
   if (alreadyInstantiating) {
     return alreadyInstantiating;
   }
   if (Object.keys(instantiatingClientForAccount).length > 0) {
-    await new Promise((r) => setTimeout(r, 200));
-    return getXmtpClient(account);
+    await Promise.all(Object.values(instantiatingClientForAccount));
+    return xmtpClientByAccount[lowerCaseAccount];
   }
   instantiatingClientForAccount[lowerCaseAccount] = (async () => {
     try {
       logger.debug("[XmtpRN] Getting client from address");
       const client = await getXmtpClientFromAddress(account);
       logger.info(`[XmtpRN] Instantiated client for ${client.address}`);
       xmtpClientByAccount[lowerCaseAccount] = client;
       return client;
     } catch (e: unknown) {
       throw e;
     } finally {
       delete instantiatingClientForAccount[lowerCaseAccount];
     }
   })();
   return instantiatingClientForAccount[
     lowerCaseAccount
   ] as Promise<ConverseXmtpClientType>;
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90733b7 and 35a51ec.

📒 Files selected for processing (73)
  • App.tsx (0 hunks)
  • components/XmtpEngine.tsx (0 hunks)
  • containers/GroupScreenConsentTable.tsx (1 hunks)
  • containers/GroupScreenMembersTable.tsx (2 hunks)
  • data/store/chatStore.ts (0 hunks)
  • features/GroupInvites/joinGroup/JoinGroup.client.ts (1 hunks)
  • features/GroupInvites/joinGroup/joinGroup.machine.ts (1 hunks)
  • features/consent/account-can-message-peer.ts (1 hunks)
  • features/consent/update-consent-for-addresses-for-account.ts (1 hunks)
  • features/consent/update-consent-for-groups-for-account.ts (1 hunks)
  • features/consent/update-inbox-ids-consent-for-account.ts (1 hunks)
  • features/consent/use-allow-group.mutation.ts (1 hunks)
  • features/consent/use-dm-consent.tsx (1 hunks)
  • features/conversation-list/conversation-list-item/conversation-list-item-dm.tsx (1 hunks)
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-dm.tsx (1 hunks)
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-group.tsx (1 hunks)
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-message-preview.tsx (1 hunks)
  • features/conversation-list/conversation-list.screen.tsx (1 hunks)
  • features/conversation-list/conversation-list.tsx (1 hunks)
  • features/conversation-list/hooks/use-delete-dm.ts (1 hunks)
  • features/conversation-list/hooks/useMessagePlainText.ts (1 hunks)
  • features/conversation-requests-list/use-conversation-requests-list-items.tsx (1 hunks)
  • features/conversation/conversation-composer/conversation-composer-reply-preview.tsx (1 hunks)
  • features/conversation/conversation-message/conversation-message-content-types/conversation-message-reply.tsx (1 hunks)
  • features/conversation/conversation-message/conversation-message-status/conversation-message-status.utils.ts (1 hunks)
  • features/conversation/conversation-message/conversation-message.store-context.tsx (1 hunks)
  • features/conversation/conversation-message/conversation-message.tsx (1 hunks)
  • features/conversation/conversation-message/conversation-message.utils.tsx (1 hunks)
  • features/conversation/conversation-messages-list.tsx (1 hunks)
  • features/conversation/conversation.tsx (1 hunks)
  • features/conversation/conversation.utils.ts (1 hunks)
  • features/conversation/hooks/use-send-message.ts (1 hunks)
  • features/conversation/utils/__tests__/search.test.ts (1 hunks)
  • features/conversation/utils/has-next-message-in-serie.ts (1 hunks)
  • features/conversation/utils/has-previous-message-in-serie.ts (1 hunks)
  • features/conversation/utils/is-conversation-allowed.ts (1 hunks)
  • features/conversation/utils/is-conversation-consent-unknown.ts (1 hunks)
  • features/conversation/utils/is-conversation-denied.ts (1 hunks)
  • features/conversation/utils/is-conversation-dm.ts (1 hunks)
  • features/conversation/utils/is-conversation-group.ts (1 hunks)
  • features/conversation/utils/is-conversation-message-from-eth-address.ts (1 hunks)
  • features/conversation/utils/message-is-from-current-user.ts (1 hunks)
  • features/conversation/utils/message-should-show-date-change.ts (1 hunks)
  • features/conversation/utils/search.ts (1 hunks)
  • features/notifications/utils/background/converseNotification.ts (1 hunks)
  • features/notifications/utils/background/groupJoinRequestNotification.ts (1 hunks)
  • features/notifications/utils/background/groupMessageNotification.ts (1 hunks)
  • features/notifications/utils/background/groupWelcomeNotification.ts (1 hunks)
  • features/notifications/utils/background/notificationContent.ts (1 hunks)
  • features/notifications/utils/background/notificationSpamScore.ts (1 hunks)
  • features/notifications/utils/background/protocolNotification.ts (1 hunks)
  • features/notifications/utils/subscribeToNotifications.ts (1 hunks)
  • queries/conversations-query.ts (1 hunks)
  • queries/use-conversation-messages-query.ts (1 hunks)
  • queries/useConversationMessage.ts (1 hunks)
  • queries/useGroupMembersQuery.ts (1 hunks)
  • queries/useGroupPermissionsQuery.ts (1 hunks)
  • queries/useGroupQuery.ts (1 hunks)
  • screens/Main.tsx (1 hunks)
  • utils/api/auth.ts (1 hunks)
  • utils/events.ts (1 hunks)
  • utils/evm/xmtp.ts (1 hunks)
  • utils/frames.ts (2 hunks)
  • utils/logout/index.tsx (1 hunks)
  • utils/xmtpRN/attachments.ts (1 hunks)
  • utils/xmtpRN/client/client-installations.ts (1 hunks)
  • utils/xmtpRN/client/client.ts (1 hunks)
  • utils/xmtpRN/client/client.types.ts (1 hunks)
  • utils/xmtpRN/conversations.ts (1 hunks)
  • utils/xmtpRN/signIn.ts (1 hunks)
  • utils/xmtpRN/sync.ts (1 hunks)
  • utils/xmtpRN/xmtp-messages/xmtp-messages-stream.ts (1 hunks)
  • utils/xmtpRN/xmtp-messages/xmtp-messages.ts (1 hunks)
💤 Files with no reviewable changes (3)
  • components/XmtpEngine.tsx
  • data/store/chatStore.ts
  • App.tsx
✅ Files skipped from review due to trivial changes (66)
  • utils/xmtpRN/signIn.ts
  • utils/api/auth.ts
  • features/conversation/conversation-message/conversation-message-content-types/conversation-message-reply.tsx
  • features/conversation/conversation-message/conversation-message.utils.tsx
  • features/conversation/conversation-messages-list.tsx
  • features/conversation-list/conversation-list.tsx
  • features/conversation/utils/has-previous-message-in-serie.ts
  • queries/useGroupPermissionsQuery.ts
  • utils/xmtpRN/xmtp-messages/xmtp-messages-stream.ts
  • features/conversation/utils/is-conversation-dm.ts
  • utils/events.ts
  • queries/conversations-query.ts
  • features/conversation/conversation.tsx
  • utils/xmtpRN/conversations.ts
  • features/conversation/hooks/use-send-message.ts
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-message-preview.tsx
  • features/conversation/utils/message-should-show-date-change.ts
  • queries/useConversationMessage.ts
  • features/consent/account-can-message-peer.ts
  • features/GroupInvites/joinGroup/joinGroup.machine.ts
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-group.tsx
  • features/conversation-list/conversation-list.screen.tsx
  • features/notifications/utils/subscribeToNotifications.ts
  • features/conversation/utils/tests/search.test.ts
  • features/consent/update-consent-for-groups-for-account.ts
  • queries/useGroupMembersQuery.ts
  • features/conversation/conversation-message/conversation-message.store-context.tsx
  • features/conversation-list/hooks/useMessagePlainText.ts
  • features/conversation/utils/is-conversation-allowed.ts
  • features/conversation-list/hooks/use-delete-dm.ts
  • features/conversation/conversation-message/conversation-message.tsx
  • utils/xmtpRN/client/client.types.ts
  • utils/evm/xmtp.ts
  • features/conversation/utils/search.ts
  • features/consent/update-inbox-ids-consent-for-account.ts
  • features/conversation/utils/is-conversation-denied.ts
  • features/conversation/utils/is-conversation-message-from-eth-address.ts
  • containers/GroupScreenConsentTable.tsx
  • utils/logout/index.tsx
  • features/consent/update-consent-for-addresses-for-account.ts
  • features/consent/use-dm-consent.tsx
  • features/conversation/utils/has-next-message-in-serie.ts
  • features/conversation-requests-list/use-conversation-requests-list-items.tsx
  • features/conversation/utils/is-conversation-consent-unknown.ts
  • queries/useGroupQuery.ts
  • features/conversation-list/conversation-list-pinned-conversations/conversation-list-pinned-conversation-dm.tsx
  • features/conversation/conversation-composer/conversation-composer-reply-preview.tsx
  • features/notifications/utils/background/converseNotification.ts
  • features/conversation/conversation-message/conversation-message-status/conversation-message-status.utils.ts
  • features/notifications/utils/background/notificationContent.ts
  • features/conversation/utils/message-is-from-current-user.ts
  • features/notifications/utils/background/groupWelcomeNotification.ts
  • containers/GroupScreenMembersTable.tsx
  • features/conversation/utils/is-conversation-group.ts
  • queries/use-conversation-messages-query.ts
  • features/GroupInvites/joinGroup/JoinGroup.client.ts
  • features/notifications/utils/background/notificationSpamScore.ts
  • features/conversation/conversation.utils.ts
  • features/notifications/utils/background/protocolNotification.ts
  • features/conversation-list/conversation-list-item/conversation-list-item-dm.tsx
  • features/consent/use-allow-group.mutation.ts
  • features/notifications/utils/background/groupJoinRequestNotification.ts
  • features/notifications/utils/background/groupMessageNotification.ts
  • utils/frames.ts
  • utils/xmtpRN/attachments.ts
  • utils/xmtpRN/xmtp-messages/xmtp-messages.ts
🔇 Additional comments (6)
utils/xmtpRN/client/client-installations.ts (3)

6-6: Importing Client from "@xmtp/react-native-sdk"

The import of Client is necessary for type annotations and client operations within this file.


8-8: Correct import of getXmtpClient

Importing getXmtpClient from "../sync" ensures the client retrieval function is accurately referenced.


10-10: Updated import path for ConverseXmtpClientType

Adjusting the import path to @/utils/xmtpRN/client/client.types reflects the new project structure and improves code organization.

utils/xmtpRN/sync.ts (2)

11-11: Updated import paths for client modules

The imports now correctly reflect the reorganized module structure, improving maintainability.


Line range hint 26-39: Verify the impact of removing reconnecting state updates

The removal of chat.setReconnecting(true) may affect how the app indicates connectivity issues to the user. Ensure that the user interface still accurately reflects the connection status.

Run the following script to check for any remaining references to chat.setReconnecting:

✅ Verification successful

Connection status UI remains properly maintained

The removal of chat.setReconnecting(true) does not impact the app's ability to indicate connectivity issues. The connection status is still properly handled through:

  • useShouldShowConnecting hook that shows appropriate status messages
  • Combined monitoring of network reachability and reconnection state
  • Proper user feedback through "Waiting for network" and "Reconnecting" messages
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find usages of 'setReconnecting' method in the codebase

rg 'setReconnecting\('

Length of output: 24


Script:

#!/bin/bash
# Search for any references to 'reconnecting' state or property
rg -i 'reconnecting' -A 2 -B 2

# Search for connection status related patterns
rg -i '(connection.*status|isConnected|connected)' -A 2 -B 2

# Look for UI components that might show connection status
ast-grep --pattern 'const $_ = $$$; return (<$$$>connection$$$</$$>);'

Length of output: 11397

screens/Main.tsx (1)

4-4: LGTM! The import path change aligns with the XMTP cleanup objectives.

The new path structure is more organized and specific, improving code maintainability.

Let's verify the consistency of XMTP-related changes across the codebase:

✅ Verification successful

Import path change is valid and consistent with codebase structure

The new import path @/utils/xmtpRN/client/client-installations is part of a well-organized XMTP module structure, and no files are using the old import path. The change aligns with the codebase organization and the PR's XMTP cleanup objectives.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any remaining old XMTP import paths and verify the new structure

# Check for any remaining imports from the old path
echo "Checking for old import paths..."
rg -l "@utils/xmtpRN/client['\"]"

# Verify the new client-installations structure
echo "Verifying new structure..."
rg -l "@/utils/xmtpRN/client/client-installations"

Length of output: 243


Script:

#!/bin/bash
# Description: Check for any other XMTP-related imports and files

# Search for any XMTP-related imports
echo "Checking for any XMTP-related imports..."
rg -l "xmtpRN"

# List XMTP-related files in utils directory
echo -e "\nListing XMTP-related files..."
fd -p "utils/.*xmtp.*" -t f

Length of output: 5792

Copy link
Collaborator

@technoplato technoplato left a comment

Choose a reason for hiding this comment

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

LGTM just a few questions

Also what test scenarios did you run through with these changes

@@ -20,7 +20,7 @@ import {
} from "@/features/conversation/conversation.store-context";
import { usePreferredInboxName } from "@/hooks/usePreferredInboxName";
import { captureError } from "@/utils/capture-error";
import { DecodedMessageWithCodecsType } from "@/utils/xmtpRN/client.types";
import { DecodedMessageWithCodecsType } from "@/utils/xmtpRN/client/client.types";
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm starting to think it might be a good idea if we have a very thin layer that wraps all of our messaging stuff before messaging stuff touches the application

The reason being we don't need all these complicated types littering our code base and we could just have a message that has content available on it with a content type that is a Concrete property that we can determine at that layer and so instead of these complicated decoded message with Kodex types, etc., we could simply have message conversation, etc.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we should delete frames stuff for now. We're definitely going to be redoing it.

[account: string]: ConverseXmtpClientType;
} = {};

export const reconnectXmtpClientsDbConnections = async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I thought the PR said we were getting rid of this

@@ -88,8 +86,6 @@ export const onSyncLost = async (account: string, error: any) => {
}
};

const streamingAccounts: { [account: string]: boolean } = {};
Copy link
Collaborator

Choose a reason for hiding this comment

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

Curious, if there was anywhere else, this was used other than where you deleted it below

@alexrisch
Copy link
Contributor

I really think we should keep this PR small to easily verify the change being done

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.

3 participants