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

Refactor/use hooks #452

Merged
merged 71 commits into from
Mar 12, 2024
Merged

Refactor/use hooks #452

merged 71 commits into from
Mar 12, 2024

Conversation

devceline
Copy link
Collaborator

@devceline devceline commented Feb 29, 2024

Warning

@web3inbox/core & @web3inbox/react still in canary here.
WalletConnect/web3inbox-client#75

Description

1. Package Changes

Note

Summary: Remove rxjs and notify-client-js in favor of @web3inbox/react and @web3inbox/core

Additions

  • @web3inbox/core: To enable @web3inbox/react
  • @web3inbox/react: To replace internal notify hooks and facades
  • @web3inbox/core/valtio: To act as simple storage for modal state

Removals

  • rxjs: It is now unnecessary with the addition of @web3inbox/core/valtio. Its features are no longer utilized
  • @walletconnect/notify-client: It is now unnecessary with the addition of @web3inbox/core, as core comes prepackaged with it

2. Pattern changes

Note

Summary: w3iProxy and related abstractions are gone. Event based reactivity is gone. Simple react hooks used instead. Also, the app is no longer externally configurable: providers, ui and dappOrigin included here.

Reactivity

  • Event architecture is heavily de-prioritized. This includes both rxjs Observers and emitter.on. Instead, simple react state changes are reacted to.

Abstraction

  • src/w3iProxy folder is DELETED. In short, this means that the old abstraction chain of: W3iContext -> W3iProxy -> W3iNotifyFacade -> InternalNotifyProvider -> notify-client-js is gone. It has been replaced with @web3inbox/react directly, there is no abstraction over this in the Web3Inbox codebase.
  • Remove observableController and related observe methods

External Control

  • Remove providerQueryHooks as this app is no longer controllable externally
  • Remove uiHooks as this app's UI is no longer configurable
  • Remove dappOrigin state as Web3Inbox is no longer supported as an externally controllable iframe.

3. Authentication

Note

Authentication is now coupled with wagmi directly.

  • Remove w3iAuthFacade and all related abstractions
  • Refactor authHooks to use wagmi directly
  • Initialize web3InboxAccount there.

4. Chat

Note

No more chat related features and components.

  • Remove messages components. There is no longer any UI components related to messages
  • Remove chat related settings

5. Components

Note

Summary: Responsibility is delegated among components. Not all actions happen in a central place now.

SignatureModal

Signature Modal now has full responsibility of initiating and completing registration.

PreferencesModal

Preferences modal now has full responsibility of updating scopes.

UnsubscribeModal

Unsubscribe modal now has full responsibility of unsubscribing from a dapp.

Login Page

Now depends on notifyRegisteredKey to know if registration is complete. Old extra logic is removed as app is no longer externally configurable

6. Navigation

Note

Navigation to dapps is now via domain and not topic.

7. Push Notifications

Note

Push notifications are enabled via push notification util registerWithPushServer from @web3inbox/core

8. Widget Pages

Note

Have been removed

9. State Management

Note

Modals.tsx now uses valtio instead of rxjs to maintain state.

Type of change

  • Refactor
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Draft PR (breaking/non-breaking change which needs more work for having a proper functionality [Mark this PR as ready to review only when completely ready])
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • I have performed a self-review of my own code
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

Copy link

vercel bot commented Feb 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app-web3inbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 11, 2024 11:51am

devceline and others added 2 commits March 7, 2024 16:44
@devceline devceline merged commit d249a87 into main Mar 12, 2024
3 checks passed
@devceline devceline deleted the refactor/use-hooks branch March 12, 2024 10:58
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