Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'Test Networks Enabled' option in settings #17879

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

ajayesivan
Copy link
Contributor

@ajayesivan ajayesivan commented Nov 10, 2023

fixes: #17826

Add Test Networks Enabled toggle in Advanced Settings

Test Notes

  1. Go to Advanced settings
  2. Toggle Test Networks Enabled option
  3. The user will be logged out from the account automatically
  4. Log back in & see if the Test Networks Enabled option persists in the previous state.

Note: This option is required to test curated communities in status.test fleet. This PR doesn't fix the issue logged here: #17852, additional changes are required to fully fix that.

@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch from 05abe42 to 6bf782f Compare November 10, 2023 21:40
@@ -242,6 +242,7 @@

(defn- internal-discover-view
[params]
(rf/dispatch [:fetch-contract-communities])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This dispatch is not related to the Test Networks Enabled option.

Just added back the curated communities fetch event dispatch that got removed in a previous PR.

@ajayesivan ajayesivan changed the title Add **Test Networks Enabled** option in settings Add 'Test Networks Enabled' option in settings Nov 10, 2023
@ajayesivan ajayesivan self-assigned this Nov 10, 2023
@status-im-auto
Copy link
Member

status-im-auto commented Nov 10, 2023

Jenkins Builds

Click to see older builds (48)
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 6bf782f #2 2023-11-10 21:46:24 ~5 min android 🤖apk 📲
✔️ 6bf782f #2 2023-11-10 21:47:01 ~6 min ios 📱ipa 📲
✔️ 6bf782f #2 2023-11-10 21:50:51 ~10 min android-e2e 🤖apk 📲
✔️ 6bf782f #2 2023-11-10 21:50:58 ~10 min tests 📄log
443ae8b #3 2023-11-30 08:06:37 ~2 min tests 📄log
✔️ 443ae8b #3 2023-11-30 08:10:46 ~7 min android-e2e 🤖apk 📲
✔️ 443ae8b #3 2023-11-30 08:10:54 ~7 min android 🤖apk 📲
✔️ 443ae8b #3 2023-11-30 08:11:31 ~7 min ios 📱ipa 📲
✔️ 29d99f0 #4 2023-12-01 06:22:41 ~6 min android-e2e 🤖apk 📲
✔️ 29d99f0 #4 2023-12-01 06:25:11 ~8 min android 🤖apk 📲
✔️ 29d99f0 #4 2023-12-01 06:27:15 ~10 min tests 📄log
✔️ 29d99f0 #4 2023-12-01 06:30:21 ~13 min ios 📱ipa 📲
✔️ 083a7a6 #5 2023-12-01 09:34:04 ~6 min android-e2e 🤖apk 📲
✔️ 083a7a6 #5 2023-12-01 09:34:21 ~6 min ios 📱ipa 📲
✔️ 083a7a6 #5 2023-12-01 09:38:10 ~10 min android 🤖apk 📲
✔️ 083a7a6 #5 2023-12-01 09:39:09 ~11 min tests 📄log
✔️ e422434 #6 2023-12-01 13:06:01 ~11 min tests 📄log
✔️ e422434 #6 2023-12-01 13:06:06 ~11 min android-e2e 🤖apk 📲
✔️ e422434 #6 2023-12-01 13:06:10 ~11 min android 🤖apk 📲
✔️ e422434 #6 2023-12-01 13:08:24 ~14 min ios 📱ipa 📲
✔️ 0441c96 #7 2023-12-04 07:24:49 ~11 min tests 📄log
✔️ 0441c96 #7 2023-12-04 07:24:52 ~11 min android-e2e 🤖apk 📲
✔️ 0441c96 #7 2023-12-04 07:24:52 ~11 min android 🤖apk 📲
✔️ 0441c96 #7 2023-12-04 07:27:21 ~14 min ios 📱ipa 📲
✔️ d90a076 #8 2023-12-05 08:13:12 ~7 min android-e2e 🤖apk 📲
✔️ d90a076 #8 2023-12-05 08:13:18 ~7 min android 🤖apk 📲
✔️ d90a076 #8 2023-12-05 08:16:24 ~10 min tests 📄log
✔️ d90a076 #8 2023-12-05 08:18:37 ~12 min ios 📱ipa 📲
✔️ b62f6b6 #9 2023-12-05 09:42:30 ~6 min android 🤖apk 📲
✔️ b62f6b6 #9 2023-12-05 09:43:05 ~7 min ios 📱ipa 📲
✔️ b62f6b6 #9 2023-12-05 09:46:54 ~10 min tests 📄log
✔️ b62f6b6 #9 2023-12-05 09:46:57 ~11 min android-e2e 🤖apk 📲
✔️ 5a9b000 #11 2023-12-06 05:54:40 ~6 min android-e2e 🤖apk 📲
✔️ 5a9b000 #11 2023-12-06 05:54:54 ~6 min ios 📱ipa 📲
✔️ 5a9b000 #11 2023-12-06 05:55:01 ~6 min android 🤖apk 📲
✔️ 5a9b000 #11 2023-12-06 05:58:34 ~10 min tests 📄log
✔️ 81a9fc1 #12 2023-12-06 07:14:45 ~7 min android-e2e 🤖apk 📲
✔️ 81a9fc1 #12 2023-12-06 07:14:47 ~7 min android 🤖apk 📲
✔️ 81a9fc1 #12 2023-12-06 07:17:30 ~10 min tests 📄log
✔️ 81a9fc1 #12 2023-12-06 07:21:19 ~14 min ios 📱ipa 📲
✔️ f5ec2ac #13 2023-12-06 08:34:33 ~6 min android 🤖apk 📲
✔️ f5ec2ac #13 2023-12-06 08:35:07 ~6 min ios 📱ipa 📲
✔️ f5ec2ac #13 2023-12-06 08:39:28 ~11 min android-e2e 🤖apk 📲
✔️ f5ec2ac #13 2023-12-06 08:40:45 ~12 min tests 📄log
✔️ bb5c080 #14 2023-12-06 10:23:45 ~6 min android-e2e 🤖apk 📲
✔️ bb5c080 #14 2023-12-06 10:25:09 ~7 min ios 📱ipa 📲
✔️ bb5c080 #14 2023-12-06 10:27:43 ~10 min android 🤖apk 📲
✔️ bb5c080 #14 2023-12-06 10:28:33 ~11 min tests 📄log
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ a26358c #15 2023-12-11 08:53:55 ~6 min android-e2e 🤖apk 📲
✔️ a26358c #15 2023-12-11 08:54:31 ~7 min ios 📱ipa 📲
✔️ a26358c #15 2023-12-11 08:56:13 ~8 min android 🤖apk 📲
✔️ a26358c #15 2023-12-11 08:58:43 ~11 min tests 📄log
✔️ c36f316 #16 2023-12-12 06:38:56 ~4 min tests 📄log
✔️ c36f316 #16 2023-12-12 06:41:01 ~6 min android-e2e 🤖apk 📲
✔️ c36f316 #16 2023-12-12 06:41:21 ~6 min ios 📱ipa 📲
✔️ c36f316 #16 2023-12-12 06:42:06 ~7 min android 🤖apk 📲

@@ -56,6 +57,10 @@
{:profile.settings/webview-debug-changed value}
(profile-update :webview-debug (boolean value) {})))

