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

Epic: new mobile app (move to monorepo) #4698

Merged
merged 50 commits into from
Dec 20, 2024
Merged

Epic: new mobile app (move to monorepo) #4698

merged 50 commits into from
Dec 20, 2024

Conversation

compojoom
Copy link
Contributor

@compojoom compojoom commented Dec 19, 2024

What it solves

This PR adds the code for the mobile application previously residing in a private repo.

The commits were alrady reviewed in the other repo. The last commit just fixes a problem introduced from improper path resolution with typescript.

apps/mobile - RN app uses React 18
apps/web - nextjs app uses React 19

yarn was correctly resolving the packages and adding apps/web/node_modules/react19, but tsc was erroring out and loading at one point the react18 version from the main /node_modules.

Storybook is broken both in web and mobile. (will fix in a separate PR)

How to test it

@safe-global/web package should continue to work as usual. New is the @safe-mobile/mobile package located in apps/mobile.
You can follow it's readme to start the React-Native app.

Screenshots

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

Copy link

github-actions bot commented Dec 19, 2024

Copy link

github-actions bot commented Dec 19, 2024

Coverage (49%)
File% Stmts% Branch% Funcs% LinesUncovered Line #s
All files49.5843.7244.4449.71 
src0000 
   react-app-env.d.ts0000 
src/components/Alert10091.66100100 
   Alert.tsx10091.6610010055
   index.ts0000 
src/components/Badge87.57510087.5 
   Badge.tsx85.717510085.7147
   index.ts0000 
   theme.ts100100100100 
src/components/BlurredIdenticonBackground0000 
   BlurredIdenticonBackground.tsx000014–51
   index.tsx0000 
src/components/Container100100100100 
   Container.tsx100100100100 
   index.ts0000 
src/components/CopyButton010000 
   CopyButton.tsx0100005–10
   index.ts0000 
src/components/DataRow100100100100 
   DataRow.tsx100100100100 
   index.ts0000 
src/components/Dropdown94.7387.585.7194.44 
   Dropdown.tsx88.8887.57588.8834
   index.ts0000 
   sheetComponents.tsx100100100100 
src/components/EthAddress0000 
   ETHAddress.tsx000011–12
   index.ts0000 
src/components/Fiat100100100100 
   Fiat.tsx100100100100 
   index.ts0000 
src/components/Identicon100100100100 
   Identicon.tsx100100100100 
   index.ts0000 
src/components/InnerShadow100100100100 
   InnerShadow.tsx100100100100 
   index.ts0000 
src/components/Logo100100100100 
   Logo.tsx100100100100 
   index.ts0000 
src/components/SafeButton100100100100 
   SafeButton.tsx100100100100 
   index.ts0000 
src/components/SafeFontIcon87.571.4210087.5 
   SafeFontIcon.tsx87.571.4210087.528
   index.ts0000 
src/components/SafeListItem10066.66100100 
   SafeListItem.tsx10066.6610010071–85
   index.tsx0000 
src/components/SafeTab0000 
   SafeTab.tsx01000013–37
   SafeTabBar.tsx000012–38
   index.tsx0000 
   types.ts0000 
src/components/StatusBanners/PendingTransactions10050100100 
   PendingTransactions.tsx1005010010017
   index.tsx0000 
src/components/Title100100100100 
   LargeHeaderTitle.tsx100100100100 
   NavBarTitle.tsx100100100100 
   index.ts0000 
src/components/TxInfo23.84.545023.8 
   TxInfo.tsx23.84.545023.845–96, 100
   index.tsx0000 
src/components/navigation100100100100 
   TabBarIcon.tsx100100100100 
   index.ts0000 
src/components/transactions-list/Card/AssetsCard100100100100 
   AssetsCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxBatchCard100100100100 
   TxBatchCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxConflictingCard010000 
   TxConflictingCard.tsx01000013–31
   index.tsx0000 
src/components/transactions-list/Card/TxContractInteractionCard100100100100 
   TxContractInteractionCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxCreationCard100100100100 
   TxCreationCard.tsx100100100100 
   index.ts0000 
src/components/transactions-list/Card/TxGroupedCard90.9757590.9 
   TxGroupedCard.tsx90.9757590.957
   index.tsx0000 
