Commit Graph

406 Commits

Author SHA1 Message Date
Siddarth Kumar df76881c90
chore: disable hermes via gradle project env var (#18675)
fixes #18493

We enabled `hermes` for android in the `react-native` upgrade to `0.72.5`
Although things seemed fine but developers were seeing frequent crashes in their local environment.

After some investigation the crashes were traced to max native call stack depth in `hermes` engine.
Disabling `hermes` for local debug builds helps fix that issue.

This commit disables `hermes` by default with the help of a exporting an environment variable in the `make run-android` command.
It is annoying that this also modifies `android/gradle.properties` so we keep `hermesEnabled` as `false` there as well.
We also enable `hermes` when generating release builds so that we can take advantage of `hermes` engine in release builds.

We also add a log to print whether `hermes` is enabled or not. I think its helpful to have this so that we know whether `hermes` is enabled or not.
2024-02-01 20:56:18 +05:30
Siddarth Kumar f57a26b5f5
Remove hacks from darwin nix purge script (#18656)
## Summary
In this commit we : 
- instead of `cd` to `/Library/LaunchDaemons` and then attempting to `launchctl unload` the nixos plist files we just pass the full path to unload as seen in `nix` documentation here : https://nixos.org/manual/nix/stable/installation/uninstall.html#:~:text=Stop%20and%20remove%20the%20Nix%20daemon%20services%3A

- move killing a process by prompting for confirmation to a new shell script as per feedback from previous PR : https://github.com/status-im/status-mobile/pull/18192#discussion_r1439495310

- fix few small typos

## Platforms
- macOS
2024-01-30 09:00:26 +05:30
Lungu Cristian 901818492d
Replace unmaintained biometrics package (#18531)
* feat: added react-native-biometrics dependency

* chore: added malli schema to auth

* fix: malli schema

* feat: using react-native-biometrics

* fix: removed biometry not-enrolled error supression

* feat: added check for enabled biometric

* fix: biometrics error handling on ios

* chore: remove touch-id library

* chore: cleanup

* removed proj.list dep

* fix: gradle get_projects regex edge-case

Handles cases when the gradle project has a description, which shows up when running `gradle projects` as (`react-native-biometrics` - react-native-biometrics), breaking `make nix-update-gradle`. Here we're just adjusting the regex to ignore everything in the line after the closing (`).

* build: ran "make nix-update-gradle"

* chore: comment typo

* chore: replaced old lib in test mocks

* fix: addressed review comments

* fix: using event for standard-auth biometrics

* ref: using ex-cause for biometric error codes

* fix: removed promesa changes

* fix: auth slide biometric success not triggered
2024-01-29 13:33:46 +02:00
Siddarth Kumar 09bf6673cf
chore: upgrade `kotlinPluginVersion` to `1.9.0` (#18487)
### Summary

We need to bump `kotlin` Plugin version to `1.9.0` because the `nixpkgs` upgrade will set default `gradle` version to `8.4`.
`gradle` version `8.4` comes with a base `kotlin` version of `1.9.0` which becomes incompatible with our existing version of `1.7`

Otherwise we get errors like this :

```
e: /Users/siddarthkumar/code/experiments/status-mobile/node_modules/@react-native/
gradle-plugin/src/main/kotlin/com/facebook/react/utils/TaskUtils.kt: (25, 7): Class
'kotlin.collections.CollectionsKt__CollectionsKt' was compiled with an incompatible version of Kotlin.
The binary version of its metadata is 1.9.0, expected version is 1.7.1.
The class is loaded from /nix/store/3a228ppiiljfvsrxyq15h25chmiwsmbh-gradle-8.4/lib/gradle/lib/
kotlin-stdlib-1.9.10.jar!/kotlin/collections/CollectionsKt__CollectionsKt.class
.
.
.
```

needed for https://github.com/status-im/status-mobile/pull/18321

In this commit we set `kotlinPluginVersion` to `1.9.0` and update `gradle` dependencies.

#### Platforms
- Android
2024-01-16 21:18:15 +05:30
Siddarth Kumar 4eff9cc39c
fix: don't show trace message when default is set (#18464)
`getEnvWithDefault.nix` prints a trace message in console when a default value is not set. 

In this commit we add a check to see if default value matches the value of that env var.
Otherwise we get log messages like these when running `make run-ios`

```
trace: getEnvWithDefault IOS_STATUS_GO_TARGETS 
(default: ios/arm64;iossimulator/amd64): ios/arm64;iossimulator/amd64
trace: getEnvWithDefault IOS_STATUS_GO_TARGETS 
(default: ios/arm64;iossimulator/amd64): ios/arm64;iossimulator/amd64
```

We also fix a tiny mistake in `make run-ios` status-go target by updating the delimiter to be a semi-colon instead of a comma.
2024-01-11 14:57:28 +05:30
Jakub Sokołowski 257b0684ef
nix: fix regex in clean.sh script
Repo used to be called `status-react`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-01-10 13:05:39 +01:00
Siddarth Kumar f992f4addd
fix: boost checksum issue due to jfrog (#18434)
I tried doing a clean pod install and was faced with this : 

```
Installing Yoga (1.14.0)
Installing boost (1.76.0)

[!] Error installing boost
Verification checksum was incorrect, expected 
f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41, got 
5e89103d9b70bba5c91a794126b169cb67654be2051f90cf7c22ba6893ede0ff
```

related issue in react-native repo : https://github.com/facebook/react-native/issues/42180 

In this commit we patch the pod specs provided by react native to rely on `sourceforge` instead `jfrog` to get boost.
2024-01-08 23:55:36 +05:30
Jakub Sokołowski 5915dd42bd
ci: upgrade CI hosts to Xcode 15.1
https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes
https://developer.apple.com/documentation/xcode-release-notes/xcode-15_0_1-release-notes
https://developer.apple.com/documentation/xcode-release-notes/xcode-15_1-release-notes

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2024-01-07 22:24:35 +01:00
Siddarth Kumar 7a4d79179d
chore: add Kotlin support (#18293)
This commit is a pre-requisite to upgrading `react-native` to `0.73.x`, now that react-native has completely moved their android code over from `Java` to `Kotlin` , it is also necessary for us to begin doing the same.

This commit converts just 2 files which are important at the moment.
- `android/app/src/main/java/im/status/ethereum/MainActivity.java`
- `android/app/src/main/java/im/status/ethereum/MainApplication.java`

I will can convert the remaining files in follow ups.
2023-12-28 20:20:25 +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 10b97843ce
feat: add `xcbeautify` to iOS shell (#18273)
I can't remember the number of times I have had to ask developers to run `make run-ios | xcbeautify` when debugging iOS build failures and they do not have `xcbeautify` installed on their environment.

`xcbeautify` helps make `xcodebuild` output more readable and to identify problems quickly.

This commit adds `xcbeautify` to iOS shell and to  `make run-ios` so that we get readable output by default.
2023-12-22 19:45:59 +05:30
Anton Iakimov 2d22ed810c
ci: fix android-e2e nightly builds (#18261) 2023-12-21 14:36:16 +01:00
Siddarth Kumar 771fb111e6
make purge script more robust for Darwin (#18192)
The existing purge script for Darwin would fail and stop at many stages.

This commit makes the script more robust to certain failures that were observed and documented in https://github.com/status-im/status-mobile/issues/16404
2023-12-19 08:46:19 +05:30
Siddarth Kumar 8d0bb7ba9e
fix: modify permissions of all files to read (#18214)
`react-native-reanimated` generates write protected files during build time which are problematic because we copy over `node_modules` from `nix` store and when replacing them with new node modules we are manually asked to confirm this overwrite.

This used to happen before with `.cxx` files but now it also happens with `.so` files. 

This commit fixes those permissions.

partially fixes #18211
2023-12-18 14:38:34 +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
Siddarth Kumar 3ad345519b
nix: bump clang to 15 & patch Glog for CC,CXX flag (#18108)
After upgrading MacOS to Sonoma and Xcode to 15, pod install stage would fail with clang errors.
Turns out that react-native's configure glog script sets 2 additional flags, CC and CXX which conflicts with flags already set in nix iOS shell.

In this commit we :

- bump clang from 10.0.0 to 15.0.7
- patch glog configure script to avoid setting those flags

This fixes the iOS builds.
2023-12-07 15:36:08 +05:30
Icaro Motta 563f1c588d
Improve test failure readability (#18049)
Problem: failed equality checks as in "(is (= expected actual))" will give a
single, long line of output that for anything but the simplest data structures
is unreadable by humans, and the output doesn't give a useful diff.

Solution: use library https://github.com/nubank/matcher-combinators and its test
directive "match?" which will pinpoint where two data structures differ. Then,
instead of "(is (= ...", use "(is (match? expected actual)". It works
beautifully.

The library offers other nice matchers, but the majority of the time match? is
sufficient.

Can we use another test runner like Kaocha? kaocha-cljs2
(https://github.com/lambdaisland/kaocha-cljs2) would be able to print better
test errors out of the box, among other features, but I have no clue if it would
work well or at all in our stack (in theory yes, but it's a larger piece of
work).
2023-12-05 17:20:54 -03: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
Dmitri Akatov a5bb95cd18
add translation linting to the "make lint" pipeline. (#17820) 2023-11-07 11:33:59 +01:00
yqrashawn 701df811b0
feat: lint direct require quo component outside src/quo (#17828) 2023-11-07 10:21:58 +08: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
Icaro Motta ca6fd3df66
Upgrade Clojure libraries (#17690)
Upgrades and cleans up all production Clojure dependencies and 1 dev-only
dependency (com.taoensso/tufte).

- Remove warning "WARNING: update-keys already refers to:
  #'clojure.core/update-keys in namespace: io.aviso.exception"
- Remove hickory and mvxcvi/alphabase dependencies they are not used.
- Upgrade com.taoensso/tufte from 2.1.0 to 2.6.3
- Upgrade transit-cljs from 0.8.248 to 0.8.280
- Upgrade cljs-bean from 1.3.0 to 1.9.0
- Remove workaround for com.taoensso/timbre in shadow-cljs.edn
- Upgrade com.taoensso/timbre from 4.10 (Status fork) to 6.3.1
2023-10-20 20:47:23 -03:00
Jakub Sokołowski 2df7a7cf6d
nix: do not exclude module files from Gradle deps
This is necessary for the React Native `0.72.5` build to work.
https://github.com/status-im/status-mobile/pull/17241

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-10-19 14:06:39 +02:00
yqrashawn 4c2ae2338a
chore: add lsp clean-ns in lint-fix (#17661) 2023-10-18 00:17:43 +08:00
Jakub Sokołowski 6bbe930425
nix: pin Ruby at 3.1, fastlane shell for nix-update-gems
Since the `default` shell doesn't have Ruby, the `nix-update-gems`
target would incorrectly use the system Ruby instead of the one from Nix.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-10-17 16:59:49 +02:00
Jakub Sokołowski d01c337a2c
nix: update Clojure dependencies to remove POMs
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-10-13 15:23:42 +02:00
Jakub Sokołowski d1442b306a
nix: stop downloading POMs for Clojure dependencies
Clojure dependencies require only JARs to work. Downloading POMs is both
a waste of time, space, and bandwidth. In addition POMs create edge
cases that we would have to handle, an would rather avoid.

For example, the `guice` package which shows up in the classpath
includes a JAR named `guice-4.2.2-no_aop.jar`. The issue with that is
that there is no corresponding POM in the directory:
https://repo1.maven.org/maven2/com/google/inject/guice/4.2.2/

Either we have to make a special case for such packages, or we can just
skip POMs entirely and avoid the mess.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-10-13 15:23:41 +02:00
Icaro Motta 7f960f9be5
Add custom linter for i18n/label translation keywords (#17610)
This commit adds a custom linter to verify i18n/label is called with a qualified
keyword, like :t/foo. More sophisticated linters are possible too.

We also set the stage for other developers to consider more lint automation
instead of manually reviewing conventions in PRs.

If you want to understand how to write custom linters, check out
https://github.com/clj-kondo/clj-kondo/blob/master/doc/hooks.md. You can fire
the Clojure JVM REPL in status-mobile and play with the clj-kondo hook too, it
works beautifully.

Why do we care? By making sure all translation keywords are qualified with "t",
it is trivial to grep or replace them because they're unique in the repo, and
can't be confused with other words if you search by ":t/<something>".

Note: It's a best practice to commit clj-kondo configuration from external
libraries in the .clj-kondo directory. The directory .clj-kondo/babashka is
auto-generated, that's why it was added.
2023-10-11 18:53:34 -03:00
Icaro Motta b73ac6b107
Upgrade clj-kondo and configure new linters (#17543)
- Upgrade clj-kondo to latest version to take advantage of new linters. From
  version 2023.04.14
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230414 to
  2023.09.07
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230907
- Use new linter ":unused-alias" and set at WARN level for the moment, because
  otherwise the PR would increase a bit too much, but it did catch many unused
  "require" aliases. Added in version 2023.09.07
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230907
- Use new linter ":case-symbol-test" and fix the reported errors, added in
  version 2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Use new linters ":equals-true", ":plus-one", and ":minus-one" and fix reported
  errors, added in version 2023.05.18
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230518
- Raise level from WARN to ERROR for linter "uninitialized-var".
- Explicitly add ":case-duplicate-test" to clj-kondo config, renamed in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Explicitly add ":case-quoted-test" to clj-kondo config, renamed in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713
- Explicitly add ":deprecated-namespace" to clj-kondo config, added in version
  2023.07.13
  https://github.com/clj-kondo/clj-kondo/blob/master/CHANGELOG.md#20230713

Fixes https://github.com/status-im/status-mobile/issues/17287
2023-10-05 15:50:57 -03:00
Vitaliy Vlasov fbe30d7b18
Update status-go to v0.167.6
b3213172...e1354016
Signed-off-by: Vitaliy Vlasov <siphiuel@protonmail.com>
2023-10-04 01:16:25 +03:00
Anton Iakimov b7a090716d
nix: set ios status-go targets 2023-09-07 14:15:30 +02:00
Andrea Maria Piana 155f57ca6b
Dont parse unused identicon 2023-09-06 14:09:37 +01:00
Jakub Sokołowski f433956657
nix: refresh Gradle dependenncies using new setup
Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-09-04 09:58:21 +02:00
Jakub Sokołowski 83f622d349
nix: make fetching Gradle dependencies more generic
Before what we did was essentially guess what files might exist for any
given package. This approach mostly works, but not entirely.
This is especially problematic when dealing with weird edge case
packages like `react-native`, which you can read about here:

https://github.com/react-native-community/discussions-and-proposals/pull/508
https://github.com/react-native-community/discussions-and-proposals/blob/4a06fc64/proposals/0508-out-of-npm-artifacts.md#the-react-native-android-archive

In order to avoid as much the guessing aspect of fetching Gradle
dependencies we are using both HTML listsings of files and
`artifact-metadata.json` files that exist for more recent packages.

This way we can avoid having to add special edge cases that have been
found out when working on React Native 72 upgrade in:
https://github.com/status-im/status-mobile/pull/17062

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-09-04 09:57:53 +02:00
Anton Iakimov 34f7a48503 nix: map android arch to status-go builds
Fixes partially #15595
In order to build less targets, when not needed we introduce this
mapping logic.
If only specific ABI is required - status-go will have the same
arhitecuture.
2023-08-23 12:15:05 +03:00
Anton Iakimov d5c1ecc104
nix: switch status-im config to env vars, cleanup
To help with #15595 changes, refactoring is required.
In this PR we switch from config to env vars.
Doing some cleanup meanwhile.
2023-08-07 14:50:36 +02: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
Anton Iakimov 07d037f2e1
nix: downgrade watchman to 4.9.0
watchman was upgraded significantly during the last #14944 (4.9.0 (Aug 16, 2017) to 2023.01.30.00 - 6 years between):
status-im/nixpkgs@4e9c02b

Probably causing developers to have "too many files open" issue #16341

This PR is an attempt to fix the issue by downgrading the watchman

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-07-02 08:46:28 +02:00
Jakub Sokołowski 1503f6b250
nix: use Darwin stat command explicitly
Otherwise if in Nix context we can accidentally use GNU stat which
results in a different output due to different command line flags:
```
[nix-shell:~/status-mobile]$ stat -Lf "%Sg" "/nix/store"
stat: cannot read file system information for '%Sg': No such file or directory
  File: "/nix/store"
    ID: 10000110000001a Namelen: ?       Type: apfs
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 242837545  Free: 199242283  Available: 199242283
Inodes: Total: 7971454780 Free: 7969691320
```
And it should be just owner group name or ID. Which in turn results in:
```
Unknown Nix installtion type!
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-27 13:25:41 +02:00
Anton Iakimov 5dcd64c478
nix: fix Android SDK on Darwin with nixpkgs system override
Android SDK in nixpkg doesn't support `aarch64-darwin`, for details see
https://github.com/status-im/status-mobile/issues/12794

The workaround was to run terminal application with Rosetta or make with `aarch` tool.

This PR overrides system architecture to always be `x86_64` for Android shell and build targets ran by make.
CI is not affected as it runs `nix` directly.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-26 17:33:44 +02:00
Siddarth Kumar 1c50dc7067
nix: skip git-lfs checks failing on darwin
On macOS `git-lfs` checks fail sometimes and they also take a lot of time to execute.

```log
FAIL    github.com/git-lfs/git-lfs/v3/lfshttp   0.820s
FAIL
error: builder for '/nix/store/abd6spw876qvcmlpcwsljsnbpbnvx1fg-git-lfs-3.3.0.drv' failed with exit code 1;
       last 10 log lines:
       >          Error Trace:    certs_test.go:210
       >              Error:          Expected value not to be nil.
       >          Test:           TestCertFromSSLCAPathEnv
       >     certs_test.go:210:
       >               Error Trace:    certs_test.go:210
       >              Error:          Expected value not to be nil.
       >          Test:           TestCertFromSSLCAPathEnv
       > FAIL
       > FAIL    github.com/git-lfs/git-lfs/v3/lfshttp   0.820s
       > FAIL
       For full logs, run 'nix-store -l /nix/store/abd6spw876qvcmlpcwsljsnbpbnvx1fg-git-lfs-3.3.0.drv'.
```
Failures initially observed by me and @smohamedjavid and then today again reported by @yqrashawn

This commit adds a `nix` overlay that skips those checks
2023-06-26 10:49:32 +02:00
Ibrahem 125d3239de
nix: build derivation from sources if cache fails
This is a workaround for a well known issue of Nix failing to download
bigger packages from Nix cache due to errors like this:
```
HTTP error 200 (curl error: Transferred a partial file)
```
or
```
HTTP error 200 (curl error: Stream error in the HTTP/2 framing layer)
```
From docs: https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-fallback

>If set to true, Nix will fall back to building from source if a binary
>substitute fails. This is equivalent to the --fallback flag. The default is false.

Realted: https://github.com/status-im/infra-ci/issues/17

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-25 23:34:59 +02:00
Anton Iakimov 7e56e35f56
nix: add missing Apple SDKs to fix make test on macOS
Fixes following error:
```
ld: framework not found IOKit
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [status_nodejs_addon.target.mk:175: Release/status_nodejs_addon.node] Error 1
```
The `make test` target started to fail on macOS after #14944.

This PR adds 2 Apple SDK frameworks to default shell: `IOKit` and `CoreServices`

The other 2 mentioned in `binding.gyp` are not added, but build is ok.

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

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-24 10:56:21 +02:00
Jakub Sokołowski 5e6d488a3e
nix: fix cache usage by modifying global config
Otherwise Nix produces warnings like this:
```
warning: ignoring untrusted substituter 'https://nix-cache.status.im/', you are not a trusted user.
```
Since adding users to `trusted-users` essentially gives them `root`:

>Adding a user to trusted-users is essentially equivalent to giving that user root access to the system.
> — https://nixos.org/manual/nix/stable/command-ref/conf-file.html#conf-trusted-users

A more kosher approach might be to just add the cache config itself globally.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-23 18:02:38 +02:00
Jakub Sokołowski 33b2e12e3b
android: fix Gradle deps, drop Flipper, upgrade Fresco
There are a few fixes here:

* Changes format of Gradle deps to `:buildEnvironment` and `:dependencies`:
    ```
    Cannot locate tasks that match '::buildEnvironment'. The path should not include an empty segment (try ':buildEnvironment' instead).
    ```
* Fix for GNU Parallel tool to use stdin for list of arguments:
    ```
    nix/deps/gradle/generate.sh: line 55: parallel: Argument list too long
    ```
* Update of Facebook Fresco dependencies from `2.2.0` to `2.5.0` to fix:
    ```
     > echo com.facebook.fresco:animated-gif:2.2.0 | ./go-maven-resolver > /dev/null
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:imagepipeline-native:2.2.0 O=false S=compile >
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:memory-type-native:2.2.0 O=false S=compile >
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:imagepipeline:2.2.0 O=false S=compile >
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:drawee:2.2.0 O=false S=runtime >
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:memory-type-java:2.2.0 O=false S=compile >
    finder.go:121: error: 'no pom data' for: <Dep ID=com.facebook.fresco:fbcore:2.2.0 O=false S=runtime >
    ```
* Remove Flipper to avoid pulling in Fresco `2.2.0` versions:
    ```
    +--- com.facebook.flipper:flipper-fresco-plugin:0.54.0
    |    +--- com.facebook.fresco:fresco:2.2.0 -> 2.5.0
    |    +--- com.facebook.fresco🐬2.2.0
    |    \--- com.facebook.fresco:stetho:2.2.0
    ```

Thanks for help from Sidarth.

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

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-23 12:02:18 +02:00
Jakub Sokołowski 7260c23e8e
nix: downgrade from 2.14.1 to 2.13.4
Should resolve errors like this:
```
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
```

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-22 14:23:47 +02:00
Jakub Sokołowski c4b13eb043
nix: use builtins to not depend on channels
We use `builtins.fetchTarball` to avoid having to first import a
`nixpkgs` from existing channels, which breaks if there are no channels.

Otherwise new Nix 2.14 version can result in:
```
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)
```
Which happens due to no default `nixpkgs` channel existing:
```
 > nix-channel --list

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

Signed-off-by: Jakub Sokołowski <jakub@status.im>
2023-06-21 15:36:08 +02:00
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