(rf/reg-event-fx :profile.settings/change-test-networks-enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to add a simple test here? 🙏

@J-Son89
Copy link
Contributor

J-Son89 commented Nov 13, 2023

@briansztamfater, @vkjr, @OmarBasem I believe we can use this for wallet test-net being enabled.

Also @ajayesivan - I believe there is some corresponding UI for this where there is an orange banner at the top of the application. Should we add this here or in a follow up?

@@ -56,6 +57,10 @@
{:profile.settings/webview-debug-changed value}
(profile-update :webview-debug (boolean value) {})))

(rf/reg-event-fx :profile.settings/change-test-networks-enabled
(fn [_ [value]]
{:fx [[:dispatch [:profile.settings/profile-update :test-networks-enabled? (boolean value) {}]]]}))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see much of a need for this new event if it's just re-dispatching and passing value converted to a boolean.

We can create a more useful event, like :profile.settings/toggle-test-networks and have it read from the app db itself. So the view wouldn't even need to pass value, since that's already in the global state.

Or just consume :profile.settings/profile-update directly in the view.

modified   src/status_im/ui/screens/advanced_settings/views.cljs
@@ -101,8 +101,7 @@
      :accessibility-label :test-networks-enabled
      :container-margin-bottom 8
      :on-press
-     #(re-frame/dispatch
-       [:profile.settings/change-test-networks-enabled (not test-networks-enabled?)])
+     #(re-frame/dispatch [:profile.settings/toggle-test-networks])
      :accessory :switch
      :active test-networks-enabled?}
     {:size :small
modified   src/status_im2/contexts/profile/settings/events.cljs
@@ -61,6 +61,11 @@
  (fn [_ [value]]
    {:fx [[:dispatch [:profile.settings/profile-update :test-networks-enabled? (boolean value) {}]]]}))
 
