Source code structure

From Ethora iOS & Android ERC-20 & NFT tokenized community platform
Revision as of 10:33, 13 April 2022 by Taras.filatov (talk | contribs) (→‎ETHORA ENGINE v2)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Ethora engine GIT repo link

https://github.com/dappros/ethora/

ETHORA ENGINE v1

JWT Authentication

Ethora engine uses JWT for authentication. All API requests are signed with this token.

Application JWT

Your Application has its own JWT which is permanent. You obtain this JWT after registering your Owner account and creating a new Application - this is done via Dappros platform backend:

User JWT

Users have their own JWT which expire over time and are re-issued by authenticating the User again.

Owners

When you register your account at our cloud backend (Dappros Platform) you become an Owner User.

Owners are Users with maximum privileges to the Applications they have created.

Social sign-in and Firebase role

Ethora cloud backend (Dappros Platform) handles JWT operations.

Firebase integration helps to support Social sign-in functionality.

ACL

Access Control List table is available here: ACL

Redux

Currently Ethora engine uses Redux for session state management.

Realm

Realm is being used as a persistent local storage for caching data.

App.js

Typical contents, implements the Redux store.

Routes.js (/src/routes.js)

Typical contents. Handles the Screens, navigation etc.

Components (/src/components/)

  • AppIntro - (optional) if enabled, this implements the static on-boarding screens to explain to the User the main concepts / how to use the App. By default this is disabled as the UX is pretty self explanatory.
  • shared/* - a number of reusable UI components
  • shared/defaultHeader.js - the main nav bar (header) of the App
  • shared/customHeader.js - the header for Chat Rooms and Profile screen
  • MessageBody - (more like Room Body, name is inherited from GiftedChat) chat screen container, includes processing / parsing particular messages and parts of their UI
  • MessageBubble - container for a particular message
  • SystemMessage - the area for system messages in the bottom of the chat room
  • TransactionListComponents - used to display transactions in Profile (and deprecated Transactions screen)
  • pushController - (may be redundant) was used for push notifications initiation

Helpers:  (/src/helpers/)

  • downloadFileLogic.js - handles file attachments
  • underscoreLogic.js - handles conversion between Ethereum hash and XMPP JID formats
  • xmppCentral.js - handles XMPP connection + XMPP listener
  • xmppStanzaRequestMessages.js - converts app/user actions into XMPP language and sends requests to XMPP server

XMPP listener

TO DO: XMPP listener requires further description / breakdown into subcomponents

Realm storage (/src/components/realmModels/allSchemas.js)

Local storage - handles caching for data received from the server.

stores schemas:

  • TransactionSchema - for blockchain transactions (Coin and Item transfers)
  • ChatListSchema - list of chat Rooms/Spaces for our Lobby screen
  • MessageSchema - messages within chat Rooms/Spaces


ETHORA ENGINE v2

Dev plan:


  1. Mobx
  2. Typescript
  3. Start converting components into functional


Development plan:

Architecture diagram

UI

(UI)

Config

/docs/config.js - allows to configure the app engine. Keep this and improve this.

/src/config/*.* should be reformed. Most of these are obsolete. Remove this folder?

routesConstants.js - obsolete.

Add colors into Config (src/constants/colors.js)

Components (UI-based)

Structure this feature wise.

/chat/MessageBody.js

/chat/MessageBubble.js

/chat/RealmChatList.js (??) or ChatList.js cache? right now it's in /realmModels/chatList.js

Question: where to place Realm components - inside Realm folder or inside Topic-based folders?

/blockchain/NftTransactionsHistoryComponent.js

/blockchain/TransactionListComponent.js

/players/audio

/players/video

/push/pushController.js

Helpers (functional, non-UI)

  • Keep the ones we have
  • Restructure (naming etc)
  • downloadFileLogic.js - handles file attachments
  • xmppUnderscoreLogic.js - handles conversion between Ethereum hash and XMPP JID formats
  • xmppCentral.js - handles XMPP connection + XMPP listener - needs improvements / breakdown. MobX store with all information? Resolve suboptimal parts (presence sent for all rooms etc)
  • xmppStanzaRequestMessages.js - converts app/user actions into XMPP language and sends requests to XMPP server

Reducers

  • src/reducers/apiReducer.js - move endpoints to Config


Networking

(SSO / Firebase)

(DP API)

(XMPP)

(File attachments - IPFS)


Tech wishlist

  • Redux -> Mobx (state management improvements) - actions, reducers will go
  • Realm is staying
  • Components are replaced with functional
  • Switch applicable components/interactions to async (pending Architecture review of which interactions have to remain sync)
  • TypeScript

Joint wishlist

  • Clean code, Clear component names and Comments
  • Config file improvements (move all switches/variables there, some are still not there)

Product/Commercial wishlist

  • Global User Identity (consider Self-Sovereign Identity)
  • Metamask / 3rd party wallet integration
  • Bots Code sample
  • Audio/Video calls