Commit Graph

271 Commits

Author SHA1 Message Date
Siddarth Kumar 0a1152bcc6
chore: bump `react-native-webview` to `13.6.3` (#18295)
We need to upgrade `react-native-webview` as a pre-requisite for upgrading `react-native` to `0.73.x`
else we face this issue while building iOS : https://github.com/react-native-webview/react-native-webview/issues/3233
2023-12-27 09:13:29 +05:30
Icaro Motta 0b4a1545ae
Fix component tests, upgrade Jest & friends, and a few other goodies (#18276)
Fix all component tests after the latest RN upgrade.

Fixes https://github.com/status-im/status-mobile/issues/18157
Closes https://github.com/status-im/status-mobile/pull/18235

Dependency changes

- Upgraded Jest: from 26.6.3 to latest 29.7.0.
- Upgraded @testing-library/jest-native: from 5.3.0 to latest 5.4.3
- Upgraded @testing-library/react-native: from 11.5.4 to 12.4.2
- Removed explicit dependency on jest-circus, this is now the default test
  runner.
- Removed explicit dependency on jest-environment-node. This is handled by the
  package manager.
- Added jest-silent-reporter at version 0.5.0.

### Why component tests were failing?

Many tests were failing because we were using RN Testing Library (RNTL) in an
unreliable fashion. With the recent library upgrades, the unreliability was
excerbated. Other times, the tests were incorrectly arranging data.

### with-redefs does not work with async code

Generally speaking, with-redefs should not be used with async code, assume the
worst. The scope of the macro will cease to exist by the time the async code
runs. In many tests we were using with-redefs, then calling render, but for some
components that use use-effect, JS timers, animations, etc it's unreliable and
were the reason for failures.

It's easy to reproduce too:

```clojure
(defn foo []
  :foo)

(foo)
;; => :foo

(with-redefs [foo (constantly :bar)]
  (foo))
;; => :bar

(js/setTimeout
 (fn []
   (tap> [:calling-foo (foo)]))
 100)
;; Taps [:calling-foo :foo]
;; As you would expect, when running without with-redefs, it prints :foo.

;; So far so good, but whatch what happens with async code:

(with-redefs [foo (constantly :bar)]
  (js/setTimeout
   (fn []
     (tap> [:calling-foo (foo)]))
   100))
;; Taps [:calling-foo :foo]
;; ====> PROBLEM: Taps :foo, not :bar as one might expect
```

### Not waiting on wait-for

When test-helpers.component/wait-for is used, subsequent assertions/etc should
be done after the promise returned by wait-for is resolved. But remember to not
perform side-effects inside the wait-for callback (check out the docs
https://callstack.github.io/react-native-testing-library/docs/api#waitfor).
Most, if not all of our usages of wait-for were not waiting.

#### Improvement 1 - Silence Jest on demand

If you need to re-run component tests frequently, you may want to reduce the
output verbosity. By passing JEST_USE_SILENT_REPORTER=true to make
component-test or make component-test-watch you will see a lot less noise and be
able to focus on what really matters to you.

#### Improvement 2 - Selectively focus/disable tests

Because of our need to first compile CLJS to JS before running tests via Jest,
we couldn't easily skip or focus on specific tests. From this commit onwards, we
should never again have to change the list of requires in files core_spec.cljs.
Commenting out required namespaces gives a bad DX because it causes constant
rebasing issues.

#### Improvement 3 - Translations now work as in prod code (but only English)

Translations performed by *-by-translation-text can be done now without any
workaround under the hood. The query functions are now linted just like
i18n/label, which means static translation keywords must be qualified with :t/,
which is good for consistency.
2023-12-26 11:58:23 -03:00
Siddarth Kumar 46c5f42fad
chore: add `form-data` package for DIWAI uploads (#18299) 2023-12-26 16:08:46 +05:30
Parvesh Monu c74461db3a
remove unused react-native-intersection-observer library (#18230) 2023-12-20 14:21:07 +05:30
Parvesh Monu 8ba9f45e44
Upgrade react-native-reanimated to 3.6.1 (#18216) 2023-12-18 09:44:53 +05:30
Siddarth Kumar 761a7df06f
upgrade react-native to 0.72.5 (#17241)
This commit does many things :
- Upgrade `react-native ` to `0.72.5`
- Upgrade `react-native-reanimated` to  `3.5.4`
- Upgrade `react-native-navigation` to `7.37.0`
- `ndkVersion` has been bumped to `25.2.9519653`
- `cmakeVersion` has been bumped to `3.22.1`
- `kotlinVersion` has been bumped to `1.7.22`
- `AGP` has been bumped to `7.4.2`
- `Gradle` has been upgraded to `8.0.1`
- Android `CompileSDK` and `TargetSDK` have been bumped to 33
- `@react-native-async-storage/async-storage` has been upgraded to `1.19.3`
- `@walletconnect/client` has been nuked
- some of the old `react-native-reanimated` code has been nuked
- `react-native-keychain` fork has been replaced with `8.1.2`

- On Android we are currently relying on `Hermes` Engine.
- On iOS we are currently relying on `JSC`
- We are not enabling new architecture for now (I have plans for that in the future) ref: https://github.com/status-im/status-mobile/issues/18138

IOS only PR : https://github.com/status-im/status-mobile/pull/16721
Android only PR : https://github.com/status-im/status-mobile/pull/17062

- `make run-metro` now has a target of `android` which was `clojure` earlier, this will increase the time it takes to start metro terminal but this is needed otherwise you will get a nasty error while developing for android locally.
2023-12-11 21:22:23 +05:30
flexsurfer 7c45b1e075
update deps (#18056) 2023-12-04 14:49:51 +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
Ibrahem Khalil 132e53844c
New TopBar animation (#17582) 2023-11-03 14:20:10 +02:00
Ibrahem Khalil 8296bda85b
Fix recent album not showing count (#17498) 2023-10-24 17:23:16 +03:00
Ibrahem Khalil b910f05286
Update `react-native-camera-kit` to latest beta to enable programmitcal zooming (#17708) 2023-10-24 11:48:36 +03:00
Siddarth Kumar 6924d9978d
prevent changing deps outside of nix shell (#17662)
We've often seen cases of devs attempting to change  dependencies outside a nix-shell and run into weird side effects

This commit stops them from :

- updating pods outside a nix shell
- updating node deps outside a nix shell

This commit also cleanup unused scripts in package.json and adds a fake comment script.
2023-10-17 23:35:58 +05:30
Ulises Manuel 1abd1e9420
[#16329] QR code variants (#17221)
* Rename wallet-user-avatar's `:color` prop to `:customization-color`
* Refactor QR code component and implement all variants
  - Improve preview screen
* Update QR code usages
* Remove `status-im2.common.qr-code-viewer.view/qr-code-view` component
to keep only one implementation.
* Remove the node dependency:
  "qrcode": "^1.4.1"
2023-10-08 17:42:58 -06:00
flexsurfer 6a169bd0bd
[#17347] move [status-im.utils.http :as http] to status-im2 (#17350) 2023-09-20 14:16:07 +02:00
Andrea Maria Piana 155f57ca6b
Dont parse unused identicon 2023-09-06 14:09:37 +01:00
Brian Sztamfater 1c730bc692
feat: implement interactive graphs (#17029)
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-08-31 13:45:54 -03:00
Ibrahem Khalil bdfdf687a4
[16827] Disable transparent video looping (#17000) 2023-08-21 11:49:41 +03:00
Brian Sztamfater 21807cb761
feat: implement wallet graph component (#16789)
Signed-off-by: Brian Sztamfater <brian@status.im>
2023-08-01 11:10:16 -03:00
Mohamed Javid 162f02ea27
Implement `gradient cover` component (#16778)
This commit implements the "gradient cover" component which is needed for wallet screen development, and upgrades the "react-native-linear-gradient" library to "v2.8.0".

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-07-31 12:49:34 +05:30
Icaro Motta b9890a9d44
Upgrade shadow-cljs and ClojureScript (#15417)
This commit upgrades Shadow CLJS from 2.11.16 (released on Feb/21) to latest
2.25.0 (Jul/23), so ~1.5 years worth of upgrades. By upgrading shadow we
can finally use the latest major Clojure version 1.11.x.

Why upgrade shadow?

- Shadow CLJS controls the ClojureScript version we can use. In order to use the
  latest major Clojure version we must upgrade Shadow CLJS.

- Shadow CLJS releases new versions very frequently, and if you take a look at
  its changelog https://github.com/thheller/shadow-cljs/blob/master/CHANGELOG.md, you'll see
  it had tons and tons of bug fixes over the years. I hope some of them help
  improve the DX for certain contributors who recently reported issues with
  it.

- Clojure 1.11 brings new features, bug fixes and even performance improvements
  (although I think the performance mostly impacts Clojure on the JVM). See the
  changelog https://github.com/clojure/clojure/blob/master/changes.md#changes-to-clojure-in-version-1110

Things that can be beneficial to us, or are interesting nonetheless:

- New :as-alias to be used in require, which is like :as but does not require
  the namespace to load. This means namespaced keywords using :as-alias can't
  cause circular dependency errors. This feature would very useful if we used
  namespaced keywords, but we don't, so...
  https://github.com/clojure/clojure/blob/master/changes.md#22-as-alias-in-require
- New macros run-test and run-test-var to run single test with fixtures and
  report.
- New iteration function, useful for processing paginated data.
  https://www.abhinavomprakash.com/posts/clojure-iteration/
- New update-keys function: applies a function to every key in a map.
- New update-vals function: applies a function to every value in a map.

Examples for update-vals and update-keys. They should perform better than the
common reduce-kv approach since they use a transient data structure.

    (let [m {:a 1 :b 2}]
      (update-vals m inc)) ; => {:a 2, :b 3}
    
    (let [m {:a 1 :b 2}]
      (update-keys m name)) ; => {"a" 1, "b" 2}

Why change namespaces within __tests__ directories?

Any namespace with the word --tests-- throws an error, like the one below. I
didn't bother investigating why, so I changed the guidelines to reflect the new
convention. It's probably related to the double dashes in the name.

    Namespace quo2.components.dividers.--tests--.divider-label-component-spec has a
    segment starting with an invalid JavaScript identifier at line 1
2023-07-28 13:40:54 -03:00
Omar Basem e49a3ab5cd
feat: category reorder component (#16719)
* feat: category reorder component

---------

Co-authored-by: Milad <mmilad.sanati@gmail.com>
2023-07-26 11:11:17 +04:00
Anton Iakimov 43ef6db7b9
js: remove unused visual tests and detox package #16372
After the nixpkgs upgrade we started to have Xcode command line tools installation popup on each make test, dtrace-provider was failing meanwhile: #16356

It appeared, that it was failing before the upgrade with different issue: #16356

dtrace-provider is a dependency for detox, which was added for visiual tests in #14329
These tests don't run.

This build issues didn't cause any problems, because it was not obligatary.
See NODE_DTRACE_PROVIDER_REQUIRE option, which can enforce this requirement.

See #16356 for more details.

In this PR we disable detox dependency for now.
And also Visual Tests.
2023-06-26 11:59:15 +02:00
Jamie Caprani e5778ee300
feat: add new theming mechanism (#16191)
* chore: set react-dom to same version as react
2023-06-23 05:11:50 -07:00
Rahul Pratap bb7ff3239d
Update prettier script. (#16324)
* Update prettier script.

* Add target and component-spec to prettierignore.
2023-06-20 19:50:27 +05:30
Mohamed Javid b397411daa
Upgrade `react-native-camera-kit` library to resolve camera issues in Sign In screen (#16248)
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2023-06-20 18:50:05 +05:30
Rahul Pratap c80992b6bf
Update prettier config for the project. (#16303)
* Update prettier config for the project.

* Add prettier to make lint-fix.
2023-06-19 19:09:12 +05:30
Jamie Caprani 2cbc94320d
feat: add parallax component (#16277) 2023-06-16 03:09:10 -07:00
Omar Basem fbe4b0a36c
feat: Lightbox share images (#16224)
* feat: share images
2023-06-14 18:24:55 +04:00
Siddarth Kumar 350303256b
upgrade `react-native` from 0.67.5 to 0.69.10 (#16016) 2023-06-14 07:17:41 +05:30
Omar Basem 62945205a0
update hooks lib (#15956) 2023-05-19 14:31:57 +04:00
Ajay Sivan 1aff364595
fix: android blur view hash mismatch in some locations 2023-05-09 21:36:12 +02:00
flexsurfer cd69d0423a
fix (fn[]) usage in hiccup (#15713) 2023-04-25 15:13:14 +02:00
Siddarth Kumar 3bd4038089
Upgrade `react-native` from 0.63.3 to 0.67.5 (#15486)
* [IOS Only] react-native 0.63 to 0.67

* [Android Only] react-native 0.63 to 0.67

* bring back all the jenkinsfiles

* make auto-complete prop for text-input compatible

* [IOS Only] react-native 0.63 to 0.67

* [Android Only] react-native 0.63 to 0.67

* bring back all the jenkinsfiles

* nix: drop unnecessary set -x from status-go build

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* add explicity implementation line for soloader

And add deleteDebugFilesForVariant fix for libhermes.

Signed-off-by: Jakub Sokołowski <jakub@status.im>

* use fast-image for link previews

* fix extra line in message composer on android

This elevation prop is un-necessary and causes an extra line to appear which looks like a border but its actually a shadow.

* don't use `fast-image` for url preview favicon

* fix audio record button interfering cancel android

This fix was not needed in react-native 0.63.4 but is needed after we upgraded to 0.67.5

* get rid of unused platform import

---------
Co-authored-by: Jakub Sokołowski <jakub@status.im>
2023-04-12 15:25:19 +05:30
Mohamed Javid 7d4be37111
[Feature] Sign in by scanning sync QR code (#15416) 2023-03-24 20:36:25 +05:30
Omar Basem 8923408972
Landscape Mode (#15175)
* feat: landscape mode
2023-03-03 16:33:28 +04:00
Brian Sztamfater 9333692830
feat: remove wallet connect 1.0 (#15010) 2023-03-02 17:55:03 +01:00
Michele Balistreri 6a58f9552d
update keycard native module
Signed-off-by: Michele Balistreri <michele@bitgamma.com>
2023-02-23 11:11:20 +01:00
yqrashawn 46896ff7f4
ci: add component test (#15071) 2023-02-21 13:42:33 +08:00
Parvesh Monu 612c17a8db
Add blur overlay for bottom tabs and shell top nav (#14783) 2023-01-25 20:08:11 +05:30
Icaro Motta 8cf95cdb30
New make target to run tests via REPL (#14576) 2022-12-20 09:07:00 -03:00
Jamie Caprani c6e8aad745
feat: add component tests using react-testing-library and jest (#14331) 2022-11-23 05:59:18 -08:00
Jamie Caprani 72d43ba745
Visual tests setup (#14329)
feat: configuration setup for visual tests

Co-authored-by: Erik Seppanen <esep@protonmail.com>
2022-11-20 15:46:04 -08:00
yqrashawn f5a61d9a8b
chore: fix can't remove node 0 error breaking react-devtools (#14316) 2022-11-10 16:42:41 +08:00
Andrea Maria Piana 01eae4da9c
upgrade react native to 0.63.5 2022-11-08 19:50:36 +00:00
Andrej Česen 5e5ed0a11e
Add `code-snippet` component (#14275) 2022-11-03 10:55:33 +03:00
Jakub Sokołowski 93f5b2e32c
nix: fix shadow-cljs on M1 by upgrading to 2.11.16
On M1 calling `shadow-cljs` fails with:
```
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader$NativeLibrary/load (ClassLoader.java:-2).
/private/var/folders/__/x311ykg17rqgq2wyl4kn1pdr0001yh/T/jna8753030888504535661.tmp:
    dlopen(/private/var/folders/__/x311ykg17rqgq2wyl4kn1pdr0001yh/T/jna8753030888504535661.tmp, 0x0001):
        tried: '/private/var/folders/__/x311ykg17rqgq2wyl4kn1pdr0001yh/T/jna8753030888504535661.tmp'
            (fat file, but missing compatible architecture (have (unknown,i386,x86_64), need (arm64e)))
```
This is due to an outdeted dependency on JNA 3.2.2, which is pulled in
by `hawk` package which up until release `2.11.16` was a `shadow-clj`
dependency which was removed because it was:

>Only used to be used on macOS since it was slightly faster than the default
>JVM implementation. However in Big Sur it seems to cause issues and break
>completely or just be a lot slower.

https://github.com/thheller/shadow-cljs/commit/f3b89b5a

Dropped the explicit dependency on `org.clojure/core.async` to avoid:
```
WARNING: The org.clojure/core.async dependency in shadow-cljs.edn was ignored.
Default version is used and override is not allowed to ensure compatibility.
```

Resolves: https://github.com/status-im/status-mobile/issues/14196

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2022-10-20 17:54:02 +02:00
Icaro Motta 5d775d93fa
Use native binary for the clj-kondo linter (#14179) 2022-10-19 09:54:01 -03:00
frank 7ac2e1aa20
replace web3-utils methods usage by status-go (#13940)
Signed-off-by: frank <lovefree103@gmail.com>
2022-10-19 00:05:07 +08:00
flexsurfer 35eae4587b
clean deps and fix warnings (#14141) 2022-10-11 12:20:37 +02:00
Michele Balistreri 56cb2b747a
bump keycard module
Signed-off-by: Michele Balistreri <michele@bitgamma.com>
2022-09-19 20:22:19 +02:00