+(rf/reg-event-fx :profile.settings/toggle-test-networks
+ (fn [{:keys [db]}]
+   (let [value (get-in db [:profile/profile :test-networks-enabled?])]
+     {:fx [[:dispatch [:profile.settings/profile-update :test-networks-enabled? (not value) {}]]]})))

@J-Son89
Copy link
Contributor

J-Son89 commented Nov 14, 2023

@ajayesivan, why don't we make logout automatic here?

@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch 2 times, most recently from 443ae8b to 29d99f0 Compare December 1, 2023 06:16
@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch 6 times, most recently from b62f6b6 to 4e29983 Compare December 6, 2023 05:47
@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch 3 times, most recently from 81a9fc1 to f5ec2ac Compare December 6, 2023 08:28
@ajayesivan
Copy link
Contributor Author

@ajayesivan, why don't we make logout automatic here?

@J-Son89 On desktop they are not logging out. I mentioned it as a test note to confirm the toggle is working properly.

@J-Son89
Copy link
Contributor

J-Son89 commented Dec 6, 2023

@ajayesivan, why don't we make logout automatic here?

@J-Son89 On desktop they are not logging out. I mentioned it as a test note to confirm the toggle is working properly.

okay that's fine for now - Desktop has setup it up that the login initialisation calls are repeated (at least for wallet) so that the tokens etc are on testnet. It might be good for us even to prompt/alert the user that they should logout/login again to avoid confusion among ourselves

@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch from f5ec2ac to bb5c080 Compare December 6, 2023 10:16
@VolodLytvynenko
Copy link
Contributor

hi, @ajayesivanThank you for the PR. Currently, I don't have any issues. I just have a few questions to ensure it should work so for now

ISSUE 1: ETH assets unavailable when test mode activated with mainnet or deactivated with goerli network enabled

Steps:

  1. Activate "test mode" and "Mainnet network" or deactivate "test mode" and activate "Gerli network"
    image
  2. go to the wallet
  3. Open eth account

Actual result:

Upon opening ETH account, the assets are not visible
image

Expected result:

Potential solution:

  • if testnet mode is activated, then the tests assets always should be visible
  • if testnet mode is deactivated, then the mainnet assets always should be visible

@VolodLytvynenko
Copy link
Contributor

@ajayesivan Is this an issue or a temporary behavior until the wallet setting screen, as mentioned by @J-Son89 in this comment, gets implemented?

@J-Son89
Copy link
Contributor

J-Son89 commented Dec 11, 2023

ISSUE 1: ETH assets unavailable when test mode activated with mainnet or deactivated with goerli network enabled

This pr just adds the testnet network toggle that will make that change in Status-Go. There are a few minor adjustments we then need to make in Wallet once we have this pr merged so we will handle that in a separate issue/pr which someone from the wallet team can take 👍

@VolodLytvynenko
Copy link
Contributor

VolodLytvynenko commented Dec 11, 2023

@ajayesivan, you mentioned in this comment that 'This option is required to test curated communities in status.test fleet.'

when I visit https://community-dapp-git-review-status-im-web.vercel.app/votes testnet (Optimism Goerli) to view the 'status.test' fleet communities, I don't see any community listed there. However, one community is fetched in the Status app in the Curated Communities section when the 'test mode' is activated. I'm a bit confused about what kind of community is being fetched into our Status app?

Actual result:

No communities are shown in the https://community-dapp-git-review-status-im-web.vercel.app/votes but one community is fetched in Status app in discovery page
image

Expected result:

If no communities are shown in https://community-dapp-git-review-status-im-web.vercel.app/votes , then no communities are fetched to Curated communities page

@ajayesivan
Copy link
Contributor Author

Hi @VolodLytvynenko,
As @J-Son89's mentioned, the goal of this pull request is to introduce the option to toggle the Test Networks state. This PR does not include any additional fixes for the wallet or curated communities. Instead, it's a preliminary step to facilitate upcoming fixes.

Concerning curated communities, to retrieve test network communities, we must enable both this toggle and switch to the status.test fleet. However, additional changes are still required to fully address the curated communities issue.

@ajayesivan ajayesivan force-pushed the add-test-networks-enabled-setting branch from a26358c to c36f316 Compare December 12, 2023 06:34
@VolodLytvynenko
Copy link
Contributor

hi @ajayesivan . Thank you for the clarification. No additional issues from my side. PR is ready to be merged

@ajayesivan ajayesivan merged commit e5179d3 into develop Dec 12, 2023
6 checks passed
@ajayesivan ajayesivan deleted the add-test-networks-enabled-setting branch December 12, 2023 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

Successfully merging this pull request may close these issues.

Wallet: Add testnet setting for new wallet
7 participants