mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-30 10:26:24 +00:00
Hide viewing community token requirements under a feature flag (#21814)
Co-authored-by: Shivek Khurana <khuranashivek@outlook.com>
This commit is contained in:
parent
c1daea3e99
commit
1b9c3b577c
@ -10,6 +10,7 @@
|
|||||||
[status-im.contexts.communities.actions.community-rules.view :as community-rules]
|
[status-im.contexts.communities.actions.community-rules.view :as community-rules]
|
||||||
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
|
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
|
||||||
[status-im.contexts.communities.utils :as communities.utils]
|
[status-im.contexts.communities.utils :as communities.utils]
|
||||||
|
[status-im.feature-flags :as ff]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
@ -34,47 +35,47 @@
|
|||||||
:t/member))
|
:t/member))
|
||||||
can-edit-addresses? (rf/sub [:communities/can-edit-shared-addresses? id])
|
can-edit-addresses? (rf/sub [:communities/can-edit-shared-addresses? id])
|
||||||
navigate-back (rn/use-callback #(rf/dispatch [:navigate-back]))
|
navigate-back (rn/use-callback #(rf/dispatch [:navigate-back]))
|
||||||
|
show-addresses-for-permissions (rn/use-callback
|
||||||
show-addresses-for-permissions
|
|
||||||
(rn/use-callback
|
|
||||||
(fn []
|
(fn []
|
||||||
(if can-edit-addresses?
|
(if can-edit-addresses?
|
||||||
(rf/dispatch [:open-modal :addresses-for-permissions {:community-id id}])
|
(rf/dispatch [:open-modal :addresses-for-permissions
|
||||||
|
{:community-id id}])
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:community-id id
|
{:community-id id
|
||||||
:content (fn [] [addresses-for-permissions/view])}])))
|
:content
|
||||||
|
addresses-for-permissions/view}])))
|
||||||
[can-edit-addresses?])
|
[can-edit-addresses?])
|
||||||
|
show-airdrop-addresses (rn/use-callback
|
||||||
show-airdrop-addresses
|
|
||||||
(rn/use-callback
|
|
||||||
(fn []
|
(fn []
|
||||||
(if can-edit-addresses?
|
(if can-edit-addresses?
|
||||||
(rf/dispatch [:open-modal :address-for-airdrop {:community-id id}])
|
(rf/dispatch [:open-modal :address-for-airdrop
|
||||||
|
{:community-id id}])
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:community-id id
|
{:community-id id
|
||||||
:content (fn [] [airdrop-addresses/view])}])))
|
:content airdrop-addresses/view}])))
|
||||||
[can-edit-addresses?])
|
[can-edit-addresses?])
|
||||||
|
confirm-choices (rn/use-callback
|
||||||
confirm-choices
|
|
||||||
(rn/use-callback
|
|
||||||
(fn []
|
(fn []
|
||||||
(rf/dispatch
|
(rf/dispatch
|
||||||
[:standard-auth/authorize
|
[:standard-auth/authorize
|
||||||
{:auth-button-label (if can-edit-addresses?
|
{:auth-button-label (if can-edit-addresses?
|
||||||
(i18n/label :t/edit-shared-addresses)
|
(i18n/label
|
||||||
|
:t/edit-shared-addresses)
|
||||||
(i18n/label :t/request-to-join))
|
(i18n/label :t/request-to-join))
|
||||||
:on-auth-success (fn [password]
|
:on-auth-success
|
||||||
|
(fn [password]
|
||||||
(rf/dispatch
|
(rf/dispatch
|
||||||
[:communities/request-to-join-with-addresses
|
[:communities/request-to-join-with-addresses
|
||||||
{:community-id id
|
{:community-id id
|
||||||
:password password}]))}])
|
:password password}]))}])
|
||||||
(navigate-back))
|
(navigate-back))
|
||||||
[can-edit-addresses?])
|
[can-edit-addresses?])
|
||||||
|
open-permission-sheet (rn/use-callback
|
||||||
open-permission-sheet
|
(fn []
|
||||||
(rn/use-callback (fn []
|
(rf/dispatch
|
||||||
(rf/dispatch [:show-bottom-sheet
|
[:show-bottom-sheet
|
||||||
{:content (fn [] [permissions-sheet/view id])}]))
|
{:content (fn []
|
||||||
|
[permissions-sheet/view id])}]))
|
||||||
[id])]
|
[id])]
|
||||||
(rn/use-mount
|
(rn/use-mount
|
||||||
(fn []
|
(fn []
|
||||||
@ -86,7 +87,7 @@
|
|||||||
:icon-name :i/close
|
:icon-name :i/close
|
||||||
:on-press navigate-back
|
:on-press navigate-back
|
||||||
:accessibility-label :back-button}
|
:accessibility-label :back-button}
|
||||||
has-permissions?
|
(and has-permissions? (ff/enabled? ::ff/community.view-token-requirements))
|
||||||
(assoc :right-side
|
(assoc :right-side
|
||||||
[{:icon-left :i/unlocked
|
[{:icon-left :i/unlocked
|
||||||
:on-press open-permission-sheet
|
:on-press open-permission-sheet
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.contexts.communities.actions.addresses-for-permissions.style :as style]
|
[status-im.contexts.communities.actions.addresses-for-permissions.style :as style]
|
||||||
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
|
[status-im.contexts.communities.actions.permissions-sheet.view :as permissions-sheet]
|
||||||
|
[status-im.feature-flags :as ff]
|
||||||
[utils.i18n :as i18n]
|
[utils.i18n :as i18n]
|
||||||
[utils.money :as money]
|
[utils.money :as money]
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
@ -123,20 +124,20 @@
|
|||||||
[{:keys [community-id identical-choices? can-edit-addresses?]}]
|
[{:keys [community-id identical-choices? can-edit-addresses?]}]
|
||||||
(let [{:keys [name logo color]} (rf/sub [:communities/for-context-tag community-id])
|
(let [{:keys [name logo color]} (rf/sub [:communities/for-context-tag community-id])
|
||||||
has-permissions? (rf/sub [:communities/has-permissions? community-id])
|
has-permissions? (rf/sub [:communities/has-permissions? community-id])
|
||||||
confirm-discard-changes
|
confirm-discard-changes (rn/use-callback
|
||||||
(rn/use-callback
|
|
||||||
(fn []
|
(fn []
|
||||||
(if identical-choices?
|
(if identical-choices?
|
||||||
(rf/dispatch [:dismiss-modal :addresses-for-permissions])
|
(rf/dispatch [:dismiss-modal :addresses-for-permissions])
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:content (fn [] [confirm-discard-drawer
|
{:content (fn []
|
||||||
|
[confirm-discard-drawer
|
||||||
community-id])}])))
|
community-id])}])))
|
||||||
[identical-choices? community-id])
|
[identical-choices? community-id])
|
||||||
|
open-permission-sheet (rn/use-callback
|
||||||
open-permission-sheet
|
(fn []
|
||||||
(rn/use-callback (fn []
|
|
||||||
(rf/dispatch [:show-bottom-sheet
|
(rf/dispatch [:show-bottom-sheet
|
||||||
{:content (fn [] [permissions-sheet/view
|
{:content (fn []
|
||||||
|
[permissions-sheet/view
|
||||||
community-id])}]))
|
community-id])}]))
|
||||||
[community-id])]
|
[community-id])]
|
||||||
[:<>
|
[:<>
|
||||||
@ -161,7 +162,7 @@
|
|||||||
:community-name name
|
:community-name name
|
||||||
:community-logo logo
|
:community-logo logo
|
||||||
:customization-color color}
|
:customization-color color}
|
||||||
has-permissions?
|
(and has-permissions? (ff/enabled? ::ff/community.view-token-requirements))
|
||||||
(assoc :button-icon :i/info
|
(assoc :button-icon :i/info
|
||||||
:button-type :grey
|
:button-type :grey
|
||||||
:on-button-press open-permission-sheet))])]))
|
:on-button-press open-permission-sheet))])]))
|
||||||
|
@ -40,7 +40,8 @@
|
|||||||
:right-icon :i/chevron-right
|
:right-icon :i/chevron-right
|
||||||
:accessibility-label :view-token-gating
|
:accessibility-label :view-token-gating
|
||||||
:on-press #(rf/dispatch [:show-bottom-sheet
|
:on-press #(rf/dispatch [:show-bottom-sheet
|
||||||
{:content (fn [] [permissions-sheet/view id])
|
{:content (fn []
|
||||||
|
[permissions-sheet/view id])
|
||||||
:padding-bottom-override 16}])
|
:padding-bottom-override 16}])
|
||||||
:label (i18n/label :t/view-token-gating)})
|
:label (i18n/label :t/view-token-gating)})
|
||||||
|
|
||||||
@ -138,7 +139,9 @@
|
|||||||
[id token-gated? intro-message test-networks-enabled?]
|
[id token-gated? intro-message test-networks-enabled?]
|
||||||
(let [common [(show-qr id) (share-community id)]
|
(let [common [(show-qr id) (share-community id)]
|
||||||
specific (cond
|
specific (cond
|
||||||
(and token-gated? (not test-networks-enabled?))
|
(and token-gated?
|
||||||
|
(not test-networks-enabled?)
|
||||||
|
(ff/enabled? ::ff/community.view-token-requirements))
|
||||||
[(invite-contacts id) (view-token-gating id)]
|
[(invite-contacts id) (view-token-gating id)]
|
||||||
|
|
||||||
token-gated?
|
token-gated?
|
||||||
@ -161,7 +164,8 @@
|
|||||||
[id token-gated? muted? muted-till color intro-message]
|
[id token-gated? muted? muted-till color intro-message]
|
||||||
[[(view-members id)
|
[[(view-members id)
|
||||||
(view-rules id intro-message)
|
(view-rules id intro-message)
|
||||||
(when token-gated? (view-token-gating id))
|
(when (and token-gated? (ff/enabled? ::ff/community.view-token-requirements))
|
||||||
|
(view-token-gating id))
|
||||||
(when (ff/enabled? ::ff/community.edit-account-selection)
|
(when (ff/enabled? ::ff/community.edit-account-selection)
|
||||||
(edit-shared-addresses id))
|
(edit-shared-addresses id))
|
||||||
(mark-as-read id)
|
(mark-as-read id)
|
||||||
|
@ -11,13 +11,13 @@
|
|||||||
|
|
||||||
(def ^:private initial-flags
|
(def ^:private initial-flags
|
||||||
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
|
{::community.edit-account-selection (enabled-in-env? :FLAG_EDIT_ACCOUNT_SELECTION_ENABLED)
|
||||||
|
::community.view-token-requirements (enabled-in-env? :FLAG_VIEW_TOKEN_REQUIREMENTS)
|
||||||
|
|
||||||
;; Feature toggled (off by default) because the desktop app disabled this
|
;; Feature toggled (off by default) because the desktop app disabled this
|
||||||
;; feature and we want both clients in sync. We keep the code because it
|
;; feature and we want both clients in sync. We keep the code because it
|
||||||
;; works and we may re-enable it by default.
|
;; works and we may re-enable it by default.
|
||||||
::profile-pictures-visibility (enabled-in-env? :FLAG_PROFILE_PICTURES_VISIBILITY_ENABLED)
|
::profile-pictures-visibility (enabled-in-env? :FLAG_PROFILE_PICTURES_VISIBILITY_ENABLED)
|
||||||
::settings.import-all-keypairs (enabled-in-env?
|
::settings.import-all-keypairs (enabled-in-env? :FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS)
|
||||||
:FLAG_WALLET_SETTINGS_IMPORT_ALL_KEYPAIRS)
|
|
||||||
::wallet.add-watched-address (enabled-in-env? :FLAG_ADD_WATCHED_ADDRESS)
|
::wallet.add-watched-address (enabled-in-env? :FLAG_ADD_WATCHED_ADDRESS)
|
||||||
::wallet.advanced-sending (enabled-in-env? :FLAG_ADVANCED_SENDING)
|
::wallet.advanced-sending (enabled-in-env? :FLAG_ADVANCED_SENDING)
|
||||||
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
|
::wallet.assets-modal-hide (enabled-in-env? :FLAG_ASSETS_MODAL_HIDE)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user