Compare commits

...
Author SHA1 Message Date
Prem Chaitanya Prathi 08c1b84f41 fix: handle network change for filter subs
https://github.com/status-im/status-go/compare/84493728...58707e78
2025-01-08 07:27:46 +05:30
Mohamed Javid ba8cf8e863 fix(wallet)_: collectible route cleanup on navigating back from TX confirmation page (#21883)
This commit fixes routes not cleaned properly ("Context Canceled" and "No Routes Found" errors thrown on generating the next route) when the user navigates back from the TX confirmation screen using the device's back button/gesture.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2025-01-07 19:04:01 +05:30
Siddarth Kumar ce1d2c4ed8 android: Kotlinify push notifications module (#21881) 2025-01-07 15:45:54 +05:30
Yevheniia Berdnyk 813c60f9e1 e2e: requirements cleanup 2025-01-07 03:07:01 +02:00
Volodymyr Kozieiev 28a81f2dd8 🎄 🧹 New Year cleanup (#21868)
* big cleannup: warnings fixed, unused code removed
2025-01-06 12:03:36 +00:00
Yevheniia Berdnyk 826410b687 e2e: cleanup base_test_case and conftest 2025-01-03 18:14:20 +02:00
Siddarth Kumar 1aa7594c41 android: kotlinify encryption utils (#21878) 2025-01-03 21:21:11 +05:30
Siddarth Kumar 5ff1d70357 android: kotlinify ui helper (#21879) 2025-01-03 21:03:06 +05:30
Siddarth Kumar 2a95f7cfac android: kotlinify root util (#21877) 2025-01-03 20:30:48 +05:30
frank 4654c4a543 fix(sha3)_: support hex string (#21837)
* fix(sha3)_: support hex string

https://github.com/status-im/status-go/compare/84493728...e01e489e
2025-01-03 08:44:02 +08:00
Mohamed Javid baf3b8c9ed fix(wallet)_: Send flow for collectibles (#21871)
This commit fixes

- the send flow for collectibles (ERC721 and ERC1155)
- picking the right balance of the ERC1155 in the send flow from the account page, based on the account viewing by the user
- the balance of ERC1155 is sometimes incorrect if the collectible is present in more than one account of the user

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2025-01-02 23:40:11 +05:30
Brian Sztamfater c6ff90954f fix_: add token and selected network on "Select network to receive" screen (#21872) 2025-01-02 11:40:04 -03:00
Tetiana Churikova c37498a6b2 e2e: big cleanup (#21875) 2024-12-30 21:10:54 +01:00
Brian Sztamfater c1b0f3ae98 fix_: include assets only related to selected network on edit asset drawer on send and bridge flows (#21869)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-12-30 11:36:43 -03:00
Icaro Motta 5007dc757f chore: Bump status-go version to include fix for bad peer check for lightmode (#21865)
Upgrades status-go to version v8.0.0, which includes the fix from PR
https://github.com/status-im/status-go/pull/5964 fix_: bad peer check logic for
lightmode and some fixes.

Might resolve https://github.com/status-im/status-mobile/issues/18031

Areas that may be impacted: we are moving from status-go version 7.0.0 to 8.0.0.
These are the changes:

- https://github.com/status-im/status-go/commit/a4e36d49c * fix_: missing message verifier start-stop ,go-waku updates, lightpush service rate limits (#5964)
- https://github.com/status-im/status-go/commit/810468a57 * test_: create private group tests (#6225)
- https://github.com/status-im/status-go/commit/0cf556bdb * test_: unskip test initialize logging (#6229)
- https://github.com/status-im/status-go/commit/b803918c2 * ci_: pytest-lint correct target pr branch (#6230)
- https://github.com/status-im/status-go/commit/d29120447 * chore(block)!: remove desktop BlockContact function for parity (#6172)
- https://github.com/status-im/status-go/commit/309d17ae5 * feat_: status-backend health endpoint (#6201)
- https://github.com/status-im/status-go/commit/6a5623bac * test_: set proxy creds (#6211)
- https://github.com/status-im/status-go/commit/2172abe95 * fix_: add infuraSecret and statusProxyBlockchainPassword to secrets (#6217)
- https://github.com/status-im/status-go/commit/0f7c26dc9 * test_: skip flaky TestService_IncrementalUpdateMixed (#6205)
- https://github.com/status-im/status-go/commit/75bdda271 * fix_: correct sensitive regex (#6188)
- https://github.com/status-im/status-go/commit/08eee8a64 * test_: add python linters (#6212)
- https://github.com/status-im/status-go/commit/66850321e * fix_: remove logging of rpc endpoint (#6195)
- https://github.com/status-im/status-go/commit/c27c773c2 * chore(wallet)_: from and to chains added to send details
- https://github.com/status-im/status-go/commit/74db63143 * test_: contact requests tests (#6167)
- https://github.com/status-im/status-go/commit/5a8310d5a * fix(pins)_: delete pins when the og message is deleted (#6173)
- https://github.com/status-im/status-go/commit/137698e02 * ci_: bring back cmd coverage (#6204)
- https://github.com/status-im/status-go/commit/1795620df * test_: run functional tests on host (no container) (#6159)
- https://github.com/status-im/status-go/commit/ef177c1c6 * feat_: SensitiveString type (#6190)
- https://github.com/status-im/status-go/commit/8b95c8148 * feat_: graceful shutdown with status-backend (#6189)
- https://github.com/status-im/status-go/commit/e6c2f89f0 * chore_: remove endpoint InitLogging (#6182)
- https://github.com/status-im/status-go/commit/4ccb08f11 * test_: WalletService class (#6171)
- https://github.com/status-im/status-go/commit/943ae1335 * fix(functional-tests)_: disable testnet (#6181)
- https://github.com/status-im/status-go/commit/616a76098 * feat_: api logging signals (#6150)
- https://github.com/status-im/status-go/commit/dfb591874 * fix_: check group error in GetBalancesAtByChain (#6169)
- https://github.com/status-im/status-go/commit/3a0080281 * fix_: create/restore account error signal (#6174)
- https://github.com/status-im/status-go/commit/e7cc53529 * feat(telem)_: track total waku message bandwidth (#6157)
- https://github.com/status-im/status-go/commit/d07e61f61 * fix_: nil *MessengerResponse is a valid result (#6175))
2024-12-26 22:20:43 -03:00
Tetiana Churikova b09f3fa6da logs: enable nightly (#21864) 2024-12-26 13:46:21 +01:00
Yevheniia Berdnyk b11c817392 e2e: LambdaTest 2024-12-26 11:44:48 +02:00
Parvesh Monu 247674b280 Onboarding remove identifiers code and refactor create_or_sync_profile screen (#21668) 2024-12-24 21:34:45 +05:30
Mohsen 07ea097bb4 [#21336] feat: upgrade wallet connect (#21833) 2024-12-24 13:13:52 +03:00
Brian Sztamfater 23d3a2db2a feat(wallet): simplify send and bridge flow ux (#21595)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-12-23 12:00:17 -03:00
Shivek KhuranaandIcaro Motta a85ca5bd3d chore: Give non-destructive instructions when Keycard migration failed (#21844)
Co-authored-by: Icaro Motta <icaro.ldm@gmail.com>
2024-12-20 18:05:11 +05:30
Mohamed Javid 0f036ca9c4 fix_: slider reset in standard authentication (#21831)
This commit fixes the slider-button doesn't reset after the completion of slider in standard authentication with keycard keypairs.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-17 17:46:16 +05:30
flexsurfer c19128e8b1 [#21828] Close the flows for adding accounts in keycard accounts (#21829) 2024-12-16 17:49:59 +01:00
Brian Sztamfater 8d615801d1 feat_: optimize endpoint calls when fetching balances (#21802)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-12-16 12:11:09 -03:00
Mohsen 4f6e1897fe [#21135] fix: handle unsupported wallet address (#21820) 2024-12-16 17:54:16 +03:00
Ulises ManuelandShivek Khurana 93b5f8d180 Hide viewing community token requirements under a feature flag (#21814)
Co-authored-by: Shivek Khurana <khuranashivek@outlook.com>
2024-12-16 18:17:06 +05:30
Parvesh Monu 0e607dc293 fix Privacy policy button in learn more sheet open terms-of-use sheet (#21823) 2024-12-16 15:42:17 +05:30
flexsurfer 9ced0e4131 [#21708] [Android] Login with Keycard stucks on Preparing screen from time to time (#21811) 2024-12-13 19:57:26 +01:00
Sean Hagstrom 55ee800e18 feature: add keycard metric events (#21794)
This change adds some metrics events for tracking when keycard users have reached an unavailable feature, when keycard users have successfully logged in, and when keycard users have succeeded or failed to migrate to keycard.
2024-12-12 09:21:09 -08:00
flexsurfer 676998b83b [#21803] Cannot perform transactions/create derived account via keycard using NON default keypairs which existed before keycard migration (#21808) 2024-12-12 16:31:54 +01:00
Ulises Manuel 755ef19315 feat(profile): Make terms of use and privacy policy easily accessible (#21759)
* Fix `:true` keyword being used in navigation screens.

* Add about screen, terms of use and privacy policy links

* Remove old about app screen
2024-12-11 13:15:26 -06:00
Ulises Manuel bc9b0f8c87 feat(oboarding): Update ilustrations (#21781)
* Share usage data screen image done

* Update login by syncing and login using recovery phrase images

*  Small refactor: remove `merge` and add a `let` binding

* Fix modal entering expected animation
2024-12-11 11:05:23 -06:00
Yevheniia Berdnyk c8b063493b e2e: False failures fixes 2024-12-11 00:38:34 +02:00
flexsurfer 949e78a17e [#21577] Keycard [Wallet] - Derives next account for profile key pair (#21753) 2024-12-10 18:07:45 +01:00
Mohsen a821ec5a14 [#21763] feat: add feature unavailable for dapps interaction (#21771) 2024-12-10 11:35:44 +01:00
cuiyourong 4648066ec7 chore: fix some typos in comment (#21775) 2024-12-10 09:27:32 +01:00
Ulises ManuelandYevheniia Berdnyk e85bc539d3 feat(onboarding): Remove color and username steps (#21715)
* Remove password disclaimer, update copy and simplify implementation

* Remove non-existing wallet event

* Skip profile configuration for the "create profile" onboarding flow

* Include flow for new profiles when another profile already exists

* Add explanation about temp username

* Point 20 to a constant

* Simplify create profile password screen

* Fix password creation screen jump on mount

* e2e: updated tests

* Completely remove the "create profile" onboarding screen

* e2e: updated tests with recovering user

---------

Co-authored-by: Yevheniia Berdnyk <ie.berdnyk@gmail.com>
2024-12-09 13:55:47 -06:00
Mohamed Javid c26d298573 fix_: slider reset in standard authentication (#21779)
This commit resets the slider-button after the completion of slider in standard authentication.


Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-10 00:56:57 +05:30
Mohamed Javid cdde36ca28 fix(wallet)_: logic for calculating zero balance (#21777)
This commit fixes logic to calculate whether the user has zero balance in all non-watched accounts.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-10 00:21:00 +05:30
Mohamed Javid 3c3ef20769 fix(wallet)_: tx data cleanup after send or bridge tx (#21770)
This commit fixes the token/networks going to zero/disabled in the "Bridge to" screen when the user navigates back from the input screen.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-09 20:02:48 +05:30
Alexander 2150f6db48 Bump release to 2.32.0 (#21773) 2024-12-09 12:26:51 +01:00
Sean Hagstrom 10101a23e6 Feature: add "close community" action to opened/spectated communities (#21687)
This change adds a new action to the action-drawer for opened communities. Now opened communities can be closed by users by pressing on the "Close community" action. Note, that this action will only be available to communities displayed in communities list under the opened tab.
2024-12-06 09:50:40 -08:00
Brian Sztamfater f75fff9dd8 fix_: sometimes balances are not updated until relogin (#21748)
https://github.com/status-im/status-go/compare/a61f28bf...5371520f

Signed-off-by: Brian Sztamfater <brian@status.im>
2024-12-06 13:32:05 -03:00
frank 9aa31ddf02 fix: no peers available supporting LightPush protocol (#21730)
When network is restored from disabled state.
2024-12-06 11:09:22 -03:00
Mohamed Javid 9a61b30c50 feat(wallet)_: keycard support for swap and approval (#21764)
This commit adds support for Keycard in the swap flow

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-06 17:55:36 +05:30
Volodymyr Kozieiev f1652ee2c4 Change value that triggers routes requesting in send screen (#21751) 2024-12-06 11:43:02 +00:00
Mohsen e1d2b9b1c1 [#21709] fix: big number issue in swap max value (#21752) 2024-12-06 12:48:24 +03:00
frank e60c20bc10 feat(websocket): add ping/pong keep-alive mechanism for iOS websocket (#21733)
Add WebSocket keep-alive mechanism using ping/pong frames to maintain connection stability:
- Add ping timer that sends ping every 30 seconds
- Automatically reconnect if ping fails
- Properly cleanup timer on disconnect
- Add logging for StatusGo server requests

This helps prevent connection timeouts and ensures timely detection of connection issues.
2024-12-06 15:37:17 +08:00
Icaro Motta 1391c48e39 chore(analytics): Improve tracking of login and onboarding completion events (#21760)
Improves tracking of login and successful onboarding completion according to
requests from non-technical analytics users and to synchronize with desktop. We
now publish two new events user-logged-in and onboarding-completed.

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

Areas that may be impacted: no impact is expected whatsoever, but login and
onboarding code were lightly touched.

- Event user-logged-in is always published, whenever the profile login is
  successful. If the user created a profile, we publish both
  onboarding-completed and user-logged-in.
- Event onboarding-completed is published if the user created a profile,
  recovered using seed phrase or paired devices successfully.
2024-12-05 18:40:10 -03:00
Mohamed Javid 2343d9be1e fix(wallet)_: default token image fallback (#21762)
This commit replaces the fallback for an unknown token image (where we display the first letter of the token name) with the default token image

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-05 20:56:38 +05:30
Parvesh Monu 7b85bfbd53 Remove elipses from preparing status label (#21757) 2024-12-05 16:01:23 +05:30
Volodymyr Kozieiev 27bfbea6bd Fix sending collectible by building transaction before signing (#21744)
* Fix sending collectible by building transaction before signing
2024-12-05 10:19:26 +00:00
Lungu Cristian caaff74efe Fix div error after amount is set as fiat (#21732)
* fix: cleanup send state on input unmount

* fix: switching default val to fiat filled input with 0.00
2024-12-05 09:53:57 +02:00
Brian Sztamfater 6ce58db7b9 fix_: incorrect USDT estimation and decimals on swap on arbitrum network (#21741)
https://github.com/status-im/status-go/compare/896eb635...a61f28bf

Signed-off-by: Brian Sztamfater <brian@status.im>
2024-12-04 14:34:01 -03:00
Sean Hagstrom fe788c3c26 feature: display registered profile keycards inside keycard settings (#21739)
This change adds support for displaying the keycards inside the keycards settings screen. Note, that the keycards that are displayed are the keycards that are associated to the user's profile keypair.
2024-12-04 09:06:19 -08:00
Yevheniia Berdnyk 1faa2e8f88 e2e: added key pair test 2024-12-04 16:55:39 +02:00
Parvesh Monu 2b7430e008 Update onboarding carousel and share usage screen (#21742) 2024-12-04 20:19:23 +05:30
Sean Hagstrom 62c8e73409 fix: avoid re-renders inside contact-list for new-chat sheet (#21640)
This change fixes some of the re-rendering issues that occur inside the contact list when creating a new chat. Most important is that we avoid extra re-renders by configuring the flat-list with stable props. And we also avoid re-rendering avatar images each time the avatar component re-renders.
2024-12-04 06:30:10 -08:00
Mohamed Javid e0e9ab9adb fix(wallet)_: token decimals in activities (#21745)
This commit fixes certain asset values that are 0 in wallet activities.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-04 19:23:48 +05:30
Siddarth Kumar b618f73063 ios: explicitly specify path to fetch CryptoSwift (#21750)
This commit explicitly specifies location and version of `CryptoSwift` pod in attempt to fix errors like this in CI.
```
None of your spec sources contain a spec satisfying the dependencies: `CryptoSwift (= 1.8.0), CryptoSwift`.
```
2024-12-04 19:05:43 +05:30
Mohamed Javid 8a88aac34d fix(wallet)_: wallet card flexible width (#21746)
This commit 
 - adds container-style prop to the wallet card component 
 - makes the Buy and Receive CTAs (cards) width flexible as we display two cards, and it needs to fill the screen width.

NOTE: The component's fixed width is 161, but in certain phones, it's small and does not fill the screen's whole width.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-03 23:50:17 +05:30
Mohsen 32ccca0912 [#21323] fix: wrong networks when asset not available in default account (#21689) 2024-12-03 17:24:30 +03:00
flexsurfer 2be78041e2 [#21669] [iOS] "Oops, this is not a Keycard" screen appears if user didn't scan his card properly (#21737) 2024-12-03 14:32:37 +01:00
Lungu Cristian d941029661 Fix swaps received value UI bug (#21724)
* fix: use text instead of input for received value

* fix: using input-disabled? instead of pay?
2024-12-03 11:49:15 +02:00
Lungu Cristian f7c930964c Show Swaps fee accurately as <0.01 when very small (#21726)
* fix: use full fiat value when converting from crypto

* test: fixed tests
2024-12-03 11:21:45 +02:00
Lungu Cristian 0c25b77e54 fix: show accurate approval fee for swaps (#21718) 2024-12-03 10:28:23 +02:00
Icaro Motta d0deb94bf3 fix(chats): Fix chats leaking to other profile (#21713)
Fixes a regression introduced in PR
https://github.com/status-im/status-mobile/pull/21634.

What's important is that the fix for chats leaking to other profiles was a
client-side bug, thus not coming from status-go, thus no private data was
leaking to other profiles. This PR keeps the existing workaround to memoize
chats in the home screen.

Fixes https://github.com/status-im/status-mobile/issues/21696
2024-12-02 23:27:37 -03:00
Icaro Motta 3a444f40f3 fix(group-chat): Missing group chat name when clearing history (#21684)
Fix missing group name when user chooses drawer option to clear chat history
from within the group chat screen.

Fixes https://github.com/status-im/status-mobile/issues/21639
2024-12-02 22:01:53 -03:00
Icaro Motta 7537c6b033 chore: Use en-US as default locale for F-Droid (#21714)
In Google Play and App Store, it is desirable to use en-GB (English UK) as the
default locale for legal reasons. We heard from F-Droid folks that en-GB is not
as well supported as en-US
https://github.com/status-im/status-mobile/issues/21665.

In this PR we go back to en-US as the default locale in fastlane and update the
text for English (UK) standards. Google Play and App Store shouldn’t be affected
and will use en-GB as the default locale.

Fixes https://github.com/status-im/status-mobile/issues/21665
2024-12-02 21:49:46 -03:00
Yevheniia Berdnyk e67f6c1cd3 e2e: mark skipped tests in TR 2024-12-02 20:13:35 +02:00
Tetiana Churikova 1d7eb49c57 e2e: remove xfail for staging fleet (#21681) 2024-12-02 18:33:48 +01:00
Mohamed Javid f6dfc64567 feat(wallet)!: Activity - a more reliable update (#21596)
This commit:

- Removes the usage of deprecated "wallet_filterActivityAsync RPC" and updates it to "wallet_startActivityFilterSessionV2" with other supporting activity filter session RPCs
- Removes deprecated "wallet_checkRecentHistoryForChainIDs" RPC as we no longer support past transaction history
- Added support for Bridge, Swap and Approval activities
- Added context for the sender and receiver if the address is known (own accounts or saved addresses)
- Added support for viewing, copying and sharing links to TX details on block explorer

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-12-02 21:35:05 +05:30
flexsurfer f08ac94596 [#21686] User can not sign transactions after Login/Sign up flows using Keycard (#21699) 2024-12-02 14:57:03 +01:00
Mohamed Javid 52a8f8fc22 feat(wallet)_: Show buy and receive cta on zero balance (#21690)
This commit:

- adds wallet-card component
- adds Buy and Receive CTAs above the assets list in the wallet home if the balance is zero

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-11-30 00:03:29 +05:30
Brian Sztamfater 6859fb8f8e fix(swap): optimize endpoints calls (#21549)
Signed-off-by: Brian Sztamfater <brian@status.im>
2024-11-29 13:21:44 -03:00
frank f45f96975e refactor_: rename LOG_REQUEST_GO to API_LOGGING_ENABLED (#21677)
https://github.com/status-im/status-go/compare/032eb5b6...c014fbfc

- Rename LOG_REQUEST_GO env variable to API_LOGGING_ENABLED across all env files
- Rename requests.log to api.log for consistency
- Remove standalone initLogging functionality from native modules as it's now
  handled within InitializeApplication
- Add logging configuration (logEnabled, logLevel, apiLoggingEnabled) to
  InitializeApplication params
- Add logDir parameter for Android to ensure proper log file location

This change consolidates logging initialization into the InitializeApplication
flow and makes the naming more consistent with its actual functionality.
2024-11-29 22:01:27 +08:00
Lungu Cristian 53d5ac4ea2 Using Keycard with the new Endpoints for Send/Bridge (#21705)
* fix: routes component annoying warning

* feat: replaced keycard sign with sign-hashes

* feat: using the keycard to sign transactions

* fix: removed unused and weird imports

* chore: removed debug logs

* chore: linting

* fix: removed clearing data on send error
2024-11-29 09:18:12 +02:00
Mohsen 874f07bd77 [#21644] fix: display zero for empty balances asset (#21697) 2024-11-29 08:42:37 +03:00
Mohamed Javid 4efb3c111a fix(wallet)_: error on tapping from/to section in tx confirmation screen (#21695)
This commit fixes the error thrown when tapping the From or To sections in the transaction confirmation screen.

Signed-off-by: Mohamed Javid <19339952+smohamedjavid@users.noreply.github.com>
2024-11-28 22:59:19 +05:30
Alexander de2b5fb935 Update sending transaction end point (#21480) (#21541)
* Update sending transaction end point

* Transaction approval

* Fixes

* Fixes

* Fixes

* Fix for issue 3

* Fixes for 2, 4, 7

* Update

* Fixes

* Fixes
2024-11-28 14:08:35 +01:00
Icaro Motta 5f8d5fd57e perf: Optimize messenger initialization (#21642)
Integrates the optimizations coming from the status-go PR
https://github.com/status-im/status-go/pull/6106. Now messenger filters are
set-up concurrently and we can call the endpoint wakuext_chatsPreview twice:
once for non-community chats and once for community chats. This way, the user
should be able to see some data render before the slow part ends
(community-related data).

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

Areas that may be impacted

- Login
- Loading of data after login (contacts, chats, etc)
2024-11-28 08:46:32 -03:00
Ulises Manuel 763b291629 fix(messenger): List of users overlap composer input (#21641)
* Fix mentions overlapped

* Fix rendering blink
2024-11-27 16:05:56 -06:00
Sean Hagstrom 9f50686042 fix: ensure keycard pin error message is visible (#21691)
Primarily, this change fixes an issue related to the Keycard PIN error message not being visible displayed on some devices. Additionally, this change also clears the PIN entry state after failing to enter the correct Keycard PIN. And this change also allows for the PIN entry component to have two separate error modes: one for the entire component and another for just the info text.
2024-11-27 08:47:56 -08:00
Yevheniia Berdnyk 1652601a82 e2e: fix for fallback tests 2024-11-27 15:47:12 +02:00
Yevheniia Berdnyk 7a44db36fe e2e: updated onboarding flow in tests 2024-11-27 03:30:00 +05:30
Parvesh Monu 338b241c8e Implement onboarding share usage data screen 2024-11-27 03:30:00 +05:30
Volodymyr Kozieiev 91761a92c7 Replace GetWalletToken endpoint with FetchOrGetCachedWalletBalances (#21625) 2024-11-26 13:27:58 +00:00
Sean Hagstrom 4b2a1db12f fix: add spacing between wrong-password error and forgot-password link (#21594) 2024-11-25 10:29:00 -08:00
Mohsen 05d4b4b068 [#21615] fix: hide mercuryo provider (#21626) 2024-11-25 20:58:58 +03:00
flexsurfer 9c9b55fe3e [#21573] Keycard - Sign up with a new Keycard (#21623) 2024-11-25 15:22:21 +01:00
Yevheniia Berdnyk 6ec307a8bb e2e: updated buttons ids 2024-11-25 15:07:37 +05:30
Parvesh Monu 86553eff14 Update create profile and sign in screen 2024-11-25 15:06:18 +05:30
Yevheniia Berdnyk 60911a1dd1 e2e: false failures fixes 2024-11-22 17:54:38 +02:00
671 changed files with 8770 additions and 27805 deletions
-185
View File
@@ -1,185 +0,0 @@
legacy.status-im.utils.build/warning-handler
legacy.status-im.utils.build/get-current-sha
status-im.constants/spacing-char
status-im.constants/arg-wrapping-char
legacy.status-im.ios.core/init
legacy.status-im.ui.components.camera/aspects
legacy.status-im.ui.components.camera/capture-targets
legacy.status-im.ui.components.camera/set-torch
legacy.status-im.ui.components.camera/request-access-ios
legacy.status-im.chat.models.message-content/stylings
legacy.status-im.chat.models.message-content/actions
legacy.status-im.chat.models.message-content/blank-string
legacy.status-im.chat.models.message-content/sorted-ranges
legacy.status-im.ethereum.mnemonic/words->passphrase
native-module.core/listener
native-module.core/multiaccount-reset
native-module.core/extract-group-membership-signatures
native-module.core/sign-group-membership
native-module.core/update-mailservers
legacy.status-im.ethereum.abi-spec/bytes-to-hex
legacy.status-im.android.core/init
legacy.status-im.chat.models.message/transport-keys
legacy.status-im.utils.datetime/week
legacy.status-im.utils.datetime/time-ago
legacy.status-im.utils.datetime/format-date
legacy.status-im.utils.datetime/get-ordinal-date
reagent.dom/render
reagent.dom/unmount-component-at-node
reagent.dom/dom-node
reagent.dom/force-update-all
legacy.status-im.multiaccounts.create.core/get-new-key-code
legacy.status-im.ethereum.decode/string
legacy.status-im.ui.screens.network.views/mainnet?
legacy.status-im.data-store.chats/event->string
legacy.status-im.mailserver.constants/seven-days
legacy.status-im.mailserver.constants/connection-timeout
legacy.status-im.hardwallet.card/install-applet
legacy.status-im.hardwallet.card/install-cash-applet
legacy.status-im.multiaccount.login.data-test/all-contacts
legacy.status-im.multiaccount.login.data-test/multiaccounts
legacy.status-im.multiaccount.login.data-test/get-chats
legacy.status-im.multiaccount.login.data-test/transport
legacy.status-im.multiaccount.login.data-test/topics
legacy.status-im.utils.utils/clear-timeout
legacy.status-im.utils.handlers/logged-in
legacy.status-im.multiaccounts.model/credentials
legacy.status-im.multiaccounts.login.core/contract-fleet?
legacy.status-im.multiaccounts.login.core/fetch-nodes
status-im.config/rpc-networks-only?
status-im.config/waku-enabled?
legacy.status-im.utils.pairing/has-paired-installations?
legacy.status-im.tribute-to-talk.core-test/user-cofx
mocks.js-dependencies/action-button
mocks.js-dependencies/camera
mocks.js-dependencies/dismiss-keyboard
mocks.js-dependencies/emoji-picker
mocks.js-dependencies/i18n
mocks.js-dependencies/qr-code
mocks.js-dependencies/svg
mocks.js-dependencies/icons
mocks.js-dependencies/webview
mocks.js-dependencies/desktop-linking
mocks.js-dependencies/desktop-shortcuts
mocks.js-dependencies/snoopy
mocks.js-dependencies/snoopy-filter
mocks.js-dependencies/snoopy-bars
mocks.js-dependencies/snoopy-buffer
mocks.js-dependencies/desktop-menu
mocks.js-dependencies/desktop-config
mocks.js-dependencies/react-native-navigation-twopane
mocks.js-dependencies/react-native-screens
mocks.js-dependencies/react-native-shake
mocks.js-dependencies/back-handler
mocks.js-dependencies/react
mocks.js-dependencies/react-navigation-native
mocks.js-dependencies/react-navigation-stack
mocks.js-dependencies/react-navigation-bottom-tabs
mocks.js-dependencies/react-native-haptic-feedback
mocks.js-dependencies/mock
quo.previews.main/init
legacy.status-im.chat.models.message-list-test/descending-range
legacy.status-im.chat.models.message-list-test/random-range
legacy.status-im.ethereum.eip165/supports?
legacy.status-im.utils.hex/valid-hex?
legacy.status-im.multiaccounts.core/chat-send?
legacy.status-im.hardwallet.simulated-keycard/install-cash-applet
legacy.status-im.hardwallet.simulated-keycard/sign-typed-data
legacy.status-im.utils.core/safe-read-message-content
legacy.status-im.ui.components.react/native-modules
legacy.status-im.ui.components.react/progress-bar
react-native.fs/move-file
react-native.fs/read-dir
react-native.fs/mkdir
react-native.fs/unlink
react-native.fs/file-exists?
legacy.status-im.ui.components.colors/white
legacy.status-im.ui.components.colors/black
legacy.status-im.ui.components.core/animated-header
legacy.status-im.ui.components.core/safe-area-provider
legacy.status-im.ui.components.core/safe-area-consumer
legacy.status-im.ui.components.core/safe-area-view
legacy.status-im.utils.universal-links.core/open!
legacy.status-im.transport.filters.core-test/member-2
legacy.status-im.ui.screens.chat.ttt/one-to-one-chat-description-container
legacy.status-im.ethereum.ens/ttl
legacy.status-im.ethereum.ens/addr-hash
legacy.status-im.ethereum.ens/name-hash
legacy.status-im.ethereum.ens/ABI-hash
legacy.status-im.ethereum.ens/pubkey-hash
legacy.status-im.network.core/get-network
status-im.constants/desktop-content-types
status-im.constants/blocks-per-hour
status-im.constants/one-earth-day
status-im.constants/left-pane-min-width
status-im.constants/system
status-im.constants/contact-discovery
status-im.constants/send-transaction-failed-parse-response
status-im.constants/send-transaction-failed-parse-params
status-im.constants/send-transaction-no-account-selected
status-im.constants/send-transaction-invalid-tx-sender
status-im.constants/web3-get-logs
status-im.constants/web3-transaction-receipt
status-im.constants/web3-new-filter
status-im.constants/web3-new-pending-transaction-filter
status-im.constants/web3-new-block-filter
status-im.constants/web3-uninstall-filter
status-im.constants/web3-get-filter-changes
status-im.constants/web3-shh-post
status-im.constants/web3-shh-new-identity
status-im.constants/web3-shh-has-identity
status-im.constants/web3-shh-new-group
status-im.constants/web3-shh-add-to-group
status-im.constants/web3-shh-new-filter
status-im.constants/web3-shh-uninstall-filter
status-im.constants/web3-shh-get-filter-changes
status-im.constants/web3-shh-get-messages
status-im.constants/status-create-address
status-im.constants/event-transfer-hash
status-im.constants/regx-rtl-characters
status-im.constants/desktop-msg-chars-hard-limit
status-im.constants/debug-metrics
status-im.constants/scan-qr-code
status-im.constants/ipfs-proto-code
status-im.constants/swarm-proto-code
legacy.status-im.multiaccounts.update.publisher/publish-update!
legacy.status-im.utils.async/task-queue
legacy.status-im.utils.async/async-periodic-run!
legacy.status-im.desktop.core/app-root
legacy.status-im.desktop.core/init
legacy.status-im.chat.models-test/test-db
legacy.status-im.ui.components.spacing/padding-vertical
legacy.status-im.utils.money/percent-change
utils.debounce/clear-all
legacy.status-im.transport.db/create-chat
legacy.status-im.utils.priority-map/priority-map
legacy.status-im.utils.priority-map/priority-map-by
legacy.status-im.utils.priority-map/priority-map-keyfn
legacy.status-im.utils.priority-map/empty-message-map
legacy.status-im.wallet.choose-recipient.core/use-default-eth-gas
legacy.status-im.ui.components.animation/decay
legacy.status-im.ui.components.animation/remove-all-listeners
legacy.status-im.ui.components.animation/stop-animation
legacy.status-im.ui.components.animation/animated
legacy.status-im.ui.components.animation/add
legacy.status-im.ui.components.animation/subtract
legacy.status-im.ui.components.animation/get-layout
legacy.status-im.wallet.transactions-test/uri-query-data
legacy.status-im.utils.name/shortened-name
legacy.status-im.ui.components.button.haptic/trigger
legacy.status-im.contact.db/filter-dapps
legacy.status-im.contact.db/filter-group-contacts
legacy.status-im.contact.db/legacy-pending?
legacy.status-im.utils.transducers-test/preview-call-1
legacy.status-im.utils.transducers-test/preview-call-2
legacy.status-im.utils.types/to-string
legacy.status-im.chat.db/datemark?
legacy.status-im.chat.db/gap?
legacy.status-im.chat.db/map->sorted-seq
legacy.status-im.utils.snoopy/status-module-filter
legacy.status-im.utils.snoopy/websocket-filter
legacy.status-im.utils.snoopy/touches-filter
legacy.status-im.utils.snoopy/native-animation-filter
legacy.status-im.utils.snoopy/keyboard-observer-filter
legacy.status-im.utils.multihash/hex
legacy.status-im.utils.multihash/decode-array
+28 -3
View File
@@ -4,7 +4,7 @@
legacy.status-im.utils.views/letsubs clojure.core/let
reagent.core/with-let clojure.core/let
legacy.status-im.utils.fx/defn clj-kondo.lint-as/def-catch-all
utils.re-frame/defn clj-kondo.lint-as/def-catch-all
utils.re-frame/defn clojure.core/defn
quo.react/with-deps-check clojure.core/fn
quo.previews.preview/list-comp clojure.core/for
legacy.status-im.utils.styles/def clojure.core/def
@@ -13,7 +13,29 @@
test-helpers.unit/deftest-event clojure.core/defn
taoensso.tufte/defnp clojure.core/defn}
:linters {:case-duplicate-test {:level :error}
:linters {:clojure-lsp/unused-public-var {:exclude-when-defined-by #{utils.re-frame/defn}
:exclude #{
;; even if we are not
;; using color now, we
;; will need it later
quo.foundations.colors
;; same for funcs from
;; native-module
native-module.core
;; some funcs used
;; temporarily during
;; development
test-helpers.component
test-helpers.unit
;; not sure if unused
;; functions here should
;; be removed:
keycard.keycard
react-native.fs}}
:case-duplicate-test {:level :error}
:case-quoted-test {:level :error}
:case-symbol-test {:level :error}
:clj-kondo-config {:level :error}
@@ -40,7 +62,8 @@
:equals-true {:level :error}
:inline-def {:level :error}
:invalid-arity {:skip-args [legacy.status-im.utils.fx/defn
utils.re-frame/defn]}
utils.re-frame/defn
utils.re-frame/merge]}
:loop-without-recur {:level :error}
:minus-one {:level :error}
:misplaced-docstring {:level :error}
@@ -53,6 +76,8 @@
:redundant-do {:level :error}
:redundant-let {:level :error}
:refer-all {:level :error}
;; ignore error in config itself saying that `:shadowed-fn-param` is unknown
#_{:clj-kondo/ignore [:clj-kondo-config]}
:shadowed-fn-param {:level :error}
:shadowed-var {:level :error
;; We temporarily use :include to define an
+1 -1
View File
@@ -35,4 +35,4 @@ TEST_NETWORKS_ENABLED=1
SHOW_NOT_IMPLEMENTED_FEATURES=0
ENABLE_ALERT_BANNER=0
FLAG_WALLET_CONNECT_ENABLED=1
LOG_REQUEST_GO=1
API_LOGGING_ENABLED=1
+1 -1
View File
@@ -39,4 +39,4 @@ DELETE_MESSAGE_UNDO_TIME_LIMIT=10000
ENABLE_ALERT_BANNER=0
FLAG_WALLET_CONNECT_ENABLED=1
MOBILE_DATA_SYNCING_TOGGLE_ENABLE=0
LOG_REQUEST_GO=1
API_LOGGING_ENABLED=1
+1 -1
View File
@@ -36,4 +36,4 @@ FAST_CREATE_COMMUNITY_ENABLED=1
TEST_NETWORKS_ENABLED=1
ENABLE_ALERT_BANNER=1
FLAG_WALLET_CONNECT_ENABLED=1
LOG_REQUEST_GO=1
API_LOGGING_ENABLED=1
+2 -2
View File
@@ -2,7 +2,7 @@ DEBUG_WEBVIEW=1
ETHEREUM_DEV_CLUSTER=1
EXTENSIONS=0
GROUP_CHATS_ENABLED=1
LOG_LEVEL=info
LOG_LEVEL=debug
MAILSERVER_CONFIRMATIONS_ENABLED=1
MAINNET_WARNING_ENABLED=1
PFS_ENCRYPTION_ENABLED=1
@@ -23,4 +23,4 @@ FAST_CREATE_COMMUNITY_ENABLED=0
TEST_NETWORKS_ENABLED=0
ENABLE_ALERT_BANNER=1
FLAG_WALLET_CONNECT_ENABLED=1
LOG_REQUEST_GO=0
API_LOGGING_ENABLED=1
+1 -1
View File
@@ -20,4 +20,4 @@ FAST_CREATE_COMMUNITY_ENABLED=0
TEST_NETWORKS_ENABLED=0
STATUS_PROXY_STAGE_NAME=prod
FLAG_WALLET_CONNECT_ENABLED=1
LOG_REQUEST_GO=0
API_LOGGING_ENABLED=0
+1 -1
View File
@@ -1 +1 @@
2.30.0
2.32.0
@@ -1,40 +0,0 @@
package im.status.ethereum;
import java.io.File;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/** @author Kevin Kowalewski */
public class RootUtil {
public static boolean isDeviceRooted() {
return checkRootMethod1() || checkRootMethod2() || checkRootMethod3();
}
private static boolean checkRootMethod1() {
String buildTags = android.os.Build.TAGS;
return buildTags != null && buildTags.contains("test-keys");
}
private static boolean checkRootMethod2() {
String[] paths = { "/system/app/Superuser.apk", "/sbin/su", "/system/bin/su", "/system/xbin/su", "/data/local/xbin/su", "/data/local/bin/su", "/system/sd/xbin/su",
"/system/bin/failsafe/su", "/data/local/su" };
for (String path : paths) {
if (new File(path).exists()) return true;
}
return false;
}
private static boolean checkRootMethod3() {
Process process = null;
try {
process = Runtime.getRuntime().exec(new String[] { "/system/xbin/which", "su" });
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
return in.readLine() != null;
} catch (Throwable t) {
return false;
} finally {
if (process != null) process.destroy();
}
}
}
@@ -0,0 +1,42 @@
package im.status.ethereum
import android.os.Build
import java.io.BufferedReader
import java.io.File
import java.io.InputStreamReader
object RootUtil {
fun isDeviceRooted(): Boolean =
checkRootMethod1() || checkRootMethod2() || checkRootMethod3()
private fun checkRootMethod1(): Boolean =
Build.TAGS?.contains("test-keys") ?: false
private fun checkRootMethod2(): Boolean {
val paths = arrayOf(
"/system/app/Superuser.apk",
"/sbin/su",
"/system/bin/su",
"/system/xbin/su",
"/data/local/xbin/su",
"/data/local/bin/su",
"/system/sd/xbin/su",
"/system/bin/failsafe/su",
"/data/local/su"
)
return paths.any { File(it).exists() }
}
private fun checkRootMethod3(): Boolean {
var process: Process? = null
return try {
process = Runtime.getRuntime().exec(arrayOf("/system/xbin/which", "su"))
BufferedReader(InputStreamReader(process.inputStream)).readLine() != null
} catch (t: Throwable) {
false
} finally {
process?.destroy()
}
}
}
+4 -20
View File
@@ -73,9 +73,9 @@ pipeline {
passwordVariable: 'TESTRAIL_PASS'
),
usernamePassword(
credentialsId: 'sauce-labs-api',
usernameVariable: 'SAUCE_USERNAME',
passwordVariable: 'SAUCE_ACCESS_KEY'
credentialsId: 'lambda-test-api',
usernameVariable: 'LAMBDA_TEST_USERNAME',
passwordVariable: 'LAMBDA_TEST_ACCESS_KEY'
),
string(
credentialsId: 'etherscan-api-key',
@@ -95,8 +95,7 @@ pipeline {
sh 'cp -f $TEST_ETH_ACCOUNTS_FILE users.py'
sh """
python3 -m pytest \
--numprocesses 8 \
--rerun_count=2 \
--numprocesses 9 \
--testrail_report=True \
-m testrail_id \
-m \"nightly\" \
@@ -110,21 +109,6 @@ pipeline {
}
post {
always {
script {
sauce('sauce-labs-cred') {
saucePublisher()
}
}
}
success {
script {
junit(
testDataPublishers: [[$class: 'SauceOnDemandReportPublisher', jobVisibility: 'public']],
testResults: 'test/appium/tests/*.xml'
)
}
}
cleanup {
sh 'make purge'
}
+4 -5
View File
@@ -111,9 +111,9 @@ pipeline {
passwordVariable: 'TESTRAIL_PASS'
),
usernamePassword(
credentialsId: 'sauce-labs-api',
usernameVariable: 'SAUCE_USERNAME',
passwordVariable: 'SAUCE_ACCESS_KEY'
credentialsId: 'lambda-test-api',
usernameVariable: 'LAMBDA_TEST_USERNAME',
passwordVariable: 'LAMBDA_TEST_ACCESS_KEY'
),
string(
credentialsId: 'etherscan-api-key',
@@ -133,8 +133,7 @@ pipeline {
sh 'cp -f $TEST_ETH_ACCOUNTS_FILE users.py'
sh """
python3 -m pytest \
--numprocesses 8 \
--rerun_count=2 \
--numprocesses 9 \
--testrail_report=True \
-k \"${params.KEYWORD_EXPRESSION}\" \
--apk=${params.APK_URL ?: apk_path} \
+1 -1
View File
@@ -150,7 +150,7 @@ This one is straightforward, just evaluate a navigation dispatch form from anywh
#### REPL-ing a component
This is also straighforward, but there are some small differences. Just like above, we only have to evaluate a dispatch form, as follows:
This is also straightforward, but there are some small differences. Just like above, we only have to evaluate a dispatch form, as follows:
```cljs
;; example debugging a quo component, although it could be any other component e.g. from the `status-im2` ns.
+1 -1
View File
@@ -26,7 +26,7 @@ export STATUS_BACKEND_SERVER_HOST="127.0.0.1:60000"
export STATUS_BACKEND_SERVER_ROOT_DATA_DIR="/path/to/your/root/data/dir"
```
You need to change `STATUS_BACKEND_SERVER_ROOT_DATA_DIR` to your preferred directory and ensure it exists, it should be in absolute path.
All the db files and log files(requests.log/geth.log) and keystore files etc will be stored in this directory.
All the db files and log files(api.log/geth.log) and keystore files etc will be stored in this directory.
### Start the status backend server:
```shell
@@ -6,13 +6,13 @@ SECURE ETHEREUM WALLET
The Status crypto wallet allows you to securely send, store, and exchange Ethereum assets such as ETH, SNT, stable coins such as DAI, as well as collectibles. Confidently take control of your cryptocurrency and digital assets with our multichain Ethereum wallet app, supporting mainnet, Arbitrum, and Optimism. The Status blockchain wallet currently only supports ETH, ERC-20, ERC-721, and ERC-1155 assets; it does not support Bitcoin.
PRIVATE MESSENGER
Send private 1:1 and private group chats without anyone snooping on your communications. Status is a messenger app that eliminates centralised message relays for greater privacy and secure messaging. All messages are encrypted with end-to-end encryption. Additionally, no message exposes who the author or the intended recipient is, so nobody, not even Status, knows who is talking to who or what was said.
Send private 1:1 and private group chats without anyone snooping on your communications. Status is a messenger app that eliminates centralized message relays for greater privacy and secure messaging. All messages are encrypted with end-to-end encryption. Additionally, no message exposes who the author or the intended recipient is, so nobody, not even Status, knows who is talking to who or what was said.
EARN WITH DEFI
Put your crypto to work with the latest decentralised finance apps and decentralised exchanges (DEX) such as Maker, Aave, Uniswap, Synthetix, PoolTogether, Zerion, Kyber, and more.
Put your crypto to work with the latest decentralized finance apps and decentralized exchanges (DEX) such as Maker, Aave, Uniswap, Synthetix, PoolTogether, Zerion, Kyber, and more.
CONNECT WITH YOUR COMMUNITY
Explore, connect, and chat with your favourite communities and friends. Whether it is a small group of friends, an artist collective, crypto traders, or the next big organization - text and communicate with Status communities.
Explore, connect, and chat with your favorite communities and friends. Whether it is a small group of friends, an artist collective, crypto traders, or the next big organization - text and communicate with Status communities.
PRIVATE ACCOUNT CREATION
Stay private with pseudo-anonymous account creation. When creating your free account, you will NEVER have to enter a phone number, email address, or bank account. Your wallet private keys are locally generated and securely stored to ensure only you have access to your funds and financial transactions.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 192 KiB

Before

Width:  |  Height:  |  Size: 272 KiB

After

Width:  |  Height:  |  Size: 272 KiB

Before

Width:  |  Height:  |  Size: 263 KiB

After

Width:  |  Height:  |  Size: 263 KiB

Before

Width:  |  Height:  |  Size: 396 KiB

After

Width:  |  Height:  |  Size: 396 KiB

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 222 KiB

Before

Width:  |  Height:  |  Size: 262 KiB

After

Width:  |  Height:  |  Size: 262 KiB

Before

Width:  |  Height:  |  Size: 202 KiB

After

Width:  |  Height:  |  Size: 202 KiB

Before

Width:  |  Height:  |  Size: 425 KiB

After

Width:  |  Height:  |  Size: 425 KiB

+3 -2
View File
@@ -57,10 +57,11 @@ abstract_target 'Status' do
pod 'react-native-config', :path => '../node_modules/react-native-config'
pod 'SSZipArchive', '2.4.3'
# to fix [!] CocoaPods could not find compatible versions for pod "CryptoSwift"
pod 'CryptoSwift', git: "https://github.com/krzyzanowskim/CryptoSwift", tag: '1.8.0'
pod "react-native-status-keycard", path: "../node_modules/react-native-status-keycard"
pod "react-native-status", path: "../modules/react-native-status"
pod "Keycard", git: "https://github.com/status-im/Keycard.swift.git"
pod "Keycard", git: "https://github.com/status-im/Keycard.swift.git", tag: '3.1.1'
pod 'secp256k1', git: "https://github.com/status-im/secp256k1.swift.git", submodules: true
target 'StatusIm' do
+21 -10
View File
@@ -1,6 +1,7 @@
PODS:
- BigInt (5.2.0)
- boost (1.83.0)
- CryptoSwift (1.5.1)
- CryptoSwift (1.8.0)
- DoubleConversion (1.1.6)
- FBLazyVector (0.73.5)
- FBReactNativeSpec (0.73.5):
@@ -16,7 +17,8 @@ PODS:
- hermes-engine/Pre-built (= 0.73.5)
- hermes-engine/Pre-built (0.73.5)
- HMSegmentedControl (1.5.6)
- Keycard (3.0.6):
- Keycard (3.1.0):
- BigInt
- CryptoSwift
- secp256k1
- SSZipArchive
@@ -943,7 +945,7 @@ PODS:
- React
- react-native-status (1.0.0):
- React
- react-native-status-keycard (2.5.39):
- react-native-status-keycard (2.6.2):
- Keycard
- React
- react-native-webview (13.6.3):
@@ -1192,12 +1194,13 @@ PODS:
DEPENDENCIES:
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- CryptoSwift (from `https://github.com/krzyzanowskim/CryptoSwift`, tag `1.8.0`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
- FBReactNativeSpec (from `../node_modules/react-native/React/FBReactNativeSpec`)
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- Keycard (from `https://github.com/status-im/Keycard.swift.git`)
- Keycard (from `https://github.com/status-im/Keycard.swift.git`, tag `3.1.1`)
- libevent (~> 2.1.12)
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCT-Folly/Fabric (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
@@ -1285,7 +1288,7 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- CryptoSwift
- BigInt
- fmt
- HMSegmentedControl
- libevent
@@ -1299,6 +1302,9 @@ SPEC REPOS:
EXTERNAL SOURCES:
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
CryptoSwift:
:git: https://github.com/krzyzanowskim/CryptoSwift
:tag: 1.8.0
DoubleConversion:
:podspec: "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec"
FBLazyVector:
@@ -1312,6 +1318,7 @@ EXTERNAL SOURCES:
:tag: hermes-2024-02-20-RNv0.73.5-18f99ace4213052c5e7cdbcd39ee9766cd5df7e4
Keycard:
:git: https://github.com/status-im/Keycard.swift.git
:tag: 3.1.1
RCT-Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTRequired:
@@ -1475,17 +1482,21 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"
CHECKOUT OPTIONS:
CryptoSwift:
:git: https://github.com/krzyzanowskim/CryptoSwift
:tag: 1.8.0
Keycard:
:commit: 17381678bb981c3c553bb7202a26e642cecb1817
:git: https://github.com/status-im/Keycard.swift.git
:tag: 3.1.1
secp256k1:
:commit: 46a1fa30d9b8babeae85ff519050f42394ab5fcc
:git: https://github.com/status-im/secp256k1.swift.git
:submodules: true
SPEC CHECKSUMS:
BigInt: f668a80089607f521586bbe29513d708491ef2f7
boost: d3f49c53809116a5d38da093a8aa78bf551aed09
CryptoSwift: c4f2debceb38bf44c80659afe009f71e23e4a082
CryptoSwift: 52aaf3fce7337552863b1d952e408085f0e65030
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
FBLazyVector: 56e0e498dbb513b96c40bac6284729ba4e62672d
FBReactNativeSpec: 146c741a3f40361f6bc13a4ba284678cbedb5881
@@ -1493,7 +1504,7 @@ SPEC CHECKSUMS:
glog: c0eca6ffed0a6fde1965ef26dcc7bf528f052af4
hermes-engine: 1d1835b2cc54c381909d94d1b3c8e0a2f1a94a0e
HMSegmentedControl: 34c1f54d822d8308e7b24f5d901ec674dfa31352
Keycard: ac6df4d91525c3c82635ac24d4ddd9a80aca5fc8
Keycard: 3bd24405b9a875b3b3cf1ab1be69b5c30c5f28bc
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
RCT-Folly: 7169b2b1c44399c76a47b5deaaba715eeeb476c0
@@ -1534,7 +1545,7 @@ SPEC CHECKSUMS:
react-native-shake: de052eaa3eadc4a326b8ddd7ac80c06e8d84528c
react-native-slider: 12bd76d3d568c9c5500825db54123d44b48e4ad4
react-native-status: 21f75d492fd311dc111303da38a7a2b23a8a8466
react-native-status-keycard: f1c1227b2d5984c10fb44db68e4bfd2937f31e98
react-native-status-keycard: 76a5c826352ee1d70de854b3e8b12670946bc1c8
react-native-webview: 88293a0f23eca8465c0433c023ec632930e644d0
React-nativeconfig: 1166714a4f7ea57a0df5c2cb44fbc70f98d580f9
React-NativeModulesApple: 726664e9829eb5eed8170241000e46ead269a05f
@@ -1582,6 +1593,6 @@ SPEC CHECKSUMS:
TOCropViewController: edfd4f25713d56905ad1e0b9f5be3fbe0f59c863
Yoga: a716eea57d0d3430219c0a5a233e1e93ee931eb7
PODFILE CHECKSUM: 5dd4a5279260d370bcdf016158c825ceb404ee06
PODFILE CHECKSUM: 81a66b45adddb083171ade882c343deb4faf2a8b
COCOAPODS: 1.15.2
+1 -1
View File
@@ -26,4 +26,4 @@ These log files are uploaded to Jenkins as CI job artifacts on failure using `ar
* `set_xcode_version.log` - Output from `node_modules/react-native/scripts/react-native-xcode.sh`.
- Created by redirecting output of `shellScript` in `ios/StatusIm.xcodeproj/project.pbxproj` for "Run Script" build Phase.
* `Status PR-StatusImPR.log - Created by [Fastlane Gym](https://docs.fastlane.tools/actions/gym/).
- Configred via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
- Configured via [`Fastfile`](../Fastfile) using `buildlog_path` argument for `build_ios_app`.
@@ -248,10 +248,14 @@ class AccountManager(private val reactContext: ReactApplicationContext) : ReactC
@ReactMethod
private fun initializeApplication(request: String, callback: Callback) {
Log.d(TAG, "initializeApplication")
val jsonParams = JSONObject(request)
// for ios, the log dir will be the same as the root data dir, status-go will default to root data dir if logDir is not provided
jsonParams.put("logDir", utils.getPublicStorageDirectory()?.absolutePath)
val jsonString = jsonParams.toString()
StatusBackendClient.executeStatusGoRequestWithCallback(
"InitializeApplication",
request,
{ Statusgo.initializeApplication(request) },
jsonString,
{ Statusgo.initializeApplication(jsonString) },
callback
)
}
@@ -1,297 +0,0 @@
package im.status.ethereum.module;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.Callback;
import android.util.Log;
import statusgo.Statusgo;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.function.Function;
import android.app.Activity;
import android.view.WindowManager;
import android.os.Build;
import android.view.Window;
import android.preference.PreferenceManager;
import android.content.SharedPreferences;
public class EncryptionUtils extends ReactContextBaseJavaModule {
private static final String TAG = "EncryptionUtils";
private ReactApplicationContext reactContext;
private Utils utils;
public EncryptionUtils(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
this.utils = new Utils(reactContext);
}
@Override
public String getName() {
return "EncryptionUtils";
}
@ReactMethod
private void initKeystore(final String keyUID, final Callback callback) throws JSONException {
Log.d(TAG, "initKeystore");
final String commonKeydir = this.utils.pathCombine(this.utils.getNoBackupDirectory(), "/keystore");
final String keydir = this.utils.pathCombine(commonKeydir, keyUID);
StatusBackendClient.executeStatusGoRequestWithCallback(
"InitKeystore",
keydir,
() -> Statusgo.initKeystore(keydir),
callback
);
}
@ReactMethod
public void reEncryptDbAndKeystore(final String keyUID, final String password, final String newPassword, final Callback callback) throws JSONException {
JSONObject params = new JSONObject();
params.put("keyUID", keyUID);
params.put("oldPassword", password);
params.put("newPassword", newPassword);
String jsonParams = params.toString();
StatusBackendClient.executeStatusGoRequestWithCallback(
"ChangeDatabasePasswordV2",
jsonParams,
() -> Statusgo.changeDatabasePasswordV2(jsonParams),
callback
);
}
@ReactMethod
public void convertToKeycardAccount(final String keyUID, final String accountData, final String options, final String keycardUID, final String password,
final String newPassword, final Callback callback) throws JSONException {
final String keyStoreDir = this.utils.getKeyStorePath(keyUID);
JSONObject params = new JSONObject();
params.put("keyUID", keyUID);
params.put("account", new JSONObject(accountData));
params.put("settings", new JSONObject(options));
params.put("keycardUID", keycardUID);
params.put("oldPassword", password);
params.put("newPassword", newPassword);
final String jsonParams = params.toString();
StatusBackendClient.executeStatusGoRequest(
"InitKeystore",
keyStoreDir,
() -> Statusgo.initKeystore(keyStoreDir)
);
StatusBackendClient.executeStatusGoRequestWithCallback(
"ConvertToKeycardAccountV2",
jsonParams,
() -> Statusgo.convertToKeycardAccountV2(jsonParams),
callback
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String encodeTransfer(final String to, final String value) {
try {
JSONObject params = new JSONObject();
params.put("to", to);
params.put("value", value);
String jsonParams = params.toString();
return StatusBackendClient.executeStatusGoRequestWithResult(
"EncodeTransferV2",
jsonParams,
() -> Statusgo.encodeTransferV2(jsonParams)
);
} catch (JSONException e) {
Log.e(TAG, "Error creating JSON for encodeTransfer: " + e.getMessage());
return null;
}
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String encodeFunctionCall(final String method, final String paramsJSON) {
try {
JSONObject params = new JSONObject();
params.put("method", method);
params.put("paramsJSON", new JSONObject(paramsJSON));
String jsonString = params.toString();
return StatusBackendClient.executeStatusGoRequestWithResult(
"EncodeFunctionCallV2",
jsonString,
() -> Statusgo.encodeFunctionCallV2(jsonString)
);
} catch (JSONException e) {
Log.e(TAG, "Error creating JSON for encodeFunctionCall: " + e.getMessage());
return null;
}
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String decodeParameters(final String decodeParamJSON) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"DecodeParameters",
decodeParamJSON,
() -> Statusgo.decodeParameters(decodeParamJSON)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String hexToNumber(final String hex) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"HexToNumber",
hex,
() -> Statusgo.hexToNumber(hex)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String numberToHex(final String numString) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"NumberToHex",
numString,
() -> Statusgo.numberToHex(numString)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String sha3(final String str) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"Sha3",
str,
() -> Statusgo.sha3(str)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String utf8ToHex(final String str) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"Utf8ToHex",
str,
() -> Statusgo.utf8ToHex(str)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String hexToUtf8(final String str) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"HexToUtf8",
str,
() -> Statusgo.hexToUtf8(str)
);
}
@ReactMethod(isBlockingSynchronousMethod = true)
public String serializeLegacyKey(final String publicKey) {
return StatusBackendClient.executeStatusGoRequestWithResult(
"SerializeLegacyKey",
publicKey,
() -> Statusgo.serializeLegacyKey(publicKey)
);
}
@ReactMethod
public void setBlankPreviewFlag(final Boolean blankPreview) {
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
sharedPrefs.edit().putBoolean("BLANK_PREVIEW", blankPreview).commit();
setSecureFlag();
}
private void setSecureFlag() {
final SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.reactContext);
final boolean setSecure = sharedPrefs.getBoolean("BLANK_PREVIEW", true);
final Activity activity = this.reactContext.getCurrentActivity();
if (activity != null) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
final Window window = activity.getWindow();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && setSecure) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE);
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE);
}
}
});
}
}
@ReactMethod
public void hashTransaction(final String txArgsJSON, final Callback callback) throws JSONException {
StatusBackendClient.executeStatusGoRequestWithCallback(
"HashTransaction",
txArgsJSON,
() -> Statusgo.hashTransaction(txArgsJSON),
callback
);
}
@ReactMethod
public void hashMessage(final String message, final Callback callback) throws JSONException {
StatusBackendClient.executeStatusGoRequestWithCallback(
"HashMessage",
message,
() -> Statusgo.hashMessage(message),
callback
);
}
@ReactMethod
public void multiformatDeserializePublicKey(final String multiCodecKey, final String base58btc, final Callback callback) throws JSONException {
JSONObject params = new JSONObject();
params.put("key", multiCodecKey);
params.put("outBase", base58btc);
String jsonParams = params.toString();
StatusBackendClient.executeStatusGoRequestWithCallback(
"MultiformatDeserializePublicKeyV2",
jsonParams,
() -> Statusgo.multiformatDeserializePublicKeyV2(jsonParams),
callback
);
}
@ReactMethod
public void deserializeAndCompressKey(final String desktopKey, final Callback callback) throws JSONException {
StatusBackendClient.executeStatusGoRequestWithCallback(
"DeserializeAndCompressKey",
desktopKey,
() -> Statusgo.deserializeAndCompressKey(desktopKey),
callback
);
}
@ReactMethod
public void hashTypedData(final String data, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashTypedData(data), callback);
}
@ReactMethod
public void hashTypedDataV4(final String data, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.hashTypedDataV4(data), callback);
}
@ReactMethod
public void signMessage(final String rpcParams, final Callback callback) throws JSONException {
StatusBackendClient.executeStatusGoRequestWithCallback(
"SignMessage",
rpcParams,
() -> Statusgo.signMessage(rpcParams),
callback
);
}
@ReactMethod
public void signTypedData(final String data, final String account, final String password, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signTypedData(data, account, password), callback);
}
@ReactMethod
public void signTypedDataV4(final String data, final String account, final String password, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signTypedDataV4(data, account, password), callback);
}
@ReactMethod
public void signGroupMembership(final String content, final Callback callback) throws JSONException {
this.utils.executeRunnableStatusGoMethod(() -> Statusgo.signGroupMembership(content), callback);
}
}
@@ -0,0 +1,294 @@
package im.status.ethereum.module
import android.app.Activity
import android.os.Build
import android.preference.PreferenceManager
import android.util.Log
import android.view.WindowManager
import com.facebook.react.bridge.*
import org.json.JSONException
import org.json.JSONObject
import statusgo.Statusgo
import java.lang.Exception
import java.lang.RuntimeException
class EncryptionUtils(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
private val utils = Utils(reactContext)
companion object {
private const val TAG = "EncryptionUtils"
}
override fun getName(): String = "EncryptionUtils"
@ReactMethod
@Throws(Exception::class)
private fun initKeystore(keyUID: String, callback: Callback) {
Log.d(TAG, "initKeystore")
val commonKeydir = utils.pathCombine(utils.getNoBackupDirectory(), "/keystore")
val keydir = utils.pathCombine(commonKeydir, keyUID)
StatusBackendClient.executeStatusGoRequestWithCallback(
"InitKeystore",
keydir,
{ Statusgo.initKeystore(keydir) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun reEncryptDbAndKeystore(keyUID: String, password: String, newPassword: String, callback: Callback) {
val params = JSONObject().apply {
put("keyUID", keyUID)
put("oldPassword", password)
put("newPassword", newPassword)
}
StatusBackendClient.executeStatusGoRequestWithCallback(
"ChangeDatabasePasswordV2",
params.toString(),
{ Statusgo.changeDatabasePasswordV2(params.toString()) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun convertToKeycardAccount(
keyUID: String,
accountData: String,
options: String,
keycardUID: String,
password: String,
newPassword: String,
callback: Callback
) {
val keyStoreDir = utils.getKeyStorePath(keyUID)
val params = JSONObject().apply {
put("keyUID", keyUID)
put("account", JSONObject(accountData))
put("settings", JSONObject(options))
put("keycardUID", keycardUID)
put("oldPassword", password)
put("newPassword", newPassword)
}
val jsonParams = params.toString()
StatusBackendClient.executeStatusGoRequest(
"InitKeystore",
keyStoreDir,
{ Statusgo.initKeystore(keyStoreDir) }
)
StatusBackendClient.executeStatusGoRequestWithCallback(
"ConvertToKeycardAccountV2",
jsonParams,
{ Statusgo.convertToKeycardAccountV2(jsonParams) },
callback
)
}
@ReactMethod(isBlockingSynchronousMethod = true)
fun encodeTransfer(to: String, value: String): String? {
return try {
val params = JSONObject().apply {
put("to", to)
put("value", value)
}
StatusBackendClient.executeStatusGoRequestWithResult(
"EncodeTransferV2",
params.toString(),
{ Statusgo.encodeTransferV2(params.toString()) }
)
} catch (e: JSONException) {
Log.e(TAG, "Error creating JSON for encodeTransfer: ${e.message}")
null
}
}
@ReactMethod(isBlockingSynchronousMethod = true)
fun encodeFunctionCall(method: String, paramsJSON: String): String? {
return try {
val params = JSONObject().apply {
put("method", method)
put("paramsJSON", JSONObject(paramsJSON))
}
StatusBackendClient.executeStatusGoRequestWithResult(
"EncodeFunctionCallV2",
params.toString(),
{ Statusgo.encodeFunctionCallV2(params.toString()) }
)
} catch (e: JSONException) {
Log.e(TAG, "Error creating JSON for encodeFunctionCall: ${e.message}")
null
}
}
@ReactMethod(isBlockingSynchronousMethod = true)
fun decodeParameters(decodeParamJSON: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"DecodeParameters",
decodeParamJSON,
{ Statusgo.decodeParameters(decodeParamJSON) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun hexToNumber(hex: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"HexToNumber",
hex,
{ Statusgo.hexToNumber(hex) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun numberToHex(numString: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"NumberToHex",
numString,
{ Statusgo.numberToHex(numString) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun sha3(str: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"Sha3",
str,
{ Statusgo.sha3(str) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun utf8ToHex(str: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"Utf8ToHex",
str,
{ Statusgo.utf8ToHex(str) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun hexToUtf8(str: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"HexToUtf8",
str,
{ Statusgo.hexToUtf8(str) }
)
@ReactMethod(isBlockingSynchronousMethod = true)
fun serializeLegacyKey(publicKey: String): String =
StatusBackendClient.executeStatusGoRequestWithResult(
"SerializeLegacyKey",
publicKey,
{ Statusgo.serializeLegacyKey(publicKey) }
)
@ReactMethod
fun setBlankPreviewFlag(blankPreview: Boolean) {
PreferenceManager.getDefaultSharedPreferences(reactContext)
.edit()
.putBoolean("BLANK_PREVIEW", blankPreview)
.commit()
setSecureFlag()
}
private fun setSecureFlag() {
val sharedPrefs = PreferenceManager.getDefaultSharedPreferences(reactContext)
val setSecure = sharedPrefs.getBoolean("BLANK_PREVIEW", true)
reactContext.currentActivity?.run {
runOnUiThread {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH && setSecure) {
window.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
} else {
window.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
}
}
}
}
@ReactMethod
@Throws(Exception::class)
fun hashTransaction(txArgsJSON: String, callback: Callback) {
StatusBackendClient.executeStatusGoRequestWithCallback(
"HashTransaction",
txArgsJSON,
{ Statusgo.hashTransaction(txArgsJSON) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun hashMessage(message: String, callback: Callback) {
StatusBackendClient.executeStatusGoRequestWithCallback(
"HashMessage",
message,
{ Statusgo.hashMessage(message) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun multiformatDeserializePublicKey(multiCodecKey: String, base58btc: String, callback: Callback) {
val params = JSONObject().apply {
put("key", multiCodecKey)
put("outBase", base58btc)
}
StatusBackendClient.executeStatusGoRequestWithCallback(
"MultiformatDeserializePublicKeyV2",
params.toString(),
{ Statusgo.multiformatDeserializePublicKeyV2(params.toString()) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun deserializeAndCompressKey(desktopKey: String, callback: Callback) {
StatusBackendClient.executeStatusGoRequestWithCallback(
"DeserializeAndCompressKey",
desktopKey,
{ Statusgo.deserializeAndCompressKey(desktopKey) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun hashTypedData(data: String, callback: Callback) {
utils.executeRunnableStatusGoMethod({ Statusgo.hashTypedData(data) }, callback)
}
@ReactMethod
@Throws(Exception::class)
fun hashTypedDataV4(data: String, callback: Callback) {
utils.executeRunnableStatusGoMethod({ Statusgo.hashTypedDataV4(data) }, callback)
}
@ReactMethod
@Throws(Exception::class)
fun signMessage(rpcParams: String, callback: Callback) {
StatusBackendClient.executeStatusGoRequestWithCallback(
"SignMessage",
rpcParams,
{ Statusgo.signMessage(rpcParams) },
callback
)
}
@ReactMethod
@Throws(Exception::class)
fun signTypedData(data: String, account: String, password: String, callback: Callback) {
utils.executeRunnableStatusGoMethod({ Statusgo.signTypedData(data, account, password) }, callback)
}
@ReactMethod
@Throws(Exception::class)
fun signTypedDataV4(data: String, account: String, password: String, callback: Callback) {
utils.executeRunnableStatusGoMethod({ Statusgo.signTypedDataV4(data, account, password) }, callback)
}
@ReactMethod
@Throws(Exception::class)
fun signGroupMembership(content: String, callback: Callback) {
utils.executeRunnableStatusGoMethod({ Statusgo.signGroupMembership(content) }, callback)
}
}
@@ -195,25 +195,6 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
}
}
@ReactMethod
fun initLogging(enabled: Boolean, mobileSystem: Boolean, logLevel: String, logRequestGo: Boolean, callback: Callback) {
val jsonConfig = JSONObject().apply {
put("Enabled", enabled)
put("MobileSystem", mobileSystem)
put("Level", logLevel)
put("File", getGethLogFile().absolutePath)
put("LogRequestGo", logRequestGo)
put("LogRequestFile", getRequestLogFile().absolutePath)
}
val config = jsonConfig.toString()
StatusBackendClient.executeStatusGoRequestWithCallback(
endpoint = "InitLogging",
requestBody = config,
statusgoFunction = { Statusgo.initLogging(config) },
callback = callback
)
}
@ReactMethod(isBlockingSynchronousMethod = true)
fun logFileDirectory(): String? {
return utils.getPublicStorageDirectory()?.absolutePath
@@ -223,7 +204,7 @@ class LogManager(private val reactContext: ReactApplicationContext) : ReactConte
private const val TAG = "LogManager"
private const val gethLogFileName = "geth.log"
private const val statusLogFileName = "Status.log"
private const val requestsLogFileName = "requests.log"
private const val requestsLogFileName = "api.log"
private const val logsZipFileName = "Status-debug-logs.zip"
}
}
@@ -1,124 +0,0 @@
package im.status.ethereum.module;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import android.app.Activity;
import android.util.Log;
import android.os.Build;
import android.webkit.WebView;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebStorage;
import android.view.WindowManager;
import com.facebook.react.uimanager.UIManagerModule;
import com.facebook.react.uimanager.UIBlock;
import com.facebook.react.uimanager.NativeViewHierarchyManager;
import android.view.inputmethod.InputMethodManager;
import android.view.View;
import android.widget.EditText;
import android.content.Context;
public class UIHelper extends ReactContextBaseJavaModule {
private static final String TAG = "UIHelper";
private ReactApplicationContext reactContext;
public UIHelper(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
}
@Override
public String getName() {
return "UIHelper";
}
@ReactMethod
public void setSoftInputMode(final int mode) {
Log.d(TAG, "setSoftInputMode");
final Activity activity = getCurrentActivity();
if (activity == null) {
return;
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.getWindow().setSoftInputMode(mode);
}
});
}
@SuppressWarnings("deprecation")
@ReactMethod
public void clearCookies() {
Log.d(TAG, "clearCookies");
final Activity activity = getCurrentActivity();
if (activity == null) {
return;
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().removeAllCookies(null);
CookieManager.getInstance().flush();
} else {
CookieSyncManager cookieSyncManager = CookieSyncManager.createInstance(activity);
cookieSyncManager.startSync();
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();
cookieManager.removeSessionCookie();
cookieSyncManager.stopSync();
cookieSyncManager.sync();
}
}
@ReactMethod
public void toggleWebviewDebug(final boolean val) {
Log.d(TAG, "toggleWebviewDebug");
final Activity activity = getCurrentActivity();
if (activity == null) {
return;
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
WebView.setWebContentsDebuggingEnabled(val);
}
});
}
@ReactMethod
public void clearStorageAPIs() {
Log.d(TAG, "clearStorageAPIs");
final Activity activity = getCurrentActivity();
if (activity == null) {
return;
}
WebStorage storage = WebStorage.getInstance();
if (storage != null) {
storage.deleteAllData();
}
}
@ReactMethod
public void resetKeyboardInputCursor(final int reactTagToReset, final int selection) {
UIManagerModule uiManager = getReactApplicationContext().getNativeModule(UIManagerModule.class);
uiManager.addUIBlock(new UIBlock() {
@Override
public void execute(NativeViewHierarchyManager nativeViewHierarchyManager) {
InputMethodManager imm = (InputMethodManager) getReactApplicationContext().getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
View viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset);
imm.restartInput(viewToReset);
try {
EditText textView = (EditText) viewToReset;
textView.setSelection(selection);
} catch (Exception e) {}
}
}
});
}
}
@@ -0,0 +1,97 @@
package im.status.ethereum.module
import android.app.Activity
import android.content.Context
import android.os.Build
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.view.inputmethod.InputMethodManager
import android.webkit.CookieManager
import android.webkit.CookieSyncManager
import android.webkit.WebStorage
import android.webkit.WebView
import android.widget.EditText
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.ReactContextBaseJavaModule
import com.facebook.react.bridge.ReactMethod
import com.facebook.react.uimanager.NativeViewHierarchyManager
import com.facebook.react.uimanager.UIBlock
import com.facebook.react.uimanager.UIManagerModule
class UIHelper(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
companion object {
private const val TAG = "UIHelper"
}
override fun getName(): String = "UIHelper"
@ReactMethod
fun setSoftInputMode(mode: Int) {
Log.d(TAG, "setSoftInputMode")
getCurrentActivity()?.run {
runOnUiThread {
window.setSoftInputMode(mode)
}
}
}
@Suppress("DEPRECATION")
@ReactMethod
fun clearCookies() {
Log.d(TAG, "clearCookies")
getCurrentActivity()?.let { activity ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
CookieManager.getInstance().apply {
removeAllCookies(null)
flush()
}
} else {
CookieSyncManager.createInstance(activity).also { cookieSyncManager ->
cookieSyncManager.startSync()
CookieManager.getInstance().apply {
removeAllCookie()
removeSessionCookie()
}
cookieSyncManager.stopSync()
cookieSyncManager.sync()
}
}
}
}
@ReactMethod
fun toggleWebviewDebug(enabled: Boolean) {
Log.d(TAG, "toggleWebviewDebug")
getCurrentActivity()?.run {
runOnUiThread {
WebView.setWebContentsDebuggingEnabled(enabled)
}
}
}
@ReactMethod
fun clearStorageAPIs() {
Log.d(TAG, "clearStorageAPIs")
getCurrentActivity()?.let {
WebStorage.getInstance()?.deleteAllData()
}
}
@ReactMethod
fun resetKeyboardInputCursor(reactTagToReset: Int, selection: Int) {
reactApplicationContext.getNativeModule(UIManagerModule::class.java)?.addUIBlock(object : UIBlock {
override fun execute(nativeViewHierarchyManager: NativeViewHierarchyManager) {
(reactApplicationContext.baseContext.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.let { imm ->
val viewToReset = nativeViewHierarchyManager.resolveView(reactTagToReset)
imm.restartInput(viewToReset)
try {
(viewToReset as? EditText)?.setSelection(selection)
} catch (e: Exception) {
// Ignore exceptions during selection setting
}
}
}
})
}
}
@@ -1,109 +0,0 @@
package im.status.ethereum.pushnotifications;
import android.content.Context;
import android.content.Intent;
import android.app.Service;
import android.content.pm.ServiceInfo;
import android.os.IBinder;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.provider.Settings;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import android.os.Build;
import im.status.ethereum.module.R;
public class ForegroundService extends Service {
private static final String CHANNEL_ID = "status-service";
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent i, int flags, int startId) {
// NOTE: recent versions of Android require the service to display
// a sticky notification to inform the user that the service is running
Context context = getApplicationContext();
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
Intent intent = null;
String notificationContentText = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationManager notificationManager =
context.getSystemService(NotificationManager.class);
NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
context.getResources().getString(R.string.status_service),
NotificationManager.IMPORTANCE_HIGH);
channel.setShowBadge(false);
notificationManager.createNotificationChannel(channel);
// Create intent that takes the user to the notification channel settings so they can hide it
intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
intent.putExtra(Settings.EXTRA_CHANNEL_ID, CHANNEL_ID);
notificationContentText = context.getResources().getString(R.string.tap_to_hide_notification);
} else {
// For older versions of android intent takes the user to the Status app
Class intentClass;
String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
try {
intentClass = Class.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return 0;
}
intent = new Intent(context, intentClass);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
notificationContentText = context.getResources().getString(R.string.keep_status_running);
}
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_IMMUTABLE);
Intent stopIntent = new Intent(PushNotificationHelper.ACTION_TAP_STOP);
PendingIntent stopPendingIntent = PendingIntent.getBroadcast(context, 0, stopIntent,
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE);
Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stat_notify_status)
.setContentTitle(context.getResources().getString(R.string.background_service_opened))
.setContentText(notificationContentText)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setContentIntent(pendingIntent)
.setNumber(0)
.addAction(R.drawable.ic_stat_notify_status,
context.getResources().getString(R.string.stop),
stopPendingIntent)
.build();
// the id of the foreground notification MUST NOT be 0
if (Build.VERSION.SDK_INT >= 33) {
startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE);
} else {
startForeground(1, notification);
}
return START_STICKY;
}
}
@@ -0,0 +1,122 @@
package im.status.ethereum.pushnotifications
import android.content.Context
import android.content.Intent
import android.app.Service
import android.content.pm.ServiceInfo
import android.os.IBinder
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.provider.Settings
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import android.os.Build
import im.status.ethereum.module.R
class ForegroundService : Service() {
companion object {
private const val CHANNEL_ID = "status-service"
}
override fun onBind(intent: Intent?): IBinder? {
return null
}
override fun onStartCommand(i: Intent?, flags: Int, startId: Int): Int {
// NOTE: recent versions of Android require the service to display
// a sticky notification to inform the user that the service is running
val context = applicationContext
// Create the NotificationChannel, but only on API 26+ because
// the NotificationChannel class is new and not in the support library
// Create notification channel for Android O and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val notificationManager = context.getSystemService(NotificationManager::class.java)
val channel = NotificationChannel(
CHANNEL_ID,
context.resources.getString(R.string.status_service),
NotificationManager.IMPORTANCE_HIGH
).apply {
setShowBadge(false)
}
notificationManager.createNotificationChannel(channel)
}
// Initialize intent and notification text based on Android version
val notificationIntent = createNotificationIntent(context)
val notificationText = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.resources.getString(R.string.tap_to_hide_notification)
} else {
context.resources.getString(R.string.keep_status_running)
}
val pendingIntent = PendingIntent.getActivity(
this,
0,
notificationIntent,
PendingIntent.FLAG_IMMUTABLE
)
val stopIntent = Intent(PushNotificationHelper.ACTION_TAP_STOP)
val stopPendingIntent = PendingIntent.getBroadcast(
context,
0,
stopIntent,
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
val notification = NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stat_notify_status)
.setContentTitle(context.resources.getString(R.string.background_service_opened))
.setContentText(notificationText)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setContentIntent(pendingIntent)
.setNumber(0)
.addAction(
R.drawable.ic_stat_notify_status,
context.resources.getString(R.string.stop),
stopPendingIntent
)
.build()
// the id of the foreground notification MUST NOT be 0
if (Build.VERSION.SDK_INT >= 33) {
startForeground(1, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE)
} else {
startForeground(1, notification)
}
return START_STICKY
}
private fun createNotificationIntent(context: Context): Intent {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Create intent that takes the user to the notification channel settings
Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, packageName)
putExtra(Settings.EXTRA_CHANNEL_ID, CHANNEL_ID)
}
} else {
// For older versions of android, intent takes the user to the Status app
val packageName = context.packageName
val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
val className = launchIntent?.component?.className
try {
val intentClass = Class.forName(className!!)
Intent(context, intentClass).apply {
addCategory(Intent.CATEGORY_BROWSABLE)
action = Intent.ACTION_VIEW
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}
} catch (e: ClassNotFoundException) {
e.printStackTrace()
// Return an empty intent as fallback
Intent()
}
}
}
}
@@ -1,146 +0,0 @@
package im.status.ethereum.pushnotifications;
import android.app.Activity;
import android.app.Application;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationManagerCompat;
import java.security.SecureRandom;
import com.facebook.react.bridge.ActivityEventListener;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import android.util.Log;
import im.status.ethereum.pushnotifications.PushNotificationJsDelivery;
public class PushNotification extends ReactContextBaseJavaModule implements ActivityEventListener {
public static final String LOG_TAG = "PushNotification";
private final SecureRandom mRandomNumberGenerator = new SecureRandom();
private PushNotificationHelper pushNotificationHelper;
private PushNotificationJsDelivery delivery;
private ReactApplicationContext reactContext;
private boolean started;
public PushNotification(ReactApplicationContext reactContext) {
super(reactContext);
this.reactContext = reactContext;
reactContext.addActivityEventListener(this);
Application applicationContext = (Application) reactContext.getApplicationContext();
IntentFilter intentFilter = new IntentFilter();
pushNotificationHelper = new PushNotificationHelper(applicationContext, intentFilter);
delivery = new PushNotificationJsDelivery(reactContext);
}
@Override
public String getName() {
return "PushNotification";
}
// removed @Override temporarily just to get it working on different versions of RN
public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) {
onActivityResult(requestCode, resultCode, data);
}
// removed @Override temporarily just to get it working on different versions of RN
public void onActivityResult(int requestCode, int resultCode, Intent data) {
// Ignored, required to implement ActivityEventListener for RN 0.33
}
private Bundle getBundleFromIntent(Intent intent) {
Bundle bundle = null;
if (intent.hasExtra("notification")) {
bundle = intent.getBundleExtra("notification");
} else if (intent.hasExtra("google.message_id")) {
bundle = new Bundle();
bundle.putBundle("data", intent.getExtras());
}
if(null != bundle && !bundle.getBoolean("foreground", false) && !bundle.containsKey("userInteraction")) {
bundle.putBoolean("userInteraction", true);
}
return bundle;
}
@Override
public void onNewIntent(Intent intent) {
Bundle bundle = this.getBundleFromIntent(intent);
if (bundle != null) {
delivery.notifyNotification(bundle);
}
}
@ReactMethod
/**
* Creates a channel if it does not already exist. Returns whether the channel was created.
*/
public void createChannel(ReadableMap channelInfo, Callback callback) {
boolean created = pushNotificationHelper.createChannel(channelInfo);
if(callback != null) {
callback.invoke(created);
}
}
@ReactMethod
public void presentLocalNotification(ReadableMap details) {
if (!this.started) {
return;
}
Bundle bundle = Arguments.toBundle(details);
// If notification ID is not provided by the user, generate one at random
if (bundle.getString("id") == null) {
bundle.putString("id", String.valueOf(mRandomNumberGenerator.nextInt()));
}
pushNotificationHelper.sendToNotificationCentre(bundle);
}
@ReactMethod
public void clearMessageNotifications(String conversationId) {
if (this.started) {
pushNotificationHelper.clearMessageNotifications(conversationId);
}
}
@ReactMethod
public void clearAllMessageNotifications() {
pushNotificationHelper.clearAllMessageNotifications();
}
@ReactMethod
public void enableNotifications() {
this.started = true;
this.pushNotificationHelper.start();
}
@ReactMethod
public void disableNotifications() {
if (this.started) {
this.started = false;
this.pushNotificationHelper.stop();
}
}
}
@@ -0,0 +1,118 @@
package im.status.ethereum.pushnotifications
import android.app.Activity
import android.app.Application
import android.app.NotificationManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import android.util.Log
import androidx.annotation.NonNull
import androidx.core.app.NotificationManagerCompat
import com.facebook.react.bridge.*
import im.status.ethereum.pushnotifications.PushNotificationJsDelivery
import java.security.SecureRandom
class PushNotification(reactContext: ReactApplicationContext) :
ReactContextBaseJavaModule(reactContext), ActivityEventListener {
companion object {
const val LOG_TAG = "PushNotification"
}
private val mRandomNumberGenerator = SecureRandom()
private val pushNotificationHelper: PushNotificationHelper
private val delivery: PushNotificationJsDelivery
private val reactContext: ReactApplicationContext = reactContext
private var started: Boolean = false
init {
reactContext.addActivityEventListener(this)
val applicationContext = reactContext.applicationContext as Application
val intentFilter = IntentFilter()
pushNotificationHelper = PushNotificationHelper(applicationContext, intentFilter)
delivery = PushNotificationJsDelivery(reactContext)
}
override fun getName(): String = "PushNotification"
// Primary implementation of ActivityEventListener interface
override fun onActivityResult(activity: Activity, requestCode: Int, resultCode: Int, data: Intent?) {
// Call the helper method with the correct parameter order
handleActivityResult(requestCode, resultCode, data)
}
// Private helper method for handling activity results
private fun handleActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
// Ignored, required to implement ActivityEventListener for RN 0.33
}
private fun getBundleFromIntent(intent: Intent): Bundle? {
return when {
intent.hasExtra("notification") -> intent.getBundleExtra("notification")
intent.hasExtra("google.message_id") -> Bundle().apply {
putBundle("data", intent.extras)
}
else -> null
}?.apply {
if (!getBoolean("foreground", false) && !containsKey("userInteraction")) {
putBoolean("userInteraction", true)
}
}
}
override fun onNewIntent(intent: Intent) {
getBundleFromIntent(intent)?.let { bundle ->
delivery.notifyNotification(bundle)
}
}
@ReactMethod
fun createChannel(channelInfo: ReadableMap, callback: Callback?) {
val created = pushNotificationHelper.createChannel(channelInfo)
callback?.invoke(created)
}
@ReactMethod
fun presentLocalNotification(details: ReadableMap) {
if (!started) return
Arguments.toBundle(details)?.apply {
// If notification ID is not provided by the user, generate one at random
if (getString("id") == null) {
putString("id", mRandomNumberGenerator.nextInt().toString())
}
pushNotificationHelper.sendToNotificationCentre(this)
}
}
@ReactMethod
fun clearMessageNotifications(conversationId: String) {
if (started) {
pushNotificationHelper.clearMessageNotifications(conversationId)
}
}
@ReactMethod
fun clearAllMessageNotifications() {
pushNotificationHelper.clearAllMessageNotifications()
}
@ReactMethod
fun enableNotifications() {
started = true
pushNotificationHelper.start()
}
@ReactMethod
fun disableNotifications() {
if (started) {
started = false
pushNotificationHelper.stop()
}
}
}
@@ -1,93 +0,0 @@
package im.status.ethereum.pushnotifications;
import android.os.Build;
import android.app.Application;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.bridge.ReactContext;
import im.status.ethereum.pushnotifications.PushNotificationJsDelivery;
import static im.status.ethereum.pushnotifications.PushNotification.LOG_TAG;
public class PushNotificationActions extends BroadcastReceiver {
@Override
public void onReceive(final Context context, Intent intent) {
String intentActionPrefix = context.getPackageName() + ".ACTION_";
Log.i(LOG_TAG, "PushNotificationBootEventReceiver loading scheduled notifications");
if (null == intent.getAction() || !intent.getAction().startsWith(intentActionPrefix)) {
return;
}
final Bundle bundle = intent.getBundleExtra("notification");
// Dismiss the notification popup.
NotificationManager manager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
int notificationID = Integer.parseInt(bundle.getString("id"));
boolean autoCancel = bundle.getBoolean("autoCancel", true);
if(autoCancel) {
if (bundle.containsKey("tag")) {
String tag = bundle.getString("tag");
manager.cancel(tag, notificationID);
} else {
manager.cancel(notificationID);
}
}
boolean invokeApp = bundle.getBoolean("invokeApp", true);
// Notify the action.
if(invokeApp) {
IntentFilter intentFilter = new IntentFilter();
PushNotificationHelper helper = new PushNotificationHelper((Application) context.getApplicationContext(), intentFilter);
helper.invokeApp(bundle);
} else {
// We need to run this on the main thread, as the React code assumes that is true.
// Namely, DevServerHelper constructs a Handler() without a Looper, which triggers:
// "Can't create handler inside thread that has not called Looper.prepare()"
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
public void run() {
// Construct and load our normal React JS code bundle
final ReactInstanceManager mReactInstanceManager = ((ReactApplication) context.getApplicationContext()).getReactNativeHost().getReactInstanceManager();
ReactContext context = mReactInstanceManager.getCurrentReactContext();
PushNotificationJsDelivery delivery = new PushNotificationJsDelivery(context);
// If it's constructed, send a notification
if (context != null) {
delivery.notifyNotificationAction(bundle);
} else {
// Otherwise wait for construction, then send the notification
mReactInstanceManager.addReactInstanceEventListener(new ReactInstanceManager.ReactInstanceEventListener() {
public void onReactContextInitialized(ReactContext context) {
PushNotificationJsDelivery delivery = new PushNotificationJsDelivery(context);
delivery.notifyNotificationAction(bundle);
mReactInstanceManager.removeReactInstanceEventListener(this);
}
});
if (!mReactInstanceManager.hasStartedCreatingInitialContext()) {
// Construct it in the background
mReactInstanceManager.createReactContextInBackground();
}
}
}
});
}
}
}
@@ -0,0 +1,100 @@
package im.status.ethereum.pushnotifications
import android.os.Build
import android.app.Application
import android.app.NotificationManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.facebook.react.ReactApplication
import com.facebook.react.ReactInstanceManager
import com.facebook.react.bridge.ReactContext
import im.status.ethereum.pushnotifications.PushNotificationJsDelivery
import im.status.ethereum.pushnotifications.PushNotification.Companion.LOG_TAG
/**
* BroadcastReceiver responsible for handling push notification actions.
* This class processes notification interactions and manages their lifecycle.
*/
class PushNotificationActions : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val intentActionPrefix = "${context.packageName}.ACTION_"
Log.i(LOG_TAG, "PushNotificationBootEventReceiver loading scheduled notifications")
if (intent.action == null || !intent.action!!.startsWith(intentActionPrefix)) {
return
}
val bundle = intent.getBundleExtra("notification") ?: return
val manager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationID = bundle.getString("id")?.toInt() ?: return
// Dismiss the notification popup.
val autoCancel = bundle.getBoolean("autoCancel", true)
if (autoCancel) {
bundle.getString("tag")?.let { tag ->
manager.cancel(tag, notificationID)
} ?: run {
manager.cancel(notificationID)
}
}
// Notify the action.
val invokeApp = bundle.getBoolean("invokeApp", true)
if (invokeApp) {
val intentFilter = IntentFilter()
val helper = PushNotificationHelper(
context.applicationContext as Application,
intentFilter
)
helper.invokeApp(bundle)
} else {
// We need to run this on the main thread, as the React code assumes that is true.
// Namely, DevServerHelper constructs a Handler() without a Looper, which triggers:
// "Can't create handler inside thread that has not called Looper.prepare()"
Handler(Looper.getMainLooper()).post {
// Construct and load our normal React JS code bundle
val reactInstanceManager = (context.applicationContext as ReactApplication)
.reactNativeHost
.reactInstanceManager
val currentContext = reactInstanceManager.currentReactContext
when {
// If context exists, deliver notification immediately
currentContext != null -> {
PushNotificationJsDelivery(currentContext)
.notifyNotificationAction(bundle)
}
// Otherwise wait for construction, then send the notification
else -> {
val listener = object : ReactInstanceManager.ReactInstanceEventListener {
override fun onReactContextInitialized(reactContext: ReactContext) {
PushNotificationJsDelivery(reactContext)
.notifyNotificationAction(bundle)
reactInstanceManager.removeReactInstanceEventListener(this)
}
}
// Add the listener and create context if needed
reactInstanceManager.addReactInstanceEventListener(listener)
if (!reactInstanceManager.hasStartedCreatingInitialContext()) {
// Construct it in the background
reactInstanceManager.createReactContextInBackground()
}
}
}
}
}
}
}
@@ -1,890 +0,0 @@
// https://github.com/zo0r/react-native-push-notification/blob/bedc8f646aab67d594f291449fbfa24e07b64fe8/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java Copy-Paste with removed firebase
package im.status.ethereum.pushnotifications;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.AlarmManager;
import android.app.Application;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.BroadcastReceiver;
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.util.Base64;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.Person;
import androidx.core.graphics.drawable.IconCompat;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.HashMap;
import java.util.Map;
import im.status.ethereum.module.R;
import static im.status.ethereum.pushnotifications.PushNotification.LOG_TAG;
public class PushNotificationHelper {
private Context context;
private static final long DEFAULT_VIBRATION = 300L;
private static final String CHANNEL_ID = "status-im-notifications";
public static final String ACTION_DELETE_NOTIFICATION = "im.status.ethereum.module.DELETE_NOTIFICATION";
public static final String ACTION_TAP_STOP = "im.status.ethereum.module.TAP_STOP";
final int flag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_CANCEL_CURRENT;
private NotificationManager notificationManager;
private HashMap<String, Person> persons;
private HashMap<String, StatusMessageGroup> messageGroups;
private IntentFilter intentFilter;
public PushNotificationHelper(Application context, IntentFilter intentFilter) {
this.context = context;
this.intentFilter = intentFilter;
this.persons = new HashMap<String, Person>();
this.messageGroups = new HashMap<String, StatusMessageGroup>();
this.notificationManager = context.getSystemService(NotificationManager.class);
this.registerBroadcastReceiver();
}
public Intent getOpenAppIntent(String deepLink) {
Class intentClass;
String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
try {
intentClass = Class.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
Intent intent = new Intent(context, intentClass);
intent.addCategory(Intent.CATEGORY_BROWSABLE);
intent.setAction(Intent.ACTION_VIEW);
//NOTE: you might wonder, why the heck did he decide to set these flags in particular. Well,
//the answer is a simple as it can get in the Android native development world. I noticed
//that my initial setup was opening the app but wasn't triggering any events on the js side, like
//the links do from the browser. So I compared both intents and noticed that the link from
//the browser produces an intent with the flag 0x14000000. I found out that it was the following
//flags in this link:
//https://stackoverflow.com/questions/52390129/android-intent-setflags-issue
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
if (deepLink != null) {
intent.setData(Uri.parse(deepLink));
}
return intent;
}
//NOTE: we use a dynamically created BroadcastReceiver here so that we can capture
//intents from notifications and act on them. For instance when tapping/dismissing
//a chat notification we want to clear the chat so that next messages don't show
//the messages that we have seen again
private final BroadcastReceiver notificationActionReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction() == ACTION_DELETE_NOTIFICATION) {
String groupId = intent.getExtras().getString("im.status.ethereum.groupId");
if (groupId != null) {
cleanGroup(groupId);
}
}
if (intent.getAction() == ACTION_TAP_STOP) {
stop();
System.exit(0);
}
Log.e(LOG_TAG, "intent received: " + intent.getAction());
}
};
public void registerBroadcastReceiver() {
this.intentFilter.addAction(ACTION_DELETE_NOTIFICATION);
this.intentFilter.addAction(ACTION_TAP_STOP);
context.registerReceiver(notificationActionReceiver, this.intentFilter, Context.RECEIVER_EXPORTED);
Log.e(LOG_TAG, "Broadcast Receiver registered");
}
private NotificationManager notificationManager() {
return (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
}
public void invokeApp(Bundle bundle) {
String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
try {
Class<?> activityClass = Class.forName(className);
Intent activityIntent = new Intent(context, activityClass);
if(bundle != null) {
activityIntent.putExtra("notification", bundle);
}
activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(activityIntent);
} catch(Exception e) {
Log.e(LOG_TAG, "Class not found", e);
return;
}
}
public void sendToNotificationCentre(final Bundle bundle) {
PushNotificationPicturesAggregator aggregator = new PushNotificationPicturesAggregator(new PushNotificationPicturesAggregator.Callback() {
public void call(Bitmap largeIconImage, Bitmap bigPictureImage) {
sendToNotificationCentreWithPicture(bundle, largeIconImage, bigPictureImage);
}
});
aggregator.setLargeIconUrl(context, bundle.getString("largeIconUrl"));
aggregator.setBigPictureUrl(context, bundle.getString("bigPictureUrl"));
}
public void handleConversation(final Bundle bundle) {
if (bundle.getBoolean("deleted")){
this.removeStatusMessage(bundle);
} else {
this.addStatusMessage(bundle);
}
}
public void clearMessageNotifications(String conversationId) {
notificationManager.cancel(conversationId.hashCode());
cleanGroup(conversationId);
}
public void clearAllMessageNotifications() {
notificationManager.cancelAll();
}
public void sendToNotificationCentreWithPicture(final Bundle bundle, Bitmap largeIconBitmap, Bitmap bigPictureBitmap) {
try {
Class intentClass = getMainActivityClass();
if (intentClass == null) {
Log.e(LOG_TAG, "No activity class found for the notification");
return;
}
if (bundle.getBoolean("isConversation")) {
this.handleConversation(bundle);
return;
}
if (bundle.getString("message") == null) {
// this happens when a 'data' notification is received - we do not synthesize a local notification in this case
Log.d(LOG_TAG, "Ignore this message if you sent data-only notification. Cannot send to notification centre because there is no 'message' field in: " + bundle);
return;
}
String notificationIdString = bundle.getString("id");
if (notificationIdString == null) {
Log.e(LOG_TAG, "No notification ID specified for the notification");
return;
}
Resources res = context.getResources();
String packageName = context.getPackageName();
String title = bundle.getString("title");
if (title == null) {
ApplicationInfo appInfo = context.getApplicationInfo();
title = context.getPackageManager().getApplicationLabel(appInfo).toString();
}
int priority = NotificationCompat.PRIORITY_HIGH;
final String priorityString = bundle.getString("priority");
if (priorityString != null) {
switch (priorityString.toLowerCase()) {
case "max":
priority = NotificationCompat.PRIORITY_MAX;
break;
case "high":
priority = NotificationCompat.PRIORITY_HIGH;
break;
case "low":
priority = NotificationCompat.PRIORITY_LOW;
break;
case "min":
priority = NotificationCompat.PRIORITY_MIN;
break;
case "default":
priority = NotificationCompat.PRIORITY_DEFAULT;
break;
default:
priority = NotificationCompat.PRIORITY_HIGH;
}
}
int visibility = NotificationCompat.VISIBILITY_PRIVATE;
final String visibilityString = bundle.getString("visibility");
if (visibilityString != null) {
switch (visibilityString.toLowerCase()) {
case "private":
visibility = NotificationCompat.VISIBILITY_PRIVATE;
break;
case "public":
visibility = NotificationCompat.VISIBILITY_PUBLIC;
break;
case "secret":
visibility = NotificationCompat.VISIBILITY_SECRET;
break;
default:
visibility = NotificationCompat.VISIBILITY_PRIVATE;
}
}
String channel_id = bundle.getString("channelId");
if(channel_id == null) {
channel_id = this.getNotificationDefaultChannelId();
}
NotificationCompat.Builder notification = new NotificationCompat.Builder(context, channel_id)
.setContentTitle(title)
.setTicker(bundle.getString("ticker"))
.setVisibility(visibility)
.setPriority(priority)
.setAutoCancel(bundle.getBoolean("autoCancel", true))
.setOnlyAlertOnce(bundle.getBoolean("onlyAlertOnce", false));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // API 24 and higher
// Restore showing timestamp on Android 7+
// Source: https://developer.android.com/reference/android/app/Notification.Builder.html#setShowWhen(boolean)
boolean showWhen = bundle.getBoolean("showWhen", true);
notification.setShowWhen(showWhen);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // API 26 and higher
// Changing Default mode of notification
notification.setDefaults(Notification.DEFAULT_LIGHTS);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) { // API 20 and higher
String group = bundle.getString("group");
if (group != null) {
notification.setGroup(group);
}
if (bundle.containsKey("groupSummary") || bundle.getBoolean("groupSummary")) {
notification.setGroupSummary(bundle.getBoolean("groupSummary"));
}
}
String numberString = bundle.getString("number");
if (numberString != null) {
notification.setNumber(Integer.parseInt(numberString));
}
// Small icon
int smallIconResId = 0;
String smallIcon = bundle.getString("smallIcon");
if (smallIcon != null && !smallIcon.isEmpty()) {
smallIconResId = res.getIdentifier(smallIcon, "mipmap", packageName);
} else if(smallIcon == null) {
smallIconResId = res.getIdentifier("ic_stat_notify_status", "drawable", packageName);
}
if (smallIconResId == 0) {
smallIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
if (smallIconResId == 0) {
smallIconResId = android.R.drawable.ic_dialog_info;
}
}
notification.setSmallIcon(smallIconResId);
// Large icon
if(largeIconBitmap == null) {
int largeIconResId = 0;
String largeIcon = bundle.getString("largeIcon");
if (largeIcon != null && !largeIcon.isEmpty()) {
largeIconResId = res.getIdentifier(largeIcon, "mipmap", packageName);
} else if(largeIcon == null) {
largeIconResId = res.getIdentifier("ic_launcher", "mipmap", packageName);
}
// Before Lolipop there was no large icon for notifications.
if (largeIconResId != 0 && (largeIcon != null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)) {
largeIconBitmap = BitmapFactory.decodeResource(res, largeIconResId);
}
}
Bundle author = bundle.getBundle("notificationAuthor");
if (largeIconBitmap == null && author != null) {
String base64Image = author.getString("icon").split(",")[1];
byte[] decodedString = Base64.decode(base64Image, Base64.DEFAULT);
Bitmap decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
notification.setLargeIcon(getCircleBitmap(decodedByte));
} else if (largeIconBitmap != null){
notification.setLargeIcon(largeIconBitmap);
}
String message = bundle.getString("message");
notification.setContentText(message);
String subText = bundle.getString("subText");
if (subText != null) {
notification.setSubText(subText);
}
String bigText = bundle.getString("bigText");
if (bigText == null) {
bigText = message;
}
NotificationCompat.Style style;
if(bigPictureBitmap != null) {
style = new NotificationCompat.BigPictureStyle()
.bigPicture(bigPictureBitmap)
.setBigContentTitle(title)
.setSummaryText(message);
} else {
style = new NotificationCompat.BigTextStyle().bigText(bigText);
}
notification.setStyle(style);
Intent intent = new Intent(context, intentClass);
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
bundle.putBoolean("foreground", this.isApplicationInForeground());
bundle.putBoolean("userInteraction", true);
intent.putExtra("notification", bundle);
Uri soundUri = null;
if (!bundle.containsKey("playSound") || bundle.getBoolean("playSound")) {
String soundName = bundle.getString("soundName");
if (soundName == null) {
soundName = "default";
}
soundUri = getSoundUri(soundName);
notification.setSound(soundUri);
}
if (soundUri == null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notification.setSound(null);
}
if (bundle.containsKey("ongoing") || bundle.getBoolean("ongoing")) {
notification.setOngoing(bundle.getBoolean("ongoing"));
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
notification.setCategory(NotificationCompat.CATEGORY_CALL);
String color = bundle.getString("color");
int defaultColor = -1;
if (color != null) {
notification.setColor(Color.parseColor(color));
} else if (defaultColor != -1) {
notification.setColor(defaultColor);
}
}
int notificationID = notificationIdString.hashCode();
notification.setContentIntent(createOnTapIntent(context, notificationID, bundle.getString("deepLink")))
.setDeleteIntent(createOnDismissedIntent(context, notificationID, bundle.getString("deepLink")));
NotificationManager notificationManager = notificationManager();
long[] vibratePattern = new long[]{0};
if (!bundle.containsKey("vibrate") || bundle.getBoolean("vibrate")) {
long vibration = bundle.containsKey("vibration") ? (long) bundle.getDouble("vibration") : DEFAULT_VIBRATION;
if (vibration == 0)
vibration = DEFAULT_VIBRATION;
vibratePattern = new long[]{0, vibration};
notification.setVibrate(vibratePattern);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Define the shortcutId
String shortcutId = bundle.getString("shortcutId");
if (shortcutId != null) {
notification.setShortcutId(shortcutId);
}
Long timeoutAfter = (long) bundle.getDouble("timeoutAfter");
if (timeoutAfter != null && timeoutAfter >= 0) {
notification.setTimeoutAfter(timeoutAfter);
}
}
Long when = (long) bundle.getDouble("when");
if (when != null && when >= 0) {
notification.setWhen(when);
}
notification.setUsesChronometer(bundle.getBoolean("usesChronometer", false));
notification.setChannelId(channel_id);
JSONArray actionsArray = null;
try {
actionsArray = bundle.getString("actions") != null ? new JSONArray(bundle.getString("actions")) : null;
} catch (JSONException e) {
Log.e(LOG_TAG, "Exception while converting actions to JSON object.", e);
}
if (actionsArray != null) {
// No icon for now. The icon value of 0 shows no icon.
int icon = 0;
// Add button for each actions.
for (int i = 0; i < actionsArray.length(); i++) {
String action;
try {
action = actionsArray.getString(i);
} catch (JSONException e) {
Log.e(LOG_TAG, "Exception while getting action from actionsArray.", e);
continue;
}
Intent actionIntent = new Intent(context, PushNotificationActions.class);
actionIntent.setAction(packageName + ".ACTION_" + i);
actionIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
// Add "action" for later identifying which button gets pressed.
bundle.putString("action", action);
actionIntent.putExtra("notification", bundle);
actionIntent.setPackage(packageName);
PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent,
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
notification.addAction(new NotificationCompat.Action.Builder(icon, action, pendingActionIntent).build());
} else {
notification.addAction(icon, action, pendingActionIntent);
}
}
}
if (!(this.isApplicationInForeground() && bundle.getBoolean("ignoreInForeground"))) {
Notification info = notification.build();
info.defaults |= Notification.DEFAULT_LIGHTS;
if (bundle.containsKey("tag")) {
String tag = bundle.getString("tag");
notificationManager.notify(tag, notificationID, info);
} else {
notificationManager.notify(notificationID, info);
}
}
} catch (Exception e) {
Log.e(LOG_TAG, "failed to send push notification", e);
}
}
private boolean checkOrCreateChannel(NotificationManager manager, String channel_id, String channel_name, String channel_description, Uri soundUri, int importance, long[] vibratePattern, boolean showBadge) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
return false;
if (manager == null)
return false;
NotificationChannel channel = manager.getNotificationChannel(channel_id);
if (
channel == null && channel_name != null && channel_description != null ||
channel != null &&
(
channel_name != null && !channel.getName().equals(channel_name) ||
channel_description != null && !channel.getDescription().equals(channel_description)
)
) {
// If channel doesn't exist create a new one.
// If channel name or description is updated then update the existing channel.
channel = new NotificationChannel(channel_id, channel_name, importance);
channel.setDescription(channel_description);
channel.enableLights(true);
channel.enableVibration(vibratePattern != null);
channel.setVibrationPattern(vibratePattern);
channel.setShowBadge(showBadge);
if (soundUri != null) {
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build();
channel.setSound(soundUri, audioAttributes);
} else {
channel.setSound(null, null);
}
manager.createNotificationChannel(channel);
return true;
}
return false;
}
public boolean createChannel(ReadableMap channelInfo) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O)
return false;
String channelId = channelInfo.getString("channelId");
String channelName = channelInfo.getString("channelName");
String channelDescription = channelInfo.hasKey("channelDescription") ? channelInfo.getString("channelDescription") : "";
String soundName = channelInfo.hasKey("soundName") ? channelInfo.getString("soundName") : "default";
int importance = channelInfo.hasKey("importance") ? channelInfo.getInt("importance") : 4;
boolean vibrate = channelInfo.hasKey("vibrate") && channelInfo.getBoolean("vibrate");
long[] vibratePattern = vibrate ? new long[] { DEFAULT_VIBRATION } : null;
boolean showBadge = channelInfo.hasKey("showBadge") && channelInfo.getBoolean("showBadge");
NotificationManager manager = notificationManager();
Uri soundUri = getSoundUri(soundName);
return checkOrCreateChannel(manager, channelId, channelName, channelDescription, soundUri, importance, vibratePattern, showBadge);
}
public String getNotificationDefaultChannelId() {
return this.CHANNEL_ID;
}
private Uri getSoundUri(String soundName) {
if (soundName == null || "default".equalsIgnoreCase(soundName)) {
return RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
} else {
// sound name can be full filename, or just the resource name.
// So the strings 'my_sound.mp3' AND 'my_sound' are accepted
// The reason is to make the iOS and android javascript interfaces compatible
int resId;
if (context.getResources().getIdentifier(soundName, "raw", context.getPackageName()) != 0) {
resId = context.getResources().getIdentifier(soundName, "raw", context.getPackageName());
} else {
soundName = soundName.substring(0, soundName.lastIndexOf('.'));
resId = context.getResources().getIdentifier(soundName, "raw", context.getPackageName());
}
return Uri.parse("android.resource://" + context.getPackageName() + "/" + resId);
}
}
public Class getMainActivityClass() {
String packageName = context.getPackageName();
Intent launchIntent = context.getPackageManager().getLaunchIntentForPackage(packageName);
String className = launchIntent.getComponent().getClassName();
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
public boolean isApplicationInForeground() {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> processInfos = activityManager.getRunningAppProcesses();
if (processInfos != null) {
for (RunningAppProcessInfo processInfo : processInfos) {
if (processInfo.processName.equals(context.getPackageName())
&& processInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND
&& processInfo.pkgList.length > 0) {
return true;
}
}
}
return false;
}
private Bitmap getCircleBitmap(Bitmap bitmap) {
final Bitmap output = Bitmap.createBitmap(bitmap.getWidth(),
bitmap.getHeight(), Bitmap.Config.ARGB_8888);
final Canvas canvas = new Canvas(output);
final int color = Color.RED;
final Paint paint = new Paint();
final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
final RectF rectF = new RectF(rect);
paint.setAntiAlias(true);
canvas.drawARGB(0, 0, 0, 0);
paint.setColor(color);
canvas.drawOval(rectF, paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
canvas.drawBitmap(bitmap, rect, rect, paint);
bitmap.recycle();
return output;
}
private Person getPerson(Bundle bundle) {
String name = bundle.getString("name");
return new Person.Builder().setName(name).build();
}
private StatusMessage createMessage(Bundle data) {
Person author = getPerson(data.getBundle("notificationAuthor"));
long timeStampLongValue = (long) data.getDouble("timestamp");
return new StatusMessage(data.getString("id"), author, timeStampLongValue, data.getString("message"));
}
private PendingIntent createGroupOnDismissedIntent(Context context, int notificationId, String groupId, String deepLink) {
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
intent.putExtra("im.status.ethereum.groupId", groupId);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, flag);
}
private PendingIntent createGroupOnTapIntent(Context context, int notificationId, String groupId, String deepLink) {
Intent intent = getOpenAppIntent(deepLink);
return PendingIntent.getActivity(context.getApplicationContext(), notificationId, intent, flag);
}
private PendingIntent createOnTapIntent(Context context, int notificationId, String deepLink) {
Intent intent = getOpenAppIntent(deepLink);
return PendingIntent.getActivity(context.getApplicationContext(), notificationId, intent, flag);
}
private PendingIntent createOnDismissedIntent(Context context, int notificationId, String deepLink) {
Intent intent = new Intent(ACTION_DELETE_NOTIFICATION);
intent.putExtra("im.status.ethereum.deepLink", deepLink);
return PendingIntent.getBroadcast(context.getApplicationContext(), notificationId, intent, flag);
}
public void removeStatusMessage(Bundle bundle) {
String conversationId = bundle.getString("conversationId");
StatusMessageGroup group = this.messageGroups.get(conversationId);
NotificationManager notificationManager = notificationManager();
if (group == null) {
group = new StatusMessageGroup(conversationId);
}
this.messageGroups.put(conversationId, group);
String id = bundle.getString("id");
group.removeMessage(id);
this.showMessages(bundle);
}
public StatusMessageGroup getMessageGroup(String conversationId) {
return this.messageGroups.get(conversationId);
}
public void addStatusMessage(Bundle bundle) {
String conversationId = bundle.getString("conversationId");
StatusMessageGroup group = this.messageGroups.get(conversationId);
NotificationManager notificationManager = notificationManager();
if (group == null) {
group = new StatusMessageGroup(conversationId);
}
this.messageGroups.put(conversationId, group);
group.addMessage(createMessage(bundle));
this.showMessages(bundle);
}
public void showMessages(Bundle bundle) {
String conversationId = bundle.getString("conversationId");
StatusMessageGroup group = this.messageGroups.get(conversationId);
NotificationManager notificationManager = notificationManager();
NotificationCompat.MessagingStyle messagingStyle = new NotificationCompat.MessagingStyle("Me");
ArrayList<StatusMessage> messages = group.getMessages();
if (messages.size() == 0) {
notificationManager.cancel(conversationId.hashCode());
return;
}
for (int i = 0; i < messages.size(); i++) {
StatusMessage message = messages.get(i);
messagingStyle.addMessage(message.getText(),
message.getTimestamp(),
message.getAuthor());
}
if (bundle.getString("title") != null) {
messagingStyle.setConversationTitle(bundle.getString("title"));
}
NotificationCompat.Builder builder = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stat_notify_status)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
.setStyle(messagingStyle)
.setGroup(conversationId)
.setOnlyAlertOnce(true)
.setGroupSummary(true)
.setContentIntent(createGroupOnTapIntent(context, conversationId.hashCode(), conversationId, bundle.getString("deepLink")))
.setDeleteIntent(createGroupOnDismissedIntent(context, conversationId.hashCode(), conversationId, bundle.getString("deepLink")))
.setNumber(messages.size() + 1)
.setAutoCancel(true);
if (Build.VERSION.SDK_INT >= 21) {
builder.setVibrate(new long[0]);
}
notificationManager.notify(conversationId.hashCode(), builder.build());
}
class StatusMessageGroup {
private ArrayList<StatusMessage> messages;
private String id;
StatusMessageGroup(String id) {
this.id = id;
this.messages = new ArrayList<StatusMessage>();
}
public ArrayList<StatusMessage> getMessages() {
return messages;
}
public void addMessage(StatusMessage message) {
this.messages.add(message);
}
public void removeMessage(String id) {
ArrayList<StatusMessage> newMessages = new ArrayList<StatusMessage>();
for(StatusMessage message: this.messages) {
if(!message.id.equals(id)) {
newMessages.add(message);
}
}
this.messages = newMessages;
}
public String getId() {
return this.id;
}
}
class StatusMessage {
public Person getAuthor() {
return author;
}
public long getTimestamp() {
return timestamp;
}
public String getText() {
return text;
}
private String id;
private Person author;
private long timestamp;
private String text;
StatusMessage(String id, Person author, long timestamp, String text) {
this.id = id;
this.author = author;
this.timestamp = timestamp;
this.text = text;
}
}
private void removeGroup(String groupId) {
this.messageGroups.remove(groupId);
}
private void cleanGroup(String groupId) {
removeGroup(groupId);
if (messageGroups.size() == 0) {
notificationManager.cancelAll();
}
}
public void start() {
Log.e(LOG_TAG, "Starting Foreground Service");
Intent serviceIntent = new Intent(context, ForegroundService.class);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(serviceIntent);
} else {
context.startService(serviceIntent);
}
this.registerBroadcastReceiver();
}
public void stop() {
Log.e(LOG_TAG, "Stopping Foreground Service");
//NOTE: we cancel all the current notifications, because the intents can't be used anymore
//since the broadcast receiver will be killed as well and won't be able to handle any intent
notificationManager.cancelAll();
Intent serviceIntent = new Intent(context, ForegroundService.class);
context.stopService(serviceIntent);
context.unregisterReceiver(notificationActionReceiver);
}
}
@@ -0,0 +1,750 @@
// https://github.com/zo0r/react-native-push-notification/blob/bedc8f646aab67d594f291449fbfa24e07b64fe8/android/src/main/
// java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java Copy-Paste with removed firebase
package im.status.ethereum.pushnotifications
import android.app.ActivityManager
import android.app.ActivityManager.RunningAppProcessInfo
import android.app.AlarmManager
import android.app.Application
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.BroadcastReceiver
import android.content.SharedPreferences
import android.content.pm.ApplicationInfo
import android.content.res.Resources
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Color
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.PorterDuff
import android.graphics.PorterDuffXfermode
import android.graphics.Rect
import android.graphics.RectF
import android.media.AudioAttributes
import android.media.RingtoneManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.service.notification.StatusBarNotification
import android.util.Log
import android.util.Base64
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.core.app.Person
import androidx.core.graphics.drawable.IconCompat
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.ReadableArray
import com.facebook.react.bridge.ReadableMap
import com.facebook.react.bridge.WritableArray
import com.facebook.react.bridge.WritableMap
import org.json.JSONArray
import org.json.JSONException
import im.status.ethereum.module.R
import im.status.ethereum.pushnotifications.PushNotification.Companion.LOG_TAG
class PushNotificationHelper(private val context: Application, private val intentFilter: IntentFilter) {
companion object {
private const val DEFAULT_VIBRATION: Long = 300L
private const val CHANNEL_ID = "status-im-notifications"
const val ACTION_DELETE_NOTIFICATION = "im.status.ethereum.module.DELETE_NOTIFICATION"
const val ACTION_TAP_STOP = "im.status.ethereum.module.TAP_STOP"
}
private val flag: Int = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
} else {
PendingIntent.FLAG_CANCEL_CURRENT
}
private val notificationManager: NotificationManager by lazy {
context.getSystemService(NotificationManager::class.java)
}
private val persons: MutableMap<String, Person> = mutableMapOf()
private val messageGroups: MutableMap<String, StatusMessageGroup> = mutableMapOf()
init {
registerBroadcastReceiver()
}
private val notificationActionReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
ACTION_DELETE_NOTIFICATION -> {
intent.extras?.getString("im.status.ethereum.groupId")?.let { groupId ->
cleanGroup(groupId)
}
}
ACTION_TAP_STOP -> {
stop()
System.exit(0)
}
}
Log.e(LOG_TAG, "intent received: ${intent.action}")
}
}
private fun registerBroadcastReceiver() {
intentFilter.apply {
addAction(ACTION_DELETE_NOTIFICATION)
addAction(ACTION_TAP_STOP)
}
context.registerReceiver(notificationActionReceiver, intentFilter, Context.RECEIVER_EXPORTED)
Log.e(LOG_TAG, "Broadcast Receiver registered")
}
fun getOpenAppIntent(deepLink: String?): Intent? {
val packageName = context.packageName
val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
val className = launchIntent?.component?.className ?: return null
return try {
val intentClass = Class.forName(className)
Intent(context, intentClass).apply {
addCategory(Intent.CATEGORY_BROWSABLE)
action = Intent.ACTION_VIEW
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
deepLink?.let { data = Uri.parse(it) }
}
} catch (e: ClassNotFoundException) {
e.printStackTrace()
null
}
}
fun invokeApp(bundle: Bundle?) {
val packageName = context.packageName
val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
val className = launchIntent?.component?.className ?: return
try {
val activityClass = Class.forName(className)
Intent(context, activityClass).apply {
bundle?.let { putExtra("notification", it) }
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(this)
}
} catch (e: ClassNotFoundException) {
Log.e(LOG_TAG, "Class not found", e)
}
}
fun getMainActivityClass(): Class<*>? {
val packageName = context.packageName
val launchIntent = context.packageManager.getLaunchIntentForPackage(packageName)
val className = launchIntent?.component?.className ?: return null
return try {
Class.forName(className)
} catch (e: ClassNotFoundException) {
e.printStackTrace()
null
}
}
fun isApplicationInForeground(): Boolean {
val activityManager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
val processInfos = activityManager.runningAppProcesses ?: return false
return processInfos.any { processInfo ->
processInfo.processName == context.packageName &&
processInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND &&
processInfo.pkgList.isNotEmpty()
}
}
private fun getCircleBitmap(bitmap: Bitmap): Bitmap {
val output = Bitmap.createBitmap(bitmap.width, bitmap.height, Bitmap.Config.ARGB_8888)
val canvas = Canvas(output)
val paint = Paint().apply {
isAntiAlias = true
color = Color.RED
}
val rect = Rect(0, 0, bitmap.width, bitmap.height)
val rectF = RectF(rect)
canvas.drawARGB(0, 0, 0, 0)
canvas.drawOval(rectF, paint)
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN)
canvas.drawBitmap(bitmap, rect, rect, paint)
bitmap.recycle()
return output
}
// Represents a message in a Status conversation
data class StatusMessage(
val id: String,
val author: Person,
val timestamp: Long,
val text: String
)
// Represents a group of messages in a Status conversation
inner class StatusMessageGroup(val id: String) {
private val _messages = mutableListOf<StatusMessage>()
val messages: List<StatusMessage> get() = _messages.toList()
fun addMessage(message: StatusMessage) {
_messages.add(message)
}
fun removeMessage(id: String) {
_messages.removeAll { it.id == id }
}
}
private fun getPerson(bundle: Bundle): Person {
return Person.Builder()
.setName(bundle.getString("name"))
.build()
}
private fun createMessage(data: Bundle): StatusMessage {
val author = getPerson(data.getBundle("notificationAuthor") ?: Bundle())
val timeStampLongValue = data.getDouble("timestamp").toLong()
return StatusMessage(
id = data.getString("id") ?: "",
author = author,
timestamp = timeStampLongValue,
text = data.getString("message") ?: ""
)
}
private fun createGroupOnDismissedIntent(
context: Context,
notificationId: Int,
groupId: String,
deepLink: String?
): PendingIntent {
return Intent(ACTION_DELETE_NOTIFICATION).apply {
putExtra("im.status.ethereum.deepLink", deepLink)
putExtra("im.status.ethereum.groupId", groupId)
}.let { intent ->
PendingIntent.getBroadcast(
context.applicationContext,
notificationId,
intent,
flag
)
}
}
private fun createGroupOnTapIntent(
context: Context,
notificationId: Int,
groupId: String,
deepLink: String?
): PendingIntent {
return getOpenAppIntent(deepLink)?.let { intent ->
PendingIntent.getActivity(
context.applicationContext,
notificationId,
intent,
flag
)
} ?: throw IllegalStateException("Could not create open app intent")
}
private fun createOnTapIntent(
context: Context,
notificationId: Int,
deepLink: String?
): PendingIntent {
return getOpenAppIntent(deepLink)?.let { intent ->
PendingIntent.getActivity(
context.applicationContext,
notificationId,
intent,
flag
)
} ?: throw IllegalStateException("Could not create open app intent")
}
private fun createOnDismissedIntent(
context: Context,
notificationId: Int,
deepLink: String?
): PendingIntent {
return Intent(ACTION_DELETE_NOTIFICATION).apply {
putExtra("im.status.ethereum.deepLink", deepLink)
}.let { intent ->
PendingIntent.getBroadcast(
context.applicationContext,
notificationId,
intent,
flag
)
}
}
fun removeStatusMessage(bundle: Bundle) {
val conversationId = bundle.getString("conversationId") ?: return
val group = messageGroups.getOrPut(conversationId) {
StatusMessageGroup(conversationId)
}
bundle.getString("id")?.let { id ->
group.removeMessage(id)
}
showMessages(bundle)
}
fun getMessageGroup(conversationId: String): StatusMessageGroup? {
return messageGroups[conversationId]
}
fun addStatusMessage(bundle: Bundle) {
val conversationId = bundle.getString("conversationId") ?: return
val group = messageGroups.getOrPut(conversationId) {
StatusMessageGroup(conversationId)
}
group.addMessage(createMessage(bundle))
showMessages(bundle)
}
fun showMessages(bundle: Bundle) {
val conversationId = bundle.getString("conversationId") ?: return
val group = messageGroups[conversationId] ?: return
val messagingStyle = NotificationCompat.MessagingStyle("Me")
// If there are no messages, cancel the notification and return
if (group.messages.isEmpty()) {
notificationManager.cancel(conversationId.hashCode())
return
}
group.messages.forEach { message ->
messagingStyle.addMessage(
message.text,
message.timestamp,
message.author
)
}
// Set conversation title if available
bundle.getString("title")?.let { title ->
messagingStyle.conversationTitle = title
}
val builder = NotificationCompat.Builder(context, CHANNEL_ID).apply {
setSmallIcon(R.drawable.ic_stat_notify_status)
setPriority(NotificationCompat.PRIORITY_HIGH)
setCategory(NotificationCompat.CATEGORY_MESSAGE)
setStyle(messagingStyle)
setGroup(conversationId)
setOnlyAlertOnce(true)
setGroupSummary(true)
setContentIntent(createGroupOnTapIntent(context, conversationId.hashCode(), conversationId, bundle.getString("deepLink")))
setDeleteIntent(createGroupOnDismissedIntent(context, conversationId.hashCode(), conversationId, bundle.getString("deepLink")))
setNumber(group.messages.size + 1)
setAutoCancel(true)
// Set empty vibration pattern for Android 5.0 and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setVibrate(LongArray(0))
}
}
// Show the notification
notificationManager.notify(conversationId.hashCode(), builder.build())
}
fun checkOrCreateChannel(
manager: NotificationManager?,
channelId: String,
channelName: String?,
channelDescription: String?,
soundUri: Uri?,
importance: Int,
vibratePattern: LongArray?,
showBadge: Boolean
): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O || manager == null) {
return false
}
val existingChannel = manager.getNotificationChannel(channelId)
val shouldCreateOrUpdate = when {
// Channel doesn't exist and we have required info
existingChannel == null && channelName != null && channelDescription != null -> true
// Channel exists but needs update
existingChannel != null && (
(channelName != null && existingChannel.name != channelName) ||
(channelDescription != null && existingChannel.description != channelDescription)
) -> true
else -> false
}
if (shouldCreateOrUpdate) {
NotificationChannel(channelId, channelName, importance).apply {
description = channelDescription
enableLights(true)
enableVibration(vibratePattern != null)
vibrationPattern = vibratePattern
setShowBadge(showBadge)
// Configure sound
if (soundUri != null) {
val audioAttributes = AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_NOTIFICATION)
.build()
setSound(soundUri, audioAttributes)
} else {
setSound(null, null)
}
manager.createNotificationChannel(this)
}
return true
}
return false
}
fun createChannel(channelInfo: ReadableMap): Boolean {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
return false
}
return checkOrCreateChannel(
manager = notificationManager,
channelId = channelInfo.getString("channelId") ?: return false,
channelName = channelInfo.getString("channelName"),
channelDescription = if (channelInfo.hasKey("channelDescription")) {
channelInfo.getString("channelDescription")
} else "",
soundUri = getSoundUri(
if (channelInfo.hasKey("soundName")) {
channelInfo.getString("soundName")
} else "default"
),
importance = if (channelInfo.hasKey("importance")) {
channelInfo.getInt("importance")
} else 4,
vibratePattern = if (channelInfo.hasKey("vibrate") && channelInfo.getBoolean("vibrate")) {
longArrayOf(DEFAULT_VIBRATION)
} else null,
showBadge = channelInfo.hasKey("showBadge") && channelInfo.getBoolean("showBadge")
)
}
fun getNotificationDefaultChannelId(): String = CHANNEL_ID
private fun getSoundUri(soundName: String?): Uri {
return when {
soundName == null || soundName.equals("default", ignoreCase = true) -> {
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
}
else -> {
val resources = context.resources
val packageName = context.packageName
val resId = when {
// Try to find the resource as is
resources.getIdentifier(soundName, "raw", packageName) != 0 -> {
resources.getIdentifier(soundName, "raw", packageName)
}
// Try without file extension
else -> {
val nameWithoutExtension = soundName.substringBeforeLast('.')
resources.getIdentifier(nameWithoutExtension, "raw", packageName)
}
}
Uri.parse("android.resource://$packageName/$resId")
}
}
}
private fun removeGroup(groupId: String) {
messageGroups.remove(groupId)
}
private fun cleanGroup(groupId: String) {
removeGroup(groupId)
if (messageGroups.isEmpty()) {
notificationManager.cancelAll()
}
}
fun start() {
Log.e(LOG_TAG, "Starting Foreground Service")
Intent(context, ForegroundService::class.java).also { serviceIntent ->
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(serviceIntent)
} else {
context.startService(serviceIntent)
}
}
registerBroadcastReceiver()
}
fun stop() {
Log.e(LOG_TAG, "Stopping Foreground Service")
// Cancel all current notifications since their intents won't be valid
// after the broadcast receiver is killed
notificationManager.cancelAll()
Intent(context, ForegroundService::class.java).also { serviceIntent ->
context.stopService(serviceIntent)
}
context.unregisterReceiver(notificationActionReceiver)
}
fun sendToNotificationCentre(bundle: Bundle) {
val aggregator = PushNotificationPicturesAggregator { largeIconImage, bigPictureImage ->
sendToNotificationCentreWithPicture(bundle, largeIconImage, bigPictureImage)
}
aggregator.apply {
setLargeIconUrl(context, bundle.getString("largeIconUrl"))
setBigPictureUrl(context, bundle.getString("bigPictureUrl"))
}
}
fun handleConversation(bundle: Bundle) {
if (bundle.getBoolean("deleted")) {
removeStatusMessage(bundle)
} else {
addStatusMessage(bundle)
}
}
fun clearMessageNotifications(conversationId: String) {
notificationManager.cancel(conversationId.hashCode())
cleanGroup(conversationId)
}
fun clearAllMessageNotifications() {
notificationManager.cancelAll()
}
fun sendToNotificationCentreWithPicture(
bundle: Bundle,
largeIconBitmap: Bitmap?,
bigPictureBitmap: Bitmap?
) {
try {
val intentClass = getMainActivityClass() ?: run {
Log.e(LOG_TAG, "No activity class found for the notification")
return
}
if (bundle.getBoolean("isConversation")) {
handleConversation(bundle)
return
}
if (bundle.getString("message") == null) {
Log.d(LOG_TAG, "Ignore this message if you sent data-only notification. " +
"Cannot send to notification centre because there is no 'message' field in: $bundle")
return
}
val notificationIdString = bundle.getString("id") ?: run {
Log.e(LOG_TAG, "No notification ID specified for the notification")
return
}
val resources = context.resources
val packageName = context.packageName
val title = bundle.getString("title") ?: run {
val appInfo = context.applicationInfo
context.packageManager.getApplicationLabel(appInfo).toString()
}
val priority = when (bundle.getString("priority")?.toLowerCase()) {
"max" -> NotificationCompat.PRIORITY_MAX
"high" -> NotificationCompat.PRIORITY_HIGH
"low" -> NotificationCompat.PRIORITY_LOW
"min" -> NotificationCompat.PRIORITY_MIN
"default" -> NotificationCompat.PRIORITY_DEFAULT
else -> NotificationCompat.PRIORITY_HIGH
}
val visibility = when (bundle.getString("visibility")?.toLowerCase()) {
"private" -> NotificationCompat.VISIBILITY_PRIVATE
"public" -> NotificationCompat.VISIBILITY_PUBLIC
"secret" -> NotificationCompat.VISIBILITY_SECRET
else -> NotificationCompat.VISIBILITY_PRIVATE
}
val channelId = bundle.getString("channelId") ?: getNotificationDefaultChannelId()
NotificationCompat.Builder(context, channelId).apply {
setContentTitle(title)
setTicker(bundle.getString("ticker"))
setVisibility(visibility)
setPriority(priority)
setAutoCancel(bundle.getBoolean("autoCancel", true))
setOnlyAlertOnce(bundle.getBoolean("onlyAlertOnce", false))
// Configure notification based on Android version
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
setShowWhen(bundle.getBoolean("showWhen", true))
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
setDefaults(Notification.DEFAULT_LIGHTS)
}
// Handle group settings for Android KitKat Watch and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
bundle.getString("group")?.let { group ->
setGroup(group)
}
if (bundle.containsKey("groupSummary") || bundle.getBoolean("groupSummary")) {
setGroupSummary(bundle.getBoolean("groupSummary"))
}
}
// Set notification number if provided
bundle.getString("number")?.toIntOrNull()?.let { number ->
setNumber(number)
}
val smallIconResId = findSmallIconResourceId(resources, packageName, bundle)
setSmallIcon(smallIconResId)
configureLargeIcon(this, largeIconBitmap, bundle, resources, packageName)
val message = bundle.getString("message") ?: ""
setContentText(message)
bundle.getString("subText")?.let { subText ->
setSubText(subText)
}
val bigText = bundle.getString("bigText") ?: message
val style = when {
bigPictureBitmap != null -> NotificationCompat.BigPictureStyle()
.bigPicture(bigPictureBitmap)
.setBigContentTitle(title)
.setSummaryText(message)
else -> NotificationCompat.BigTextStyle().bigText(bigText)
}
setStyle(style)
val notificationId = notificationIdString.hashCode()
setContentIntent(createOnTapIntent(context, notificationId, bundle.getString("deepLink")))
setDeleteIntent(createOnDismissedIntent(context, notificationId, bundle.getString("deepLink")))
configureSoundAndVibration(this, bundle)
setOngoing(bundle.getBoolean("ongoing", false))
// Handle color for Lollipop and above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
setCategory(NotificationCompat.CATEGORY_CALL)
bundle.getString("color")?.let { color ->
setColor(Color.parseColor(color))
}
}
// Finally show the notification if conditions are met
if (!(isApplicationInForeground() && bundle.getBoolean("ignoreInForeground"))) {
val notification = build()
notification.defaults = notification.defaults or Notification.DEFAULT_LIGHTS
if (bundle.containsKey("tag")) {
notificationManager.notify(bundle.getString("tag"), notificationId, notification)
} else {
notificationManager.notify(notificationId, notification)
}
}
}
} catch (e: Exception) {
Log.e(LOG_TAG, "Failed to send push notification", e)
}
}
private fun findSmallIconResourceId(resources: Resources, packageName: String, bundle: Bundle): Int {
val smallIcon = bundle.getString("smallIcon")
return when {
!smallIcon.isNullOrEmpty() ->
resources.getIdentifier(smallIcon, "mipmap", packageName)
smallIcon == null ->
resources.getIdentifier("ic_stat_notify_status", "drawable", packageName)
else -> {
val defaultIcon = resources.getIdentifier("ic_launcher", "mipmap", packageName)
defaultIcon.takeIf { it != 0 } ?: android.R.drawable.ic_dialog_info
}
}
}
private fun configureLargeIcon(
builder: NotificationCompat.Builder,
largeIconBitmap: Bitmap?,
bundle: Bundle,
resources: Resources,
packageName: String
) {
var finalLargeIcon = largeIconBitmap
if (finalLargeIcon == null) {
val largeIcon = bundle.getString("largeIcon")
val largeIconResId = when {
!largeIcon.isNullOrEmpty() ->
resources.getIdentifier(largeIcon, "mipmap", packageName)
largeIcon == null ->
resources.getIdentifier("ic_launcher", "mipmap", packageName)
else -> 0
}
if (largeIconResId != 0 && (largeIcon != null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)) {
finalLargeIcon = BitmapFactory.decodeResource(resources, largeIconResId)
}
}
bundle.getBundle("notificationAuthor")?.getString("icon")?.let { icon ->
val base64Image = icon.split(",")[1]
val decodedString = Base64.decode(base64Image, Base64.DEFAULT)
val decodedByte = BitmapFactory.decodeByteArray(decodedString, 0, decodedString.size)
builder.setLargeIcon(getCircleBitmap(decodedByte))
} ?: finalLargeIcon?.let { icon ->
builder.setLargeIcon(icon)
}
}
private fun configureSoundAndVibration(
builder: NotificationCompat.Builder,
bundle: Bundle
) {
var soundUri: Uri? = null
if (!bundle.containsKey("playSound") || bundle.getBoolean("playSound")) {
val soundName = bundle.getString("soundName") ?: "default"
soundUri = getSoundUri(soundName)
builder.setSound(soundUri)
}
if (soundUri == null || Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
builder.setSound(null)
}
if (!bundle.containsKey("vibrate") || bundle.getBoolean("vibrate")) {
val vibration = if (bundle.containsKey("vibration")) {
bundle.getDouble("vibration").toLong()
} else DEFAULT_VIBRATION
val finalVibration = if (vibration == 0L) DEFAULT_VIBRATION else vibration
builder.setVibrate(longArrayOf(0, finalVibration))
}
}
}
@@ -1,86 +0,0 @@
package im.status.ethereum.pushnotifications;
import android.os.Build;
import android.app.Application;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Set;
import static im.status.ethereum.pushnotifications.PushNotification.LOG_TAG;
class PushNotificationJsDelivery {
private ReactContext reactContext;
PushNotificationJsDelivery(ReactContext context){
reactContext = context;
}
String convertJSON(Bundle bundle) {
try {
JSONObject json = convertJSONObject(bundle);
return json.toString();
} catch (JSONException e) {
return null;
}
}
// a Bundle is not a map, so we have to convert it explicitly
private JSONObject convertJSONObject(Bundle bundle) throws JSONException {
JSONObject json = new JSONObject();
Set<String> keys = bundle.keySet();
for (String key : keys) {
Object value = bundle.get(key);
if (value instanceof Bundle) {
json.put(key, convertJSONObject((Bundle)value));
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
json.put(key, JSONObject.wrap(value));
} else {
json.put(key, value);
}
}
return json;
}
void notifyNotification(Bundle bundle) {
String bundleString = convertJSON(bundle);
WritableMap params = Arguments.createMap();
params.putString("dataJSON", bundleString);
sendEvent("remoteNotificationReceived", params);
}
void notifyNotificationAction(Bundle bundle) {
String bundleString = convertJSON(bundle);
WritableMap params = Arguments.createMap();
params.putString("dataJSON", bundleString);
sendEvent("notificationActionReceived", params);
}
void sendEvent(String eventName, Object params) {
if (reactContext.hasActiveCatalystInstance()) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
.emit(eventName, params);
}
}
}
@@ -0,0 +1,93 @@
package im.status.ethereum.pushnotifications
import android.os.Build
import android.app.Application
import android.app.NotificationManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.util.Log
import com.facebook.react.bridge.ReactContext
import com.facebook.react.bridge.Arguments
import com.facebook.react.bridge.WritableMap
import com.facebook.react.modules.core.DeviceEventManagerModule
import org.json.JSONException
import org.json.JSONObject
import im.status.ethereum.pushnotifications.PushNotification.Companion.LOG_TAG
class PushNotificationJsDelivery(
private val reactContext: ReactContext
) {
/**
* Converts a Bundle to its JSON string representation.
* Returns null if conversion fails.
*/
fun convertJSON(bundle: Bundle): String? {
return try {
convertJSONObject(bundle).toString()
} catch (e: JSONException) {
null
}
}
/**
* Converts a Bundle to a JSONObject, handling nested bundles and different value types.
* This explicit conversion is necessary because Bundle is not a standard map.
*/
@Throws(JSONException::class)
private fun convertJSONObject(bundle: Bundle): JSONObject {
return JSONObject().apply {
// Using Kotlin's for loop syntax and 'apply' scope function
bundle.keySet().forEach { key ->
bundle.get(key)?.let { value ->
when (value) {
is Bundle -> put(key, convertJSONObject(value))
else -> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
put(key, JSONObject.wrap(value))
} else {
put(key, value)
}
}
}
}
}
}
/**
* Notifies about a received remote notification by sending an event to JavaScript
*/
fun notifyNotification(bundle: Bundle) {
convertJSON(bundle)?.let { bundleString ->
Arguments.createMap().apply {
putString("dataJSON", bundleString)
sendEvent("remoteNotificationReceived", this)
}
}
}
/**
* Notifies about a notification action by sending an event to JavaScript
*/
fun notifyNotificationAction(bundle: Bundle) {
convertJSON(bundle)?.let { bundleString ->
Arguments.createMap().apply {
putString("dataJSON", bundleString)
sendEvent("notificationActionReceived", this)
}
}
}
/**
* Sends an event to JavaScript if there's an active Catalyst instance
*/
fun sendEvent(eventName: String, params: Any) {
if (reactContext.hasActiveCatalystInstance()) {
reactContext
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
.emit(eventName, params)
}
}
}
@@ -1,27 +0,0 @@
package im.status.ethereum.pushnotifications;
import im.status.ethereum.pushnotifications.PushNotification;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.Collections;
import java.util.List;
public class PushNotificationPackage implements ReactPackage {
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Collections.<NativeModule>singletonList(new PushNotification(reactContext));
}
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
return Collections.emptyList();
}
}
@@ -0,0 +1,24 @@
package im.status.ethereum.pushnotifications
import im.status.ethereum.pushnotifications.PushNotification
import com.facebook.react.ReactPackage
import com.facebook.react.bridge.JavaScriptModule
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.uimanager.ViewManager
class PushNotificationPackage : ReactPackage {
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
return listOf(PushNotification(reactContext))
}
// Note: This function is deprecated in newer versions of React Native
// but kept for backwards compatibility
fun createJSModules(): List<Class<out JavaScriptModule>> {
return emptyList()
}
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
return emptyList()
}
}
@@ -1,136 +0,0 @@
package im.status.ethereum.pushnotifications;
import androidx.annotation.Nullable;
import com.facebook.common.executors.CallerThreadExecutor;
import com.facebook.common.references.CloseableReference;
import com.facebook.datasource.DataSource;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.common.Priority;
import com.facebook.imagepipeline.core.ImagePipeline;
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber;
import com.facebook.imagepipeline.image.CloseableImage;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;
import android.util.Log;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import java.util.concurrent.atomic.AtomicInteger;
import static im.status.ethereum.pushnotifications.PushNotification.LOG_TAG;
public class PushNotificationPicturesAggregator {
interface Callback {
public void call(Bitmap largeIconImage, Bitmap bigPictureImage);
}
private AtomicInteger count = new AtomicInteger(0);
private Bitmap largeIconImage;
private Bitmap bigPictureImage;
private Callback callback;
public PushNotificationPicturesAggregator(Callback callback) {
this.callback = callback;
}
public void setBigPicture(Bitmap bitmap) {
this.bigPictureImage = bitmap;
this.finished();
}
public void setBigPictureUrl(Context context, String url) {
if(null == url) {
this.setBigPicture(null);
return;
}
Uri uri = null;
try {
uri = Uri.parse(url);
} catch(Exception ex) {
Log.e(LOG_TAG, "Failed to parse bigPictureUrl", ex);
this.setBigPicture(null);
return;
}
final PushNotificationPicturesAggregator aggregator = this;
this.downloadRequest(context, uri, new BaseBitmapDataSubscriber() {
@Override
public void onNewResultImpl(@Nullable Bitmap bitmap) {
aggregator.setBigPicture(bitmap);
}
@Override
public void onFailureImpl(DataSource dataSource) {
aggregator.setBigPicture(null);
}
});
}
public void setLargeIcon(Bitmap bitmap) {
this.largeIconImage = bitmap;
this.finished();
}
public void setLargeIconUrl(Context context, String url) {
if(null == url) {
this.setLargeIcon(null);
return;
}
Uri uri = null;
try {
uri = Uri.parse(url);
} catch(Exception ex) {
Log.e(LOG_TAG, "Failed to parse largeIconUrl", ex);
this.setLargeIcon(null);
return;
}
final PushNotificationPicturesAggregator aggregator = this;
this.downloadRequest(context, uri, new BaseBitmapDataSubscriber() {
@Override
public void onNewResultImpl(@Nullable Bitmap bitmap) {
aggregator.setLargeIcon(bitmap);
}
@Override
public void onFailureImpl(DataSource dataSource) {
aggregator.setLargeIcon(null);
}
});
}
private void downloadRequest(Context context, Uri uri, BaseBitmapDataSubscriber subscriber) {
ImageRequest imageRequest = ImageRequestBuilder
.newBuilderWithSource(uri)
.setRequestPriority(Priority.HIGH)
.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
.build();
if(!Fresco.hasBeenInitialized()) {
Fresco.initialize(context);
}
DataSource<CloseableReference<CloseableImage>> dataSource = Fresco.getImagePipeline().fetchDecodedImage(imageRequest, context);
dataSource.subscribe(subscriber, CallerThreadExecutor.getInstance());
}
private void finished() {
synchronized(this.count) {
int val = this.count.incrementAndGet();
if(val >= 2 && this.callback != null) {
this.callback.call(this.largeIconImage, this.bigPictureImage);
}
}
}
}
@@ -0,0 +1,109 @@
package im.status.ethereum.pushnotifications
import androidx.annotation.Nullable
import com.facebook.common.executors.CallerThreadExecutor
import com.facebook.common.references.CloseableReference
import com.facebook.datasource.DataSource
import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.imagepipeline.common.Priority
import com.facebook.imagepipeline.datasource.BaseBitmapDataSubscriber
import com.facebook.imagepipeline.image.CloseableImage
import com.facebook.imagepipeline.request.ImageRequest
import com.facebook.imagepipeline.request.ImageRequestBuilder
import android.util.Log
import android.content.Context
import android.graphics.Bitmap
import android.net.Uri
import java.util.concurrent.atomic.AtomicInteger
import im.status.ethereum.pushnotifications.PushNotification.Companion.LOG_TAG
class PushNotificationPicturesAggregator(
private val callback: (Bitmap?, Bitmap?) -> Unit
) {
private val count = AtomicInteger(0)
private var largeIconImage: Bitmap? = null
private var bigPictureImage: Bitmap? = null
fun setBigPicture(bitmap: Bitmap?) {
bigPictureImage = bitmap
finished()
}
fun setBigPictureUrl(context: Context, url: String?) {
if (url == null) {
setBigPicture(null)
return
}
val uri = try {
Uri.parse(url)
} catch (ex: Exception) {
Log.e(LOG_TAG, "Failed to parse bigPictureUrl", ex)
setBigPicture(null)
return
}
downloadRequest(context, uri, object : BaseBitmapDataSubscriber() {
override fun onNewResultImpl(@Nullable bitmap: Bitmap?) {
setBigPicture(bitmap)
}
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
setBigPicture(null)
}
})
}
fun setLargeIcon(bitmap: Bitmap?) {
largeIconImage = bitmap
finished()
}
fun setLargeIconUrl(context: Context, url: String?) {
if (url == null) {
setLargeIcon(null)
return
}
val uri = try {
Uri.parse(url)
} catch (ex: Exception) {
Log.e(LOG_TAG, "Failed to parse largeIconUrl", ex)
setLargeIcon(null)
return
}
downloadRequest(context, uri, object : BaseBitmapDataSubscriber() {
override fun onNewResultImpl(@Nullable bitmap: Bitmap?) {
setLargeIcon(bitmap)
}
override fun onFailureImpl(dataSource: DataSource<CloseableReference<CloseableImage>>) {
setLargeIcon(null)
}
})
}
private fun downloadRequest(context: Context, uri: Uri, subscriber: BaseBitmapDataSubscriber) {
val imageRequest = ImageRequestBuilder
.newBuilderWithSource(uri)
.setRequestPriority(Priority.HIGH)
.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
.build()
if (!Fresco.hasBeenInitialized()) {
Fresco.initialize(context)
}
val dataSource = Fresco.getImagePipeline().fetchDecodedImage(imageRequest, context)
dataSource.subscribe(subscriber, CallerThreadExecutor.getInstance())
}
private fun finished() {
synchronized(count) {
if (count.incrementAndGet() >= 2) {
callback(largeIconImage, bigPictureImage)
}
}
}
}
@@ -1,54 +0,0 @@
package im.status.ethereum.pushnotifications;
import org.junit.Test;
import static org.junit.Assert.*;
import android.app.Application;
import android.app.NotificationManager;
import android.os.Bundle;
import android.content.Intent;
import android.app.PendingIntent;
import android.content.IntentFilter;
import static org.mockito.Mockito.*;
import org.mockito.Spy;
public class PushNotificationHelperTest {
PushNotificationHelper helper;
@Test
public void testAddStatusMessage() {
final Application context = mock(Application.class);
final NotificationManager manager = mock(NotificationManager.class);
final IntentFilter filter = mock(IntentFilter.class);
when(context.getSystemService(NotificationManager.class)).thenReturn(manager);
// Create a spy for PushNotificationHelper
PushNotificationHelper realHelper = new PushNotificationHelper(context, filter);
helper = spy(realHelper);
Bundle bundle = mock(Bundle.class);
Bundle personBundle = mock(Bundle.class);
String conversationId = "conversation-id";
String deepLink = "deep-link";
when(bundle.getString("conversationId")).thenReturn(conversationId);
when(bundle.getString("id")).thenReturn("id");
when(bundle.getString("message")).thenReturn("message");
when(bundle.getDouble("timestamp")).thenReturn(100000.0);
when(bundle.getString("deepLink")).thenReturn(deepLink);
when(personBundle.getString("name")).thenReturn("name");
when(bundle.getBundle("notificationAuthor")).thenReturn(personBundle);
doNothing().when(helper).showMessages(bundle);
helper.addStatusMessage(bundle);
assertNotNull(helper.getMessageGroup(conversationId));
}
}
@@ -0,0 +1,49 @@
package im.status.ethereum.pushnotifications
import android.app.Application
import android.app.NotificationManager
import android.content.Intent
import android.content.IntentFilter
import android.os.Bundle
import org.junit.Assert.assertNotNull
import org.junit.Test
import org.mockito.Mockito.*
import org.mockito.Spy
class PushNotificationHelperTest {
private lateinit var helper: PushNotificationHelper
@Test
fun testAddStatusMessage() {
val context = mock(Application::class.java)
val manager = mock(NotificationManager::class.java)
val filter = mock(IntentFilter::class.java)
`when`(context.getSystemService(NotificationManager::class.java)).thenReturn(manager)
// Create a spy for PushNotificationHelper
val realHelper = PushNotificationHelper(context, filter)
helper = spy(realHelper)
val bundle = mock(Bundle::class.java)
val personBundle = mock(Bundle::class.java)
val conversationId = "conversation-id"
val deepLink = "deep-link"
`when`(bundle.getString("conversationId")).thenReturn(conversationId)
`when`(bundle.getString("id")).thenReturn("id")
`when`(bundle.getString("message")).thenReturn("message")
`when`(bundle.getDouble("timestamp")).thenReturn(100000.0)
`when`(bundle.getString("deepLink")).thenReturn(deepLink)
`when`(personBundle.getString("name")).thenReturn("name")
`when`(bundle.getBundle("notificationAuthor")).thenReturn(personBundle)
doNothing().`when`(helper).showMessages(bundle)
helper.addStatusMessage(bundle)
assertNotNull(helper.getMessageGroup(conversationId))
}
}
@@ -36,7 +36,7 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
NSURL *mainGethLogsFile = [rootUrl URLByAppendingPathComponent:@"geth.log"];
NSURL *mainLogsFile = [logsFolderName URLByAppendingPathComponent:@"geth.log"];
NSURL *requestsLogFile = [rootUrl URLByAppendingPathComponent:@"requests.log"];
NSURL *requestsLogFile = [rootUrl URLByAppendingPathComponent:@"api.log"];
[dbJson writeToFile:dbFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
[jsLogs writeToFile:jsLogsFile.path atomically:YES encoding:NSUTF8StringEncoding error:nil];
@@ -44,7 +44,7 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
[fileManager copyItemAtPath:mainGethLogsFile.path toPath:mainLogsFile.path error:nil];
if ([fileManager fileExistsAtPath:requestsLogFile.path]) {
[fileManager copyItemAtPath:requestsLogFile.path toPath:[logsFolderName URLByAppendingPathComponent:@"requests.log"].path error:nil];
[fileManager copyItemAtPath:requestsLogFile.path toPath:[logsFolderName URLByAppendingPathComponent:@"api.log"].path error:nil];
}
[SSZipArchive createZipFileAtPath:zipFile.path withContentsOfDirectory:logsFolderName.path];
@@ -53,43 +53,6 @@ RCT_EXPORT_METHOD(sendLogs:(NSString *)dbJson
callback(@[zipFile.absoluteString]);
}
RCT_EXPORT_METHOD(initLogging:(BOOL)enabled
mobileSystem:(BOOL)mobileSystem
logLevel:(NSString *)logLevel
logRequestGo:(BOOL)logRequestGo
callback:(RCTResponseSenderBlock)callback)
{
NSString *logDirectory = [self logFileDirectory];
NSString *logFilePath = [logDirectory stringByAppendingPathComponent:@"geth.log"];
NSString *logRequestFilePath = [logDirectory stringByAppendingPathComponent:@"requests.log"];
NSDictionary *config = @{
@"Enabled": @(enabled),
@"MobileSystem": @(mobileSystem),
@"Level": logLevel,
@"File": logFilePath,
@"LogRequestGo": @(logRequestGo),
@"LogRequestFile": logRequestFilePath
};
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:config options:0 error:&error];
if (error) {
NSLog(@"Error creating JSON: %@", [error localizedDescription]);
return;
}
NSString *configJson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
[StatusBackendClient executeStatusGoRequestWithCallback:@"InitLogging"
body:configJson
statusgoFunction:^NSString *{
return StatusgoInitLogging(configJson);
}
callback:callback];
}
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(logFileDirectory) {
NSURL *rootUrl = [Utils getRootUrl];
return rootUrl.path;
@@ -8,6 +8,7 @@
NSString *_statusGoEndpoint;
NSString *_signalEndpoint;
NSString *_rootDataDir;
NSTimer *_pingTimer;
}
RCT_EXPORT_MODULE();
@@ -77,6 +78,8 @@ RCT_EXPORT_MODULE();
[self.webSocket resume];
[self receiveMessage];
[self startPingTimer];
}
- (void)receiveMessage {
@@ -109,6 +112,7 @@ RCT_EXPORT_MODULE();
}
- (void)disconnectWebSocket {
[self stopPingTimer];
if (self.webSocket) {
[self.webSocket cancel];
self.webSocket = nil;
@@ -119,6 +123,7 @@ RCT_EXPORT_MODULE();
body:(NSString *)body
callback:(void (^)(NSString *response, NSError *error))callback {
NSString *fullUrlString = [NSString stringWithFormat:@"%@%@", self.statusGoEndpoint, endpoint];
NSLog(@"StatusGo server is enabled, executing request, endpoint: %@, body: %@", fullUrlString, body);
NSURL *url = [NSURL URLWithString:fullUrlString];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url];
request.HTTPMethod = @"POST";
@@ -225,7 +230,6 @@ RCT_EXPORT_METHOD(configStatusBackendServer:(BOOL)serverEnabled
if (client.serverEnabled) {
dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
__block NSString *resultString = @"";
[client request:endpoint body:body callback:^(NSString *response, NSError *error) {
if (error) {
NSLog(@"request to %@ failed: %@", endpoint, error);
@@ -243,4 +247,33 @@ RCT_EXPORT_METHOD(configStatusBackendServer:(BOOL)serverEnabled
}
}
- (void)startPingTimer {
[self stopPingTimer];
_pingTimer = [NSTimer scheduledTimerWithTimeInterval:30.0
target:self
selector:@selector(sendPing)
userInfo:nil
repeats:YES];
}
- (void)stopPingTimer {
if (_pingTimer) {
[_pingTimer invalidate];
_pingTimer = nil;
}
}
- (void)sendPing {
if (self.webSocket) {
[self.webSocket sendPingWithPongReceiveHandler:^(NSError * _Nullable error) {
if (error) {
NSLog(@"WebSocket ping failed: %@", error);
// Reconnect on ping failure
[self disconnectWebSocket];
[self connectWebSocket];
}
}];
}
}
@end
@@ -1946,35 +1946,6 @@ void _ConnectionChange(const FunctionCallbackInfo<Value>& args) {
ConnectionChange(arg0, arg1);
}
void _InitLogging(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
if (args.Length() != 1) {
// Throw an Error that is passed back to JavaScript
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong number of arguments for InitLogging")));
return;
}
// Check the argument types
if (!args[0]->IsString()) {
isolate->ThrowException(Exception::TypeError(
String::NewFromUtf8Literal(isolate, "Wrong argument type for 'logSettingsJSON'")));
return;
}
String::Utf8Value arg0Obj(isolate, args[0]->ToString(context).ToLocalChecked());
char *arg0 = *arg0Obj;
// Call exported Go function, which returns a C string
char *c = InitLogging(arg0);
Local<String> ret = String::NewFromUtf8(isolate, c).ToLocalChecked();
args.GetReturnValue().Set(ret);
delete c;
}
void _RestoreAccountAndLogin(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
Local<Context> context = isolate->GetCurrentContext();
@@ -2064,7 +2035,6 @@ void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "hashTransaction", _HashTransaction);
NODE_SET_METHOD(exports, "connectionChange", _ConnectionChange);
NODE_SET_METHOD(exports, "pollSignal", _PollSignal);
NODE_SET_METHOD(exports, "initLogging", _InitLogging);
NODE_SET_METHOD(exports, "restoreAccountAndLogin", _RestoreAccountAndLogin);
}
+183 -198
View File
@@ -8789,31 +8789,31 @@
},
{
"path": "com/github/status-im/status-keycard-java/android/3.1.1",
"path": "com/github/status-im/status-keycard-java/android/3.1.2",
"repo": "https://jitpack.io",
"files": {
"android-3.1.1.pom": {
"sha1": "ac7e6699628e329dfc028345f32bc41c5d6c2f33",
"sha256": "sha256-EvrtvGGyvB3Fxp72KXYl46pIsxgf8vDMXk9IZjkuEIs="
"android-3.1.2.pom": {
"sha1": "9afce579939bad3c2b6d15787a0c861f6dbd9afa",
"sha256": "sha256-hNYvQQKfHNmbGQw5P0sssZAI11wfRhLir46QdukK0bs="
},
"android-3.1.1.jar": {
"sha1": "26118061c0996fff357ae30cc360e5928c8dd455",
"sha256": "sha256-4IjMQ6ZLAlsk4JC9sumOsRhdOF1F0L3Jl8dbEDOBoJY="
"android-3.1.2.jar": {
"sha1": "46fe72fb8fca5935c73e0df5c10ccdd5c64fca8e",
"sha256": "sha256-QNpDWQ1TWvCWg3YdL4UWSEiafpoHavXSY3VWCN45rtE="
}
}
},
{
"path": "com/github/status-im/status-keycard-java/lib/3.1.1",
"path": "com/github/status-im/status-keycard-java/lib/3.1.2",
"repo": "https://jitpack.io",
"files": {
"lib-3.1.1.pom": {
"sha1": "63c7bbd55ddbf88d1b89941f78158aa07fb46873",
"sha256": "sha256-ERsZGvECIQGlNusSk+13760//JU6SaONxOW9b3AHFvQ="
"lib-3.1.2.pom": {
"sha1": "0c0d8ef7318ba054457dea1e6624e0284aec91ca",
"sha256": "sha256-Vs9p287YNgMD76/egyeHTqlIsENjwbZsspQbzs8QkeY="
},
"lib-3.1.1.jar": {
"sha1": "07f0374f17160c8731350316226ffe0de50f6f31",
"sha256": "sha256-oaolZh+Ad/Dq6byP3SU8z19gUjPdV8wM0Ryobj1Y260="
"lib-3.1.2.jar": {
"sha1": "5df9eef589a72c5a3143f59b0f547092aeb0c309",
"sha256": "sha256-M0P6r96RkgaIjC912Z/VxJgHmfm/ftl7rqYOto8A0Ic="
}
}
},
@@ -9082,16 +9082,16 @@
},
{
"path": "commons-io/commons-io/2.17.0",
"path": "commons-io/commons-io/2.18.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"commons-io-2.17.0.pom": {
"sha1": "af3aa19bcc67a14e5d0dad042e7d985f733cdff4",
"sha256": "sha256-SEqTn/9TELjLXGuQKcLc8VXT+TuLjWKF8/VrsroJ/Ek="
"commons-io-2.18.0.pom": {
"sha1": "cbd7a6fd54081f8e3d2a90c3cb74a91a31662a86",
"sha256": "sha256-Y9lpQetE35yQ0q2yrYw/aZwuBl5wcEXF2vcT/KUrz8o="
},
"commons-io-2.17.0.jar": {
"sha1": "ddcc8433eb019fb48fe25207c0278143f3e1d7e2",
"sha256": "sha256-SqTKSPPf0wt4Igt4gdjLk+rECT7JQ2G2vvqUh5mKVQs="
"commons-io-2.18.0.jar": {
"sha1": "44084ef756763795b31c578403dd028ff4a22950",
"sha256": "sha256-88oPjWPEDiOlbVQQHGDV7e4Ta0LYS/uFvHljCTEJz4s="
}
}
},
@@ -10987,20 +10987,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-annotations/2.18.0",
"path": "com/fasterxml/jackson/core/jackson-annotations/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-annotations-2.18.0.pom": {
"sha1": "15e211c936f255998ba87e8a80c14989f9895f08",
"sha256": "sha256-pqA47zy3L8FXW5w4ZdpK2arX0COo1J3K0DeRBlVx6Bw="
"jackson-annotations-2.18.2.pom": {
"sha1": "40ab24a80879d82a46bd3653a43da88917e929c0",
"sha256": "sha256-CyvWlOqJJn7qSBJqilskplI0xkM4dULSRGnRlb+6HPg="
},
"jackson-annotations-2.18.0.jar": {
"sha1": "9bddcc56af9d90f902ef5dba7348102cd12b04e2",
"sha256": "sha256-oJNn0u61Joc6v3N/91TFCF+CBzo4LucsO74VQSIXZx8="
"jackson-annotations-2.18.2.jar": {
"sha1": "985d77751ebc7fce5db115a986bc9aa82f973f4a",
"sha256": "sha256-WBvWEADvdkiUP3gcoFaJ5W0D9gUnSDZajis6m10/oy8="
},
"jackson-annotations-2.18.0.module": {
"sha1": "c84262b96118cbb3bc27bf127735b93b18728a6c",
"sha256": "sha256-DwmMCDBXb8nHVdQ9fzFuinV8k4ErNXdRJbNo/rzWA10="
"jackson-annotations-2.18.2.module": {
"sha1": "9bd316d8447c1738d7bbfcc373693627c38eaea4",
"sha256": "sha256-4Ruvm1NubflNqmNaEBPsPgabhmuOES3cKqBEahVQUNw="
}
}
},
@@ -11021,20 +11021,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-core/2.18.0",
"path": "com/fasterxml/jackson/core/jackson-core/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-core-2.18.0.pom": {
"sha1": "1d9d4da19eb2b14ba2975c254b6bfdd8ac4894fd",
"sha256": "sha256-2u9SqBcSdESKRuwovBCgBQldduysz4Fbp6Y6AaiGf2c="
"jackson-core-2.18.2.pom": {
"sha1": "9a77a48adfca5182e9f8b3ee20ee2b186477b089",
"sha256": "sha256-4GWwA50h9N/ORr1DEEx9dtWFa9cy4qqGDMWkonDtct4="
},
"jackson-core-2.18.0.jar": {
"sha1": "65e8ead7de5d8f7a53e296c363bea3182f21f925",
"sha256": "sha256-IVu9fI/WW+UEy5L/OqHEt5D8exTMpy9FRqrEFDwQG7U="
"jackson-core-2.18.2.jar": {
"sha1": "fb64ccac5c27dca8819418eb4e443a9f496d9ee7",
"sha256": "sha256-2AVK58DRwtL1XSjkYCbr5YkogfP6tfQ5IzGEOBw7Sh8="
},
"jackson-core-2.18.0.module": {
"sha1": "b7e0781f9c8f54d94d5e28bad1816c7a8c3a6799",
"sha256": "sha256-xSmBTu77fwRPz2UL+lJ+60totpYGfLZMGmmUcvs1ZYc="
"jackson-core-2.18.2.module": {
"sha1": "6a97d687f4996c423f97dc56f7e63860581f0f05",
"sha256": "sha256-ynjGBDZ2f8w2zhRrd05PUKnLn2MtExcsRLrojgwDz6I="
}
}
},
@@ -11055,20 +11055,20 @@
},
{
"path": "com/fasterxml/jackson/core/jackson-databind/2.18.0",
"path": "com/fasterxml/jackson/core/jackson-databind/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-databind-2.18.0.pom": {
"sha1": "3e52a2c42c3824afc2e696dad92f94dd6c1067fb",
"sha256": "sha256-+Mn0Od1EsdAkLWbmlB2pfFe6hONANu7peqHDr/vxugQ="
"jackson-databind-2.18.2.pom": {
"sha1": "65295373e682120eba7894bb6632d6f8d17d5d6c",
"sha256": "sha256-STo9tkR7eo7Ls3JCNMbOZ31y20sE9roAjw6+rqe+Wp0="
},
"jackson-databind-2.18.0.jar": {
"sha1": "8dba1f789a75fc30b59303574fe2b269afa4d3bc",
"sha256": "sha256-K/GSe38yJGg+0BV6HsOw7edRedo+WX14xXLVbtAPnzw="
"jackson-databind-2.18.2.jar": {
"sha1": "deef8697b92141fb6caf7aa86966cff4eec9b04f",
"sha256": "sha256-SzZOaFDciRcvzx1N0muP9UiO2kT/RlfiLdJlID3Vqzw="
},
"jackson-databind-2.18.0.module": {
"sha1": "49c271f0ef5bb935ca797921904e7ebe138925e3",
"sha256": "sha256-LEnsfnQwbUh/lVkbqJiQRhnDKi4/0bWG+z5jIskaTmI="
"jackson-databind-2.18.2.module": {
"sha1": "8bc88e1ebdc91d61f75e1dabb3cdeaca74ad0032",
"sha256": "sha256-jH2sL3J4GNiEeoKqTqxrAXTXnPBN+Q3iJGBy5t005wA="
}
}
},
@@ -11100,12 +11100,12 @@
},
{
"path": "com/fasterxml/jackson/jackson-base/2.18.0",
"path": "com/fasterxml/jackson/jackson-base/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-base-2.18.0.pom": {
"sha1": "d445ae58e3b3a15aa50a3e3707eaf46463b121e6",
"sha256": "sha256-EFZMv/uFf5BlqhG1hJqMMIw1NfD1PG9Muytvt7NQf5c="
"jackson-base-2.18.2.pom": {
"sha1": "08e5c4c7f519a42a74dac257c922a7adbb4dda1b",
"sha256": "sha256-71dLcvW0iUgET2g3a4dMiK4JoCncjgX2Shwwvftt4Uo="
}
}
},
@@ -11122,12 +11122,12 @@
},
{
"path": "com/fasterxml/jackson/jackson-bom/2.18.0",
"path": "com/fasterxml/jackson/jackson-bom/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-bom-2.18.0.pom": {
"sha1": "02fecc45cb9609006d979cb8f06f8a571957a0b8",
"sha256": "sha256-ut3oZMpztsoE3p9+5J5knhpeivj4x8FoLHRr5eI0xYc="
"jackson-bom-2.18.2.pom": {
"sha1": "b269a504e4c7d10af05db454c367fb03d6c434b6",
"sha256": "sha256-UkfNwwFyXT9n9+8EkDconVr3CdaXK89LFwluRUjSlWs="
}
}
},
@@ -11144,12 +11144,12 @@
},
{
"path": "com/fasterxml/jackson/jackson-parent/2.18",
"path": "com/fasterxml/jackson/jackson-parent/2.18.1",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-parent-2.18.pom": {
"sha1": "3696eb746d84dafc7933ec26f13f4fb407530ab0",
"sha256": "sha256-Vp3ADWi05t993oVimeHANT+kC9rxI+DfVj7L7kFlhtk="
"jackson-parent-2.18.1.pom": {
"sha1": "fcd5c9c72aeebb63d13eb4330842fdb8ae4f9a1c",
"sha256": "sha256-0IIvrBoCJoRLitRFySDEmk9hkWnQmxAQp9/u0ZkQmYw="
}
}
},
@@ -11166,12 +11166,12 @@
},
{
"path": "com/fasterxml/jackson/module/jackson-modules-base/2.18.0",
"path": "com/fasterxml/jackson/module/jackson-modules-base/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-modules-base-2.18.0.pom": {
"sha1": "6c3a68a52acce7482ba68999bd9b06a076b4c0ce",
"sha256": "sha256-vtjbLqeIGzWwOA9V+67R1Wv+P9o6AmB0Ww9dXqzteyk="
"jackson-modules-base-2.18.2.pom": {
"sha1": "a38a7c307ae9250be61ea90b86dab2b3b504f847",
"sha256": "sha256-wVCoPSPNizMiqqSYmEh0J5vi3I1f4qN5B9P1arYOJpw="
}
}
},
@@ -11192,20 +11192,20 @@
},
{
"path": "com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.18.0",
"path": "com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.18.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"jackson-module-jaxb-annotations-2.18.0.pom": {
"sha1": "40eb69b3a20fb98faf66bee669b60e0fbda324ad",
"sha256": "sha256-rOb/zJ9+f89Atu3uRVB6FQJdI5N6PbBSxDNSeVdJQ9c="
"jackson-module-jaxb-annotations-2.18.2.pom": {
"sha1": "36b8fbaf3577061bb92ecf23d6aa9d802558fdb4",
"sha256": "sha256-T2FGzIFi5nDA1ERI8q1Iqf9WSeQHFmhM+gSua2Bm+fA="
},
"jackson-module-jaxb-annotations-2.18.0.jar": {
"sha1": "62cc7b7517b752360fef4796e396363a2396d29c",
"sha256": "sha256-WStXNngYHG2Te1dJnDqGrON3knBrVoRFc3FcC7muw30="
"jackson-module-jaxb-annotations-2.18.2.jar": {
"sha1": "048c96032e5a428739e28ff04973717c032df598",
"sha256": "sha256-ZFyk3imYBHPxmubAjXws4OP9JzJE0xVbXao7yC+hPUE="
},
"jackson-module-jaxb-annotations-2.18.0.module": {
"sha1": "7adb3648b6e45a0ce0afd75efca142268ca592a1",
"sha256": "sha256-66HSqRlv9sC7h9CrfZ6Ta5i2y7eZH8DUShi2gtBDmns="
"jackson-module-jaxb-annotations-2.18.2.module": {
"sha1": "2c300d407906f321a9e3d3ecc01cc56696ffc660",
"sha256": "sha256-wRlrUgwa7RJ88R3ka0l9gbxPNVquWqvIFwcwfX6x30U="
}
}
},
@@ -12215,16 +12215,16 @@
},
{
"path": "com/google/errorprone/error_prone_annotations/2.35.1",
"path": "com/google/errorprone/error_prone_annotations/2.36.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"error_prone_annotations-2.35.1.pom": {
"sha1": "7b4b876b40f04941ede1e324f2af6261ad514a7b",
"sha256": "sha256-un1clTzvrQU6AlOiJ46g1u+aiW4ZKgMnzHiO9EJBeBc="
"error_prone_annotations-2.36.0.pom": {
"sha1": "daf188a28315b31852ebd550f78f6b764972ee1f",
"sha256": "sha256-15z9N8hfdta3VMdQHuHchEe3smQsI4LXeCUhZr0zHpw="
},
"error_prone_annotations-2.35.1.jar": {
"sha1": "c36f9e12192226278c2b163bf61990b131e59903",
"sha256": "sha256-A7Y/7jjjqG/aMRr1oDV+ZO6kSQmqtSUe0XgRknBQj/U="
"error_prone_annotations-2.36.0.jar": {
"sha1": "227d4d4957ccc3dc5761bd897e3a0ee587e750a7",
"sha256": "sha256-d0QOJwsLyaJJkDxaB2w2pyLEiGyk9CZ18pA6HFPtYaU="
}
}
},
@@ -12362,12 +12362,12 @@
},
{
"path": "com/google/errorprone/error_prone_parent/2.35.1",
"path": "com/google/errorprone/error_prone_parent/2.36.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"error_prone_parent-2.35.1.pom": {
"sha1": "ec496cb2eecb573bac52f53e75e677d21b7d79dd",
"sha256": "sha256-vclIzC9eZtiTxFLrVEXgU1TS8PrejWxkUxDYJgEWu0k="
"error_prone_parent-2.36.0.pom": {
"sha1": "f280159378f00e9f428f10887e22f84ebb2c7e9f",
"sha256": "sha256-Okz8imvtYetI6Wl5b8MeoNJwtj5nBZmUamGIOttwlNw="
}
}
},
@@ -12953,12 +12953,12 @@
},
{
"path": "com/google/protobuf/protobuf-bom/4.29.0-RC2",
"path": "com/google/protobuf/protobuf-bom/4.29.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-bom-4.29.0-RC2.pom": {
"sha1": "9a1d56ef3dcd903fe6188028b41a08cd95b7aed6",
"sha256": "sha256-+fpeoeIYK8Z1Ug+VW8oKTMXIqjvw0QlYTlSXaC7Z268="
"protobuf-bom-4.29.0.pom": {
"sha1": "5542df7ac3708da8bf30756f4ee6d804d04b8c9b",
"sha256": "sha256-3L/Apl6DmDAE0HFOmL8NIGBwEUVbYhk5cowAkmvIyZk="
}
}
},
@@ -13204,16 +13204,16 @@
},
{
"path": "com/google/protobuf/protobuf-java/4.29.0-RC2",
"path": "com/google/protobuf/protobuf-java/4.29.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-java-4.29.0-RC2.pom": {
"sha1": "6a3b8220cf0191d1cac58f518e8fe089105a6215",
"sha256": "sha256-laBUKUQ7qipRaJ2LniTI0JIqMOTbBMbK2MPX5F6+G9A="
"protobuf-java-4.29.0.pom": {
"sha1": "27c4abe9c47f4aed31cf7acff86853a05f7e85f0",
"sha256": "sha256-7cHftEVG5yel+sU/CQUGv6aN2DB65vEHbv+tVy+S16Q="
},
"protobuf-java-4.29.0-RC2.jar": {
"sha1": "2c26bef798eaf3604cae2487cc7f98fbc30b34b2",
"sha256": "sha256-7UEwvtFLpLMrQFVkcnZC1J3sqc14fsugWtO2/2377YQ="
"protobuf-java-4.29.0.jar": {
"sha1": "ffea90ab158435d68de76951857ef5f8b0f98365",
"sha256": "sha256-FpAYUevl6J/oiqrTwmhmNzaVvC4wYnu4kyhH4vX8LnY="
}
}
},
@@ -13333,12 +13333,12 @@
},
{
"path": "com/google/protobuf/protobuf-parent/4.29.0-RC2",
"path": "com/google/protobuf/protobuf-parent/4.29.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"protobuf-parent-4.29.0-RC2.pom": {
"sha1": "87f14265eeeddd4c78ccaed313fe4125e7681442",
"sha256": "sha256-awus769PZSQsjKRKvb1PZe3Z0XoiZ1PetQE3m7dICzU="
"protobuf-parent-4.29.0.pom": {
"sha1": "c35e0844930aea715cc8f4335fee49223b1fe35c",
"sha256": "sha256-jU6O2nh45revZuPCtvWHE839P7bNsHGS3My2HN0uSTA="
}
}
},
@@ -15259,16 +15259,16 @@
},
{
"path": "io/netty/netty-tcnative-classes/2.0.66.Final",
"path": "io/netty/netty-tcnative-classes/2.0.69.Final",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"netty-tcnative-classes-2.0.66.Final.pom": {
"sha1": "75dca372aa373fac57023721582360f84c79e44c",
"sha256": "sha256-SULNAuKRbB+094zKiEHw9yGbuQ+CirdImokCfC76kes="
"netty-tcnative-classes-2.0.69.Final.pom": {
"sha1": "ee65d639d3c5312a4b6369f0d59504ad0c8dfe0b",
"sha256": "sha256-WdoPlJ4r7on1cR6z4Mb9jPeRTmtwwAfza56waIJDAVw="
},
"netty-tcnative-classes-2.0.66.Final.jar": {
"sha1": "9588bd2f891157538a78d86c945aa34bf9308dda",
"sha256": "sha256-ZpqBGhk9wefJ74bLVHpKuS8PNMzo+bhCuQKb9c+gfMU="
"netty-tcnative-classes-2.0.69.Final.jar": {
"sha1": "0f018f36b688bafabe4573af230a8b59cf3c0713",
"sha256": "sha256-C7woSMsJnrP29Ow2UBs2AOGChFfNpB1TMGh/YB7gS+8="
}
}
},
@@ -15285,12 +15285,12 @@
},
{
"path": "io/netty/netty-tcnative-parent/2.0.66.Final",
"path": "io/netty/netty-tcnative-parent/2.0.69.Final",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"netty-tcnative-parent-2.0.66.Final.pom": {
"sha1": "91784588e56a54734c698f08118b4f3b94a58ec1",
"sha256": "sha256-KwF/s8He6rXR6uvsE0ZZt96ueMFNXr/D1JwLMITqc2U="
"netty-tcnative-parent-2.0.69.Final.pom": {
"sha1": "ba3c1cc69d48f0196ee84ecd3c5157c52a987931",
"sha256": "sha256-KVMCcZZjdhDIlPMr2nBQk82HaDFcnxpXOVGnXxeGmvw="
}
}
},
@@ -15804,17 +15804,6 @@
}
},
{
"path": "net/bytebuddy/byte-buddy-parent/1.14.18",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-parent-1.14.18.pom": {
"sha1": "6b0b1f08e2d2d8166176c80fd22ee3198a26a3cf",
"sha256": "sha256-dpxdCxEV5z9oRSu6qjVrrZtzfV/ge4PUyeSDl1uB/jw="
}
}
},
{
"path": "net/bytebuddy/byte-buddy-parent/1.15.4",
"repo": "https://repo.maven.apache.org/maven2",
@@ -15826,6 +15815,17 @@
}
},
{
"path": "net/bytebuddy/byte-buddy-parent/1.15.10",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-parent-1.15.10.pom": {
"sha1": "6f8c0f39f52c09fbf4df945ff563f5fd81130724",
"sha256": "sha256-ZX1HwTcRTN8u0plv73gJYTgX3v9k2L4TI/QJiaO6BG4="
}
}
},
{
"path": "net/bytebuddy/byte-buddy/1.11.13",
"repo": "https://repo.maven.apache.org/maven2",
@@ -15856,21 +15856,6 @@
}
},
{
"path": "net/bytebuddy/byte-buddy/1.14.18",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-1.14.18.pom": {
"sha1": "5f889814c247762909c7007bdf5ef72f2e7cea7a",
"sha256": "sha256-IvsZB4/nBkirYFSSZscUaZaEciaqbm9+iP7MCBRySTk="
},
"byte-buddy-1.14.18.jar": {
"sha1": "0081e9b9a20944626e6757b5950676af901c2485",
"sha256": "sha256-UhF68WlqU6p3wTE1MHStolzL3y31EfKvM/rWcE+pUQQ="
}
}
},
{
"path": "net/bytebuddy/byte-buddy/1.15.4",
"repo": "https://repo.maven.apache.org/maven2",
@@ -15886,6 +15871,21 @@
}
},
{
"path": "net/bytebuddy/byte-buddy/1.15.10",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"byte-buddy-1.15.10.pom": {
"sha1": "c968dc18f092176badbc9bd389ce53cbb6f13aa5",
"sha256": "sha256-BCz/E2+5FPl2I7oremhdmEuGnb+1tFIdx8kiejJZznA="
},
"byte-buddy-1.15.10.jar": {
"sha1": "635c873fadd853c084f84fdc3cbd58c5dd8537f9",
"sha256": "sha256-2DkNIGhaQaK9ymQPlYlCzZG8vyHEJHBJS99XUtmgexQ="
}
}
},
{
"path": "net/java/dev/jna/jna-platform/5.6.0",
"repo": "https://repo.maven.apache.org/maven2",
@@ -16726,12 +16726,12 @@
},
{
"path": "org/apache/commons/commons-parent/74",
"path": "org/apache/commons/commons-parent/78",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"commons-parent-74.pom": {
"sha1": "704abf062c1f6e03f8bcf6929b4777b9af5048a5",
"sha256": "sha256-gOthsMh/3YJqBpMTsotnLaPxiFgy2kR7Uebophl+fss="
"commons-parent-78.pom": {
"sha1": "c59670d5fff6efd8b31013cb579732c75a250b4c",
"sha256": "sha256-Ai0gLmVe3QTyoQ7L5FPZKXeSTTg4Ckyow1nxgXqAMg4="
}
}
},
@@ -17471,20 +17471,20 @@
},
{
"path": "org/checkerframework/checker-qual/3.48.1",
"path": "org/checkerframework/checker-qual/3.48.2",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"checker-qual-3.48.1.pom": {
"sha1": "b6dca63179b1aedebea4b5eb877342e3f6ff8916",
"sha256": "sha256-4vslCCqCrdKE9gwb/yXZMBzX6bJhOIEs3tGEXutCJ8k="
"checker-qual-3.48.2.pom": {
"sha1": "95acb8356a028eeb22171b7330f7bb78cf0f9506",
"sha256": "sha256-Sk+LlzEYgyx4SrUIpzAJ2tAt5Nq/0dFJLWa45MC6HRE="
},
"checker-qual-3.48.1.jar": {
"sha1": "7d8cf1c00aec0042df92f8d71d7f15baaf9773f4",
"sha256": "sha256-Iejf6BA+El2WoyllPKgeh6xDAybb2/KZzqPcGuPwOaI="
"checker-qual-3.48.2.jar": {
"sha1": "2a4797df796b23026b8215545b0d2936bacc52af",
"sha256": "sha256-ryPyDJlbL+3jWx66gRd6mmaUTsZ7jk3uGapMwLcQxrU="
},
"checker-qual-3.48.1.module": {
"sha1": "f1e778df44d6ca615e580cf2bf3c0ad7ad898d6e",
"sha256": "sha256-2By/MdXdg8qGleCloaRz6TS5mq3GpN2UnvT1ll8lYAM="
"checker-qual-3.48.2.module": {
"sha1": "cdf30d8d4b97e12fc85e65e1bd55210a1a084b10",
"sha256": "sha256-D2RjlMmz5KL1aitsZ6C0NAkqxrq3pJvC/wGtjKf08NU="
}
}
},
@@ -17820,27 +17820,27 @@
},
{
"path": "org/easymock/easymock-parent/5.4.0",
"path": "org/easymock/easymock-parent/5.5.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"easymock-parent-5.4.0.pom": {
"sha1": "ac49fe5a7d9cfec46d7386f713c5cd5c5afed89f",
"sha256": "sha256-sKGUgoX4OZNIqWxgWTXYJVCnVKTDNfw0SfogL74qAnI="
"easymock-parent-5.5.0.pom": {
"sha1": "a30937cb15aa72370d3841ca217dd04cd24d506c",
"sha256": "sha256-e7FiABT3ApRLbKcywPIh6jLHwyfQ9fM6zuGf/gtAJ6A="
}
}
},
{
"path": "org/easymock/easymock/5.4.0",
"path": "org/easymock/easymock/5.5.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"easymock-5.4.0.pom": {
"sha1": "d566a45d12ee304ab0fba3877ebd93ef64469ea8",
"sha256": "sha256-v/kNdi/BrWVB5jCrgeBzJPVflbd5BhE6NKpnqn2HPhk="
"easymock-5.5.0.pom": {
"sha1": "a711c875746fa00d8c929824b0f99ed7f103ac75",
"sha256": "sha256-0TuotyX47NbHANkl9v78MwXLkIGtzLN97cUxr9HzfQY="
},
"easymock-5.4.0.jar": {
"sha1": "eb56bad81c203765f4a5c74aed28142fb0d79354",
"sha256": "sha256-SDUEf+QbVDSRB8EaGEuhIvo8P8cIQHU0ZfdCtJ5+A6M="
"easymock-5.5.0.jar": {
"sha1": "b07e2bcbc7b6bcae190a18b9ced742b6fd9ceec3",
"sha256": "sha256-vwW1axAr6Rx80LutFoTVgJrCzNA4DmhPlEW/3hRBj38="
}
}
},
@@ -19901,16 +19901,16 @@
},
{
"path": "org/jetbrains/kotlin/kotlin-reflect/2.1.0-Beta2",
"path": "org/jetbrains/kotlin/kotlin-reflect/2.1.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"kotlin-reflect-2.1.0-Beta2.pom": {
"sha1": "3e7baa22fcb4cc619f4bd40486276a93f3f2a0c3",
"sha256": "sha256-Mh8VtvMp1G9QUK5EgUhLQ0nCEefVB7U0spO9fTwzNkg="
"kotlin-reflect-2.1.0.pom": {
"sha1": "6c72cb76dbf12249eec091d5a7d6ea27a27fcc87",
"sha256": "sha256-nNhLPU9xfJYjXkujtydolcz/1V3kEcfOCz97q1Yu/kI="
},
"kotlin-reflect-2.1.0-Beta2.jar": {
"sha1": "d776709bc948b0d4d1f06d0da76c3754d80d6f50",
"sha256": "sha256-gBuxZsoD8bj+VXCQtpxdW3CeUiyFTSnSWyTW0JLqjRo="
"kotlin-reflect-2.1.0.jar": {
"sha1": "dc3753b59b67d79b7d2f546d51e22a0ec1f082d8",
"sha256": "sha256-tfYI7fqYqM+iNyzBLRitqXS+HFbBCT7/BswGH0/AiLI="
}
}
},
@@ -21579,24 +21579,24 @@
},
{
"path": "org/jetbrains/kotlin/kotlin-stdlib/2.1.0-Beta2",
"path": "org/jetbrains/kotlin/kotlin-stdlib/2.1.0",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"kotlin-stdlib-2.1.0-Beta2.pom": {
"sha1": "9bf48efa052a62e8f741b1da18105848536e0b98",
"sha256": "sha256-yK+DAGdGa23mj4Gpm5qTnpn65U2VBdfG8eXQKG9Ckuw="
"kotlin-stdlib-2.1.0.pom": {
"sha1": "b7c581edbfc43221bf7a18ea76cc482111bba949",
"sha256": "sha256-E05IwXeWwcECfsvmyfHHXHkvU1mHq4nh4d2kP4w2b14="
},
"kotlin-stdlib-2.1.0-Beta2-all.jar": {
"kotlin-stdlib-2.1.0-all.jar": {
"sha1": "37a691f3c171dc54afc64aedcd63da3440df12d3",
"sha256": "sha256-p0EvZtcbzSchw5gweXL7tflAn5RWQ+7gXRCAsomjOcs="
},
"kotlin-stdlib-2.1.0-Beta2.jar": {
"sha1": "9b6eab04a97dfca8f091764bc5bc89604afc7b01",
"sha256": "sha256-a+9Pxnj5YEdA0GUcZbg0Rw2GM8nxKfMZzNWstMvztLs="
"kotlin-stdlib-2.1.0.jar": {
"sha1": "85f8b81009cda5890e54ba67d64b5e599c645020",
"sha256": "sha256-1vkbew8wbMopn+x0+3w05IdNb17FuSWgtN4hkB4RnD8="
},
"kotlin-stdlib-2.1.0-Beta2.module": {
"sha1": "fc5281ea91c36234d3aa0de8e0c70e0f8892a677",
"sha256": "sha256-3yeZ0iUo792hyfKjSIBL692eYtrGQGxNURFP++ylC2w="
"kotlin-stdlib-2.1.0.module": {
"sha1": "10243b69a055e7a0aac5eff98c9509f34b4b5d1e",
"sha256": "sha256-3PvI6L8yzWen763ZHTEVK86YcJEdbsUIePT9tuA+cOI="
}
}
},
@@ -22698,21 +22698,6 @@
}
},
{
"path": "org/ow2/asm/asm/9.7",
"repo": "https://repo.maven.apache.org/maven2",
"files": {
"asm-9.7.pom": {
"sha1": "e2568079bd69f0fdf35fe2d9e7cd9b16db8eff94",
"sha256": "sha256-3gARXx2E86Cy7jpLb2GS0Gb4bRhdZ7nRUi8sgP6sXwA="
},
"asm-9.7.jar": {
"sha1": "073d7b3086e14beb604ced229c302feff6449723",
"sha256": "sha256-rfRtXjSUC98Ujs3Sap7o7qlElqcgNP9xQQZrPupcTp0="
}
}
},
{
"path": "org/ow2/ow2/1.3",
"repo": "https://repo.maven.apache.org/maven2",
+2 -2
View File
@@ -559,8 +559,8 @@ com.github.bumptech.glide:glide:4.12.0
com.github.bumptech.glide:okhttp3-integration:4.12.0
com.github.clans:fab:1.6.4
com.github.gundy:semver4j:0.16.4
com.github.status-im.status-keycard-java:android:3.1.1
com.github.status-im.status-keycard-java:lib:3.1.1
com.github.status-im.status-keycard-java:android:3.1.2
com.github.status-im.status-keycard-java:lib:3.1.2
com.github.status-im:function:0.0.1
com.github.wix-playground:ahbottomnavigation:3.3.0
com.github.wix-playground:reflow-animator:1.0.6
+26 -27
View File
@@ -545,8 +545,8 @@ https://dl.google.com/dl/android/maven2/com/google/testing/platform/launcher/0.0
https://dl.google.com/dl/android/maven2/com/google/test/platform/core-proto/0.0.2-dev/core-proto-0.0.2-dev.pom
https://jitpack.io/com/github/Dimezis/BlurView/version-2.0.4/BlurView-version-2.0.4.pom
https://jitpack.io/com/github/status-im/function/0.0.1/function-0.0.1.pom
https://jitpack.io/com/github/status-im/status-keycard-java/android/3.1.1/android-3.1.1.pom
https://jitpack.io/com/github/status-im/status-keycard-java/lib/3.1.1/lib-3.1.1.pom
https://jitpack.io/com/github/status-im/status-keycard-java/android/3.1.2/android-3.1.2.pom
https://jitpack.io/com/github/status-im/status-keycard-java/lib/3.1.2/lib-3.1.2.pom
https://jitpack.io/com/github/wix-playground/ahbottomnavigation/3.3.0/ahbottomnavigation-3.3.0.pom
https://jitpack.io/com/github/wix-playground/reflow-animator/1.0.6/reflow-animator-1.0.6.pom
https://jitpack.io/com/github/yalantis/ucrop/2.2.6-native/ucrop-2.2.6-native.pom
@@ -564,7 +564,7 @@ https://repo.maven.apache.org/maven2/commons-codec/commons-codec/1.10/commons-co
https://repo.maven.apache.org/maven2/commons-codec/commons-codec/1.11/commons-codec-1.11.pom
https://repo.maven.apache.org/maven2/commons-codec/commons-codec/1.17.1/commons-codec-1.17.1.pom
https://repo.maven.apache.org/maven2/commons-io/commons-io/2.4/commons-io-2.4.pom
https://repo.maven.apache.org/maven2/commons-io/commons-io/2.17.0/commons-io-2.17.0.pom
https://repo.maven.apache.org/maven2/commons-io/commons-io/2.18.0/commons-io-2.18.0.pom
https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.pom
https://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.3.4/commons-logging-1.3.4.pom
@@ -667,22 +667,22 @@ https://repo.maven.apache.org/maven2/com/facebook/soloader/soloader/0.10.1/soloa
https://repo.maven.apache.org/maven2/com/facebook/soloader/soloader/0.10.5/soloader-0.10.5.pom
https://repo.maven.apache.org/maven2/com/facebook/yoga/proguard-annotations/1.19.0/proguard-annotations-1.19.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.11.1/jackson-annotations-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.18.0/jackson-annotations-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.18.2/jackson-annotations-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.11.1/jackson-core-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.18.0/jackson-core-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-core/2.18.2/jackson-core-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.11.1/jackson-databind-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.18.0/jackson-databind-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.18.2/jackson-databind-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-xml/2.11.1/jackson-dataformat-xml-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.11.1/jackson-base-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.18.0/jackson-base-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-base/2.18.2/jackson-base-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.11.1/jackson-bom-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.18.0/jackson-bom-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-bom/2.18.2/jackson-bom-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-parent/2.11/jackson-parent-2.11.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-parent/2.18/jackson-parent-2.18.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/jackson-parent/2.18.1/jackson-parent-2.18.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.11.1/jackson-modules-base-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.18.0/jackson-modules-base-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-modules-base/2.18.2/jackson-modules-base-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.11.1/jackson-module-jaxb-annotations-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.18.0/jackson-module-jaxb-annotations-2.18.0.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.18.2/jackson-module-jaxb-annotations-2.18.2.pom
https://repo.maven.apache.org/maven2/com/fasterxml/jackson/module/jackson-module-kotlin/2.11.1/jackson-module-kotlin-2.11.1.pom
https://repo.maven.apache.org/maven2/com/fasterxml/oss-parent/38/oss-parent-38.pom
https://repo.maven.apache.org/maven2/com/fasterxml/oss-parent/61/oss-parent-61.pom
@@ -751,7 +751,7 @@ https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotatio
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.10.0/error_prone_annotations-2.10.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.11.0/error_prone_annotations-2.11.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.27.0/error_prone_annotations-2.27.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.35.1/error_prone_annotations-2.35.1.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_annotations/2.36.0/error_prone_annotations-2.36.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.0.18/error_prone_parent-2.0.18.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.2.0/error_prone_parent-2.2.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.3.1/error_prone_parent-2.3.1.pom
@@ -764,7 +764,7 @@ https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.10.0/error_prone_parent-2.10.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.11.0/error_prone_parent-2.11.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.27.0/error_prone_parent-2.27.0.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.35.1/error_prone_parent-2.35.1.pom
https://repo.maven.apache.org/maven2/com/google/errorprone/error_prone_parent/2.36.0/error_prone_parent-2.36.0.pom
https://repo.maven.apache.org/maven2/com/google/flatbuffers/flatbuffers-java/1.12.0/flatbuffers-java-1.12.0.pom
https://repo.maven.apache.org/maven2/com/google/google/1/google-1.pom
https://repo.maven.apache.org/maven2/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.pom
@@ -809,7 +809,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.13.0/pro
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.17.2/protobuf-bom-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.19.2/protobuf-bom-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/3.19.3/protobuf-bom-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/4.29.0-RC2/protobuf-bom-4.29.0-RC2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-bom/4.29.0/protobuf-bom-4.29.0.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-javalite/3.17.2/protobuf-javalite-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-javalite/3.19.2/protobuf-javalite-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java-util/3.4.0/protobuf-java-util-3.4.0.pom
@@ -826,7 +826,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.13.0/pr
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.17.2/protobuf-java-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.19.2/protobuf-java-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/3.19.3/protobuf-java-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/4.29.0-RC2/protobuf-java-4.29.0-RC2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-java/4.29.0/protobuf-java-4.29.0.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-lite/3.0.1/protobuf-lite-3.0.1.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.0.0/protobuf-parent-3.0.0.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.4.0/protobuf-parent-3.4.0.pom
@@ -837,7 +837,7 @@ https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.13.0/
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.17.2/protobuf-parent-3.17.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.19.2/protobuf-parent-3.19.2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/3.19.3/protobuf-parent-3.19.3.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/4.29.0-RC2/protobuf-parent-4.29.0-RC2.pom
https://repo.maven.apache.org/maven2/com/google/protobuf/protobuf-parent/4.29.0/protobuf-parent-4.29.0.pom
https://repo.maven.apache.org/maven2/com/google/truth/truth-parent/1.4.4/truth-parent-1.4.4.pom
https://repo.maven.apache.org/maven2/com/google/truth/truth/1.4.4/truth-1.4.4.pom
https://repo.maven.apache.org/maven2/com/google/zxing/core/3.4.1/core-3.4.1.pom
@@ -971,9 +971,9 @@ https://repo.maven.apache.org/maven2/io/netty/netty-resolver/4.1.52.Final/netty-
https://repo.maven.apache.org/maven2/io/netty/netty-resolver/4.1.72.Final/netty-resolver-4.1.72.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-resolver/5.0.0.Alpha2/netty-resolver-5.0.0.Alpha2.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-classes/2.0.46.Final/netty-tcnative-classes-2.0.46.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-classes/2.0.66.Final/netty-tcnative-classes-2.0.66.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-classes/2.0.69.Final/netty-tcnative-classes-2.0.69.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-parent/2.0.46.Final/netty-tcnative-parent-2.0.46.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-parent/2.0.66.Final/netty-tcnative-parent-2.0.66.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-tcnative-parent/2.0.69.Final/netty-tcnative-parent-2.0.69.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-transport/4.1.34.Final/netty-transport-4.1.34.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-transport/4.1.52.Final/netty-transport-4.1.52.Final.pom
https://repo.maven.apache.org/maven2/io/netty/netty-transport/4.1.72.Final/netty-transport-4.1.72.Final.pom
@@ -1009,12 +1009,12 @@ https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.11.19/byte
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-agent/1.15.4/byte-buddy-agent-1.15.4.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.11.13/byte-buddy-parent-1.11.13.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.11.19/byte-buddy-parent-1.11.19.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.14.18/byte-buddy-parent-1.14.18.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.15.4/byte-buddy-parent-1.15.4.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy-parent/1.15.10/byte-buddy-parent-1.15.10.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.11.13/byte-buddy-1.11.13.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.11.19/byte-buddy-1.11.19.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.14.18/byte-buddy-1.14.18.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.15.4/byte-buddy-1.15.4.pom
https://repo.maven.apache.org/maven2/net/bytebuddy/byte-buddy/1.15.10/byte-buddy-1.15.10.pom
https://repo.maven.apache.org/maven2/net/java/dev/jna/jna-platform/5.6.0/jna-platform-5.6.0.pom
https://repo.maven.apache.org/maven2/net/java/dev/jna/jna/5.6.0/jna-5.6.0.pom
https://repo.maven.apache.org/maven2/net/java/jvnet-parent/1/jvnet-parent-1.pom
@@ -1080,7 +1080,7 @@ https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/48/common
https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/52/commons-parent-52.pom
https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/71/commons-parent-71.pom
https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/72/commons-parent-72.pom
https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/74/commons-parent-74.pom
https://repo.maven.apache.org/maven2/org/apache/commons/commons-parent/78/commons-parent-78.pom
https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom
https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.2.6/httpclient-4.2.6.pom
https://repo.maven.apache.org/maven2/org/apache/httpcomponents/httpclient/4.5.2/httpclient-4.5.2.pom
@@ -1135,7 +1135,7 @@ https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/2.8.1/che
https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/2.11.1/checker-qual-2.11.1.pom
https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.pom
https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.12.0/checker-qual-3.12.0.pom
https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.48.1/checker-qual-3.48.1.pom
https://repo.maven.apache.org/maven2/org/checkerframework/checker-qual/3.48.2/checker-qual-3.48.2.pom
https://repo.maven.apache.org/maven2/org/codehaus/codehaus-parent/4/codehaus-parent-4.pom
https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy-xml/3.0.9/groovy-xml-3.0.9.pom
https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy-xml/3.0.10/groovy-xml-3.0.10.pom
@@ -1158,8 +1158,8 @@ https://repo.maven.apache.org/maven2/org/codehaus/mojo/mojo-parent/84/mojo-paren
https://repo.maven.apache.org/maven2/org/codehaus/woodstox/stax2-api/4.2.1/stax2-api-4.2.1.pom
https://repo.maven.apache.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.pom
https://repo.maven.apache.org/maven2/org/easymock/easymock-parent/3.2/easymock-parent-3.2.pom
https://repo.maven.apache.org/maven2/org/easymock/easymock-parent/5.4.0/easymock-parent-5.4.0.pom
https://repo.maven.apache.org/maven2/org/easymock/easymock/5.4.0/easymock-5.4.0.pom
https://repo.maven.apache.org/maven2/org/easymock/easymock-parent/5.5.0/easymock-parent-5.5.0.pom
https://repo.maven.apache.org/maven2/org/easymock/easymock/5.5.0/easymock-5.5.0.pom
https://repo.maven.apache.org/maven2/org/eclipse/angus/angus-activation-project/2.0.2/angus-activation-project-2.0.2.pom
https://repo.maven.apache.org/maven2/org/eclipse/angus/angus-activation/2.0.2/angus-activation-2.0.2.pom
https://repo.maven.apache.org/maven2/org/eclipse/ee4j/project/1.0.2/project-1.0.2.pom
@@ -1285,7 +1285,7 @@ https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.6.10/
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.6.20/kotlin-reflect-1.6.20.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.7.10/kotlin-reflect-1.7.10.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/1.8.20-RC2/kotlin-reflect-1.8.20-RC2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/2.1.0-Beta2/kotlin-reflect-2.1.0-Beta2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-reflect/2.1.0/kotlin-reflect-2.1.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.6.20/kotlin-scripting-common-1.6.20.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.8.0/kotlin-scripting-common-1.8.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-scripting-common/1.9.0/kotlin-scripting-common-1.9.0.pom
@@ -1395,7 +1395,7 @@ https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.8.22/k
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.0/kotlin-stdlib-1.9.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.22/kotlin-stdlib-1.9.22.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/1.9.25/kotlin-stdlib-1.9.25.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.1.0-Beta2/kotlin-stdlib-2.1.0-Beta2.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/2.1.0/kotlin-stdlib-2.1.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-core/1.8.0/kotlin-tooling-core-1.8.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-core/1.9.0/kotlin-tooling-core-1.9.0.pom
https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-tooling-metadata/1.6.20/kotlin-tooling-metadata-1.6.20.pom
@@ -1471,7 +1471,6 @@ https://repo.maven.apache.org/maven2/org/ow2/asm/asm/8.0.1/asm-8.0.1.pom
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.1/asm-9.1.pom
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.2/asm-9.2.pom
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.7.1/asm-9.7.1.pom
https://repo.maven.apache.org/maven2/org/ow2/asm/asm/9.7/asm-9.7.pom
https://repo.maven.apache.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
https://repo.maven.apache.org/maven2/org/ow2/ow2/1.5.1/ow2-1.5.1.pom
https://repo.maven.apache.org/maven2/org/ow2/ow2/1.5/ow2-1.5.pom
+3 -3
View File
@@ -20,8 +20,8 @@
"@react-native-community/netinfo": "^4.4.0",
"@react-native-community/push-notification-ios": "^1.4.1",
"@react-native-community/slider": "^3.0.0",
"@walletconnect/react-native-compat": "2.11.2",
"@walletconnect/web3wallet": "1.10.2",
"@walletconnect/react-native-compat": "2.17.3",
"@reown/walletkit": "^1.0.0",
"base-64": "^1.0.0",
"big-integer": "1.6.51",
"bignumber.js": "git+https://github.com/status-im/bignumber.js.git#refs/tags/v4.0.2-status",
@@ -66,7 +66,7 @@
"react-native-shake": "^3.3.1",
"react-native-share": "10.0.2",
"react-native-static-safe-area-insets": "^2.2.0",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.5.39",
"react-native-status-keycard": "git+https://github.com/status-im/react-native-status-keycard.git#refs/tags/v2.6.4",
"react-native-svg": "13.10.0",
"react-native-webview": "13.6.3",
"react-syntax-highlighter": "^15.5.0"
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+4 -4
View File
@@ -1,8 +1,8 @@
import { useDerivedValue, withTiming, Easing } from 'react-native-reanimated';
const slideAnimationDuration = 300;
const totalPages = 4;
const pageSize = 100 / totalPages;
const totalPages = 3;
const pageSize = 25;
const easeOut = {
duration: slideAnimationDuration,
@@ -13,7 +13,7 @@ const easeOut = {
export function dynamicProgressBarWidth(staticProgressBarWidth, progress) {
return useDerivedValue(function () {
'worklet';
return (staticProgressBarWidth * (progress.value || 0)) / 100;
return (staticProgressBarWidth * (progress.value || 0)) / 75;
});
}
@@ -26,6 +26,6 @@ export function carouselLeftPosition(windowWidth, progress, isDragging, dragAmou
const baseOffset = (Math.floor(progressValue / pageSize) % totalPages) * windowWidth;
const adjustedOffset = baseOffset === 0 && dragAmountValue > 0 ? baseOffset : -baseOffset + dragAmountValue;
return isDragging.value ? withTiming(adjustedOffset, easeOut) : withTiming(-baseOffset, easeOut);
return isDragging.value ? adjustedOffset : withTiming(-baseOffset, easeOut);
});
}
+19 -11
View File
@@ -2,7 +2,9 @@
(:require
["react-native" :as rn]
["react-native-status-keycard" :default status-keycard]
[oops.core :as oops]
[react-native.platform :as platform]
[schema.core :as schema]
[taoensso.timbre :as log]))
(defonce event-emitter
@@ -69,6 +71,10 @@
[callback]
(.addListener ^js event-emitter "keyCardOnDisconnected" callback))
(defn on-card-new-pairing
[callback]
(.addListener ^js event-emitter "keyCardNewPairing" callback))
(defn on-nfc-user-cancelled
[callback]
(.addListener ^js event-emitter "keyCardOnNFCUserCancelled" callback))
@@ -254,17 +260,19 @@
(catch on-failure))))
(defn sign
[{pin :pin path :path card-hash :hash on-success :on-success on-failure :on-failure}]
(when (and pin card-hash)
(if path
(.. status-keycard
(signWithPath pin path card-hash)
(then on-success)
(catch on-failure))
(.. status-keycard
(sign pin card-hash)
(then on-success)
(catch on-failure)))))
[{:keys [pin path hash-data]}]
(if path
(oops/ocall status-keycard "signWithPath" pin path hash-data)
(oops/ocall status-keycard "sign" pin hash-data)))
(schema/=> sign
[:=>
[:cat
[:map
[:pin :string]
[:hash-data :string]
[:path {:optional true} [:maybe :string]]]]
:any])
(defn sign-typed-data
[{card-hash :hash on-success :on-success on-failure :on-failure}]
+7 -55
View File
@@ -19,8 +19,6 @@
[status-im.constants :as constants]
[status-im.contexts.chat.events :as chat.events]
[status-im.navigation.events :as navigation]
[taoensso.timbre :as log]
[utils.address :as address]
[utils.debounce :as debounce]
[utils.ens.core :as utils.ens]
[utils.ethereum.chain :as chain]
@@ -139,13 +137,11 @@
{:events [:browser/delete-bookmark]}
[{:keys [db] :as cofx}
url]
(let [old-bookmark (get-in db [:bookmarks/bookmarks url])
removed-bookmark (merge old-bookmark {:removed true})]
(rf/merge cofx
{:db (update db :bookmarks/bookmarks dissoc url)
:json-rpc/call [{:method "wakuext_removeBookmark"
:params [url]
:on-success #()}]})))
(rf/merge cofx
{:db (update db :bookmarks/bookmarks dissoc url)
:json-rpc/call [{:method "wakuext_removeBookmark"
:params [url]
:on-success #()}]}))
(defn can-go-back?
[{:keys [history-index]}]
@@ -357,43 +353,11 @@
:id (int id)
:result result}}})
(defn utf8-to-hex
[s]
(let [hex (native-module/utf8-to-hex (str s))]
(if (empty? hex)
nil
hex)))
(defn normalize-message
"NOTE (andrey) there is no spec for this, so this implementation just to be compatible with MM"
[message]
(if (string/starts-with? message "0x")
message
(utf8-to-hex message)))
(defn normalize-sign-message-params
"NOTE (andrey) we need this function, because params may be mixed up"
[params typed?]
(let [[first-param second-param] params]
(when (and (string? first-param) (string? second-param))
(cond
(address/address? first-param)
[first-param (if typed? second-param (normalize-message second-param))]
(address/address? second-param)
[second-param (if typed? first-param (normalize-message first-param))]))))
(rf/defn send-to-bridge
{:events [:browser.callback/call-rpc]}
[_ message]
{:browser/send-to-bridge message})
(defn web3-sign-message?
[method]
(#{constants/web3-sign-typed-data constants/web3-sign-typed-data-v3 constants/web3-sign-typed-data-v4
constants/web3-personal-sign
constants/web3-eth-sign constants/web3-keycard-sign-typed-data}
method))
(rf/defn handle-no-permissions
[cofx {:keys [method id]} message-id]
(if (= method "eth_accounts")
@@ -484,18 +448,6 @@
(when (and message webview)
(.injectJavaScript webview msg)))))
(re-frame/reg-fx
:browser/call-rpc
(fn [[payload callback]]
(native-module/call-rpc
(types/clj->json payload)
(fn [response]
(if (= "" response)
(do
(log/warn :web3-response-error)
(callback "web3-response-error" nil))
(callback nil (.parse js/JSON response)))))))
(re-frame/reg-fx
:browser/show-browser-selection
(fn [link]
@@ -548,8 +500,8 @@
(rf/defn lock-pressed
{:events [:browser.ui/lock-pressed]}
[cofx secure?]
(update-browser-option cofx :show-tooltip (if secure? :secure :not-secure)))
[cofx is-secure?]
(update-browser-option cofx :show-tooltip (if is-secure? :secure :not-secure)))
(rf/defn close-tooltip-pressed
{:events [:browser.ui/close-tooltip-pressed]}
-120
View File
@@ -1,120 +0,0 @@
(ns legacy.status-im.browser.core-test
(:require
[utils.url :as url]))
(defn has-wrong-properties?
[result dapp-url expected-browser]
(let [browser (get-in result [:db :browser/browsers dapp-url])]
(reduce (fn [acc k]
(if (= (k browser)
(k expected-browser))
acc
(conj acc [k (str "was expecting " (k expected-browser) " got " (k browser))])))
nil
(keys expected-browser))))
(defn get-dapp-id
[result dapp-url]
(some #(when (= (url/normalize-and-decode-url dapp-url) (first (:history %))) (:browser-id %))
(vals (get-in result [:db :browser/browsers]))))
#_(deftest browser-test
(let [dapp1-url "cryptokitties.co"
dapp2-url "http://test2.com"]
(testing "user opens a dapp"
(let [result-open (browser/open-url {:db {} :now 1} dapp1-url)
dapp1-id (get-dapp-id result-open dapp1-url)]
(is (= dapp1-id (get-in result-open [:db :browser/options :browser-id]))
"browser-id should be dapp1-url")
(is (not (has-wrong-properties? result-open
dapp1-id
{:browser-id dapp1-id
:history-index 0
:history ["https://cryptokitties.co"]
:dapp? false
:name (i18n/label :t/browser)}))
"some properties of the browser are not correct")
(testing "then a second dapp"
(let [result-open-2 (browser/open-url {:db (:db result-open)
:now 2}
dapp2-url)
dapp2-id (get-dapp-id result-open-2 dapp2-url)]
(is (= dapp2-id (get-in result-open-2 [:db :browser/options :browser-id]))
"browser-id should be dapp2 host")
(is (not (has-wrong-properties? result-open-2
dapp2-id
{:browser-id dapp2-id
:history-index 0
:history ["http://test2.com"]
:dapp? false}))
"some properties of the browser are not correct")
(testing "then removes the second dapp"
(let [result-remove-2 (browser/remove-browser {:db (:db result-open-2)} dapp2-id)]
(is (= #{dapp1-id}
(set (keys (get-in result-remove-2 [:db :browser/browsers]))))
"the second dapp shouldn't be in the browser list anymore")))))
(testing "then opens the dapp again"
(let [result-open-existing (browser/open-existing-browser {:db (:db result-open)
:now 2}
dapp1-id)
dapp1-url2 (str "https://" dapp1-url "/nav2")]
(is (not (has-wrong-properties? result-open-existing
dapp1-id
{:browser-id dapp1-id
:history-index 0
:history ["https://cryptokitties.co"]
:dapp? false
:name (i18n/label :t/browser)}))
"some properties of the browser are not correct")
(is (nil? (browser/navigate-to-next-page result-open-existing))
"nothing should happen if user tries to navigate to next page")
(is (nil? (browser/navigate-to-previous-page result-open-existing))
"nothing should happen if user tries to navigate to previous page")
(testing "then navigates to a new url in the dapp"
(let [result-navigate (browser/navigation-state-changed
{:db (:db result-open-existing)
:now 4}
(clj->js {"url" dapp1-url2
"loading" false})
false)]
(is (not (has-wrong-properties? result-navigate
dapp1-id
{:browser-id dapp1-id
:history-index 1
:history ["https://cryptokitties.co" dapp1-url2]
:dapp? false
:name (i18n/label :t/browser)}))
"some properties of the browser are not correct")
(testing "then navigates to previous page"
(let [result-previous (browser/navigate-to-previous-page {:db (:db result-navigate)
:now 5})]
(is
(not (has-wrong-properties? result-previous
dapp1-id
{:browser-id dapp1-id
:history-index 0
:history ["https://cryptokitties.co"
dapp1-url2]
:dapp? false
:name (i18n/label :t/browser)}))
"some properties of the browser are not correct")
(testing "then navigates to next page")
(let [result-next (browser/navigate-to-next-page {:db (:db result-previous)
:now 6})]
(is (not
(has-wrong-properties? result-next
dapp1-id
{:browser-id dapp1-id
:history-index 1
:history ["https://cryptokitties.co"
dapp1-url2]
:dapp? false
:name (i18n/label :t/browser)}))
"some properties of the browser are not correct"))))))))))))
@@ -22,7 +22,7 @@
:icon :main-icons/wallet}})
(rf/defn permission-yield-control
[{:keys [db] :as cofx} dapp-name permission message-id params]
[cofx dapp-name permission message-id]
(cond
(= permission constants/dapp-permission-qr-code)
(rf/merge (assoc-in cofx [:db :browser/options :yielding-control?] true)
@@ -33,7 +33,7 @@
:message-id message-id}}))))
(rf/defn permission-show-permission
[{:keys [db] :as cofx} dapp-name permission message-id yield-control?]
[{:keys [db]} dapp-name permission message-id yield-control?]
{:db (assoc-in db
[:browser/options :show-permission]
{:requested-permission permission
@@ -51,7 +51,7 @@
(rf/defn send-response-to-bridge
"Send response to the bridge. If the permission is allowed, send data associated
with the permission"
[{:keys [db] :as cofx} permission message-id allowed? data]
[_cofx permission message-id allowed? data]
{:browser/send-to-bridge (cond-> {:type constants/api-response
:isAllowed allowed?
:permission permission
@@ -108,13 +108,13 @@
(let [pending-permissions (get-in db [:browser/options :pending-permissions])
next-permission (last pending-permissions)
new-cofx (update-in cofx [:db :browser/options :pending-permissions] butlast)]
(when-let [{:keys [yield-control? permission message-id allowed? params]} next-permission]
(when-let [{:keys [yield-control? permission message-id allowed?]} next-permission]
(if (and yield-control? allowed?)
(permission-yield-control new-cofx dapp-name permission message-id params)
(permission-yield-control new-cofx dapp-name permission message-id)
(permission-show-permission new-cofx dapp-name permission message-id yield-control?)))))))
(rf/defn send-response-and-process-next-permission
[{:keys [db] :as cofx} dapp-name requested-permission message-id]
[cofx dapp-name requested-permission message-id]
(rf/merge cofx
(send-response-to-bridge requested-permission
message-id
@@ -126,12 +126,12 @@
"Add permission to set of allowed permission and process next permission"
{:events [:browser.permissions.ui/dapp-permission-allowed]}
[{:keys [db] :as cofx}]
(let [{:keys [requested-permission message-id dapp-name yield-control? params]}
(let [{:keys [requested-permission message-id dapp-name yield-control?]}
(get-in db [:browser/options :show-permission])]
(rf/merge (assoc-in cofx [:db :browser/options :show-permission] nil)
(update-dapp-permissions dapp-name requested-permission true)
(if yield-control?
(permission-yield-control dapp-name requested-permission message-id params)
(permission-yield-control dapp-name requested-permission message-id)
(send-response-and-process-next-permission dapp-name requested-permission message-id)))))
(rf/defn deny-permission
@@ -1,90 +0,0 @@
(ns legacy.status-im.browser.permissions-test)
#_(deftest permissions-test
(let [dapp-name "test.com"
dapp-name2 "test2.org"
cofx {:db (assoc-in (:db (browser/open-url {:db {}} dapp-name))
[:profile/profile :public-key]
"public-key")}
dapp-id (core.tests/get-dapp-id cofx dapp-name)]
(testing "dapps permissions are initialized"
(is (zero? (count (get-in cofx [:db :dapps/permissions]))))
(is (= dapp-id (get-in cofx [:db :browser/options :browser-id]))))
(testing "receiving an unsupported permission"
(let [result-ask (browser/process-bridge-message cofx
(types/clj->json
{:type "api-request"
:host dapp-name
:messageId 0
:permission "FAKE_PERMISSION"}))]
(is (not (get-in result-ask [:browser/send-to-bridge :isAllowed])))))
(testing "receiving a supported permission"
(let [result-ask (browser/process-bridge-message cofx
(types/clj->json {:type "api-request"
:host dapp-name
:messageId 1
:permission "contact-code"}))]
(is (= (get-in result-ask [:db :browser/options :show-permission])
{:requested-permission "contact-code"
:dapp-name "test.com"
:message-id 1
:yield-control? nil}))
(is (zero? (count (get-in result-ask [:db :dapps/permissions]))))
(testing "then user accepts the supported permission"
(let [accept-result (permissions/allow-permission {:db (:db result-ask)})]
(is (= (get accept-result :browser/send-to-bridge)
{:type "api-response"
:messageId 1
:isAllowed true
:data "public-key"
:permission "contact-code"})
"the data should have been sent to the bridge")
(is (= (get-in accept-result [:db :dapps/permissions])
{"test.com" {:dapp "test.com" :permissions ["contact-code"]}})
"the dapp should now have CONTACT_CODE permission")
(testing "then dapp asks for permission again"
(let [result-ask-again (browser/process-bridge-message {:db (:db accept-result)}
(types/clj->json
{:type "api-request"
:host dapp-name
:messageId 2
:permission "contact-code"}))]
(is (= (get result-ask-again :browser/send-to-bridge)
{:type "api-response"
:isAllowed true
:messageId 2
:data "public-key"
:permission "contact-code"})
"the response should be immediatly sent to the bridge")))
(testing "then user switch to another dapp that asks for permissions"
(let [new-dapp (browser/open-url {:db (:db accept-result)} dapp-name2)
result-ask2 (browser/process-bridge-message {:db (:db new-dapp)}
(types/clj->json
{:type "api-request"
:host dapp-name2
:messageId 3
:permission "contact-code"}))]
(is (= (get-in result-ask2 [:db :dapps/permissions])
{"test.com" {:dapp "test.com" :permissions ["contact-code"]}})
"there should only be permissions for dapp-name at that point")
(is (nil? (get result-ask2 :browser/send-to-bridge))
"no message should be sent to the bridge")
(testing "then user accepts permission for dapp-name2"
(let [accept-result2 (permissions/allow-permission {:db (:db result-ask2)})]
(is (= (get-in accept-result2 [:db :dapps/permissions])
{"test.com" {:dapp "test.com" :permissions ["contact-code"]}
"test2.org" {:dapp "test2.org" :permissions ["contact-code"]}})
"there should be permissions for both dapps now")
(is (= (get accept-result2 :browser/send-to-bridge)
{:type "api-response"
:isAllowed true
:messageId 3
:data "public-key"
:permission "contact-code"})
"the response should be sent to the bridge")))))))))))
+17 -19
View File
@@ -18,25 +18,23 @@
clock-value
"0x0000000000000000000000000000000000000000000000000000000000000000"))
(rf/defn update-chats-in-app-db
{:events [:chats-list/load-success]}
[{:keys [db]} ^js new-chats-js]
(let [{:keys [all-chats chats-home-list]}
(reduce (fn [acc ^js chat-js]
(let [{:keys [chat-id profile-public-key timeline? community-id active] :as chat}
(data-store.chats/<-rpc-js chat-js)]
(cond-> acc
(and (not profile-public-key) (not timeline?) (not community-id) active)
(update :chats-home-list conj chat-id)
:always
(assoc-in [:all-chats chat-id] chat))))
{:all-chats {}
:chats-home-list #{}}
new-chats-js)]
{:db (assoc db
:chats all-chats
:chats-home-list chats-home-list
:chats/loading? false)}))
(rf/reg-event-fx :chats-list/load-success
(fn [{:keys [db]} [^js new-chats-js]]
(let [{:keys [all-chats chats-home-list]}
(reduce (fn [acc ^js chat-js]
(let [{:keys [chat-id profile-public-key timeline? community-id active] :as chat}
(data-store.chats/<-rpc-js chat-js)]
(cond-> acc
(and (not profile-public-key) (not timeline?) (not community-id) active)
(update :chats-home-list conj chat-id)
:always
(assoc-in [:all-chats chat-id] chat))))
{:all-chats {}
:chats-home-list #{}}
new-chats-js)]
{:db (-> db
(update :chats merge all-chats)
(update :chats-home-list into chats-home-list))})))
(rf/defn load-chat-success
{:events [:chats-list/load-chat-success]}
@@ -156,7 +156,7 @@
(rf/defn select-mention
{:events [:chat.ui/select-mention]}
[{:keys [db]} {:keys [primary-name searched-text match public-key] :as user}]
[{:keys [db]} {:keys [primary-name searched-text match public-key] :as _user}]
(let [chat-id (:current-chat-id db)
text (get-in db [:chat/inputs chat-id :input-text])
method "wakuext_chatMentionSelectMention"
@@ -120,7 +120,7 @@
{:db (assoc-in db [:messages chat-id message-id :outgoing-status] status)}))
(rf/defn handle-removed-messages
[{:keys [db] :as cofx} removed-messages]
[cofx removed-messages]
(let [mark-as-deleted-fx (->> removed-messages
(map #(assoc %
:message-id (:messageId %)
@@ -136,7 +136,7 @@
[message-id]
nil)))
removed-messages)
remove-messages-fx (fn [{:keys [db]}]
remove-messages-fx (fn [_cofx]
{:dispatch [:activity-center.notifications/fetch-unread-count]})]
(apply rf/merge
cofx
+3 -3
View File
@@ -43,7 +43,7 @@
(rf/defn member-ban
{:events [::member-ban]}
[cofx community-id public-key]
[_cofx community-id public-key]
{:json-rpc/call [{:method "wakuext_banUserFromCommunity"
:params [{:communityId community-id
:user public-key}]
@@ -63,7 +63,7 @@
(rf/defn member-kick
{:events [::member-kick]}
[cofx community-id public-key]
[_cofx community-id public-key]
{:json-rpc/call [{:method "wakuext_removeUserFromCommunity"
:params [community-id public-key]
:js-response true
@@ -97,7 +97,7 @@
(rf/defn add-role-to-member
{:events [:community.member/add-role]}
[cofx community-id public-key role-id]
[_cofx community-id public-key role-id]
{:json-rpc/call [{:method "wakuext_addRoleToMember"
:params [{:communityId community-id
:user public-key
+2 -2
View File
@@ -134,9 +134,9 @@
unmarshal-members))
(re-frame/reg-fx :fetch-chats-preview
(fn [{:keys [on-success]}]
(fn [{:keys [on-success chat-preview-type]}]
(json-rpc/call {:method "wakuext_chatsPreview"
:params []
:params [chat-preview-type]
:js-response true
:on-success #(on-success ^js %)
:on-error #(log/error "failed to fetch chats" 0 -1 %)})))
@@ -4,12 +4,6 @@
[status-im.constants :as constants]
[utils.transforms :as transforms]))
(defn <-revealed-accounts-rpc
[accounts]
(mapv
#(set/rename-keys % {:isAirdropAddress :airdrop-address?})
(js->clj accounts :keywordize-keys true)))
(defn <-request-to-join-community-rpc
[r]
(set/rename-keys r
@@ -16,7 +16,7 @@
:community-id :communityId
:clock-value :clock})))
(defn- <-status-link-previews-rpc
(defn <-status-link-previews-rpc
[preview]
(-> preview
(update :community
@@ -40,7 +40,7 @@
(update-in [:community :banner] set/rename-keys {:data-uri :dataUri})
(update-in [:community :icon] set/rename-keys {:data-uri :dataUri})))
(defn- <-link-preview-rpc
(defn <-link-preview-rpc
[preview]
(-> preview
(update :thumbnail set/rename-keys {:dataUri :data-uri})
@@ -160,17 +160,17 @@
:on-error #(log/error "failed to delete messages by chat-id" % chat-id)}]})
(rf/defn delete-message
[cofx id]
[_cofx id]
(delete-message-rpc id))
(rf/defn delete-messages-from
[cofx author]
[_cofx author]
(delete-messages-from-rpc author))
(rf/defn mark-messages-seen
[cofx chat-id ids on-success]
[_cofx chat-id ids on-success]
(mark-seen-rpc chat-id ids on-success))
(rf/defn delete-messages-by-chat-id
[cofx chat-id]
[_cofx chat-id]
(delete-messages-by-chat-id-rpc chat-id))
@@ -29,7 +29,7 @@
:on-error on-error}]})
(rf/defn send-pin-message
[cofx pin-message]
[_cofx pin-message]
{:json-rpc/call [{:method "wakuext_sendPinMessage"
:params [(messages/->rpc pin-message)]
:js-response true
+4 -11
View File
@@ -62,7 +62,7 @@
(rf/defn update-ens-tx-state-and-redirect
{:events [:update-ens-tx-state-and-redirect]}
[{:keys [db] :as cofx} new-state username custom-domain? tx-hash]
[cofx new-state username custom-domain? tx-hash]
(rf/merge cofx
(update-ens-tx-state new-state username custom-domain? tx-hash)
(redirect-to-ens-summary)))
@@ -178,13 +178,6 @@
:else
(re-frame/dispatch [::name-resolved username :taken]))))
(defn registration-cost
[chain-id]
(case chain-id
3 50
5 10
1 10))
(rf/defn register-name
{:events [::register-name-pressed]}
[{:keys [db]} address]
@@ -239,14 +232,14 @@
(let [{:keys [custom-domain?]} (:ens/registration db)
chain-id (chain/chain-id db)
usernames (into #{} (keys (get-in db [:ens/names chain-id])))
state (state custom-domain? username usernames)]
next-state (state custom-domain? username usernames)]
(reset! resolve-last-id (random/id))
(merge
{:db (update db
:ens/registration assoc
:username username
:state state)}
(when (= state :searching)
:state next-state)}
(when (= next-state :searching)
(let [{:profile/keys [profile]} db
{:keys [public-key]} profile
addresses (addresses-without-watch db)
+1 -23
View File
@@ -1,28 +1,6 @@
(ns legacy.status-im.ethereum.macros
(:require
[clojure.java.io :as io]
[clojure.string :as string]))
(defn token-icon-path
[path]
(fn [el]
(let [el (string/replace el ".png" "")
s (str path el ".png")
s-js (str "." s)]
(when (.exists (io/file s))
[el `(js/require ~s-js)]))))
(defmacro resolve-icons
"In react-native arguments to require must be static strings.
Resolve all icons at compilation time so no variable is used."
[network]
(let [path (str "./resources/images/tokens/" (name network) "/")
files (->> (io/file path)
file-seq
(filter #(string/ends-with? % "png"))
(map #(first (string/split (.getName %) #"@")))
distinct)]
(into {} (map (token-icon-path path) files))))
[clojure.java.io :as io]))
(defn network->icon
[network]
+1 -50
View File
@@ -1,8 +1,7 @@
(ns legacy.status-im.ethereum.tokens
(:require
[clojure.string :as string]
[utils.ethereum.chain :as chain])
(:require-macros [legacy.status-im.ethereum.macros :as ethereum.macros :refer [resolve-icons]]))
(:require-macros [legacy.status-im.ethereum.macros :as ethereum.macros]))
(def default-native-currency
(memoize
@@ -13,8 +12,6 @@
:decimals 18
:icon {:source (js/require "../resources/images/tokens/default-token.png")}})))
(def snt-icon-source (js/require "../resources/images/tokens/mainnet/SNT.png"))
(def all-native-currencies
(ethereum.macros/resolve-native-currency-icons
{:mainnet {:name "Ether"
@@ -38,54 +35,8 @@
:symbol-display :BNBtest
:decimals 18}}))
(def native-currency-symbols
(set (map #(-> % val :symbol) all-native-currencies)))
(defn native-currency
[{sym :symbol :as current-network}]
(let [chain (chain/network->chain-keyword current-network)]
(get all-native-currencies chain (default-native-currency sym))))
(defn ethereum?
[sym]
(native-currency-symbols sym))
(def token-icons
{:mainnet (resolve-icons :mainnet)
:xdai (resolve-icons :xdai)
:custom []})
(def default-token (js/require "../resources/images/tokens/default-token.png"))
(defn update-icon
[network token]
(-> token
(assoc-in [:icon :source] (get-in token-icons [network (name (:symbol token))] default-token))
(update :address string/lower-case)))
(defn nfts-for
[all-tokens]
(filter :nft? (vals all-tokens)))
(defn sorted-tokens-for
[all-tokens]
(->> (vals all-tokens)
(filter #(not (:hidden? %)))
(sort #(compare (string/lower-case (:name %1))
(string/lower-case (:name %2))))))
(defn symbol->token
[all-tokens sym]
(some #(when (= sym (:symbol %)) %) (vals all-tokens)))
(defn address->token
[all-tokens address]
(get all-tokens (string/lower-case address)))
(defn asset-for
[all-tokens current-network sym]
(let [native-coin (native-currency current-network)]
(if (or (= (:symbol-display native-coin) sym)
(= (:symbol native-coin) sym))
native-coin
(symbol->token all-tokens sym))))
@@ -7,37 +7,9 @@
[re-frame.core :as re-frame]
[status-im.common.json-rpc.events :as json-rpc]
[taoensso.timbre :as log]
[utils.ethereum.chain :as chain]
[utils.ethereum.eip.eip55 :as eip55]
[utils.re-frame :as rf]))
(def confirmations-count-threshold 12)
(def etherscan-supported?
#{(chain/chain-keyword->chain-id :mainnet)
(chain/chain-keyword->chain-id :sepolia)})
(def binance-mainnet-chain-id (chain/chain-keyword->chain-id :bsc))
(def binance-testnet-chain-id (chain/chain-keyword->chain-id :bsc-testnet))
(def network->subdomain {11155111 "sepolia"})
(defn get-transaction-details-url
[chain-id tx-hash]
{:pre [(number? chain-id) (string? tx-hash)]
:post [(or (nil? %) (string? %))]}
(cond
(etherscan-supported? chain-id)
(let [network-subdomain (when-let [subdomain (network->subdomain chain-id)]
(str subdomain "."))]
(str "https://" network-subdomain "etherscan.io/tx/" tx-hash))
(= chain-id binance-mainnet-chain-id)
(str "https://bscscan.com/tx/" tx-hash)
(= chain-id binance-testnet-chain-id)
(str "https://testnet.bscscan.com/tx/" tx-hash)))
(def default-erc20-token
{:symbol :ERC20
:decimals 18
@@ -121,16 +93,16 @@
(rf/defn check-transaction
"Check if the transaction has been triggered and applies the effects returned
by `on-trigger` if that is the case"
[{:keys [db] :as cofx} {:keys [hash] :as transaction}]
[{:keys [db] :as cofx} {tx-hash :hash :as transaction}]
(when-let [watch-params
(get-in db [:ethereum/watched-transactions hash])]
(get-in db [:ethereum/watched-transactions tx-hash])]
(let [{:keys [trigger-fn on-trigger]} watch-params]
(when (trigger-fn db transaction)
(rf/merge cofx
{:db (update db
:ethereum/watched-transactions
dissoc
hash)}
tx-hash)}
(on-trigger transaction))))))
(rf/defn check-watched-transactions
@@ -152,14 +124,14 @@
"We determine a unique id for the transfer before adding it because some
transaction can contain multiple transfers and they would overwrite each other
in the transfer map if identified by hash"
[{:keys [db] :as cofx} {:keys [hash id address] :as transfer}]
(let [transfer-by-hash (get-in db [:wallet-legacy :accounts address :transactions hash])]
[{:keys [db] :as cofx} {tx-hash :hash :keys [id address] :as transfer}]
(let [transfer-by-hash (get-in db [:wallet-legacy :accounts address :transactions tx-hash])]
(when-let [unique-id (when-not (= transfer transfer-by-hash)
(if (and transfer-by-hash
(not (= :pending
(:type transfer-by-hash))))
id
hash))]
tx-hash))]
(rf/merge cofx
{:db (assoc-in db
[:wallet-legacy :accounts address :transactions unique-id]
@@ -170,11 +142,7 @@
[db address]
(get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :min-block]))
(defn get-max-block-with-transfers
[db address]
(get-in db [:wallet-legacy :accounts (eip55/address->checksum address) :max-block]))
(defn min-block-transfers-count
(defn count-min-block-transfers
[db address]
(get-in db
[:wallet-legacy :accounts
@@ -187,14 +155,14 @@
{:keys [min-block min-block-transfers-count]}
(reduce
(fn [{:keys [min-block] :as acc}
{:keys [block hash]}]
{tx-hash :hash block :block}]
(cond
(or (nil? min-block) (> min-block (js/parseInt block)))
{:min-block (js/parseInt block)
:min-block-transfers-count 1}
(and (= min-block block)
(nil? (get-in db [:wallet-legacy :accounts checksum :transactions hash])))
(nil? (get-in db [:wallet-legacy :accounts checksum :transactions tx-hash])))
(update acc :min-block-transfers-count inc)
:else acc))
@@ -203,7 +171,7 @@
(js/parseInt min-block-string))
:min-block-transfers-count
(min-block-transfers-count db address)}
(count-min-block-transfers db address)}
transfers)]
(log/debug "[transactions] set-lowest-fetched-block"
"address" address
@@ -238,7 +206,7 @@
{:db (update-fetching-status db addresses :history? false)})
(rf/defn tx-history-end-reached
[{:keys [db] :as cofx} address]
[{:keys [db]} address]
(let [syncing-allowed? (utils.mobile-sync/syncing-allowed? db)]
{:db (assoc-in db
[:wallet-legacy :fetching address :all-fetched?]
@@ -247,23 +215,22 @@
:all-preloaded))}))
(rf/defn handle-new-transfer
[{:keys [db] :as cofx} transfers {:keys [address limit]}]
[cofx transfers {:keys [address limit]}]
(log/debug "[transfers] new-transfers"
"address" address
"count" (count transfers)
"limit" limit)
(let [checksum (eip55/address->checksum address)
max-known-block (get-max-block-with-transfers db address)
effects (cond-> [(when (seq transfers)
(set-lowest-fetched-block checksum transfers))]
(let [checksum (eip55/address->checksum address)
effects (cond-> [(when (seq transfers)
(set-lowest-fetched-block checksum transfers))]
(seq transfers)
(concat
[]
(mapv add-transfer transfers))
(seq transfers)
(concat
[]
(mapv add-transfer transfers))
(< (count transfers) limit)
(conj (tx-history-end-reached checksum)))]
(< (count transfers) limit)
(conj (tx-history-end-reached checksum)))]
(apply rf/merge cofx (tx-fetching-ended [checksum]) effects)))
(rf/defn new-transfers
@@ -311,16 +278,12 @@
:limit limit)])
:on-error #(re-frame/dispatch [::tx-fetching-failed address])})))))
(defn some-transactions-loaded?
[db address]
(not-empty (get-in db [:wallet-legacy :accounts address :transactions])))
(rf/defn fetch-more-tx
{:events [:transactions/fetch-more]}
[{:keys [db] :as cofx} address]
(let [min-known-block (or (get-min-known-block db address)
(:ethereum/current-block db))
min-block-transfers-count (or (min-block-transfers-count db address) 0)]
(let [min-known-block (or (get-min-known-block db address)
(:ethereum/current-block db))
min-count (or (count-min-block-transfers db address) 0)]
(rf/merge
cofx
{:transactions/get-transfers
@@ -333,7 +296,7 @@
;; the whole `default-transfers-limit` of transfers the number of transfers already received
;; for `min-known-block` is added to the page size.
:limit-per-address {address (+ default-transfers-limit
min-block-transfers-count)}}}
min-count)}}}
(tx-fetching-in-progress [address]))))
(rf/defn get-fetched-transfers
+1 -19
View File
@@ -59,21 +59,11 @@
(fn [options]
(permissions/request-notifications options)))
(re-frame/reg-fx
:ui/show-error
(fn [content]
(utils/show-popup "Error" content)))
(re-frame/reg-fx
:ui/show-confirmation
(fn [options]
(utils/show-confirmation options)))
(re-frame/reg-fx
:ui/close-application
(fn [_]
(native-module/close-application)))
(re-frame/reg-fx
::app-state-change-fx
(fn [state]
@@ -83,11 +73,6 @@
(theme/change-device-theme (rn/get-color-scheme)))
(native-module/app-state-change state)))
(re-frame/reg-fx
:ui/listen-to-window-dimensions-change
(fn []
(dimensions/add-event-listener)))
(rf/defn dismiss-keyboard
{:events [:dismiss-keyboard]}
[_]
@@ -233,7 +218,4 @@
:on-success (fn [on-ramps]
(re-frame/dispatch [::crypto-loaded on-ramps]))}]})
(re-frame/reg-event-fx :buy-crypto.ui/open-screen
(fn []
{:fx [[:dispatch [:wallet-legacy/keep-watching]]
[:dispatch [:open-modal :buy-crypto nil]]]}))
+1 -1
View File
@@ -84,7 +84,7 @@
(rf/defn save
{:events [:fleet.ui/save-fleet-confirmed]}
[{:keys [db now] :as cofx} fleet]
[{:keys [db] :as cofx} fleet]
(let [old-fleet (get-in db [:profile/profile :fleet])]
(when (not= fleet old-fleet)
(multiaccounts.update/multiaccount-update
+6 -15
View File
@@ -40,7 +40,7 @@
(rf/defn remove-member
"Format group update message and sign membership"
{:events [:group-chats.ui/remove-member-pressed]}
[_ chat-id member do-not-navigate?]
[_ chat-id member _do-not-navigate?]
{:json-rpc/call [{:method "wakuext_removeMemberFromGroupChat"
:params [nil chat-id member]
:js-response true
@@ -48,7 +48,7 @@
(rf/defn remove-members
{:events [:group-chats.ui/remove-members-pressed]}
[{{:group-chat/keys [deselected-members]} :db :as cofx} chat-id]
[{{:group-chat/keys [deselected-members]} :db :as _cofx} chat-id]
{:json-rpc/call [{:method "wakuext_removeMembersFromGroupChat"
:params [nil chat-id deselected-members]
:js-response true
@@ -104,7 +104,7 @@
(rf/defn leave
"Leave chat"
{:events [:group-chats.ui/leave-chat-confirmed]}
[{:keys [db] :as cofx} chat-id]
[_cofx chat-id]
{:json-rpc/call [{:method "wakuext_leaveGroupChat"
:params [nil chat-id true]
:js-response true
@@ -128,7 +128,7 @@
(rf/defn name-changed
"Save chat from edited profile"
{:events [:group-chats.ui/name-changed]}
[{:keys [db] :as cofx} chat-id new-name]
[{:keys [db] :as _cofx} chat-id new-name]
(when (valid-name? new-name)
{:db (assoc-in db [:chats chat-id :name] new-name)
:json-rpc/call [{:method "wakuext_changeGroupChatName"
@@ -149,7 +149,7 @@
(rf/defn send-group-chat-membership-request
"Send group chat membership request"
{:events [:send-group-chat-membership-request]}
[{{:keys [chats] :as db} :db :as cofx} chat-id]
[{{:keys [chats] :as db} :db :as _cofx} chat-id]
(let [{:keys [invitation-admin]} (get chats chat-id)
message (get-in db [:chat/memberships chat-id :message])]
{:db (assoc-in db [:chat/memberships chat-id] nil)
@@ -161,7 +161,7 @@
(rf/defn send-group-chat-membership-rejection
"Send group chat membership rejection"
{:events [:send-group-chat-membership-rejection]}
[cofx invitation-id]
[_cofx invitation-id]
{:json-rpc/call [{:method "wakuext_sendGroupChatInvitationRejection"
:params [nil invitation-id]
:js-response true
@@ -176,15 +176,6 @@
%
invitations))})
(defn member-removed?
[{:keys [membership-update-events]} pk]
(->> membership-update-events
(filter #(contains? (set (:members %)) pk))
(sort-by :clockValue >)
first
:type
(= constants/invitation-state-removed)))
(rf/defn deselect-member
{:events [:deselect-member]}
[{:keys [db]} id]

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