src/components/transactions-list/Card/TxRejectionCard100100100100 
   TxRejectionCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxSafeAppCard100100100100 
   TxSafeAppCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxSettingsCard10050100100 
   TxSettingsCard.tsx1005010010017
   index.tsx0000 
src/components/transactions-list/Card/TxSwapCard100100100100 
   TxSwapCard.tsx100100100100 
   index.tsx0000 
src/components/transactions-list/Card/TxTokenCard88.8880.5510088.88 
   TxTokenCard.tsx88.8880.5510088.8840, 70
   index.tsx0000 
src/config10083.33100100 
   constants.ts10083.3310010013
src/features/Assets010000 
   Assets.container.tsx0100009–21
   index.tsx0000 
   styles.ts010010003
src/features/Assets/components/AssetsHeader0000 
   AssetsHeader.container.tsx0100006–13
   AssetsHeader.tsx000015
   index.tsx0000 
   styles.ts010010003
src/features/Assets/components/Balance0000 
   Balance.container.tsx01000010–34
   Balance.tsx000021–41
   ChainItems.tsx000017–28
   index.tsx0000 
src/features/Assets/components/Fallback0000 
   Fallback.tsx00008–9
   index.ts0000 
src/features/Assets/components/NFTs0000 
   NFTItem.tsx00006
   NFTs.container.tsx000018–59
   index.tsx0000 
src/features/Assets/components/Navbar010000 
   Navbar.tsx01000013–39
   index.tsx0000 
src/features/Assets/components/NoFunds010000 
   EmptyToken.tsx0100005
   NoFunds.tsx0100006
   index.ts0000 
src/features/Assets/components/Tokens0000 
   Tokens.container.tsx000017–56
   index.tsx0000 
src/features/Notifications010000 
   Notifications.container.tsx0100004–5
   index.tsx0000 
src/features/Onboarding100100100100 
   Onboarding.container.tsx100100100100 
   index.ts0000 
src/features/Onboarding/components/OnboardingCarousel9510087.595 
   CarouselFeedback.tsx100100100100 
   CarouselItem.tsx100100100100 
   OnboardingCarousel.tsx83.331008083.3318
   index.ts0000 
   items.tsx100100100100 
src/features/Onboarding/components/OnboardingHeader100100100100 
   OnboardingHeader.tsx100100100100 
   index.ts0000 
src/features/Onboarding/components/ParticlesLogo100100100100 
   ParticlesLogo.tsx100100100100 
   index.ts0000 
src/features/PendingTx0000 
   PendingTx.container.tsx0100006–8
   index.tsx0000 
   utils.tsx000021–133
src/features/PendingTx/components/PendingTxList0000 
   PendingTxList.container.tsx000033–63
   index.ts0000 
src/features/Settings0000 
   Settings.container.tsx00007–14
   Settings.tsx000020–137
   index.tsx0000 
src/features/Settings/components/AppSettings010000 
   AppSettings.container.tsx0100008–21
   AppSettings.tsx01000010–11
   index.ts0000 
src/features/Settings/components/IdenticonWithBadge0000 
   IdenticonWithBadge.tsx000014–37
   index.ts0000 
src/features/Settings/components/Navbar0000 
   Navbar.tsx01000010–27
   SettingsButton.tsx0100006–15
   SettingsMenu.tsx000015–78
   index.ts0000 
src/features/Signers010000 
   Signers.container.tsx0100003–4
   index.tsx0000 
src/features/TxHistory0000 
   TxHistory.container.tsx000011–37
   index.tsx0000 
   utils.tsx000018–58
src/features/TxHistory/components/TxHistoryList0000 
   TxHistoryList.tsx000018–32
   index.ts0000 
src/hooks/useCopyAndDispatchToast100100100100 
   index.ts100100100100 
src/hooks/usePendingTxs0000 
   index.ts00008–44
src/hooks/useTransactionType91.6679.1610091.66 
   index.tsx91.6679.1610091.66116–124
src/navigation0000 
   useScrollableHeader.tsx000022–47
src/services/exceptions88.8810010088.88 
   utils.ts88.8810010088.8814
src/store73.17505072.97 
   activeChainSlice.ts87.510066.6683.3312
   activeSafeSlice.ts57.14100066.6620–23
   index.ts91.665010091.6642
   storage.ts251000258–17
   txHistorySlice.ts100100100100 
src/store/chains100100100100 
   index.ts100100100100 
