Skip to content

Commit

Permalink
[native][web] Fix ENS resolution for local DM notifs
Browse files Browse the repository at this point in the history
Summary:
`ENSCacheProvider` and `NeynarClientProvider` are relatively standalone components, and can safely be rendered higher in the tree.

On the other hand, `TunnelbrokerProvider` now handles notif sending, and as such is tightly coupled with business logic. We should render it lower in the hierarchy.

This diff solves [ENG-9641](https://linear.app/comm/issue/ENG-9641/ens-resolution-failing-for-local-dm-notifs) by making sure the DM notif-sending code in `TunnelbrokerProvider` is able to access the `ENSCache` in `ENSCacheProvider`, and the Farcaster username resolving code in `NeynarClientProvider`.

Test Plan: Confirmed that ENS resolution was working again for local DM notifs

Reviewers: tomek, kamil, angelika

Differential Revision: https://phab.comm.dev/D13710
  • Loading branch information
Ashoat committed Oct 15, 2024
1 parent 629fa71 commit 03a6c51
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 92 deletions.
76 changes: 38 additions & 38 deletions native/root.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,33 +333,33 @@ function Root() {
<StaffContextProvider>
<IdentityServiceContextProvider>
<UserIdentityCacheProvider>
<TunnelbrokerProvider>
<IdentitySearchProvider>
<QRAuthProvider
parseTunnelbrokerQRAuthMessage={
parseTunnelbrokerQRAuthMessage
}
composeTunnelbrokerQRAuthMessage={
composeTunnelbrokerQRAuthMessage
}
generateAESKey={generateQRAuthAESKey}
performBackupRestore={performBackupRestore}
onLogInError={handleSecondaryDeviceLogInError}
>
<FeatureFlagsProvider>
<NavContext.Provider value={navContext}>
<RootContext.Provider value={rootContext}>
<InputStateContainer>
<MessageEditingContextProvider>
<SafeAreaProvider
initialMetrics={initialWindowMetrics}
>
<ActionSheetProvider>
<ENSCacheProvider
ethersProvider={ethersProvider}
alchemyKey={alchemyKey}
<ENSCacheProvider
ethersProvider={ethersProvider}
alchemyKey={alchemyKey}
>
<NeynarClientProvider apiKey={neynarKey}>
<TunnelbrokerProvider>
<IdentitySearchProvider>
<QRAuthProvider
parseTunnelbrokerQRAuthMessage={
parseTunnelbrokerQRAuthMessage
}
composeTunnelbrokerQRAuthMessage={
composeTunnelbrokerQRAuthMessage
}
generateAESKey={generateQRAuthAESKey}
performBackupRestore={performBackupRestore}
onLogInError={handleSecondaryDeviceLogInError}
>
<FeatureFlagsProvider>
<NavContext.Provider value={navContext}>
<RootContext.Provider value={rootContext}>
<InputStateContainer>
<MessageEditingContextProvider>
<SafeAreaProvider
initialMetrics={initialWindowMetrics}
>
<NeynarClientProvider apiKey={neynarKey}>
<ActionSheetProvider>
<MediaCacheProvider
persistence={filesystemMediaCache}
>
Expand Down Expand Up @@ -400,18 +400,18 @@ function Root() {
</NativeEditThreadAvatarProvider>
</EditUserAvatarProvider>
</MediaCacheProvider>
</NeynarClientProvider>
</ENSCacheProvider>
</ActionSheetProvider>
</SafeAreaProvider>
</MessageEditingContextProvider>
</InputStateContainer>
</RootContext.Provider>
</NavContext.Provider>
</FeatureFlagsProvider>
</QRAuthProvider>
</IdentitySearchProvider>
</TunnelbrokerProvider>
</ActionSheetProvider>
</SafeAreaProvider>
</MessageEditingContextProvider>
</InputStateContainer>
</RootContext.Provider>
</NavContext.Provider>
</FeatureFlagsProvider>
</QRAuthProvider>
</IdentitySearchProvider>
</TunnelbrokerProvider>
</NeynarClientProvider>
</ENSCacheProvider>
</UserIdentityCacheProvider>
</IdentityServiceContextProvider>
</StaffContextProvider>
Expand Down
110 changes: 56 additions & 54 deletions web/app.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,33 +239,29 @@ class App extends React.PureComponent<Props> {
<DndProvider backend={HTML5Backend}>
<EditModalProvider>
<MenuProvider>
<AlchemyENSCacheProvider>
<NeynarClientProvider apiKey={process.env.COMM_NEYNAR_KEY}>
<TooltipProvider>
<MessageSearchStateProvider>
<ChatMentionContextProvider>
<FocusHandler />
<VisibilityHandler />
<PolicyAcknowledgmentHandler />
<PushNotificationsHandler />
<InviteLinkHandler />
<InviteLinksRefresher />
<CommunitiesRefresher />
<MinVersionHandler />
<PlatformDetailsSynchronizer />
<LogOutIfMissingCSATHandler />
<UserInfosHandler />
<TunnelbrokerDeviceTokenHandler />
<FarcasterDataHandler />
<AutoJoinCommunityHandler />
<DMActivityHandler />
<HoldersHandler />
{content}
</ChatMentionContextProvider>
</MessageSearchStateProvider>
</TooltipProvider>
</NeynarClientProvider>
</AlchemyENSCacheProvider>
<TooltipProvider>
<MessageSearchStateProvider>
<ChatMentionContextProvider>
<FocusHandler />
<VisibilityHandler />
<PolicyAcknowledgmentHandler />
<PushNotificationsHandler />
<InviteLinkHandler />
<InviteLinksRefresher />
<CommunitiesRefresher />
<MinVersionHandler />
<PlatformDetailsSynchronizer />
<LogOutIfMissingCSATHandler />
<UserInfosHandler />
<TunnelbrokerDeviceTokenHandler />
<FarcasterDataHandler />
<AutoJoinCommunityHandler />
<DMActivityHandler />
<HoldersHandler />
{content}
</ChatMentionContextProvider>
</MessageSearchStateProvider>
</TooltipProvider>
</MenuProvider>
</EditModalProvider>
</DndProvider>
Expand Down Expand Up @@ -558,34 +554,40 @@ const ConnectedApp: React.ComponentType<BaseProps> = React.memo<BaseProps>(

return (
<AppThemeWrapper>
<TunnelbrokerProvider
shouldBeClosed={lockStatus !== 'acquired'}
onClose={releaseLockOrAbortRequest}
secondaryTunnelbrokerConnection={secondaryTunnelbrokerConnection}
>
<BadgeHandler />
<IdentitySearchProvider>
<QRAuthProvider
parseTunnelbrokerQRAuthMessage={parseTunnelbrokerQRAuthMessage}
composeTunnelbrokerQRAuthMessage={
composeTunnelbrokerQRAuthMessage
}
generateAESKey={generateQRAuthAESKey}
onLogInError={handleSecondaryDeviceLogInError}
<AlchemyENSCacheProvider>
<NeynarClientProvider apiKey={process.env.COMM_NEYNAR_KEY}>
<TunnelbrokerProvider
shouldBeClosed={lockStatus !== 'acquired'}
onClose={releaseLockOrAbortRequest}
secondaryTunnelbrokerConnection={secondaryTunnelbrokerConnection}
>
<App
{...props}
navInfo={navInfo}
entriesLoadingStatus={entriesLoadingStatus}
loggedIn={loggedIn}
activeThreadCurrentlyUnread={activeThreadCurrentlyUnread}
dispatch={dispatch}
modals={modals}
/>
</QRAuthProvider>
<DBOpsHandler />
</IdentitySearchProvider>
</TunnelbrokerProvider>
<BadgeHandler />
<IdentitySearchProvider>
<QRAuthProvider
parseTunnelbrokerQRAuthMessage={
parseTunnelbrokerQRAuthMessage
}
composeTunnelbrokerQRAuthMessage={
composeTunnelbrokerQRAuthMessage
}
generateAESKey={generateQRAuthAESKey}
onLogInError={handleSecondaryDeviceLogInError}
>
<App
{...props}
navInfo={navInfo}
entriesLoadingStatus={entriesLoadingStatus}
loggedIn={loggedIn}
activeThreadCurrentlyUnread={activeThreadCurrentlyUnread}
dispatch={dispatch}
modals={modals}
/>
</QRAuthProvider>
<DBOpsHandler />
</IdentitySearchProvider>
</TunnelbrokerProvider>
</NeynarClientProvider>
</AlchemyENSCacheProvider>
</AppThemeWrapper>
);
},
Expand Down

0 comments on commit 03a6c51

Please sign in to comment.