The native module : `react-native-status` has always been 1 big fat file per platform which contained all of the native modules.
In case of Android it was `StatusModule.java`
This commit modularises it & attempts to thin out this 1 big file into these categories:
- `AccountManager.java`
- `EncryptionUtils.java`
- `DatabaseManager.java`
- `UIHelper.java`
- `LogManager.java`
- `NetworkManager.java`
- `Utils.java`
In case of iOS it was `RCTStatus.m`
This commit modularises it & attempts to thin out this 1 big file into these categories:
- `AccountManager.m`
- `EncryptionUtils.m`
- `DatabaseManager.m`
- `UIHelper.m`
- `LogManager.m`
- `NetworkManager.m`
- `Utils.m`
In this commit we also remove a lot of unused native code which has no reference on cljs side.
* Show collectibles to send and add filter capabilities
Additionally,
* Replace the sub `:wallet/collectibles-per-account` by `:wallet/current-viewing-account-collectibles` since
it was only used for the current viewing account and simplified the code.
* Refactor the select-asset view.
* Generalize collectibles-tab view
* Add translations for "not found" state
* Modify reanimated/view to support vectors contained in styles
* Add code examples of animated inline styles
Additionally,
* Fix warning about reactive deref not supported in lazy-seqs
This commit:
- Introduces new event ":wallet/initialize" to group events that need to be called on login
- Refactors wallet networks to use the nested structure in re-frame
- Fixes a bug when updating the testnet network preferences of an account the production network preferences update
---------
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
* feat: added biometrics setting to new-settings
* fix: fix renaming issues from status-im2
* ref: addressed @cammellos' review comments
* fix: open password settings in a modal
* ref: addressed review comments
* fix: disabling biometric clears auth-method from keychain
* chore: quo/overlay seqs the childrend so need to add keys
* fix: don't pass the password unmasked between events to avoid leaks
This commit adds the feature to show aggregated tokens and balances in the Wallet home.
---------
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
* fix: generate_profile_url.cljs$core$IFn$_invoke$arity$2 crash when login
'status_im.common.universal_links.generate_profile_url.cljs$core$IFn$_invoke$arity$2' is undefined
update the function to a fixed arity function
* fix: schema/=> macro for :function schema
Signed-off-by: yqrashawn <namy.19@gmail.com>
---------
Signed-off-by: yqrashawn <namy.19@gmail.com>
* Update wallet events and subs to handle collectibles per account
Additionally,
- Move collectibles related events to a new events namespace (`status-im.contexts.wallet.events.collectibles`).
- Update tests to consider collectibles per account.
* Update collectibles tab to handle a current viewing account
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.
This commit:
- Updates the "skeleton-list" component to support the "assets" type
- Adds the assets skeleton to the assets tab in the wallet home and account screen
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This PR does a few things:
1) Add fetch messages implementation on any kind of chat. It's behind a
toggle (on by default) as design is still unsure whether we want it,
but it's very useful for debugging.
2) Allow setting light client from mobile
It also partially remove node config management from the clojure part,
as it's better if that's not explicitly managed by clients.
Some parts are still relying on it but they are not functional
(keycard), while others are still using it and will need to be updated
eventually (syncing), in order to get rid completely of node config.
Sets fleet to shards.test
90c31afe...1adcf02f
This commit:
- Updates the account switcher in the "page-nav" component to use "account-avatar" instead of "dropdown"
- Updates the account avatar (on the top right corner of the account screen) to display the watched account variant correctly
- Updates the accounts list in the account switcher to display the correct background for the watched account with the eye icon
---------
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
This commit:
- adds support for different currencies in token price calculation in the new wallet UI.
- fixes the token units and prices displayed in the individual account screen
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
* fix: chat header position when only a few messages
* fix: system_message add contact icon margin
* fix: fixed last grouped message vertical padding
* fix: show message user info on long press of grouped message
* feat: added mute button to chat's channel-actions
* fix: no custom color in message list background
* fix: composer placeholder color (light theme)
* draft: fix android initial chat position
* fix: scrolling chat to top changed content size
* fix: chat message list header animation and behavior
* fix: android initial chat state
* fix: adjusted the chat avatar animation position
* fix: chat content change with keyboard visible
* ref: small refactor and added some notes
* fix: removed broken require
* fix: mute label for channel chat
* fix: merge conflict fixes
This commit:
- adds another variant ("Select account" bottom sheet) of the account switcher for wallet - send flow
- adds watch-only? key in the account to prevent repetitive account type checks across the codebase
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
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.
* Create token component
* Replace token images by new token component
The new component is being used in the following components:
- token-input
- network-amount
- token-tag
- summary-tag
- context-tag
- token-value
- token-network
- preview-list
* Rename token image file: eth-token -> eth
* Remove resources/get-token function
* Add `utils.money/add` version able to work with `nil`s
* Store token raw-balance as big-number
* Improve account balance calculations using `utils.money` existing functions
* Update `:wallet/tokens-filtered` sub
* Make `prettify-balance` able to work with bignumbers
* Move docstring to be available while using `colors/resolve-color`
* Add text combinations - username component and tests
* Add username related svg icons
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).
* update scan qr code page
* update scan qr code page
* fixed: populate the search input with new identity
* dismiss keyboard when scan qr page is activated
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>
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.
* 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>
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.
----------------------------------------------------------------------
* 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.
- 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.
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>
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>
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
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>
Fix the unreliable swipe behavior of link previews in the chat composer. In many
occasions, we noticed the horizontal scroll wasn't being triggered properly or
not at all. In other occasions, the swipe gesture would incorrectly register a
press on the parent `Touchable` component.
Fixes https://github.com/status-im/status-mobile/issues/16599
fix: improving UI and gestures
fix: expanding on press now works reliably
fix: center text and disable gestures for short messages
feat: added styling for one-lined messages
fix: small opacity fix
ref: small condition change
fix: horizontal swiping being unreliable with vertical scrolling
ref: reusing shared value from lightbox animations
fix: text-sheet bottom gradient not visible on android
fix: addressed qa issues 1,2,4
fix: zoomable-image stuck if moved vertically when full screen
clean: removed unused var
chore: removed unused require
fix: don't allow returning text-sheet down and up in one move
fix: text-sheet bar styling was wrong
fix: adjusted gradient animation with designs
fix: text-sheet bar opacity
* Align docstring
* Create share-qr-code component
* Remove empty style file
* Implement common.share-qr-code including call to media server
* Add share-qr-code preview screen
* Use share-qr-code component in shell's share screen
* Add tests and some fixes
This commit moves the "network-routing" component test to the quo ns from quo2 ns.
Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
* feat: debug/show components from the REPL
* ref: some renames and cleanup
* chore: removed comments/imports
* feat: added remount on every eval & small changes
* doc: added tip to debugging doc
* doc: formatting
* doc: more formatting
* fix: fixed docs and other review comments
* fix: moved & renamed into the dev.component-preview ns
* style: adjusted debugging readme spacing
* fix: removed trailing line
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