Compare commits

...
117 Commits
Author SHA1 Message Date
Ibrahem Khalil 59553362d1 Merge branch 'develop' into 17116 2023-12-04 15:19:39 +02:00
Mohamed Javid 56d135f1f8 Implemented Wallet - Account Switcher (#18003)
This commit:

- Implements the Wallet Account Switcher for easy switching between wallet accounts
- Updates the About tab in the accounts screen to display the correct account address and derivation path along with the profile.
- Updates the account-item component to pass the state from the parent and refactors the depreciated color functions
- Moves the handle-bar in the bottom sheet to a standalone component 
- Adds customization-color in account-origin component

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-12-04 18:47:03 +05:30
Mohsen a7178a4950 [#17572] fix: 'Join Community' notification is not getting dismissed (#17834) 2023-12-04 15:24:06 +03:00
Siddarth Kumar 3cd302b271 fix: get rid of :redef-in-file warning (#18053) 2023-12-04 14:18:43 +05:30
yqrashawn 1e797273b6 fix: change system time backward break image server (#17989) 2023-12-04 16:12:50 +08:00
Ibrkhalil 2f1ee972c2 Better syntax 2023-12-03 16:27:11 +02:00
Ibrkhalil 3b3743d7a7 Handle uniqueness 2023-12-03 16:26:00 +02:00
Ibrkhalil 3a1737b65e Bump go 2023-12-03 16:01:14 +02:00
Ibrkhalil 2b78d323dc clean 2023-12-03 15:45:45 +02:00
Ibrkhalil 79ee136826 Cater for sending community URL 2023-12-03 15:43:43 +02:00
Ibrkhalil bf3886ea18 Bump go 2023-12-03 13:04:54 +02:00
Ibrkhalil ff1068b53b Lint 2023-12-03 12:16:21 +02:00
Ibrahem Khalil 622df31a12 Change default value for loading? 2023-12-02 19:01:45 +02:00
Ibrahem Khalil ab8f65e6fa Merge branch 'develop' into 17116 2023-12-02 18:49:33 +02:00
Ibrkhalil 9674142fdc Bump go 2023-12-02 18:39:09 +02:00
Ibrkhalil e18ca22ff7 Add component 2023-12-02 18:37:24 +02:00
Ibrkhalil 31c226fcba Bump go and update endpoint 2023-12-02 11:17:50 +02:00
Ibrkhalil 292e3b7167 Bump go 2023-12-02 10:18:52 +02:00
Ibrkhalil 4c818ebaa6 Bump go 2023-12-02 10:15:07 +02:00
frank 8ff67bf344 fix: Cannot mark as read messages in communities (#18029)
* fix: Cannot mark as read messages in communities

* rename messenger-response to _messenger-response
2023-12-02 09:05:21 +08:00
Ulises Manuel 3fee21c73a [#17923] text combinations - standard title component (#17939)
* Simplify tag components by turning them to from-1

* Add standard-title component, preview screen and tests
2023-12-01 15:49:49 -06:00
Jamie Caprani f9f328107d chore: add ability to create watch address & some related ui changes on account page (#17868) 2023-12-01 04:29:01 -08:00
Yevheniia Berdnyk 04dee8be45 e2e: updated data for waku backup test 2023-12-01 12:28:26 +02:00
Alexander 52f7fc59ee Updated data-item, monospaced & aligned address (#18008)
* Upd

* Fix
2023-12-01 10:03:08 +01:00
Mohamed Javid b5202b4d28 [Feature] Added activity check on entered watch address (#17970)
This commit 
 - implements the activity check for the entered watch address.
 - added warning colors
 - fixes bottom inset in add address to watch screen

---------

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-12-01 00:28:09 +05:30
Andrea Maria Piana 210cf64ce0 Fix panic syncing community token gated
https://github.com/status-im/status-go/compare/8a4c2d8d...8206ffc7
2023-11-30 13:49:47 +00:00
Lungu Cristian ed270b2162 Enabling biometry without password during sync (#17960)
* feat: added migration for the keychain hashed password

* feat: added sync biometry without password entry

* fix: biometry typo from develop

* ref: moved migration side-effects outside the event

* ref: some renaming for keychain migration

* ref: addressed @cammellos' review comments

* ref: removed unnecessary anon fn

* fix: addressed @ilmotta's review comments

* ref: removed theme from enable-biometrics

* ref: addressed J-Son89's review comments

* test: added tests for mask-data and hash-masked-password

* test: added schema to hash-masked-password and fixed test

* fix: forgot the threading

* ref: improved the masked data schema

* fix: no biometry error when canceled by user

* fix: biometry error wasn't propagated during login

* fix: alert dismiss button not passed properly

* fix: show biometrics NOT_ENROLLED error only once

* lint: removed unused require
2023-11-30 13:40:29 +02:00
Andrea Maria Piana d412fa3c63 Set up skeleton for communities request to join 2023-11-30 09:49:43 +00:00
Yevheniia Berdnyk b7f675aa5c e2e: fix for deep links test 2023-11-30 01:09:42 +02:00
Ibrkhalil a83fa4df87 Improvements 2023-11-29 22:20:00 +02:00
Ibrkhalil 3782cd5808 clean 2023-11-29 21:57:59 +02:00
Ibrkhalil d1b094f986 Bump go 2023-11-29 21:57:00 +02:00
Volodymyr Kozieiev bfa23c182f Add requirement for component tests (#18015) 2023-11-29 18:50:49 +00:00
Mohsen 6b721265af [#17986] feat: implement new settings ui, header section (#17991) 2023-11-29 20:54:11 +03:00
Jamie CapraniandRende11 589a581298 chore(wallet): add ui for send page (#17786) - merged in (#18017)
---------
Co-authored-by: Rende11 <artamonovn@gmail.com>
2023-11-29 05:12:21 -08:00
Yevheniia Berdnyk 0546a87e9a e2e: deep links tests added 2023-11-29 14:09:31 +02:00
Parvesh Monu e5ce7fed3a fix position of the last item in the community chat list and the position of the jump-to button (#17999) 2023-11-29 16:45:30 +05:30
Siddarth Kumar 58d5c3d7a5 don't restrict diawi upload for iOS release builds (#18016)
This commit removes the restriction of uploading iOS release builds to Diawi

Its helpful to have the status app uploaded to Diawi to test release builds on our iPhones.

The installer is very straightforward and makes life easier when we want to try out release builds.
2023-11-28 22:46:58 +05:30
Ibrahem Khalil 6ccea1ddb2 Continue button is invisible behind keyboard in Add Address To Watch … (#17940) 2023-11-28 18:38:06 +02:00
Alex Tumanov a9a17aaae8 Implement dropdown-input based on the original dropdown component (#17927) 2023-11-28 15:21:15 +00:00
Andrea Maria Piana 6d69c278cd Update key in tests 2023-11-28 10:57:10 +00:00
Yevheniia Berdnyk c7e230d070 e2e: changed test order 2023-11-28 12:05:47 +02:00
frank d309aa366d chore: specify light client mode for wakuv2 (#18002) 2023-11-28 14:48:58 +08:00
Jamie Caprani f124ca4252 chore(wallet): add common page-nav component for account switcher (#17946) 2023-11-27 09:16:31 -08:00
Brian Sztamfater 1385e27cf4 feat: select asset screen ui (#17780)
feat: select asset screen ui

Signed-off-by: Brian Sztamfater <brian@status.im>
2023-11-27 11:03:02 -03:00
Volodymyr Kozieiev f82d28c6c9 Show network info on collectible info page (#17980) 2023-11-27 12:29:12 +00:00
Omar Basem a2856cf1c3 Wallet: Emoji picker performance (#17891)
Wallet: Emoji picker navigation perf
2023-11-27 09:57:29 +04:00
Ibrahem Khalil 6a8f061627 Merge branch 'develop' into 17116 2023-11-26 14:18:58 +02:00
Ibrkhalil eef9f45834 Add community invitation type 2023-11-26 14:18:16 +02:00
Yevheniia Berdnyk e6a7c420a2 e2e: APK upload time limit increased 2023-11-23 12:34:30 +02:00
alwx 671aa67002 Detect image dimensions correctly 2023-11-23 09:28:38 +00:00
Omar Basem dbc8df251a Wallet: Keypair follow up (#17953)
* Wallet: Keypair follow up
2023-11-23 10:00:22 +04:00
Ulises Manuel 279993b658 Add channel-name component (#17903) 2023-11-22 15:54:52 -06:00
Volodymyr Kozieiev 0c1a18b444 Connect collectible overview page to backend (#17884) 2023-11-22 19:40:26 +00:00
Ibrahem Khalil 865659552d Merge branch 'develop' into 17116 2023-11-21 19:52:22 +02:00
ibrkhalil 656e545957 Bump status-go 2023-11-21 19:48:06 +02:00
Omar Basem 73e9f67dbd Wallet: illustrations (#17931)
* wallet: illustrations
2023-11-21 10:55:46 +04:00
Jamie Caprani 86c5505c94 chore(wallet): hook up qr scanner on watch only flow. (#17829) 2023-11-19 16:26:00 -08:00
Icaro Motta c1dcd7a764 Introduce malli library (#17867)
This commit is the foundational step to start using malli
(https://github.com/metosin/malli) in this project.

Take in consideration we will only be able to realize malli's full power in
future iterations.

For those without context: the mobile team watched a presentation about malli
and went through a light RFC to put everyone on the same page, among other
discussions here and there in PRs.

To keep things relatively short:

1. Unit, integration and component tests will short-circuit (fail) when
   inputs/outputs don't conform to their respective function schemas (CI should
   fail too).
2. Failed schema checks will not block the app from initializing, nor throw an
   exception that would trigger the LogBox. Exceptions are only thrown in the
   scope of automated tests.
3. There's zero performance impact in production code because we only
   instrument. Instrumentation is removed from the compiled code due to the
   usage of "^boolean js.goog/DEBUG".
4. We shouldn't expect any meaningful slowdown during development.

**What are we instrumenting in this PR?**

Per our team's agreement, we're only instrumenting the bare minimum to showcase 2 examples.

- Instrument a utility function utils.money/format-amount using the macro
  approach.
- Instrument a quo component quo.components.counter.step.view/view using the
  functional approach.

Both approaches are useful, the functional approach is powerful and allow us to
instrument anonymous functions, like the ones we pass to subscriptions or event
handlers, or the higher-order function quo.theme/with-theme. The macro approach
is perfect for functions already defined with defn.

**I evaluated the schema or function in the REPL but nothing changes**

- If you evaluate the source function, you need to evaluate schema/=> or
  schema/instrument as well.
- Remember to *var quote* when using schema/instrument.
- You must call "(status-im2.setup.schema/setup!)" after any var is
  re-instrumented. It's advisable to add a keybinding in your editor to send
  this expression automatically to the CLJS REPL, or add the call at the end of
  the namespace you are working on (similar to how some devs add "(run-tests)"
  at the end of test namespaces).

**Where should schemas be defined?**

For the moment, we should focus on instrumenting quo components, so define each
function schema in the same namespace as the component's public "view" var.

To be specific:

- A schema used only to instrument a single function and not used elsewhere,
  like a quo component schema, wouldn't benefit from being defined in a separate
  namespace because that would force the developer to constantly open two files
  instead of one to check function signatures.
- A common schema reused across the repo, like ":schema.common/theme" should be
  registered in the global registry "schema.registry" so that consumers can just
  refer to it by keyword, as if it was a built-in malli schema.
- A common schema describing status-go entities like message, notification,
  community, etc can be stored either in the respective
  "src/status_im2/contexts/*" or registered globally, or even somewhere else.
  This is yet to be defined, but since I chose not to include schemas for them,
  we can postpone this guideline.
2023-11-18 11:04:48 -03:00
Icaro Motta 17ebedd6b8 Fix: resolve our Clojure source dependencies first in the classpath (#17919)
In PR https://github.com/status-im/status-mobile/pull/17867 we have a namespace
named schema.core, but this namespace is taken by library prismatic/schema
already (see https://github.com/plumatic/schema/tree/master/src/cljc/schema), a
library used by our direct dependency on bidi 2.1.6. This leads to a broken
build where the ClojureScript compiler reports undeclared vars
(https://clojurescript.org/reference/compiler-options#warnings).

We change the order Java resolves dependencies via the classpath mechanism. We
now first resolve our own Clojure sources, and then project dependencies.
2023-11-18 08:50:11 -03:00
Jamie CapraniandUlises M 2e2d15adfb chore: add floating button page component (#17737)
Co-authored-by: Ulises M <ulises.ssb@hotmail.com>
2023-11-17 09:16:55 -08:00
Yevheniia Berdnyk 1d1d586223 e2e: added back status link opening 2023-11-17 18:09:57 +02:00
John Ngei 88dd5e04bb enable biometric when user signs in with syncing (#17627) 2023-11-17 17:58:51 +03:00
Lungu CristianandIbrkhalil 8f8c8dede2 Composer collapsing when editing canceled/done (#17785)
* fix: composer height when entering and canceling edit

* fix: blur the composer input when canceling edit

* fix: focusing animation and composer height after blur

* fix: input height when canceling edit while unfocused

* ref: removed arbitrary keyboard check

* fix: moved edit-mentions logic to use-edit to fix unresolved mention

* fix: composer edit should put the cursor at the end

* fix: (potentially) fixing the mention not resolved during edit

* fix: emoji-kb handler changing the height when default kb appears

* Fix text content when editing and reentering chat

* prevent composer when focusing on opening chat with edit/reply

* clean

* Clauxx comments

* Apply for reply

* Lintil soup = yummy

* refactor variable name

* Extract the focusing logic from the data setting logic

* Edge case

* fix: composer mention key & edit re-enter issues

* fix: reply cancel input blur and smooth reply focus

---------

Co-authored-by: Ibrkhalil <vampirekid017@gmail.com>
2023-11-17 11:32:31 +02:00
Yevheniia Berdnyk 2e0643fabe e2e: fixes 15.11 2023-11-16 15:54:35 +02:00
Flavio Fraschetti ec4046e543 Hide channel list at token-gated communities overview (#17901)
This commit hides the categorized channel list for token-gated communities overview.
2023-11-16 10:46:17 +00:00
yqrashawn 4a44161163 chore: lint require i18n-resources first in status-im2.core (#17905) 2023-11-16 11:10:40 +08:00
Icaro Motta b9353b1ccd Fix: actually run integration tests (#17900)
Integration tests weren't running since https://github.com/status-im/status-mobile/pull/17762 was merged a week ago.

This commit also allows individual integration test namespaces to run if you change the :ns-regexp option in shadow-cljs. This is quite handy, since they are relatively slow.

Fixes https://github.com/status-im/status-mobile/issues/17895
2023-11-15 19:51:09 -03:00
jakub 5ceb7c2215 tests/appium: use requests for fetching APK
Also add more context for the error.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-11-15 18:08:11 +01:00
jakub 2043e9353b tests/appium: refactor conftest.py to be more readable
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-11-15 18:08:10 +01:00
flexsurfer 7153e4da48 [#17854] [IOS] The tutorial video animation keeps playing after openi… (#17915) 2023-11-15 16:24:27 +01:00
Icaro Motta c7cba5b4d3 Fix: unable to join token-gated communities (#17894)
Fixes the bug by explicitly passing all available addresses to be revealed
to wakuext_requestToJoinCommunity and picking up the first available address
as the airdrop address. This is a temporary solution while we work on the
feature to allow users to choose which addresses to expose.

Fixes https://github.com/status-im/status-mobile/issues/17861

*Areas that may be impacted*: join community flows.

    ----------------------------------------------------------------------
    Community "Request to join" option is enabled.
    User holds more than X ETH.
    Anyone who holds <X> ETH is allowed to Become member in <COMMUNITY>.
    
    Expected: request to join is received by desktop client and accepted,
    mobile user joins the community.
    ----------------------------------------------------------------------
    
    ----------------------------------------------------------------------
    Community "Request to join" option is enabled.
    User holds less than X ETH.
    Anyone who holds <X> ETH is allowed to View and post in <CHANNEL>.
    
    Expected: request to join is received by desktop client and accepted, mobile
    user joins the community, but can't post in <CHANNEL>.
    ----------------------------------------------------------------------
    
    ----------------------------------------------------------------------
    Community "Request to join" option is enabled.
    No token permissions.
    
    Expected: request to join is received by desktop client and accepted,
    mobile user joins the community.
    ----------------------------------------------------------------------
2023-11-15 06:39:12 -03:00
Ulises Manuel 45df308dd0 [#17823] Refactor tokens data app-db (#17880)
* Refactor edit-account view and events:

 - Fix `(fn [])` code style.
 - Avoid overriding clojure.core/type by destructuring the `:type` key.
 - Split the toast callback to a different function.
 - `:wallet/save-account` receives `:on-success` instead of `:callback` to improve readability.

* Refactor app-db for `:wallet/tokens` & `:wallet/tokens-loading?`

- Remove the root sub `:wallet/tokens-loading?`, now it's in app-db in `[:wallet :ui :tokens-loading?]`.
- Remove the root subs `:wallet/tokens`, now the value is returned along with the account data by the sub
  `:wallet/accounts`, it's stored in app-db in `[:wallet :address "0x..." :tokens]`.
- Fix the format of the token data returned by the endpoint `"wallet_getWalletToken"` and the fn `js->clj`,
    - Addresses are no longer keywords (since keywords mustn't start with a number).
    - Keys are now kebab-case.
    - Chain-ids are no longer keywords, now they are integers.
- Update tests.

* Move logic to calculate `:wallet/balances` and change value returned

- Move logic to `status-im2.contexts.wallet.common.utils`
- The `:wallet/balances` value returned by the sub had the following structure:
  [{:address "0x1...", :balance 12345}
   {:address "0x2...", :balance 67890} ...]
  This required a helper function to get the balance for an address (`get-balance-by-address`)
  It has been changed to a map:
  {"0x1..." 12345
   "0x2..." 67890, ...}
  So now we don't need a helper function (just the hashmap itself or `clojure.core/get`).
- Because of the previous change, now the `get-balance-by-address` has been removed.
- The function `get-account-by-address` has zero uses, so it has been removed.
- The test for the sub has been updated.

* Create sub `:wallet/account-cards-data`

This sub returns a vector of maps to render the account cards in the wallet page.
This logic was previously in the `view` namespace, but it was completely calculated from
the subs `:wallet/accounts`, `:wallet/balances` and `:wallet/tokens-loading?`, so it was
clear that's a derived value.
2023-11-14 10:54:26 -06:00
Brian Sztamfater a74c934936 feat: implement summary tag component (#17858)
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-11-14 11:50:58 -03:00
andrey c150070cfe remove empty files 2023-11-13 14:50:45 +01:00
Ibrahem Khalilandbalogunofafrica 1b745857e8 [17634] Start rendering syncing UI ASAP (#17755)
* Start rendering syncing UI ASAP

* Consolidating values

* fix: show syncing ui immediately

* fix: error validation

---------

Co-authored-by: balogunofafrica <balogunakanbi.k@gmail.com>
2023-11-13 12:15:53 +01:00
Omar Basem 87c9946092 Wallet: Keypair Screen (#17775)
* wallet: keypair screen
2023-11-13 14:43:43 +04:00
Omar Basem f3e47ac1a2 Wallet: watch address - select random color (#17859)
Wallet: randomize color picker
2023-11-13 14:25:44 +04:00
Yevheniia Berdnyk 83a7402210 e2e: fix for terminated session 2023-11-13 02:27:36 +02:00
Siddarth Kumar 3c297bf5b4 chore: ignore auto generated lint-fix files (#17783)
We get these 2 files auto generated locally as part of make lint-fix

`.clj-kondo/taoensso/encore/config.edn`
`.clj-kondo/taoensso/encore/taoensso/encore.clj`

We don't need them checked in its fine if they're ignored.
This commit adds these folders to `.gitIgnore`

- `.clj-kondo/taoensso/`
- `.clj-kondo/babashka/`
2023-11-10 18:12:03 +05:30
yqrashawn b4919261cb fix: nav conflicts when return from bg from link (#17853) 2023-11-10 09:15:02 +08:00
Icaro Motta ffeb06f36c Communities - Token gated community fixes (#17799)
- Fix: when there are only channel token permissions, don't show the text "You
  hold 0 of these:" because there are no requirements to show.
- Fix: do not show channel token permissions when the user wants to join a
  community. In other words: only "become admin", "become member", "become token
  master", and "become token owner" are taken in consideration.
- Fix: render correct channel lock icon in 3 states (no permission, with
  permissions and locked and with permissions and unlocked).
- Fix: Previously, before having joined a community, all channels had a lock
  icon closed, now the lock icon is only closed when there's a permission set,
  otherwise no icon is shown (the lock is never open before the user joins the
  community).
- Fix: small UI spacing fix, only display community tags component when there's
  at least one tag.
- Bonus fix: community Overview and Discover screens top bar had a regression,
  see the screenshots.

Fixes https://github.com/status-im/status-mobile/issues/17267

### Areas that may be impacted

- Community overview, before and after joining a community.

### Steps to test

Code tested using the Goerli network and with the testnet flag enabled in the
Desktop client. Out of scope: minted tokens.
2023-11-09 20:19:26 -03:00
flexsurfer 69f87ce8b0 [#17611] move status-im.utils.universal-links.core (#17855) 2023-11-09 21:22:15 +01:00
Andrea Maria Piana 27e27aa113 Add contribution status-go doc 2023-11-09 15:34:20 +00:00
Ajay Sivan e48a5c4e83 Quo community-stat component (#17851) 2023-11-09 04:39:42 -08:00
Mohamed Javid 595b1cfc40 [Fix] Move category selector height to emoji picker (#17844)
This commit moves the emoji categories selector height from the "showcase-nav" component to the "emoji-picker" as we should not use any "quo" ns (except "quo.core") inside the "status-im2" ns.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-11-08 23:56:56 +05:30
Volodymyr Kozieiev e573fc914a Respect status-go API changes for collectibles request (#17857) 2023-11-08 18:01:33 +00:00
Yevheniia Berdnyk 4eda8bb6b3 e2e: temp fix for opening a link in Status 2023-11-08 18:47:56 +02:00
Volodymyr Kozieiev bd6a9e577c Updated to status-go with fixed timeouts (#17831) 2023-11-08 15:08:52 +00:00
Mohamed Javid 6bb1779723 Implement edit account and refactor wallet accounts events & subs (#17798)
This commit updates the following:

- Allow users to create new wallet accounts without having to re-login (latest account data is fetched immediately)
- Updates the max length of the wallet account name to 20
- Updates the account cards in the wallet home screen to render the actual account colour
- Updates the (individual) account screen to show the correct color, emoji, name and address
- Allows users to edit account name, colour and emoji
- The rest of the wallet screens would see the updated account information immediately
- Fixes the color (uses profile color) of the context tag and button color in the authentication (enter password) bottom sheet
- Fixes the overflowing of the "+" card in the wallet home when there are two or more accounts.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-11-08 20:09:32 +05:30
codemaster 742c451000 fix: message content text alignment and spacing (#17606) 2023-11-08 05:40:26 -08:00
Alex Tumanov 569036c1d8 Add a button to address watch screen; (#17781)
Add account creation screen

remove icons

remove extra utility and create a new one that would use conventional way of getting an emoji

fix lint

Use button component instead of bottom-actions

Provide global customization color to buttons

Use conventional approach to extract account name

Move to another address

Move to another namespace

Refactor bottom-actions to have button props in maps

Update doc with new icon location

Add spaces between styles

Work on pr comments

Use :on-change-text instead of :on-change for input component
Subscribe to :profile/customization-color directly
Use bottom button from the create-or-edit-account wrapper

Remove extra code
Sort requires

Move ns to proper fileˆ

Fix styles
2023-11-07 16:40:24 +00:00
Brian Sztamfater 188f7f461e feat: address (mocked) suggestions (#17579)
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-11-07 12:04:37 -03:00
Yevheniia Berdnyk 422004f146 e2e: fix for creating a new user 2023-11-07 14:43:30 +02:00
David Martin cb005afff2 Split up integration tests (#17762) 2023-11-07 16:47:02 +05:30
Dmitri Akatov a5bb95cd18 add translation linting to the "make lint" pipeline. (#17820) 2023-11-07 11:33:59 +01:00
frank 20ac5cfa41 use timesource(synced) to generate/validate server cert time (#17771) 2023-11-07 16:36:27 +08:00
Dmitri Akatov 1755780950 make clj-kondo hook's name match the fully qualified name of the symbol it's linting (#17817) 2023-11-07 07:10:36 +01:00
Omar Basem a6d7502455 Wallet: bridge screen (#17758)
* wallet: bridge screen
2023-11-07 07:22:38 +04:00
yqrashawn 701df811b0 feat: lint direct require quo component outside src/quo (#17828) 2023-11-07 10:21:58 +08:00
Dmitri Akatov b47c97a4fd Mark utils.re-frame/defn as deprecated (#17788)
Also suggest to use utils.re-frame/reg-event-fx instead of utils.re-frame/defn
2023-11-06 19:09:40 -03:00
Siddarth Kumar 4ac7f0bdda update docs & makefile for iPhone 13 (#17784)
The design team has now decided to keep iPhone 13 as the baseline standard instead of iPhone 11 Pro.

This commit updates the docs on pixel perfection and starting guide.
We also update the default simulator to iPhone 13 for `make run-ios`
2023-11-06 23:55:06 +05:30
Volodymyr Kozieiev 4490676398 Collectibles list on accounts page connected to backend (#17751)
* Collectibles list displayed
2023-11-06 16:39:49 +00:00
Ibrahem Khalil ee019f79f2 Show success toast when user joins community. (#17815) 2023-11-06 16:22:15 +02:00
Alexander dc571b6067 Getting rid of status-im.multiaccounts.core + removing three word random names (#17384) 2023-11-06 14:38:14 +01:00
Dmitri Akatov fb8a7d2d8e proper use of ens-username-owned-continue translation key (#17819) 2023-11-06 09:00:00 +01:00
Dmitri Akatov ac8458d304 remove outdated i18n-test namespace (#17816) 2023-11-06 08:59:34 +01:00
Dmitri Akatov c13b86b882 add Goerli network English translation (#17818) 2023-11-06 07:34:41 +01:00
Siddarth Kumar 609eb04cff stop package bot from complaining (#17810)
fix for warning : Address should end with .git for consistency.
2023-11-04 11:58:19 +05:30
Yevheniia Berdnyk f1de077d9d e2e: making 2 tests independent 2023-11-03 18:02:16 +02:00
Ajay Sivan aa6d44bee1 Adapt to status-go API Changes for Request to Join Community Flow (#17800) 2023-11-03 08:57:56 -07:00
jakub 2a4bb84e35 fix script path for resolving ANDROID_ABI_INCLUDE
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-11-03 15:10:08 +01:00
Ibrahem Khalil 132e53844c New TopBar animation (#17582) 2023-11-03 14:20:10 +02:00
Mohsen 8d3558f1c3 [#17647] fix: generate keys title overlap (#17752) 2023-11-03 14:35:42 +03:00
Alex Tumanov 0eef5204c8 Implement wallet user avatar to match designs (#17703) 2023-11-02 20:29:09 +01:00
Mohamed Javid 9a5ed62e1f [Refactor] selectors component (#17763)
This commit updates the following in the selectors component:

- Introduces the "type" prop (Figma 1-1 property) to the selectors component for easy switching between the selector types while using it on lists.
- Updates the component styles to use the "resolve-color" function as the "custom-color" function is deprecated
- Updates the component usage across the codebase

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-11-02 23:54:59 +05:30
Ibrahem f9979a14c2 Test 2023-08-28 16:49:06 +03:00
468 changed files with 9549 additions and 5209 deletions
+12 -4
View File
@@ -16,10 +16,18 @@
:clj-kondo-config {:level :error}
:cond-else {:level :error}
:consistent-alias {:level :error
:aliases {clojure.string string
clojure.set set
clojure.walk walk
taoensso.timbre log}}
:aliases {clojure.set set
clojure.string string
clojure.walk walk
malli.core malli
malli.dev.pretty malli.pretty
malli.dev.virhe malli.virhe
malli.error malli.error
malli.generator malli.generator
malli.transform malli.transform
malli.util malli.util
schema.core schema
taoensso.timbre log}}
:deprecated-namespace {:level :warning}
:docstring-blank {:level :error}
:equals-true {:level :error}
+2
View File
@@ -0,0 +1,2 @@
{:lint-as {malli.experimental/defn schema.core/defn}
:linters {:unresolved-symbol {:exclude [(malli.core/=>)]}}}
+1 -1
View File
@@ -1,2 +1,2 @@
{:hooks {:analyze-call {utils.i18n/label hooks.core/i18n-label}}
{:hooks {:analyze-call {utils.i18n/label utils.i18n/label}}
:linters {:status-im.linter/invalid-translation-keyword {:level :error}}}
-19
View File
@@ -1,19 +0,0 @@
(ns hooks.core
(:require [clj-kondo.hooks-api :as api]))
(defn i18n-label
"Verify call to `i18n/label` pass the translation keyword qualified with `t`."
[{:keys [node]}]
(let [[_ translation-key-node & _] (:children node)]
(when (and (api/keyword-node? translation-key-node)
(not= "t" (-> translation-key-node api/sexpr namespace)))
(api/reg-finding! (assoc (meta translation-key-node)
:message "Translation keyword should be qualified with \"t\""
:type :status-im.linter/invalid-translation-keyword)))))
(comment
;; Valid
(i18n-label {:node (api/parse-string "(i18n/label :t/foo)")})
;; Invalid
(i18n-label {:node (api/parse-string "(i18n/label :foo)")}))
+26
View File
@@ -0,0 +1,26 @@
(ns utils.i18n
(:require [clj-kondo.hooks-api :as hooks]))
(defn label
"Verify call to `utils.i18n/label` pass the translation keyword qualified with `t`."
[{:keys [node]}]
(let [[_ translation-key-node & _] (:children node)]
(when (and (hooks/keyword-node? translation-key-node)
(not= "t" (-> translation-key-node hooks/sexpr namespace)))
(hooks/reg-finding! (assoc (meta translation-key-node)
:message "Translation keyword should be qualified with \"t\""
:type :status-im.linter/invalid-translation-keyword)))))
(comment
;; Valid
(label {:node (hooks/parse-string "(i18n/label :t/foo {:var \"hello\"})")
:cljc false
:lang :cljs
:filename ""
:config {}
:ns ""
:context nil})
;; Invalid
(label {:node (hooks/parse-string "(i18n/label :foo)")})
)
+4
View File
@@ -190,3 +190,7 @@ test/appium/tests/users.py
## git hooks
lefthook.yml
## clj-kondo
/.clj-kondo/taoensso/*
/.clj-kondo/babashka/*
+1
View File
@@ -7,3 +7,4 @@ modules
result
target
component-spec
/app
+1
View File
@@ -36,6 +36,7 @@
"deftest-sub" :arg1-body
"wait-for" :arg1-body
"with-deps-check" :arg1-body
"schema/=>" :arg1-body
"->" [:noarg1-body
{:list {:constant-pair? false :force-nl? false}
:next-inner-restore [[:list :constant-pair?]]}]
+8 -5
View File
@@ -274,11 +274,11 @@ run-re-frisk: ##@run Start re-frisk server
# TODO: Migrate this to a Nix recipe, much the same way as nix/mobile/android/targets/release-android.nix
run-android: export TARGET := android
# INFO: If it's empty (no devices attached, parsing issues, script error) - for Nix it's the same as not set.
run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_arch.sh)
run-android: export ANDROID_ABI_INCLUDE ?= $(shell ./scripts/adb_devices_abis.sh)
run-android: ##@run Build Android APK and start it on the device
npx react-native run-android --appIdSuffix debug
SIMULATOR=iPhone 11 Pro
SIMULATOR=iPhone 13
run-ios: export TARGET := ios
run-ios: export IOS_STATUS_GO_TARGETS := iossimulator/amd64
run-ios: ##@run Build iOS app and start it in a simulator/device
@@ -311,11 +311,14 @@ endef
lint: export TARGET := clojure
lint: export CLJ_LINTER_PRINT_WARNINGS ?= false
lint: ##@test Run code style checks
@sh scripts/lint-re-frame-in-quo-components.sh && \
@sh scripts/lint/re-frame-in-quo-components.sh && \
sh scripts/lint/direct-require-component-outside-quo.sh && \
sh scripts/lint/require-i18n-resource-first.sh && \
clj-kondo --config .clj-kondo/config.edn --cache false --fail-level error --lint src $(if $(filter $(CLJ_LINTER_PRINT_WARNINGS),true),,| grep -v ': warning: ') && \
ALL_CLOJURE_FILES=$(call find_all_clojure_files) && \
scripts/lint/translations.clj && \
zprint '{:search-config? true}' -sfc $$ALL_CLOJURE_FILES && \
sh scripts/lint-trailing-newline.sh && \
sh scripts/lint/trailing-newline.sh && \
node_modules/.bin/prettier --write .
# NOTE: We run the linter twice because of https://github.com/kkinnear/zprint/issues/271
@@ -325,7 +328,7 @@ lint-fix: ##@test Run code style checks and fix issues
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
zprint '{:search-config? true}' -sw $$ALL_CLOJURE_FILES && \
clojure-lsp --ns-exclude-regex ".*/src/status_im2/core\.cljs$$" clean-ns && \
sh scripts/lint-trailing-newline.sh --fix && \
sh scripts/lint/trailing-newline.sh --fix && \
node_modules/.bin/prettier --write .
shadow-server: export TARGET := clojure
-1
View File
@@ -77,7 +77,6 @@ pipeline {
}
}
stage('Upload') {
when { expression { !utils.isReleaseBuild() } }
steps { script {
env.DIAWI_URL = ios.uploadToDiawi()
env.PKG_URL = env.DIAWI_URL
+2
View File
@@ -26,6 +26,8 @@
[Creating a pixel perfect UI](pixel-perfection.md)
[Contributing to status-go](status-go-changes.md)
## Testing
[How to run local tests](testing.md)
+1 -1
View File
@@ -23,7 +23,7 @@ setups and runs the test suite once.
setups and runs the test suite and watches for code changes will then retrigger the test suite.
## Writing Tests
New test files will need their namespace added to either the file "src/quo2/core_spec.cljs" or "src/status_im2/core_spec.cljs. These locations may update overtime but it is dependent on the entrypoint in shadow-cljs config discussed below.
New test files will need their namespace added to either the file "src/quo/core_spec.cljs" or "src/status_im2/core_spec.cljs. These locations may update overtime but it is dependent on the entrypoint in shadow-cljs config discussed below.
### Best practices
+1 -1
View File
@@ -4,7 +4,7 @@
![](images/export-icons/export-icons.gif)
1. Export from figma 2 pngs 2x and 3x put them in `./resources/images/icons`
1. Export from figma 2 pngs 2x and 3x put them in `./resources/images/icons2`
2. if necessary, rename file so that filename contains only lower case chars, e.g. `"Icon-Name@2x.png"` should be renamed to `"icon_name@2x.png"`.
3. In the app `icon_name.png` still can be accessed as `icon-name`, so in order to use can add the next code:
```clojure
+22 -22
View File
@@ -76,7 +76,7 @@ It's important to name functional components with `f-` prefix.
### Component props and API scheme to match Figma as closely as possible
Ideally, the prop names for components (particularly in quo2 Design System)
Ideally, the prop names for components (particularly in quo Design System)
should match the Figma properties as best as possible. This makes it easier for
the developer using that component to configure it correctly for the screen it
is being used on and avoids unnecessary overwrites and adjustments being made.
@@ -134,7 +134,7 @@ For example if Figma has sizes `:small`, `:medium` and `:large`
Prefer to define styles in a separate file named `style.cljs`, colocated with
the source file. For a real example, see
[src/quo2/components/record_audio/record_audio/style.cljs](../src/quo2/components/record_audio/record_audio/style.cljs).
[src/quo/components/record_audio/record_audio/style.cljs](../src/quo/components/record_audio/record_audio/style.cljs).
```clojure
;; bad
@@ -467,9 +467,9 @@ Prefer the pure version of `:json-rpc/call` (no callbacks).
### Registering event handlers
Register events with `re-frame.core/reg-event-fx` and follow [re-frame's best
Register events with `utils.re-frame/reg-event-fx` and follow [re-frame's best
practice](https://github.com/day8/re-frame/blob/39adca93673f334dc751ee2d99d340b51a9cc6db/docs/FAQs/BestPractice.md#use-the-fx-effect)
so use only `:db` and `:fx` effects. `rf/merge` is deprecated and should not be
so use only `:db` and `:fx` effects. `utils.re-frame/merge` and `utils.re-frame/defn` are deprecated and should not be
used in the new code in `src/status_im2/`. Don't use
`re-frame.core/reg-event-db`.
@@ -528,27 +528,27 @@ due to performance constraints.
(:preferred-name multiaccount)))
```
### Requiring quo2 components
### Requiring quo components
Consume `quo2` components from `quo2.core`, unless the namespace is also inside
the `quo2/` directory.
Consume `quo` components from `quo.core`, unless the namespace is also inside
the `quo/` directory.
```clojure
;; bad
(ns my-namespace
(:require [quo2.components.icon :as icon]))
(:require [quo.components.icon :as icon]))
(icon/icon :i/verified)
;; good
(ns my-namespace
(:require [quo2.core :as quo]))
(:require [quo.core :as quo]))
(quo/icon :i/verified)
;; also good because both namespaces are inside quo2/
(ns quo2.components.tabs.account-selector
(:require [quo2.components.markdown.text :as text]))
;; also good because both namespaces are inside quo/
(ns quo.components.tabs.account-selector
(:require [quo.components.markdown.text :as text]))
```
### Require/import
@@ -615,12 +615,12 @@ Use the appropriate keyword qualification/namespace.
```clojure
;; bad
(require '[quo2.components.icon :as icons])
(require '[quo.components.icon :as icons])
(icons/icon :main-icons2/verified)
;; good
(require '[quo2.core :as quo2])
(quo2/icon :i/verified)
(require '[quo.core :as quo])
(quo/icon :i/verified)
```
### Translations
@@ -695,7 +695,7 @@ First, the bird's-eye view with some example ClojureScript files:
src
├── js/
├── mocks/
├── quo2
├── quo
│ ├── components/
│ ├── foundations/
│ └── theme.cljs
@@ -716,7 +716,7 @@ src
- `src/js`: Raw Javascript files, e.g. React Native Reanimated worklets.
- `src/mocks`: Plumbing configuration to be able to run tests.
- `src/quo2/`: The component library for Status Mobile.
- `src/quo/`: The component library for Status Mobile. [Read more...](../src/quo/README.md)
- `src/react_native/`: Contains only low-level constructs to help React Native
work in tandem with Clojure(Script).
- `src/status_im2/`: Directory where we try to be as strict as possible about
@@ -728,7 +728,7 @@ src
of the directory tree. Just like directories named `utils`, their directory
nesting level communicates their applicable limits.
- `src/status_im2/common/components/`: Contains reusable components that are not
part of the design system (quo2).
part of the design system (quo).
- `src/status_im2/contexts/`: Contains [bounded contexts](#glossary), like
`browser/`, `messaging/`, etc. As much as possible, _bounded contexts_ should
not directly require each other's namespaces.
@@ -743,9 +743,9 @@ directory nesting level precisely indicates its boundaries. For example, a
`contexts/user_settings/utils/datetime.cljs` file communicates that it should
only be used in the `user_settings` context.
### src/quo2
### src/quo
The `src/quo2/` directory holds all components for the new design system. As
The `src/quo/` directory holds all components for the new design system. As
much as possible, its sub-directories and component names should reflect the
same language used by designers.
@@ -753,14 +753,14 @@ Even though the directory lives alongside the rest of the codebase, we should
think of it as an external entity that abstracts away particular Status domain
knowledge.
Components inside `src/quo2/` should not rely on re-frame, i.e. they should not
Components inside `src/quo/` should not rely on re-frame, i.e. they should not
dispatch events or use subscriptions.
Example structure:
```
src
└── quo2
└── quo
├── components
│ └── dropdown
│ ├── style.cljs
+9 -3
View File
@@ -1,16 +1,22 @@
# Pixel Perfection
The Status Mobile team aims to align the design implementation perfectly according to a given screens respective Figma design spec.
Currently the Figma Designs match up with an "iPhone 11 Pro" screen size.
Currently, the Figma Designs match up with both "iPhone 11 Pro" and "iPhone 13" screen size.
The Dimension reference for iPhone 11 Pro is 375 x 812 (width x height) and for iPhone 13 is 390 x 844.
To test your implementation is correct you can take the following steps
- Open a new Figma file so that you have write privileges.
- Copy in the component or screen from the Figma file.
- Using the "iPhone 11 Pro" simulator (it is the default now) you take a screenshot of your component and paste it into your Figma file.
- Using the "iPhone 11 Pro" or the "iPhone 13" simulator (it is the default now) you take a screenshot of your component and paste it into your Figma file.
- To get the right size, set your screenshot to width according to your simulator:
- for iPhone 13 set 390
- for iPhone 11 Pro set 375
- To get the right size, set your screenshot to width 375px
![](images/pixel-perfection/layer-width.png)
+5 -5
View File
@@ -30,23 +30,23 @@ You need to have an emulator like [AVD](https://developer.android.com/studio/run
#### Running on a simulator
We highly recommend using the `iPhone 11 Pro` simulator as its screen dimensions match with our design.
We highly recommend using either the `iPhone 11 Pro` or `iPhone 13` simulator as its screen dimensions match with our design.
If you have Xcode `v12.x` (and above) installed in your system, you need to follow the below steps to add `iPhone 11 Pro` simulator:
If you have Xcode `v12.x` (and above) installed in your system, you need to follow the below steps to add `iPhone 13` simulator:
1. Open Xcode
2. Menu `>` Window `>` Devices and Simulators
3. Tap `+` button on bottom left
4. Select **Device Type** as `iPhone 11 Pro`
4. Select **Device Type** as `iPhone 13`
5. Leave the **Simulator Name** empty and tap on **Create**
##### NOTE ⚠️
Running `make run-ios` will target `iPhone 11 Pro` by default.
Running `make run-ios` will target `iPhone 13` by default.
If you need to run on any other simulator, you can specify the simulator type by adding the `SIMULATOR` flag:
```sh
make run-ios SIMULATOR="iPhone 11 Pro"
make run-ios SIMULATOR="iPhone 13"
```
#### Running on a physical device
+31
View File
@@ -0,0 +1,31 @@
# How to make changes to status-go
## Overview
To make changes to status-go, the best approach is to first identify the issue/feature and the changes to be made directly in status-go.
For any bugs we want to most likely write a failing test in status-go, and make sure that it passes, before we test on mobile.
Once you are quite confident that the status-go code is ready to be tested on mobile, you can test it locally by running the following command:
```
env STATUS_GO_SRC_OVERRIDE={your-status-go-directory} make run-{android/ios}
```
This will recompile status-go and run status-mobile on your device with that updated status-go version.
Once you have tested the status-go changes locally and you think it's ready for a PR:
1) Create a PR in status-go
2) Point your local status-mobile branch to that PR by running the script:
```
scripts/update-status-go.sh {status-go-branch-name}
```
This will update `status-go-version.json`
Commit updated status-go-version.json and create a status-mobile PR
Once both PRs have been approved and are good to merge, you can follow the [merge guidelines](./merging-pr-process.md)
+1 -1
View File
@@ -765,7 +765,7 @@ SPEC CHECKSUMS:
RNLanguages: 962e562af0d34ab1958d89bcfdb64fafc37c513e
RNPermissions: ad71dd4f767ec254f2cd57592fbee02afee75467
RNReactNativeHapticFeedback: 2566b468cc8d0e7bb2f84b23adc0f4614594d071
RNReanimated: 62e43ee6baafb9ba3d3af1857d7fd23a1d41bff0
RNReanimated: 42f56dc5c032a11177b9ea12cdb57285318b432e
RNShare: d82e10f6b7677f4b0048c23709bd04098d5aee6c
RNStaticSafeAreaInsets: 055ddbf5e476321720457cdaeec0ff2ba40ec1b8
RNSVG: 80584470ff1ffc7994923ea135a3e5ad825546b9
@@ -1194,21 +1194,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
return getPublicStorageDirectory().getAbsolutePath();
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String generateAlias(final String seed) {
return Statusgo.generateAlias(seed);
}
@ReactMethod
public void generateAliasAsync(final String seed, final Callback callback) throws JSONException {
executeRunnableStatusGoMethod(() -> Statusgo.generateAlias(seed), callback);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String identicon(final String seed) {
return Statusgo.identicon(seed);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String encodeTransfer(final String to, final String value) {
return Statusgo.encodeTransfer(to, value);
@@ -1269,31 +1254,6 @@ class StatusModule extends ReactContextBaseJavaModule implements LifecycleEventL
executeRunnableStatusGoMethod(() -> Statusgo.identicon(seed), callback);
}
@ReactMethod
public void generateAliasAndIdenticonAsync(final String seed, final Callback callback) {
Log.d(TAG, "generateAliasAndIdenticonAsync");
if (!checkAvailability()) {
callback.invoke(false);
return;
}
Runnable r = new Runnable() {
@Override
public void run() {
String resIdenticon = Statusgo.identicon(seed);
String resAlias = Statusgo.generateAlias(seed);
Log.d(TAG, resIdenticon);
Log.d(TAG, resAlias);
callback.invoke(resAlias, resIdenticon);
}
};
StatusThreadPoolExecutor.getInstance().execute(r);
}
@Override
public @Nullable
Map<String, Object> getConstants() {
@@ -880,10 +880,6 @@ RCT_EXPORT_METHOD(callRPC:(NSString *)payload
});
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(generateAlias:(NSString *)publicKey) {
return StatusgoGenerateAlias(publicKey);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(keystoreDir) {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSURL *rootUrl =[[fileManager
@@ -943,19 +939,6 @@ RCT_EXPORT_METHOD(initLogging:(BOOL)enabled
callback(@[initResult]);
}
RCT_EXPORT_METHOD(generateAliasAsync:(NSString *)publicKey
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"generateAliasAsync() method called");
#endif
NSString *result = StatusgoGenerateAlias(publicKey);
callback(@[result]);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(identicon:(NSString *)publicKey) {
return StatusgoIdenticon(publicKey);
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(encodeTransfer:(NSString *)to
value:(NSString *)value) {
return StatusgoEncodeTransfer(to,value);
@@ -1011,15 +994,6 @@ RCT_EXPORT_METHOD(validateMnemonic:(NSString *)seed
callback(@[result]);
}
RCT_EXPORT_METHOD(identiconAsync:(NSString *)publicKey
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"identiconAsync() method called");
#endif
NSString *result = StatusgoIdenticon(publicKey);
callback(@[result]);
}
RCT_EXPORT_METHOD(createAccountAndLogin:(NSString *)request) {
#if DEBUG
NSLog(@"createAccountAndLogin() method called");
@@ -1034,16 +1008,6 @@ RCT_EXPORT_METHOD(restoreAccountAndLogin:(NSString *)request) {
StatusgoRestoreAccountAndLogin(request);
}
RCT_EXPORT_METHOD(generateAliasAndIdenticonAsync:(NSString *)publicKey
callback:(RCTResponseSenderBlock)callback) {
#if DEBUG
NSLog(@"generateAliasAndIdenticonAsync() method called");
#endif
NSString *identiconResult = StatusgoIdenticon(publicKey);
NSString *aliasResult = StatusgoGenerateAlias(publicKey);
callback(@[aliasResult, identiconResult]);
}
RCT_EXPORT_METHOD(callPrivateRPC:(NSString *)payload
callback:(RCTResponseSenderBlock)callback) {
dispatch_async( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
@@ -354,38 +354,6 @@ void _StopCPUProfiling(const FunctionCallbackInfo<Value>& args) {
}
void _Identicon(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
if (args.Length() != 1) {
// Throw an Error that is passed back to JavaScript
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for Identicon")));
return;
}
// Check the argument types
if (!args[0]->IsString()) {
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'pk'")));
return;
}
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
char *arg0 = *arg0Obj;
// Call exported Go function, which returns a C string
char *c = Identicon(arg0);
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
args.GetReturnValue().Set(ret);
delete c;
}
void _EncodeTransfer(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
@@ -864,38 +832,6 @@ void _CreateAccountAndLogin(const FunctionCallbackInfo<Value>& args) {
}
void _GenerateAlias(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
if (args.Length() != 1) {
// Throw an Error that is passed back to JavaScript
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for GenerateAlias")));
return;
}
// Check the argument types
if (!args[0]->IsString()) {
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'pk'")));
return;
}
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
char *arg0 = *arg0Obj;
// Call exported Go function, which returns a C string
char *c = GenerateAlias(arg0);
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
args.GetReturnValue().Set(ret);
delete c;
}
void _ValidateMnemonic(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
@@ -1953,7 +1889,6 @@ void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "multiAccountStoreAccount", _MultiAccountStoreAccount);
NODE_SET_METHOD(exports, "initKeystore", _InitKeystore);
NODE_SET_METHOD(exports, "stopCPUProfiling", _StopCPUProfiling);
NODE_SET_METHOD(exports, "identicon", _Identicon);
NODE_SET_METHOD(exports, "encodeTransfer", _EncodeTransfer);
NODE_SET_METHOD(exports, "encodeFunctionCall", _EncodeFunctionCall);
NODE_SET_METHOD(exports, "decodeParameters", _DecodeParameters);
@@ -1968,7 +1903,6 @@ void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "resetChainData", _ResetChainData);
NODE_SET_METHOD(exports, "saveAccountAndLogin", _SaveAccountAndLogin);
NODE_SET_METHOD(exports, "createAccountAndLogin", _CreateAccountAndLogin);
NODE_SET_METHOD(exports, "generateAlias", _GenerateAlias);
NODE_SET_METHOD(exports, "validateMnemonic", _ValidateMnemonic);
NODE_SET_METHOD(exports, "multiformatSerializePublicKey", _MultiformatSerializePublicKey);
NODE_SET_METHOD(exports, "saveAccountAndLoginWithKeycard", _SaveAccountAndLoginWithKeycard);
+48 -12
View File
@@ -45,11 +45,20 @@
},
{
"path": "borkdude/edamame/1.1.17/edamame-1.1.17",
"path": "borkdude/dynaload/0.3.5/dynaload-0.3.5",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "9087f7abf0104e0354d7db7fc4576608eac558f4",
"sha256": "1n1872i240lakn4pzsag4grf7bv7lcsipmqllxd9m4k1zp3dgla1"
"sha1": "accd696ba364b850b4d92e38f5a34d0e828a0ad1",
"sha256": "0k62m1f29xfh3cp67w7kcvkp5aj35simi8kf95ycvkmgp76w11q8"
}
},
{
"path": "borkdude/edamame/1.3.23/edamame-1.3.23",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "254d023e97ed438f0f44532b5a06d928d031ede4",
"sha256": "0l7mxza2nimslhg0qh6jp7gmb8sd6l89fk5d1zvzq2xskscq2vly"
}
},
@@ -81,20 +90,20 @@
},
{
"path": "cider/cider-nrepl/0.29.0/cider-nrepl-0.29.0",
"path": "cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "45f6034b26a14138e74145b7a4059628c0fedcd1",
"sha256": "1dy1l6y8cb8xiqq97a4lf8giyiicq4wfl4s2lxn5fb6614cjxqx2"
"sha1": "5ae0efd9377a5e60c084bdaf4a2ce094f759ce23",
"sha256": "0drxf9nm23i1pcgrkwbcr09msq37csilzww38709add0hz8spjhq"
}
},
{
"path": "cider/piggieback/0.5.2/piggieback-0.5.2",
"path": "cider/piggieback/0.4.1/piggieback-0.4.1",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "ecfd5c286a85db3f059e75c37fca5722d9e26f79",
"sha256": "1ps9yf3cxmlm447hqkidjb5xry90n0wl3jk0jn28fagq31lzylkl"
"sha1": "0a02a3e2ecd7a126ab60d8a44793342f20ced79b",
"sha256": "142vl5np33akcrnn6pksi0rjfsmmi528villxsj6cwcndvybiw4m"
}
},
@@ -539,6 +548,24 @@
}
},
{
"path": "metosin/malli/0.13.0/malli-0.13.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "286c52d26a3a9d613b5f692971bd19c581cdc4b0",
"sha256": "0vaq9d6cln5j4ww302fwlgg7m647cf2j16gs2i1p1d4klbn4jddz"
}
},
{
"path": "mvxcvi/arrangement/2.1.0/arrangement-2.1.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "1bc8f3bba7a28de85f319b7d464aa8d955f44918",
"sha256": "1j1rkwrs4wm8zk9v7ilgpnyav5sipdd2bmb83sazh392blw52wpk"
}
},
{
"path": "net/cgrand/macrovich/0.2.1/macrovich-0.2.1",
"host": "https://repo.clojars.org",
@@ -728,6 +755,15 @@
}
},
{
"path": "org/clojure/test.check/1.1.1/test.check-1.1.1",
"host": "https://repo1.maven.org/maven2",
"jar": {
"sha1": "f33d988fd57bc9c11af1952db81c10f319c91416",
"sha256": "0y2hpkj7zl4yrpsl35ifpdaja5c72b8fpjcnmdgmld9c7cb1hlcl"
}
},
{
"path": "org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0",
"host": "https://repo1.maven.org/maven2",
@@ -909,11 +945,11 @@
},
{
"path": "refactor-nrepl/refactor-nrepl/3.6.0/refactor-nrepl-3.6.0",
"path": "refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0",
"host": "https://repo.clojars.org",
"jar": {
"sha1": "2b3bb82da53b5db9c2b2aa298417816b81d0ed97",
"sha256": "1ysqabmlnghki6x0636zngxza2d83c85276wp9ma9wk183mkv52a"
"sha1": "6bc3441afc94f7ca024e41a864ca75e05df7e207",
"sha256": "0w8hax99y98l53mixxzx2ja0vcnhjv8dnsaz1zj3vqk775ns5w6i"
}
},
+8 -4
View File
@@ -3,12 +3,13 @@ babashka/fs/0.2.16/fs-0.2.16.jar
bidi/bidi/2.1.6/bidi-2.1.6.jar
binaryage/env-config/0.2.2/env-config-0.2.2.jar
binaryage/oops/0.7.2/oops-0.7.2.jar
borkdude/edamame/1.1.17/edamame-1.1.17.jar
borkdude/dynaload/0.3.5/dynaload-0.3.5.jar
borkdude/edamame/1.3.23/edamame-1.3.23.jar
borkdude/sci.impl.reflector/0.0.1/sci.impl.reflector-0.0.1.jar
camel-snake-kebab/camel-snake-kebab/0.4.3/camel-snake-kebab-0.4.3.jar
cheshire/cheshire/5.11.0/cheshire-5.11.0.jar
cider/cider-nrepl/0.29.0/cider-nrepl-0.29.0.jar
cider/piggieback/0.5.2/piggieback-0.5.2.jar
cider/cider-nrepl/0.25.3/cider-nrepl-0.25.3.jar
cider/piggieback/0.4.1/piggieback-0.4.1.jar
clj-kondo/clj-kondo/2023.09.07/clj-kondo-2023.09.07.jar
cljs-bean/cljs-bean/1.9.0/cljs-bean-1.9.0.jar
clout/clout/2.1.2/clout-2.1.2.jar
@@ -58,6 +59,8 @@ javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar
javax/servlet/servlet-api/2.5/servlet-api-2.5.jar
javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar
medley/medley/0.8.2/medley-0.8.2.jar
metosin/malli/0.13.0/malli-0.13.0.jar
mvxcvi/arrangement/2.1.0/arrangement-2.1.0.jar
net/cgrand/macrovich/0.2.1/macrovich-0.2.1.jar
net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar
nrepl/bencode/1.1.0/bencode-1.1.0.jar
@@ -79,6 +82,7 @@ org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar
org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar
org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar
org/clojure/spec.alpha/0.3.218/spec.alpha-0.3.218.jar
org/clojure/test.check/1.1.1/test.check-1.1.1.jar
org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar
org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar
org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar
@@ -99,7 +103,7 @@ org/wildfly/common/wildfly-common/1.5.2.Final/wildfly-common-1.5.2.Final.jar
prismatic/schema/1.1.7/schema-1.1.7.jar
reagent/reagent/1.2.0/reagent-1.2.0.jar
re-com/re-com/2.8.0/re-com-2.8.0.jar
refactor-nrepl/refactor-nrepl/3.6.0/refactor-nrepl-3.6.0.jar
refactor-nrepl/refactor-nrepl/2.5.0/refactor-nrepl-2.5.0.jar
re-frame/re-frame/1.3.0/re-frame-1.3.0.jar
re-frisk-remote/re-frisk-remote/1.6.0/re-frisk-remote-1.6.0.jar
re-frisk/sente/1.15.0/sente-1.15.0.jar
+6 -3
View File
@@ -67,9 +67,12 @@ stdenv.mkDerivation {
'';
buildPhase = ''
# Assemble CLASSPATH from available clojure dependencies.
# We append 'src' so it can find the local sources.
export CLASS_PATH="$(find ${deps.clojure} \
-iname '*.jar' | tr '\n' ':')src"
# We prepend 'src' so it can find the local sources and prioritize
# our own namespaces over dependencies, given that indirect dependencies
# can also cause naming conflicts (e.g. prismatic/schema already uses
# namespace schema.core).
export CLASS_PATH="src:$(find ${deps.clojure} \
-iname '*.jar' | tr '\n' ':')"
# target must be one of the builds defined in shadow-cljs.edn
java -cp "$CLASS_PATH" clojure.main \
+1 -1
View File
@@ -21,7 +21,7 @@ let
buildInputs = with pkgs; [
clojure flock maven openjdk
# lint specific utilities
clj-kondo zprint clojure-lsp
babashka clj-kondo clojure-lsp ripgrep zprint
];
# CLASSPATH from clojure deps with 'src' appended to find local sources.
shellHook = with pkgs; ''
+2 -1
View File
@@ -12,7 +12,7 @@
"@react-native-async-storage/async-storage": "^1.17.9",
"@react-native-camera-roll/camera-roll": "git+https://github.com/status-im/react-native-camera-roll.git#refs/tags/v5.1.1.1",
"@react-native-community/audio-toolkit": "git+https://github.com/tbenr/react-native-audio-toolkit.git#refs/tags/v2.0.3-status-v6",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur#refs/tags/v4.3.3-status",
"@react-native-community/blur": "git+https://github.com/status-im/react-native-blur.git#refs/tags/v4.3.3-status",
"@react-native-community/clipboard": "^1.2.2",
"@react-native-community/hooks": "^3.0.0",
"@react-native-community/masked-view": "^0.1.6",
@@ -47,6 +47,7 @@
"react-native-image-crop-picker": "git+https://github.com/status-im/react-native-image-crop-picker.git#refs/tags/v0.36.2-status.0",
"react-native-image-resizer": "^1.2.3",
"react-native-image-viewing": "git+https://github.com/status-im/react-native-image-viewing.git#refs/tags/v0.2.1.status",
"react-native-intersection-observer": "^0.2.0",
"react-native-keychain": "git+https://github.com/status-im/react-native-keychain.git#refs/tags/v.3.0.0-5-status",
"react-native-languages": "^3.0.2",
"react-native-linear-gradient": "^2.8.0",
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

+14
View File
@@ -0,0 +1,14 @@
#!/usr/bin/env sh
# quo components namespace ends with style|utils|types|reaction-resource
# are not the component view, they are usually utils fns or styles
if rg --pcre2 --glob '!src/quo/**/*' 'quo\.components(\.[\w-]+)*\.[\w-]*(?<!style|utils|types|reaction-resource)(\s|\]|\n)' src; then
echo "Found above direct require of quo component outside src/quo/"
echo "For more info, check the style guide https://github.com/status-im/status-mobile/blob/develop/doc/new-guidelines.md#requiring-quo-components"
exit 1
elif [ $? -eq 1 ]; then
exit 0
else
exit $?
fi
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env sh
if rg --quiet --multiline '^\(ns.*\n^\s*\(:require\n(^\s*(;|#_).*\n)*(^\s*\[status-im2\.setup\.i18n-resources\W)' src/status_im2/core.cljs; then
exit 0
elif [ $? -eq 1 ]; then
echo "status-im2.setup.i18n-resources must be loaded first (be the first one in ns :require form) in status-im2.core"
echo "For more info, check the comment here https://github.com/status-im/status-mobile/pull/17618#discussion_r1361275489"
else
exit $?
fi
+98
View File
@@ -0,0 +1,98 @@
#!/usr/bin/env bb
(ns lint-translations
(:require [babashka.pods :as pods]))
(pods/load-pod 'clj-kondo/clj-kondo "2023.09.07")
(require '[pod.borkdude.clj-kondo :as kondo])
(require '[cheshire.core :as json])
(require '[clojure.set :as set])
(def src-paths ["src"])
(def translation-file "translations/en.json")
;; set the following to true when solving https://github.com/status-im/status-mobile/issues/17811
(def flag-show-non-namespaced-translation-keys false)
(def flag-show-non-namespaced-translation-keys-occurrences false) ;; this makes the output super verbose!
;; set the following to true when solving https://github.com/status-im/status-mobile/issues/17813
;; and keep it permanently on after #17811 and #17813 have both been solved
(def flag-show-unused-translation-keys false)
(def flag-show-missing-translation-keys true)
(defn- safe-name
[x]
(when x (name x)))
(defn- ->keyword
[analysis-keyword]
(keyword (safe-name (:ns analysis-keyword)) (:name analysis-keyword)))
(defn- report-issues
[incorrect-usages]
(doseq [incorrect-usage incorrect-usages]
(->> incorrect-usage
((juxt :filename :row :reason ->keyword))
(apply format "%s:%s %s %s")
println)))
(defn- extract-translation-keys
[file]
(-> file slurp json/parse-string keys))
(def ^:private probably-unused-warning
(format "Probably unused translation key in %s:" translation-file))
(defn -main
[& _args]
(println "Linting translations...")
(let [result (kondo/run!
{:lint src-paths
:config {:output {:analysis {:keywords true}}}})
all-keywords (get-in result [:analysis :keywords])
used-translations (filter (comp (partial = 't) :ns) all-keywords)
file-translation-keys (apply sorted-set (extract-translation-keys translation-file))
missing-translations (remove (comp file-translation-keys :name) used-translations)
used-translation-keys (set (map :name used-translations))
possibly-unused-translation-keys (set/difference file-translation-keys used-translation-keys)
non-namespaced-translations (filter
(fn [kw]
(and (not (:ns kw))
(possibly-unused-translation-keys (:name kw))))
all-keywords)
unused-translation-keys (set/difference possibly-unused-translation-keys
(set (map :name non-namespaced-translations)))]
;; TODO (2023-11-06 akatov): delete the following once #17811 and #17813 have both been solved
(doseq [k (apply sorted-set (map :name non-namespaced-translations))]
(when flag-show-non-namespaced-translation-keys
(println "Probably non-namespaced key" k))
(when flag-show-non-namespaced-translation-keys-occurrences
(->> non-namespaced-translations
(filter #(= k (:name %)))
(map #(assoc % :reason "Possibly non-namespaced translation key"))
report-issues)))
(when flag-show-unused-translation-keys
(run! #(println probably-unused-warning %) unused-translation-keys))
(when flag-show-missing-translation-keys
(report-issues (map #(assoc % :reason "Undefined Translation Key") missing-translations)))
(if (and
(or (not flag-show-missing-translation-keys)
(empty? missing-translations))
(or (not flag-show-unused-translation-keys)
(empty? possibly-unused-translation-keys))
(or (not flag-show-non-namespaced-translation-keys)
(not flag-show-non-namespaced-translation-keys-occurrences)
(empty? unused-translation-keys)))
0
1)))
(when (= *file* (System/getProperty "babashka.file"))
(->> *command-line-args*
(apply -main)
System/exit))
+18 -2
View File
@@ -9,6 +9,7 @@
[cljs-bean "1.9.0"]
[com.cognitect/transit-cljs "0.8.280"]
[camel-snake-kebab "0.4.3"]
[metosin/malli "0.13.0"]
;; Dev dependencies
[refactor-nrepl "2.5.0"]
@@ -50,6 +51,7 @@
:after-load-async status-im2.setup.hot-reload/reload
:build-notify status-im2.setup.hot-reload/build-notify
:preloads [re-frisk-remote.preload
status-im2.setup.schema-preload
;; In order to use component test helpers in the REPL we
;; need to preload namespaces that are not normally required
;; by production code, such as
@@ -71,6 +73,10 @@
:warnings {:fn-deprecated false}
:closure-defines {re-frame.trace/trace-enabled? true}
:source-map false
;; This seems to be necessary while using the REPL,
;; otherwise sometimes you'll get weird errors when
;; instrumenting functions.
:static-fns false
:infer-externs true}
;; if you want to use a real device, set your local ip
;; in the SHADOW_HOST env variable to make sure that
@@ -104,13 +110,15 @@
:output-dir "target/test"
:optimizations :simple
:target :node-test
:dev {:devtools {:preloads [status-im2.setup.schema-preload]}}
;; Uncomment line below to `make test-watch` a specific file
;; :ns-regexp "status-im2.subs.messages-test$"
:main status-im.test-runner/main
;; set :ui-driven to true to let shadow-cljs inject node-repl
:ui-driven true
:closure-defines
{status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
{schema.core/throw-on-error? true
status-im2.config/POKT_TOKEN #shadow/env "POKT_TOKEN"
status-im2.config/INFURA_TOKEN #shadow/env "INFURA_TOKEN"
status-im2.config/OPENSEA_API_KEY #shadow/env "OPENSEA_API_KEY"
status-im2.config/ALCHEMY_ARBITRUM_GOERLI_TOKEN #shadow/env "ALCHEMY_ARBITRUM_GOERLI_TOKEN"
@@ -139,9 +147,17 @@
:compiler-options {:optimizations :simple
:source-map false}}
:component-test {:target :npm-module
:entries [quo.core-spec status-im2.core-spec]
:entries [;; We need to tell shadow-cljs to compile
;; the preloads namespace because it will
;; be used directly by Jest in the option
;; setupFilesAfterEnv.
status-im2.setup.schema-preload
quo.core-spec
status-im2.core-spec]
:ns-regexp "component-spec$"
:output-dir "component-spec"
:closure-defines {schema.core/throw-on-error? true}
:compiler-options {:warnings-as-errors false
:static-fns false
:infer-externs true}}}}
+7
View File
@@ -49,6 +49,7 @@
:Text {}
:StatusBar {}
:ScrollView {}
:SafeAreaView {}
:KeyboardAvoidingView {}
:TextInput {}
:Image {}
@@ -300,6 +301,11 @@
{:clamp nil
:withPause (fn [])})
(def react-native-intersection-observer
#js
{:InView #js {}
:IOFlatList #js {}})
(def react-native-languages
(clj->js {:default {:language "en"
:addEventListener (fn [])
@@ -426,6 +432,7 @@
"react-native-transparent-video" react-native-transparent-video
"react-native-orientation-locker" react-native-orientation-locker
"react-native-gifted-charts" react-native-gifted-charts
"react-native-intersection-observer" react-native-intersection-observer
"../resources/data/emojis/en.json" (js/JSON.parse (slurp
"./resources/data/emojis/en.json"))
"../src/js/worklets/core.js" worklet-factory
+1 -21
View File
@@ -4,8 +4,7 @@
[clojure.string :as string]
[react-native.platform :as platform]
[taoensso.timbre :as log]
[utils.transforms :as types]
[utils.validators :as validators]))
[utils.transforms :as types]))
(defn status
[]
@@ -431,19 +430,6 @@
;; in unknown scenarios we also consider the device rooted to avoid degrading security
:else (callback true)))
(defn generate-gfycat
"Generate a 3 words random name based on the user public-key, synchronously"
[public-key]
(log/debug "[native-module] generate-gfycat")
(when (validators/valid-public-key? public-key)
(.generateAlias ^js (status) public-key)))
(defn identicon
"Generate a icon based on a string, synchronously"
[seed]
(log/debug "[native-module] identicon")
(.identicon ^js (status) seed))
(defn encode-transfer
[to-norm amount-hex]
(log/debug "[native-module] encode-transfer")
@@ -501,12 +487,6 @@
(log/debug "[native-module] to-checksum-address")
(.toChecksumAddress ^js (status) address))
(defn gfycat-identicon-async
"Generate an icon based on a string and 3 words random name asynchronously"
[seed callback]
(log/debug "[native-module] gfycat-identicon-async")
(.generateAliasAndIdenticonAsync ^js (status) seed callback))
(defn validate-mnemonic
"Validate that a mnemonic conforms to BIP39 dictionary/checksum standards"
[mnemonic callback]
+11
View File
@@ -116,6 +116,17 @@ rendered. We use [React Native Testing Library](https://callstack.github.io/reac
There are dozens of examples in the repository, so use them as a reference. A
good and complete example is [quo.components.avatars.user-avatar.component-spec](/src/quo/components/avatars/user_avatar/component_spec.cljs)
### No-props test
When writing tests for the component that has props, please add one test that covers situation when props aren't passed. Because even if component not showing anything meaningful without props, it shouldn't crash.
```clojure
(h/describe "Transaction Progress"
(h/test "component renders without props"
(h/render [quo/transaction-progress {}])
(h/is-truthy (h/get-by-label-text :transaction-progress)))
```
## Do not couple the library with re-frame
Don't use re-frame inside this library (e.g. dispatch & subscribe). If a
@@ -2,7 +2,7 @@
(:require
[oops.core :as oops]
[quo.components.animated-header-flatlist.style :as style]
[quo.core :as quo]
[quo.components.icon :as icon]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
@@ -73,11 +73,11 @@
{:active-opacity 1
:on-press back-button-on-press
:style (style/button-container {:left 20 :theme theme})}
[quo/icon :i/arrow-left {:size 20 :color (colors/theme-colors colors/black colors/white theme)}]]
[icon/icon :i/arrow-left {:size 20 :color (colors/theme-colors colors/black colors/white theme)}]]
[rn/touchable-opacity
{:active-opacity 1
:style (style/button-container {:right 20 :theme theme})}
[quo/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white theme)}]]
[icon/icon :i/options {:size 20 :color (colors/theme-colors colors/black colors/white theme)}]]
[reanimated/blur-view
{:blurAmount 32
:blurType :light
@@ -30,6 +30,6 @@
{:accessibility-label :account-emoji
:adjusts-font-size-to-fit true
:style {:font-size emoji-size}}
(string/trim emoji)]]))
(when emoji (string/trim emoji))]]))
(def view (quo.theme/with-theme view-internal))
@@ -67,7 +67,7 @@
[rn/text
{:style (style/emoji-size size)
:accessibility-label :emoji}
(string/trim emoji)])
(when emoji (string/trim emoji))])
[lock locked? size theme]])
(def view (quo.theme/with-theme view-internal))
@@ -1,68 +0,0 @@
(ns quo.components.avatars.wallet-user-avatar
(:require
[clojure.string :as string]
[quo.components.markdown.text :as text]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]))
(def circle-sizes
{:small 20
:medium 32
:large 48
:size-64 64
:x-large 80})
(def font-sizes
{:small :label
:medium :paragraph-2
:large :paragraph-1
:size-64 :heading-1
:x-large :heading-1})
(def font-weights
{:small :medium
:medium :semi-bold
:large :semi-bold
:size-64 :medium
:x-large :medium})
(defn- view-internal
"params, first name, last name, customization-color, size
and if it's dark or not!"
[{:keys [f-name l-name customization-color size theme monospace? uppercase?]
:or {f-name "John"
l-name "Doe"
size :x-large
uppercase? true}}]
(let [circle-size (size circle-sizes)
small? (= size :small)
f-name-initial (-> f-name
(#(if uppercase? (string/upper-case %) %))
(subs 0 1))
l-name-initial (-> l-name
(#(if uppercase? (string/upper-case %) %))
(subs 0 1))
circle-color (if customization-color
(colors/resolve-color customization-color theme 20)
(colors/theme-colors colors/neutral-80-opa-5 colors/white-opa-5 theme))
text-color (if customization-color
(colors/resolve-color customization-color theme)
(colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme))]
[rn/view
{:style {:width circle-size
:height circle-size
:border-radius circle-size
:text-align :center
:justify-content :center
:align-items :center
:background-color circle-color}}
[text/text
{:size (size font-sizes)
:weight (if monospace? :monospace (size font-weights))
:style {:color text-color}}
(if small?
(str f-name-initial)
(str f-name-initial l-name-initial))]]))
(def wallet-user-avatar (quo.theme/with-theme view-internal))
@@ -0,0 +1,16 @@
(ns quo.components.avatars.wallet-user-avatar.component-spec
(:require [quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar]
[test-helpers.component :as h]))
(h/describe "wallet user avatar"
(h/describe "View internal"
(h/test "Renders by default even with no input parameters"
(h/render
[wallet-user-avatar/wallet-user-avatar {}])
(h/is-truthy (h/query-by-label-text :wallet-user-avatar)))
(h/test "Renders users initials when full name is provided"
(h/render
[wallet-user-avatar/wallet-user-avatar {:full-name "Jane Smith"}])
(h/is-truthy (h/get-by-text "JS")))))
@@ -0,0 +1,31 @@
(ns quo.components.avatars.wallet-user-avatar.style
(:require [quo.foundations.colors :as colors]))
(defn- circle-color
[customization-color neutral? theme]
(if neutral?
(colors/theme-colors colors/neutral-80-opa-5 colors/white-opa-5 theme)
(colors/custom-color customization-color 50 20)))
(defn- text-color
[customization-color neutral? theme]
(if neutral?
(colors/theme-colors colors/neutral-80-opa-70 colors/white-opa-70 theme)
(colors/theme-colors
(colors/custom-color customization-color 50)
(colors/custom-color customization-color 60)
theme)))
(defn container
[circle-size customization-color neutral? theme]
{:width circle-size
:height circle-size
:border-radius circle-size
:text-align :center
:justify-content :center
:align-items :center
:background-color (circle-color customization-color neutral? theme)})
(defn text
[customization-color neutral? theme]
{:color (text-color customization-color neutral? theme)})
@@ -0,0 +1,61 @@
(ns quo.components.avatars.wallet-user-avatar.view
(:require [clojure.string :as string]
[quo.components.avatars.wallet-user-avatar.style :as style]
[quo.components.markdown.text :as text]
[quo.theme :as quo.theme]
[react-native.core :as rn]
utils.string))
(def properties
{:size-20 {:size 20
:font-size :label
:font-weight :medium}
:size-24 {:size 24
:font-size :label
:font-weight :semi-bold}
:size-32 {:size 32
:font-size :paragraph-2
:font-weight :semi-bold}
:size-48 {:size 48
:font-size :paragraph-1
:font-weight :semi-bold}
:size-64 {:size 64
:font-size :paragraph-1
:font-weight :medium}
:size-80 {:size 80
:font-size :heading-1
:font-weight :medium}})
(def smallest-possible (first (keys properties)))
(def second-smallest-possible (second (keys properties)))
(defn check-if-size-small
[size]
(or (= size smallest-possible)
(= size second-smallest-possible)))
(def biggest-possible (last (keys properties)))
(defn- view-internal
"Options:
:full-name - string (default: nil) - used to generate initials
:customization-color - keyword (default: nil) - color of the avatar
:size - keyword (default: last element of properties object) - size of the
avatar
:monospace? - boolean (default: false) - use monospace font
:lowercase? - boolean (default: false) - lowercase text
:neutral? - boolean (default: false) - use neutral colors variant"
[{:keys [full-name customization-color size theme monospace? lowercase? neutral?]
:or {size biggest-possible}}]
(let [circle-size (:size (size properties))
small? (check-if-size-small size)
initials (utils.string/get-initials full-name (if small? 1 2))]
[rn/view
{:style (style/container circle-size customization-color neutral? theme)}
[text/text
{:accessibility-label :wallet-user-avatar
:size (:font-size (size properties))
:weight (if monospace? :monospace (:font-weight (size properties)))
:style (style/text customization-color neutral? theme)}
(if (and initials lowercase?) (string/lower-case initials) initials)]]))
(def wallet-user-avatar (quo.theme/with-theme view-internal))
@@ -1,3 +1,3 @@
(ns quo.components.colors.color.constants)
(def ^:const IPHONE_11_PRO_VIEWPORT_WIDTH 375)
(def ^:const color-size 48)
+3 -2
View File
@@ -1,12 +1,13 @@
(ns quo.components.colors.color.style
(:require
[quo.components.colors.color.constants :as constants]
[quo.foundations.colors :as colors]
[utils.responsiveness :as responsiveness]))
(defn color-button-common
[window-width]
{:width 48
:height 48
{:width constants/color-size
:height constants/color-size
:border-width 4
:border-radius 24
:margin-right (-> window-width
@@ -5,10 +5,6 @@
[test-helpers.component :as h]))
(h/describe "color-picker"
(h/test "color picker rendered"
(h/render [color-picker/view])
(-> (h/expect (h/get-all-by-label-text :color-picker-item))
(.toHaveLength 11)))
(h/test "clicks on a color item"
(let [event (h/mock-fn)]
(h/render [color-picker/view {:on-change #(event)}])
@@ -20,11 +16,6 @@
(h/render [color-picker/view {:on-change #(reset! selected %)}])
(h/fire-event :press (get (h/get-all-by-label-text :color-picker-item) 0))
(-> (h/expect @selected)
(.toStrictEqual :blue))))
(h/test "all of the values of colors-list are rendered"
(h/render [color-picker/view])
(js/Promise.all (map (fn [color]
(h/is-truthy (h/get-all-by-label-text color)))
color-picker/color-list))))
(.toStrictEqual :blue)))))
@@ -1,39 +1,67 @@
(ns quo.components.colors.color-picker.view
(:require
[quo.components.colors.color.constants :as constants]
[quo.components.colors.color.view :as color]
[quo.foundations.colors :as colors]
[react-native.core :as rn]
[reagent.core :as reagent]))
(def color-list
[:blue :yellow :purple :turquoise :magenta :sky :orange :army :flamingo :camel :copper])
(defn- on-change-handler
[selected color-name on-change]
(reset! selected color-name)
(when on-change (on-change color-name)))
(defn view
(defn get-item-layout
[_ index]
#js
{:length constants/color-size
:offset (* (+ constants/color-size 8) index)
:index index})
(defn- view-internal
"Options
- `default-selected` Default selected color name.
- `on-change` Callback called when a color is selected `(fn [color-name])`.
- `blur?` Boolean to enable blur background support.}"
[{:keys [default-selected]}]
[{:keys [default-selected blur? on-change feng-shui? container-style]}]
(let [selected (reagent/atom default-selected)
{window-width :width} (rn/get-window)]
(fn [{:keys [blur? on-change feng-shui? container-style]}]
[rn/scroll-view
{:horizontal true
:shows-horizontal-scroll-indicator false
:content-container-style container-style}
(doall (map-indexed (fn [idx color]
[color/view
{:selected? (= color @selected)
:on-press #(on-change-handler selected % on-change)
:blur? blur?
:key color
:color color
:idx idx
:window-width window-width}])
;; TODO: using :feng-shui? temporarily while b & w is being developed.
;; https://github.com/status-im/status-mobile/discussions/16676
(if feng-shui? (conj color-list :feng-shui) color-list)))])))
{window-width :width} (rn/get-window)
ref (atom nil)]
(rn/use-effect #(js/setTimeout (fn []
(.scrollToIndex ^js @ref
#js
{:animated true
:index (.indexOf colors/account-colors
default-selected)
:viewPosition 0.5}))
50))
[rn/flat-list
{:ref #(reset! ref %)
;; TODO: using :feng-shui? temporarily while b & w is being developed.
;; https://github.com/status-im/status-mobile/discussions/16676
:data (if feng-shui?
(conj colors/account-colors :feng-shui)
colors/account-colors)
:render-fn (fn [color idx]
[color/view
{:selected? (= color @selected)
:on-press (fn [e]
(.scrollToIndex ^js @ref
#js
{:animated true
:index idx
:viewPosition 0.5})
(on-change-handler selected e on-change))
:blur? blur?
:key color
:color color
:idx idx
:window-width window-width}])
:get-item-layout get-item-layout
:horizontal true
:shows-horizontal-scroll-indicator false
:content-container-style container-style}]))
(defn view
[props]
[:f> view-internal props])
@@ -0,0 +1,18 @@
(ns quo.components.community.community-stat.component-spec
(:require
[quo.core :as quo]
[test-helpers.component :as h]
utils.money))
(h/describe "Community Stat Component"
(h/test "default render"
(h/render [quo/community-stat
{:value "5000"
:icon :i/active-members
:accessibility-label :community-active-members}])
(h/is-truthy (h/query-by-label-text :community-active-members)))
(h/test "renders community stat with a value"
(h/render [quo/community-stat
{:value "5000"
:icon :i/members}])
(h/is-truthy (h/query-by-text (utils.money/format-amount "5000")))))
@@ -0,0 +1,12 @@
(ns quo.components.community.community-stat.style
(:require [quo.foundations.colors :as colors]))
(def container
{:flex-direction :row
:align-items :center
:height 22})
(defn text
[theme]
{:color (colors/theme-colors colors/black colors/white theme)
:margin-left 2})
@@ -0,0 +1,26 @@
(ns quo.components.community.community-stat.view
(:require [quo.components.community.community-stat.style :as style]
[quo.components.icon :as quo.icons]
[quo.components.markdown.text :as quo.text]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
utils.money))
(defn view-internal
[{:keys [value icon theme style accessibility-label]}]
[rn/view
{:style (merge style/container style)
:accessibility-label accessibility-label}
[quo.icons/icon icon
{:size 16
:container-style {:align-items :center
:justify-content :center}
:resize-mode :center
:color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)}]
[quo.text/text
{:size :paragraph-1
:weight :regular
:style (style/text theme)} (utils.money/format-amount value)]])
(def view (quo.theme/with-theme view-internal))
@@ -1,52 +1,30 @@
(ns quo.components.community.community-view
(:require
[quo.components.community.community-stat.view :as community-stat]
[quo.components.community.style :as style]
[quo.components.icon :as icons]
[quo.components.markdown.text :as text]
[quo.components.tags.permission-tag :as permission]
[quo.components.tags.tag :as tag]
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[react-native.core :as rn]
[react-native.gesture :as gesture]
utils.money))
(defn community-stats
[{:keys [icon members-count icon-color accessibility-label]}]
[rn/view
{:accessibility-label accessibility-label
:style (style/stats-count-container)}
[rn/view {:margin-right 2}
[icons/icon icon
{:container-style {:align-items :center
:justify-content :center}
:resize-mode :center
:size 16
:color icon-color}]]
[text/text
{:weight :regular
:size :paragraph-2}
members-count]])
[react-native.gesture :as gesture]))
(defn community-stats-column
[{:keys [type theme blur? members-count active-count]}]
(let [icon-color (if (and (= :dark theme) blur?)
colors/white-opa-40
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme))]
[rn/view
(if (= type :card-view)
(style/card-stats-container)
(style/list-stats-container))
[community-stats
{:accessibility-label :stats-members-count
:icon :i/group
:members-count (utils.money/format-amount members-count)
:icon-color icon-color}]
[community-stats
{:accessibility-label :stats-active-count
:icon :i/active-members
:members-count (utils.money/format-amount active-count)
:icon-color icon-color}]]))
[{:keys [type members-count active-count]}]
[rn/view
(if (= type :card-view)
(style/card-stats-container)
(style/list-stats-container))
[community-stat/view
{:accessibility-label :stats-members-count
:icon :i/group
:value members-count
:style {:margin-right 12}}]
[community-stat/view
{:accessibility-label :stats-active-count
:icon :i/active-members
:value active-count}]])
(defn community-tags
[{:keys [tags container-style last-item-style]}]
-6
View File
@@ -17,12 +17,6 @@
(def detail-container
{:flex 1})
(defn stats-count-container
[]
{:flex-direction :row
:align-items :center
:margin-right 16})
(defn card-stats-container
[]
{:flex-direction :row})
@@ -3,18 +3,22 @@
[quo.components.counter.step.view :as step]
[test-helpers.component :as h]))
(defn render
[component]
(h/render-with-theme-provider component :dark))
(h/describe "step component"
(h/test "default render of step component"
(h/render [step/view {} nil])
(render [step/view {} nil])
(-> (h/expect (h/query-by-label-text :step-counter))
(h/is-truthy)))
(h/test "renders step with a string value"
(h/render [step/view {} "1"])
(render [step/view {} "1"])
(-> (h/expect (h/get-by-text "1"))
(h/is-truthy)))
(h/test "renders step with an integer value"
(h/render [step/view {} 1])
(render [step/view {} 1])
(-> (h/expect (h/get-by-text "1"))
(h/is-truthy))))
+20 -3
View File
@@ -2,10 +2,24 @@
(:require
[quo.components.counter.step.style :as style]
[quo.components.markdown.text :as text]
[quo.theme :as theme]
quo.theme
[react-native.core :as rn]
[schema.core :as schema]
[utils.number]))
(def ?schema
[:=>
[:catn
[:props
[:map {:closed true}
[:accessibility-label {:optional true} [:maybe :keyword]]
[:customization-color {:optional true} [:maybe :schema.common/customization-color]]
[:in-blur-view? {:optional true} [:maybe :boolean]]
[:theme :schema.common/theme]
[:type {:optional true} [:enum :active :complete :neutral]]]]
[:value [:maybe [:or :string :int]]]]
:any])
(defn- view-internal
[{:keys [type accessibility-label theme in-blur-view? customization-color]} value]
(let [type (or type :neutral)
@@ -23,6 +37,9 @@
[text/text
{:weight :medium
:size :label
:style {:color (style/text-color type theme)}} label]]))
:style {:color (style/text-color type theme)}}
label]]))
(def view (theme/with-theme view-internal))
(def view
(quo.theme/with-theme
(schema/instrument #'view-internal ?schema)))
@@ -7,8 +7,9 @@
[react-native.core :as rn]))
(def default-props
{:button-one-type :primary
:button-two-type :grey})
{:button-one-type :primary
:button-two-type :grey
:customization-color :blue})
(defn- view-internal
"Options:
@@ -23,9 +24,9 @@
:scroll? - bool (default false) - Whether the iOS Home Indicator should be rendered"
[props]
(let [{:keys [actions description button-one-label button-two-label
button-one-props button-two-props theme scroll?]}
button-one-props button-two-props theme scroll? customization-color container-style]}
(merge default-props props)]
[:<>
[rn/view {:style container-style}
[rn/view {:style style/buttons-container}
(when (= actions :2-actions)
[button/button
@@ -43,7 +44,8 @@
:container-style style/button-container
:background (when scroll? :blur)
:theme theme
:accessibility-label :button-one}
:accessibility-label :button-one
:customization-color customization-color}
button-one-props)
button-one-label]]
(when description
@@ -0,0 +1,56 @@
(ns quo.components.dropdowns.dropdown-input.component-spec
(:require
[quo.components.dropdowns.dropdown-input.view :as dropdown-input]
[test-helpers.component :as h]))
(h/describe "Dropdown Input"
(h/test "default render"
(let [header-label "Label"
label "Dropdown"]
(h/render [dropdown-input/view
{:label? true
:header-label
header-label} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-text header-label))
(h/is-truthy (h/get-by-text label))))
(h/test "render with icon"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:icon? true
:icon-name
:i/wallet
:label? true}
label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-label-text :left-icon))
(h/is-truthy (h/get-by-text label))))
(h/test "render in active state"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:state :active
:label?
true} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-truthy (h/get-by-label-text :right-icon "Expecting active state icon"))))
(h/test "render in disabled state"
(let [label "Dropdown"]
(h/render [dropdown-input/view
{:state :disabled
:label? true} label])
(h/is-truthy (h/get-by-label-text :dropdown))
(h/is-disabled (h/get-by-text label "Dropdown should be disabled in disabled state"))))
(h/test "on-press"
(let [event (h/mock-fn)
label "Dropdown"]
(h/render [dropdown-input/view
{:on-press event
:label?
true} label])
(h/fire-event :press (h/get-by-text label))
(h/was-called event))))
@@ -0,0 +1,49 @@
(ns quo.components.dropdowns.dropdown-input.properties
(:require
[quo.foundations.colors :as colors]))
(def icon-size 20)
(defn- grey-blur
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-80-opa-40 colors/white-opa-70 theme)
:right-icon-color (colors/theme-colors colors/neutral-80-opa-10 colors/white-opa-10 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-80-opa-20
colors/white-opa-40
theme)
(colors/theme-colors colors/neutral-80-opa-10
colors/white-opa-10
theme))})
(defn- outline
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:right-icon-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(colors/theme-colors colors/neutral-30 colors/neutral-70 theme))})
(defn- grey
[theme active?]
{:left-icon-color (colors/theme-colors colors/neutral-50 colors/neutral-40 theme)
:right-icon-color (colors/theme-colors colors/neutral-20 colors/neutral-80 theme)
:right-icon-color-2 (colors/theme-colors colors/neutral-100 colors/white theme)
:label-color (colors/theme-colors colors/neutral-100 colors/white theme)
:border-color (if active?
(colors/theme-colors colors/neutral-40 colors/neutral-60 theme)
(colors/theme-colors colors/neutral-20
colors/neutral-60
theme))})
(defn get-colors
[{:keys [theme state blur?]}]
(let [active? (= state :active)]
(cond
blur? (grey-blur theme active?)
(= theme :dark) (outline theme active?)
(= theme :light) (grey theme active?))))
@@ -0,0 +1,62 @@
(ns quo.components.dropdowns.dropdown-input.style
(:require
[quo.foundations.colors :as colors]))
(def gap 8)
(def blur-view
{:position :absolute
:top 0
:left 0
:right 0
:bottom 0})
(def left-icon
{:margin-right gap})
(defn right-icon
[theme]
{:color (colors/theme-colors colors/neutral-100 colors/white theme)
:margin-right gap})
(defn header-label
[theme blur?]
{:color (if blur?
(colors/theme-colors colors/neutral-80-opa-40
colors/white-opa-70
theme)
(colors/theme-colors colors/neutral-50
colors/neutral-40
theme))
:margin-bottom gap})
(def root-container
{:width "100%"
:height 40})
(defn container
[{:keys [background-color border-color]}
{:keys [icon? state]}]
(cond-> {:align-items :center
:justify-content :space-between
:flex-direction :row
:padding-vertical 9
:padding-left 16
:padding-right 12
:overflow :hidden
:background-color background-color
:border-radius 12}
icon?
(assoc :padding-left 12)
border-color
(assoc :border-color border-color
:border-width 1)
(= state :disabled)
(assoc :opacity 0.3)))
(def right-half-container
{:flex-direction :row
:align-items :center})
@@ -0,0 +1,68 @@
(ns quo.components.dropdowns.dropdown-input.view
(:require
[quo.components.dropdowns.dropdown-input.properties :as properties]
[quo.components.dropdowns.dropdown-input.style :as style]
[quo.components.icon :as icon]
[quo.components.markdown.text :as text]
[quo.theme :as theme]
[react-native.core :as rn]))
(defn- view-internal
[{:keys [state theme on-press icon?
label? blur?
accessibility-label header-label]
:or {state :default
icon? true
label? true
blur? false
header-label "Label"}
:as props}
label]
(let [{:keys [left-icon-color right-icon-color right-icon-color-2]
:as colors} (properties/get-colors props)
right-icon (if (= state :active) :i/pullup :i/dropdown)]
[rn/view
{:style style/root-container}
(when label?
[text/text
{:size :paragraph-2
:weight :medium
:align :left
:style (style/header-label theme blur?)} header-label])
[rn/pressable
{:accessibility-label (or accessibility-label :dropdown)
:disabled (= state :disabled)
:on-press on-press
:style (style/container colors props)}
[rn/view
{:style style/right-half-container}
(when icon?
[icon/icon
:i/placeholder
{:accessibility-label :left-icon
:color left-icon-color
:size properties/icon-size
:container-style style/left-icon}])
[text/text
{:size :paragraph-1
:weight :regular
:number-of-lines 1
:style (style/right-icon theme)}
label]]
[icon/icon
right-icon
{:size properties/icon-size
:accessibility-label :right-icon
:color right-icon-color
:color-2 right-icon-color-2}]]]))
(def view
"Props:
- state: :default (default) | :active | :disabled
- label: string
- header-label: string
- icon?: boolean
- label?: boolean
- blur?: boolean
- on-press: function"
(theme/with-theme view-internal))
@@ -19,3 +19,7 @@
:background-color colors/danger-50
:align-items :center
:justify-content :center})
(def empty-state
{:width 375
:height 116})
@@ -2,11 +2,12 @@
(:require
[quo.components.graph.utils :as utils]
[quo.components.graph.wallet-graph.style :as style]
[quo.components.markdown.text :as text]
[quo.foundations.colors :as colors]
[quo.foundations.resources :as resources]
[quo.theme :as quo.theme]
[react-native.charts :as charts]
[react-native.core :as rn]
[react-native.fast-image :as fast-image]
[react-native.linear-gradient :as linear-gradient]))
(defn- time-frame->max-data-points
@@ -42,11 +43,10 @@
gradient-colors [(colors/alpha line-color 0.1) (colors/alpha line-color 0)]
fill-color (colors/theme-colors colors/white colors/neutral-95)]
(if (= time-frame :empty)
[rn/view
{:accessibility-label :illustration
:style style/illustration}
[text/text {:style {:color colors/white}}
"Illustration here"]]
[fast-image/fast-image
{:style style/empty-state
:source (resources/get-themed-image :no-funds theme)
:accessibility-label :illustration}]
[rn/view
[linear-gradient/linear-gradient
{:colors gradient-colors
+17 -18
View File
@@ -3,22 +3,18 @@
[quo.components.icon :as quo.icons]
[quo.components.markdown.text :as text]
[quo.foundations.colors :as colors]
[quo.theme :as theme]
[quo.theme :as quo.theme]
[react-native.core :as rn]))
(def themes
{:light {:default colors/neutral-50
:success colors/success-50
:error colors/danger-50}
:dark {:default colors/neutral-40
:success colors/success-60
:error colors/danger-60}})
(defn get-color
[k]
(get-in themes [(theme/get-theme) k]))
[k theme]
(case k
:success (colors/resolve-color :success theme)
:error (colors/resolve-color :danger theme)
:warning (colors/resolve-color :warning theme)
(colors/theme-colors colors/neutral-50 colors/neutral-40 theme)))
(defn info-message
(defn view-internal
"[info-message opts \"message\"]
opts
{:type :default/:success/:error
@@ -27,11 +23,11 @@
:text-color colors/white ;; text color override
:icon-color colors/white ;; icon color override
:no-icon-color? false ;; disable tint color for icon"
[{:keys [type size icon text-color icon-color no-icon-color? style]} message]
[{:keys [type size theme icon text-color icon-color no-icon-color? style accessibility-label]} message]
(let [weight (if (= size :default) :regular :medium)
icon-size (if (= size :default) 16 12)
size (if (= size :default) :paragraph-2 :label)
text-color (or text-color (get-color type))
text-color (or text-color (get-color type theme))
icon-color (or icon-color text-color)]
[rn/view
{:style (merge {:flex-direction :row
@@ -42,7 +38,10 @@
:no-color no-icon-color?
:size icon-size}]
[text/text
{:size size
:weight weight
:style {:color text-color
:margin-horizontal 4}} message]]))
{:accessibility-label accessibility-label
:size size
:weight weight
:style {:color text-color
:margin-horizontal 4}} message]]))
(def info-message (quo.theme/with-theme view-internal))
@@ -65,22 +65,23 @@
ens-regex address-regex
valid-ens-or-address?]}]
(let [on-change (fn [text]
(let [ens? (when ens-regex
(boolean (re-matches ens-regex text)))
address? (when address-regex
(boolean (re-matches address-regex text)))]
(if (> (count text) 0)
(reset! status :typing)
(reset! status :active))
(reset! value text)
(when on-change-text
(on-change-text text))
(when (and ens? on-detect-ens)
(reset! status :loading)
(on-detect-ens text))
(when (and address? on-detect-address)
(reset! status :loading)
(on-detect-address text))))
(when (not= @value text)
(let [ens? (when ens-regex
(boolean (re-matches ens-regex text)))
address? (when address-regex
(boolean (re-matches address-regex text)))]
(if (> (count text) 0)
(reset! status :typing)
(reset! status :active))
(reset! value text)
(when on-change-text
(on-change-text text))
(when (and ens? on-detect-ens)
(reset! status :loading)
(on-detect-ens text))
(when (and address? on-detect-address)
(reset! status :loading)
(on-detect-address text)))))
on-paste (fn []
(clipboard/get-string
(fn [clipboard]
@@ -90,6 +91,8 @@
on-clear (fn []
(reset! value "")
(reset! status (if @focused? :active :default))
(when on-change-text
(on-change-text ""))
(when on-clear
(on-clear)))
on-scan #(when on-scan
@@ -119,6 +122,7 @@
:auto-complete (when platform/ios? :none)
:auto-capitalize :none
:auto-correct false
:spell-check false
:keyboard-appearance (quo.theme/theme-value :light :dark theme)
:on-focus on-focus
:on-blur on-blur
@@ -23,6 +23,8 @@
return-key-type
size
theme
on-focus
on-blur
container-style]
:or {max-length 0
auto-focus false
@@ -48,8 +50,14 @@
:accessibility-label :profile-title-input
:keyboard-appearance (quo.theme/theme-value :light :dark theme)
:return-key-type return-key-type
:on-focus #(swap! focused? (constantly true))
:on-blur #(swap! focused? (constantly false))
:on-focus (fn []
(when (fn? on-focus)
(on-focus))
(reset! focused? true))
:on-blur (fn []
(when (fn? on-blur)
(on-blur))
(reset! focused? false))
:auto-focus auto-focus
:input-mode :text
:on-change-text on-change
@@ -0,0 +1,17 @@
(ns quo.components.ios.drawer-bar.style
(:require
[quo.foundations.colors :as colors]
[quo.theme :as theme]))
(def handle-container
{:padding-vertical 8
:height 20
:align-items :center})
(defn handle
[{:keys [theme]}]
{:width 32
:height 4
:background-color (colors/theme-colors colors/neutral-100 colors/white theme)
:opacity (theme/theme-value 0.05 0.1 theme)
:border-radius 100})
@@ -0,0 +1,12 @@
(ns quo.components.ios.drawer-bar.view
(:require
[quo.components.ios.drawer-bar.style :as style]
[quo.theme :as quo.theme]
[react-native.core :as rn]))
(defn- view-internal
[props]
[rn/view {:style style/handle-container}
[rn/view {:style (style/handle props)}]])
(def view (quo.theme/with-theme view-internal))
@@ -13,7 +13,7 @@
(h/render [account/view])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 5)})))
{:backgroundColor (colors/resolve-color :blue :light 5)})))
(h/test "on-press-in changes state to :pressed with blur? enabled"
(h/render [account/view {:blur? true}])
@@ -21,31 +21,26 @@
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-5})))
(h/test "on-press-out changes state to :active"
(h/render [account/view])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 10)})))
(h/test "render with state :active"
(h/render [account/view {:state :active}])
(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/resolve-color :blue :light 10)}))
(h/test "on-press-out changes state to :active with blur? enabled"
(h/render [account/view {:blur? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-10})))
(h/test "render with state :active and blur? enabled"
(h/render [account/view
{:blur? true
:state :active}])
(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-10}))
(h/test "on-press-out changes state to :selected"
(h/render [account/view {:selectable? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/is-truthy (h/query-by-label-text :check-icon))))
(h/test "render with state :selected"
(h/render [account/view {:state :selected}])
(h/is-truthy (h/query-by-label-text :check-icon)))
(h/test "on-press-out calls on-press"
(h/test "calls on-press"
(let [on-press (h/mock-fn)]
(h/render [account/view {:on-press on-press}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/fire-event :on-press (h/get-by-label-text :container))
(h/was-called on-press)))
(h/test "renders token props if type :tag"
@@ -3,12 +3,12 @@
[quo.foundations.colors :as colors]))
(defn- background-color
[{:keys [state blur? customization-color]}]
(cond (or (= state :pressed) (= state :selected))
(if blur? colors/white-opa-5 (colors/custom-color customization-color 50 5))
[{:keys [state pressed? blur? customization-color]}]
(cond (or pressed? (= state :selected))
(if blur? colors/white-opa-5 (colors/resolve-color customization-color :light 5))
(= state :active)
(if blur? colors/white-opa-10 (colors/custom-color customization-color 50 10))
(and (= state :pressed) blur?) colors/white-opa-10
(if blur? colors/white-opa-10 (colors/resolve-color customization-color :light 10))
(and pressed? blur?) colors/white-opa-10
:else :transparent))
(defn container
+35 -55
View File
@@ -94,62 +94,42 @@
[icon/icon :i/check
{:color (if blur?
colors/white
(colors/theme-colors (colors/custom-color customization-color 50)
(colors/custom-color customization-color 60)
theme))}]])
(defn- f-internal-view
[]
(let [state (reagent/atom :default)
active-or-selected? (atom false)
timer (atom nil)
on-press-in (fn []
(when-not (= @state :selected)
(reset! timer (js/setTimeout #(reset! state :pressed) 100))))]
(fn [{:keys [type selectable? blur? customization-color on-press]
:or {customization-color :blue
type :default
blur? false}
:as props}]
(let [on-press-out (fn []
(let [new-state (if @active-or-selected?
:default
(if (and (= type :default) selectable?)
:selected
:active))]
(when @timer (js/clearTimeout @timer))
(reset! timer nil)
(reset! active-or-selected? (or (= new-state :active)
(= new-state :selected)))
(reset! state new-state)
(when on-press
(on-press))))]
(rn/use-effect
#(cond (and selectable? (= type :default) (= @state :active)) (reset! state :selected)
(and (not selectable?) (= type :default) (= @state :selected)) (reset! state :active))
[selectable?])
[rn/pressable
{:style (style/container
{:state @state :blur? blur? :customization-color customization-color})
:on-press-in on-press-in
:on-press-out on-press-out
:accessibility-label :container}
[account-view props]
[rn/view {:style (when (= type :tag) style/token-tag-container)}
(when (or (= type :balance-neutral)
(= type :balance-negative)
(= type :balance-positive))
[balance-view props])
(when (= type :tag)
[token-tag props])
(when (= type :action)
[options-button props])
(when (and (= type :default)
(= @state :selected))
[check-icon props])]]))))
(colors/resolve-color customization-color theme))}]])
(defn- internal-view
[props]
[:f> f-internal-view props])
[_]
(let [pressed? (reagent/atom false)
on-press-in #(reset! pressed? true)
on-press-out #(reset! pressed? false)]
(fn [{:keys [type state blur? customization-color on-press]
:or {customization-color :blue
type :default
state :default
blur? false}
:as props}]
[rn/pressable
{:style (style/container
{:state state
:blur? blur?
:customization-color customization-color
:pressed? @pressed?})
:on-press-in on-press-in
:on-press on-press
:on-press-out on-press-out
:accessibility-label :container}
[account-view props]
[rn/view {:style (when (= type :tag) style/token-tag-container)}
(cond
(#{:balance-neutral :balance-negative :balance-positive} type)
[balance-view props]
(= type :tag)
[token-tag props]
(= type :action)
[options-button props]
(and (= type :default) (= state :selected))
[check-icon props])]])))
(def view (quo.theme/with-theme internal-view))
@@ -31,4 +31,5 @@
:align-items :center})
(def account-container
{:margin-left 8})
{:margin-left 8
:padding-right 56})
+12 -10
View File
@@ -1,23 +1,23 @@
(ns quo.components.list-items.address.view
(:require
[clojure.string :as string]
[quo.components.avatars.wallet-user-avatar :as wallet-user-avatar]
[quo.components.avatars.wallet-user-avatar.view :as wallet-user-avatar]
[quo.components.list-items.address.style :as style]
[quo.components.markdown.text :as text]
[quo.foundations.colors :as colors]
[quo.theme :as quo.theme]
[react-native.core :as rn]
[reagent.core :as reagent]))
[reagent.core :as reagent]
[utils.address :as address]))
(defn- left-container
[{:keys [theme address networks blur?]}]
[rn/view {:style style/left-container}
[wallet-user-avatar/wallet-user-avatar
{:size :medium
:f-name "0"
:l-name "x"
{:size :size-32
:full-name "0 x"
:monospace? true
:uppercase? false}]
:lowercase? true
:neutral? true}]
[rn/view {:style style/account-container}
[text/text {:size :paragraph-1}
(map (fn [network]
@@ -25,7 +25,8 @@
[text/text
{:size :paragraph-1
:weight :semi-bold
:style {:color (colors/resolve-color network)}} (str (subs (name network) 0 3) ":")])
:style {:color (colors/resolve-color (:network-name network) theme)}}
(str (:short-name network) ":")])
networks)
[text/text
{:size :paragraph-1
@@ -33,7 +34,7 @@
:style {:color (if blur?
colors/white
(colors/theme-colors colors/neutral-100 colors/white theme))}}
(string/replace address "x" "×")]]]])
(address/get-shortened-key address)]]]])
(defn- internal-view
[]
@@ -60,6 +61,7 @@
[left-container
{:theme theme
:networks networks
:address address}]]))))
:address address
:blur? blur?}]]))))
(def view (quo.theme/with-theme internal-view))
@@ -148,8 +148,6 @@
(when (and members (= type :discover))
[community-view/community-stats-column
{:type :list-view
:theme theme
:blur? blur?
:members-count (:members-count members)
:active-count (:active-count members)}])]
[info-component
@@ -13,7 +13,7 @@
(h/render [saved-address/view])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 5)})))
{:backgroundColor (colors/resolve-color :blue :light 5)})))
(h/test "on-press-in changes state to :pressed with blur? enabled"
(h/render [saved-address/view {:blur? true}])
@@ -22,24 +22,25 @@
{:backgroundColor colors/white-opa-5})))
(h/test "on-press-out changes state to :active"
(h/render [saved-address/view])
(h/render [saved-address/view {:active-state? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor (colors/custom-color :blue 50 10)})))
{:backgroundColor (colors/resolve-color :blue :light 10)})))
(h/test "on-press-out changes state to :active with blur? enabled"
(h/render [saved-address/view {:blur? true}])
(h/render [saved-address/view
{:blur? true
:active-state? true}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/wait-for #(h/has-style (h/query-by-label-text :container)
{:backgroundColor colors/white-opa-10})))
(h/test "on-press-out calls on-press"
(h/test "on-press container calls on-press"
(let [on-press (h/mock-fn)]
(h/render [saved-address/view {:on-press on-press}])
(h/fire-event :on-press-in (h/get-by-label-text :container))
(h/fire-event :on-press-out (h/get-by-label-text :container))
(h/fire-event :on-press (h/get-by-label-text :container))
(h/was-called on-press)))
(h/test "renders options button if type :action"

Some files were not shown because too many files have changed in this diff Show More