src/store/hooks100100100100 
   index.ts100100100100 
src/theme100100100100 
   navigation.ts100100100100 
   tamagui.config.ts100100100100 
   tokens.ts100100100100 
src/theme/helpers10081.81100100 
   utils.ts10081.8110010037, 41
src/theme/palettes100100100100 
   darkPalette.ts100100100100 
   lightPalette.ts100100100100 
src/theme/provider59.0927.776059.09 
   font.tsx90501009034
   safeTheme.tsx10037.510010019–34
   toastProvider.tsx000010–29
src/utils75.2247.9171.4275.47 
   date.ts9666.6685.7110031, 35–39
   formatters.ts87.58010087.57
   gateway.ts100100100100 
   transaction-guards.ts79.24606880.7650–56, 66, 98, 102, 116, 120
   transactions.tsx00004–29

clovisdasilvaneto and others added 24 commits December 20, 2024 14:10
* refactor: use jest for tests

I couldn’t find a way to fix our tests and make them work with tamagui.
Vitest is ignoring the native.ts files that tamagui has and tests were
failing, because of that I reconfigured the project to use jest.

* fix: button test

* feat: add container tests

* feat: add DataRow tests
* feat: create tx-history list components

* feat: use the new cards components in the TxHistory list

* fix: remove todo

* feat: add missing variants to tx history page

* feat: add missing multiSendCall information in the txList

* feat: create static transactions messages layout

* fix: android crash

* feat: add detox test for transactions

* fix: add the right name in the bulk transactions section

* fix: scroll margin in the txHistory component

* fix: story book of the TxCards components

* fix: unit tests

* fix: detox tests

* fix: remove unnecessary comment

* fix: remove swap order comment

* fix: tx history in light mode

* fix: use snapshot tests instead of inline object comparison

* fix: remove TODO comments

* chore: rename tx cards

---------

Co-authored-by: Daniel Dimitrov <[email protected]>
* chore: use Alert component for the status banners

* chore: use GestureHandler on the application entry point

* fix: remove 'isStorybookEnv' log

* fix: rename tests cases
* chore: adjust api gateway folder structure

* feat: create chains slice

* feat: create activeChain slice

* chore: remove TODO comment

* chore: remove unused code

* feat: use activeChain information instead of hard coded data

* fix: remove performance optmization in pro of readability
* feat: create pending tx screen

* feat: add pending transactions static layout in the home screen

* feat: add pending transactions slice in the api gateway

* feat: add new variant in the Alert component

* feat: create CircularBadge component to use it as the circular icon with text

* feat: put groupTx to respect SOLID definition

* feat: add lodash as project dependency

* feat: add missing parameters in the TxCards components

* feat: adjust reusable components layout

* feat: create pending transactions screen

* feat: generated snapshots
* feat: use react-navigation header in screens

* Update app/(tabs)/transactions/_layout.tsx

Co-authored-by: Clóvis Neto <[email protected]>

* Update src/features/PendingTx/PendingTxList.tsx

Co-authored-by: Clóvis Neto <[email protected]>

---------

Co-authored-by: Clóvis Neto <[email protected]>
* feature: RTK auto-generated endpoints

* chore: run prettier on the codebase

* chore: run prettier on the codebase

* refactor: tx pending & history tx types

* fix: remove usage of safe-gateway-typscript-sdk

* fix: clean up console.log

* refactor: pending & history tx cleanup
* fix: refactoring broke test initialisation

* fix: update snapshot tests

I think that the latest tamagui updates added some props that were
previously not there
* Feat: active safe slice

* Use shortenAddress
We should display first the confirmation submitted  and then the
confirmation required.

1/2

one submitted / two required
running npm run storybok:web will launch storybook in the browser.
fix: wrong types

fix: typescript compile errors

feat: run lint on new PRs

type node

.
* feat: create safe tab component

* feat: create dropdown component

* feat: create assets features layout

* feat: adjust styles of shared components

* feat: allow user to show a transparent transaction list card

* feat: adjust SafeTab component to control the active tab in the main component

* feat: add dropdown component into the assets header

* feat: integrate user balance with CGW

* feat: adjust transactions-list components colors

* feat: change default active wallet

* feat: create Logo component to use it for any token or contract logo

* feat: adjust SafeListItem colors

* feat: integrate tokens and nfts list with CGW data

