Commit Graph

9998 Commits

Author SHA1 Message Date
Icaro Motta 96d98c62ed
chore(tests)_: Facilitate writing event tests (#20424)
Introduces a new macro deftest-event to facilitate writing tests for event
handlers. Motivation came from the _problem of having to always extract event
handlers as vars in order to test them_.

Although the implementation of deftest-sub and deftest-event are similar,
deftest-sub is critically important because it guarantees changes in one
subscription can be caught by tests from all other related subscriptions in the
graph (reference: PR https://github.com/status-im/status-mobile/pull/14472).

This is not the case for the new deftest-event macro. deftest-event is
essentially a way of make testing events less ceremonial by not requiring event
handlers to be extracted to vars. But there are a few other small benefits:

- The macro uses re-frame and "finds" the event handler by computing the
  interceptor chain (except :do-fx), so in a way, the tests are covering a bit
  more ground.
- Slightly easier way to find event tests in the repo since you can just find
  references to deftest-event.
- Possibly slightly easier to maintain by devs because now event tests and sub
  tests are written in a similar fashion.
- Less code diff. Whether an event has a test or not, there's no var to
  add/remove.
- The dispatch function provided by the macro makes reading the tests easier
  over time. For example, when we read subscription tests, the Act section of
  the test is always the same (rf/sub [sub-name]). Similarly for events, the
  Act section is always (dispatch [event-id arg1 arg2]).
- Makes the re-frame code look more idiomatic because it's more common to define
  handlers as anonymous functions.

Downside: deftest-sub and deftest-event are relatively complicated macros.

Note: The test suite runs just as fast and clj-kondo can lint code within the
macro just as well.

Before:

```clojure
(deftest process-account-from-signal-test
  (testing "process account from signal"
    (let [cofx             {:db {:wallet {:accounts {}}}}
          effects          (events/process-account-from-signal cofx [raw-account])
          expected-effects {:db {:wallet {:accounts {address account}}}
                            :fx [[:dispatch [:wallet/get-wallet-token-for-account address]]
                                 [:dispatch
                                  [:wallet/request-new-collectibles-for-account-from-signal address]]
                                 [:dispatch [:wallet/check-recent-history-for-account address]]]}]
      (is (match? expected-effects effects)))))
```

After

```clojure
(h/deftest-event :wallet/process-account-from-signal
  [event-id dispatch]
  (let [expected-effects
        {:db {:wallet {:accounts {address account}}}
         :fx [[:dispatch [:wallet/get-wallet-token-for-account address]]
              [:dispatch [:wallet/request-new-collectibles-for-account-from-signal address]]
              [:dispatch [:wallet/check-recent-history-for-account address]]]}]
    (reset! rf-db/app-db {:wallet {:accounts {}}})
    (is (match? expected-effects (dispatch [event-id raw-account])))))
```
2024-06-13 22:03:02 -03:00
Ulises Manuel 435bf3dbd5
feat(wallet): Fix bugs in the bridge flow and add missing entry points (#20197)
* Fix "Bridge to" screen not showing

* Fix "Unkown flow" alert in bridge flow

* Fix warnings in transaction confirmation page

* Fix missing images and strings while bridging in transaction confirmation page

* Fix stale data shown for an instant in the suggested routes component

* Add support for bridge flow started in the wallet home screen

* Fix fetch-activities event
2024-06-13 10:32:34 -06:00
Parvesh Monu 26c4a736ad
fix group Image can't be set up during group creation (#20451) 2024-06-13 20:31:24 +05:30
Mohamed Javid aff4eb89cd
feat(wallet): implement search in saved addresses list (#20443)
This commit adds a feature to search through the saved addresses list by name, address, ENS and chain names.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-06-13 19:28:41 +05:30
flexsurfer 60b3d01ceb
use-safe-unmount for hot reload (#20450) 2024-06-13 15:23:01 +02:00
Sean Hagstrom dc335cc333
chore: Revise code for wallet settings (#20439)
* fix: use correct error message when displaying seed phrase as incorrect

* tidy: cleanup naming of events and effects

* tweak: show incorrect-seed-phrase error for any import error

* fix: show correct error message for incorrect private key

* chore: move import-private-key and import-seed-phrase namespaces

* chore: move encrypted-qr namespace

* chore: move scan-qr namespace

* tidy: rename key-pair to keypair inside for wallet settings

* tweak: use :open-modal navigation instead of :navigate-to-within-stack

* tweak: rename screen for importing missing key-pair by seed-phrase

* tidy: refactor code
2024-06-13 14:13:26 +01:00
mmilad75 e0c7ecc6df
No routes found error is displayed in case asset value is within max amount but not enough balance for fee #20148 (#20272) 2024-06-13 14:41:06 +02:00
mmilad75 d33648917a
The network marks are not shown on the 'send to' page for accounts #19545 (#20365) 2024-06-13 14:19:19 +02:00
Parvesh Monu 5f7d7254e7
fix bottom message hidden behind composer with minimised keyboard when replying to message (#20371) 2024-06-13 16:48:21 +05:30
Parvesh Monu df939bf85f
fix inability to move cursor to next line in bio field (#20403) 2024-06-13 13:56:33 +05:30
yqrashawn 874906b11f
fix: face id toggle respect system face id permission (#20227)
Signed-off-by: yqrashawn <namy.19@gmail.com>
2024-06-13 09:28:07 +08:00
Ulises Manuel 799bd1d4dc
fix(wallet): Multiple activity tab fixes (#20367)
* Add missing circle in wallet-activity component

* Move activity calculations to subscription and fix wrong data

* Fetch activities when visiting an account
2024-06-12 14:37:06 -06:00
Parvesh Monu 256c9f7b10
fix wrong community logo position when scrolling down the channel list (#20408) 2024-06-12 22:50:07 +05:30
Jamie Caprani 60e1783b36
chore(wallet): show activity tab after sending a transaction 2024-06-12 08:36:30 -07:00
Mohamed Javid 3208ec1b28
feat(wallet): display saved addresses in send flow (#20418)
This commit adds a feature to display saved addresses in the send flow

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-06-12 19:38:17 +05:30
Parvesh Monu 8f75761ae9
fix continue button partially hidden on the Change password screen (#20409) 2024-06-12 18:29:28 +05:30
Mohsen af07205f20
[#19737] feat: edit a saved address (#20398) 2024-06-12 12:55:38 +03:00
Siddarth Kumar 672358fbce
deps: bump react-native-linear-gradient library (#20329)
`react-native-linear-gradient` library has to be upgraded to `3.0.0-alpha.1` for new architecture support on `Android`.
2024-06-12 13:43:26 +05:30
Ajay Sivan 255ba9a862
Move buy assets recurrent tab out of feature flag (#20319) 2024-06-11 09:18:12 -07:00
flexsurfer 4942238cae
Remove empty box for unhandled links #20429 (#20430) 2024-06-11 15:49:46 +02:00
Ajay Sivan 6a32006e6a
Drawer/Bottom Actions - context-tag-props (#20388) 2024-06-11 06:43:12 -07:00
Alexander b119860b81
Enhance the `dapp-avatar` component (#20392) 2024-06-11 15:26:04 +02:00
Sean Hagstrom 6a7f04a5a8
feat(wallet-settings): Implement import missing key pair by private key (#20372)
* chore: update private-key validation

* chore: add native module bindings

* chore: add translation labels

* chore: add size-12 for password icon

* fix: ensure we use feature-flag namespace when using feature-flags

* fix: blur styles for icon-avatar in missing key-pairs

* fix: blur styles for accounts in missing key-pairs

* fix: blur styles for bottom-sheet

* fix: adjust blur background color for bottom-sheets

* chore: add support for private-keys for missing key-pair component

* chore: add definitions for events and effects

* feature: implement private-key import for missing key-pair

* tidy: remove debugging

* tidy: distinguish to import for missing-keypair

* tidy: remove unneeded function

* tidy: refactor layout to use floating-button-page

* tidy: remove unused effect bindings

* tidy: refactor event bindings for importing-missing-keypair-by-private-key

* tweak: add error logging

* tidy: refactor helper to re-frame utils

* tweak: group partially operable and fully operable keypairs together

* chore: add documentation for call-continuation

* tweak: refactor documentation

* tweak: throw exception when not given a compatible continuation

* fix: update least-operability when making key-pair fully operable
2024-06-11 13:05:10 +01:00
Ajay Sivan f226f0db18
Drawer Action Component - Input action variant (#20383)
* Drawer action component

* Component tests

* PR review feedback
2024-06-11 04:10:51 -07:00
Jamie Caprani 48f00f17a9
chore: fix some comments (#20410)
Signed-off-by: longxiangqiao <longxiangqiao@qq.com>
Co-authored-by: longxiangqiao <longxiangqiao@qq.com>
2024-06-11 12:48:24 +02:00
Icaro Motta 9f245ceb30
perf(login)!: Fix slow login by delaying messenger filters initialization (#20173)
Fixes the slow login when users have joined large communities, such as the
Status one. Related status-go PR
https://github.com/status-im/status-go/pull/5229.

What we mean by "slow" is that the user was getting stuck on the login screen
for almost 20s in some devices (even on iOS things were bad). And this entire
process was happening in status-go, hence most changes come from there.

By "login" we mean the process to authenticate and initialize vital data in
status-go. Setting up message filters can be slow with large communities, and
that's exactly this part we moved out of the login phase in status-go. This step
now happens implicitly when the client calls wakuext_startMessenger.

In a way, the solution makes sense because setting up filters isn't essential
for the user to access other parts of the app, such as the Wallet, Settings,
Profile, and Activity Center.

How can we magically eliminate the login delay? In reality, the time we used to
spent during login, blocking the user, still happens, but it happens in the
background and after the user is redirected to the home screen. This also means
that, until the filters are established, all chats are still in their "loading
skeleton state".

In terms of UX, this is probably fine as long as it doesn't take too long for
this setup to finish in status-go. In the future, we have room to further
optimize how filters are set up in status-go.

Fixes https://github.com/status-im/status-mobile/issues/20059
2024-06-11 07:41:29 -03:00
Volodymyr Kozieiev 94e728bdf3
Icon added to disclaimer component (#20309) 2024-06-11 11:16:01 +01:00
flexsurfer 402e67d199
Any link to status.app opens in status even if it's not supported (#20427)
* Any link to status.app opens in status even if it's not supported #20420

* Any link to status.app opens in status even if it's not supported #20420
2024-06-11 11:59:55 +02:00
Omar Basem 0d2869bfe0
fix: inability to input data while routes are loading (#20298)
fix: inability to input data while routes are loading (#20298)
2024-06-11 08:05:47 +04:00
Parvesh Monu 3634edab42
fix wrong composer opacity with minimised keyboard when editing message (#20348) 2024-06-08 18:21:02 +05:30
Yevheniia Berdnyk 712e67a62e
e2e: updates for community tests 2024-06-08 00:07:22 +03:00
mmilad75 d223151b93
Implement Alert Banner Component #20277 (#20278) 2024-06-07 18:56:14 +02:00
Mohamed Javid 9c7cb0fe93
feat(wallet)!: process wallet accounts from backup on account recovery (#20160)
This commit:

- adds a feature to process backed-up wallet data on account recovery (without the necessity to re-login)
- refactors keypair data store functions
- refactors wallet event to support calling for single account/address

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-06-07 20:28:49 +05:30
Mohamed Javid a3e713bbf0
feat(wallet): Add a new saved address with ENS (#20384)
This commit adds a feature to add new saved addresses with ENS

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-06-07 19:47:06 +05:30
flexsurfer cedd4900d5
Remove blur from android #20249 (#20308) 2024-06-07 14:28:28 +02:00
frank d43e8881ef
fix_:Missing "Backup Recovery Phrase" option in profile (#20378) 2024-06-07 07:57:03 +08:00
Mohamed Javid 75c8437cc5
feat(wallet): Add network preferences selection for saved address (#20364)
This commit:
- adds a feature to add network preferences for saved addresses while saving
- updates the network preferences in "Share save address" to show the address and color of the saved address
- fixes the screen qualifier for the settings screen when navigating to wallet settings

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-06-06 23:01:12 +05:30
Volodymyr Kozieiev f1310c7e6c
Reuse controlled input logic in collectibles sending page (#20146)
* reuse controlled input logic for sending collectibles
2024-06-06 17:34:52 +01:00
Sean Hagstrom d7530dfbee
Feature: Implement import of key-pair with recovery phrase inside wallet settings (#20181)
* fix: ensure missing key pairs scroll with list

* chore: add translations for labels

* chore: promisify validate-mnemonic native module function

* chore: add events for validating seed-phrases and making key-pairs fully operable with seed-phrase

* chore: define re-usable effects for validate-mnemonic and make-seed-phrase-keypair-fully-operable and import-keypair-by-seedphrase

* tweak: refactor error handling logic when importing key-pair by seed-phrase

* tweak: handle vectors and functions between events and effects

* tweak: refactor recover-phrase form to support custom title, children, and navigation icon

* tweak: add support for accessing input-ref in recovery-phrase form

* tweak: always mask seed-phrase when passing to render-controls

* feature: add initial screen for importing key-pair with seed phrase

* tweak: conditionally render keypair context tag inside recovery-phrase form

* tidy: rename on-input-ref to ref

* tidy: remove unused property

* tidy: refactor to use case expression

* tidy: format
2024-06-06 10:33:34 +01:00
Mohsen 0d6bd9c15d
[#19734] feat: share saved address QR (#20315) 2024-06-05 19:10:48 +03:00
Mohsen 2da6d9dffb
[#19766] feat: save an address by scanning it's QR code (#20353) 2024-06-05 18:57:51 +03:00
flexsurfer 879a4067e5
No fetching / fetched community screens #20354 (#20355) 2024-06-05 17:45:55 +02:00
Jamie Caprani e1317f503f
chore(quo): update styles for account card variant missing keypair (#20279) 2024-06-05 08:18:24 -07:00
Sean Hagstrom ec00ddf10e
Fix layout of title for select key-pairs screen (#20270)
* fix: ensure standard-title component uses flex-1 styling

* fix: adapt settings screens to use flex-0 styling for the standard-title component
2024-06-05 14:59:35 +01:00
Parvesh Monu c0e10b7c6f
fix long-press message/chat preview is missing (#20349) 2024-06-05 18:46:17 +05:30
frank da449bcd17
chore_:Add keyUID to table when migrating from v1 to v2 (#20151)
cba3ac57...9e538695
2024-06-05 20:52:19 +08:00
John Ngei ab93088d93
fix white screen when navigating back from a channel (#20326) 2024-06-05 14:24:59 +02:00
Sean Hagstrom b4a0e74a4a
Feature: add wallet network settings to app settings (#20254)
* tweak(wallet-network-settings): update testnet label for optimism network

* chore: feature-flag saved-addresses inside wallet settings

* chore: remove feature-flag for network-settings inside wallet settings

* chore: remove feature-flag for wallet-settings inside settings

* tweak: adjust vertical spacing on wallet-network settings screen

* chore: update information-box component with shell theme

* tweak: add blur styling to testnet bottom-sheet

* fix: ensure testnet-mode toggle is consistent

* tweak: implement blur background override for bottom-sheet

* tweak: change the blur background color for the overlay component

* fix: adjust alignment between categories and labels
2024-06-05 12:17:14 +01:00
Shivek Khurana 379ba87c16
🤝 🔁 [19834] Add dapp connection flow with a basic design (#20204) (#20325)
* 🔳 QR on success not being called

- IDK why, trying things out

* 🙃 Stupid of me

- My handler was not being called because I wrote the code in a
different QR scanner

*  Approval screen taking shape

* 🧹 Lint fix

* 🎛️ Wallet connect session screen shows up

- Hard coded the first account
- The data item component doesn't support networks or accounts yet
- The quo category component cannot show a data-item yet
- Connected accept and decline button

* 🧰 Fix review issues

* 🔨 Fix lint

* 🔧 Rename event and move dispatch

* 🔧 Fix lint

* 🎏 Add ff for wc scanner

- Bring back missing event
2024-06-05 16:17:19 +05:30
Jamie Caprani 901dddc603
chore(wallet): hide network preferences in watched and make multichain tab first on receive screen (#20180) 2024-06-05 03:27:52 -07:00