* feat: create NoFunds component to show the empty assets icon when no funds were found

* fix: do not show pending transactions component when there isn't any pending tx

* feat: add component to render the select chain dropdown sheet template

* fix: change CGW hooks imports

* fix: re-use the fallback markup in the assets list

* feat: separate bottom sheet components

* feat: change SafeOverview type import

* feat: optmize functions with useCallback

* feat: move assets render item function to a separated component

* fix: tslint
clovisdasilvaneto and others added 19 commits December 20, 2024 14:11
* chore: add contributing.md file in the project

* chore: generated snapshots�

* chore: change folder structures

* chore: adjust contributing.md
* fix: unit tests

* fix: remove early null return
* chore: adjust features folder structure

* chore: change features folder definition

* fix: broken ts import
The endpoint was returning more results, but we were not going
after the next page. Instead we were agian polling the first
page and this ended up in 429.
* fix: blurred background on android not working

* fix: identicon not being circular on android

* fix: visual topbar issues on android

* fix: android menu icons

* fix: app home screen warnings

* fix: remove empty space

* fix: typo

* fix: remove unused style

* fix: remove background prop

* fix: use StatusBar component instead of mutate in useEffect

* fix: remove unnecessary package

* fix: Toast message in android devices

* fix: add withDrawableAssets config to add drawable folder in the pre-build command

* feat: add withDrawableAssets config

---------

Co-authored-by: Clóvis Neto <[email protected]>
* feat: add maestro e2e tests

* refactor: remove detox and native files

Removed detox as we are going to use maestro.
Reasons for the decision
- detox is not compatible with the latest RN version
- detox apparently is no longer recommended for e2e tests on
expo EAS.

Sicne we don’t use detox, we don’t need to keep the native files
in the repo. They are auto-generated on the fly by expo.

* fix: update snapshot test for PendingTransactions

* fix: update package.lock

The package.lock went out of sync due to the last
git merge conflicts resolution.

* refactor: remove withDrawableAssets from root dir

The code is in the expo-plugins folder now

* refactor: update readme
* feature: build with eas

We are now able to build on eas.

For android:
Since the app didn’t go through the app store approval
versions we submit need to be in draft state.
We rely on Expo’s Continuous Native Generation
(https://docs.expo.dev/workflow/continuous-native-generation/).
For some reason those files were still left, despite the fact that
we’ve ignored the ios and android folders.
* refactor: repository now follows a Monorepo structure

Main project folders are now:
- apps
- packages

Apps such as expo, nextjs live inside of the apps folder. Packages
shared between the apps live in packages.

I migrated to yarn v4 (from npm) as the general opinion is that yarn has
better workspaces support. Also the web app uses it.

* fix: enable corepack in CI

And also switch to a newer node version in general

* fix: collect coverage from right files

* fix: make EAS happy

* fix: typo
* fix: remove duplicated folder

* feat: add splash scren configuration
* refactor: make prettier config global

* feature: extract store gateway to separate package

I’ve moved the autogenerated gateway API code to a separate package.
This will allow us to reuse it in the web application.

In the process I created 2 more configuration packages:
- config/tsconfig
- config/jest-presets

The goal of those is to offer base tsconfig and jest presets for reuse
across packages.

* fix: improve yarn installation instructions

* fix: tsx & linting issues
* feat: create onboarding structure

* feat: create onboarding carousel components

* feat: create onboarding header component

* feat: create onboarding container

* feat: crate re-usable SafeButton component

* feat: cover onboarding components with unit tests

* feat: add storybook for carousel component

* feat: fix unit tests

* feat: remove hardcoded colors and test warnings

* fix: remove unused testID

* fix: remove magic numbers

* feat: use tamagui variables
@compojoom compojoom marked this pull request as ready for review December 20, 2024 14:46
@compojoom compojoom requested a review from katspaugh December 20, 2024 14:48
@compojoom compojoom mentioned this pull request Dec 20, 2024
3 tasks
@katspaugh katspaugh changed the title Mobile monorepo Epic: new mobile app (move to monorepo) Dec 20, 2024
Changes the name of the workflows so that it is now clear which workflow
is running and to which app it relates
@compojoom compojoom merged commit 3b198da into dev Dec 20, 2024
5 of 6 checks passed
@compojoom compojoom deleted the mobile-monorepo branch December 20, 2024 16:03
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants