feat: removed the old & unused request-to-join screen
This commit is contained in:
@@ -104,7 +104,6 @@
|
||||
(def fast-create-community-enabled?
|
||||
(enabled? (get-config :FAST_CREATE_COMMUNITY_ENABLED "0")))
|
||||
|
||||
(def community-accounts-selection-enabled? true)
|
||||
(def fetch-messages-enabled? (enabled? (get-config :FETCH_MESSAGES_ENABLED "1")))
|
||||
(def test-networks-enabled? (enabled? (get-config :TEST_NETWORKS_ENABLED "0")))
|
||||
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
(ns status-im.contexts.communities.actions.request-to-join.style
|
||||
(:require
|
||||
[quo.foundations.colors :as colors]))
|
||||
|
||||
(def page-container
|
||||
{:margin-horizontal 20
|
||||
:margin-bottom 20})
|
||||
|
||||
(def title-container
|
||||
{:flex-direction :row
|
||||
:align-items :center
|
||||
:justify-content :space-between})
|
||||
|
||||
(def container
|
||||
{:flex 1})
|
||||
|
||||
(def community-icon
|
||||
{:margin-right :auto :margin-top 4})
|
||||
|
||||
(def cancel-button
|
||||
{:flex 1
|
||||
:margin-right 12})
|
||||
|
||||
(def bottom-container
|
||||
{:padding-top 32
|
||||
:flex-direction :row
|
||||
:align-items :center
|
||||
:margin-horizontal 20
|
||||
:justify-content :space-evenly})
|
||||
|
||||
(def final-disclaimer-container
|
||||
{:margin-bottom 7
|
||||
:margin-top 12
|
||||
:padding-horizontal 40})
|
||||
|
||||
(def final-disclaimer-text
|
||||
{:color colors/neutral-50
|
||||
:text-align :center})
|
||||
|
||||
(def rules-text
|
||||
{:margin-top 24})
|
||||
@@ -1,69 +0,0 @@
|
||||
(ns status-im.contexts.communities.actions.request-to-join.view
|
||||
(:require
|
||||
[quo.core :as quo]
|
||||
[quo.foundations.colors :as colors]
|
||||
[quo.theme]
|
||||
[react-native.core :as rn]
|
||||
[react-native.gesture :as gesture]
|
||||
[status-im.contexts.communities.actions.community-rules-list.view :as community-rules]
|
||||
[status-im.contexts.communities.actions.request-to-join.style :as style]
|
||||
[utils.i18n :as i18n]
|
||||
[utils.re-frame :as rf]))
|
||||
|
||||
(defn join-community-and-navigate-back
|
||||
[id]
|
||||
(rf/dispatch [:communities/request-to-join {:community-id id}])
|
||||
(rf/dispatch [:navigate-back]))
|
||||
|
||||
(defn view
|
||||
[]
|
||||
(fn []
|
||||
(let [theme (quo.theme/use-theme)
|
||||
{:keys [id]} (rf/sub [:get-screen-params])
|
||||
{:keys [color name images]} (rf/sub [:communities/community id])
|
||||
keycard? (rf/sub [:keycard/keycard-profile?])
|
||||
keycard-feature-unavailable (rn/use-callback
|
||||
#(rf/dispatch [:keycard/feature-unavailable-show
|
||||
{:feature-name :community.request-to-join}]))]
|
||||
[rn/safe-area-view {:flex 1}
|
||||
[gesture/scroll-view {:style style/container}
|
||||
[rn/view style/page-container
|
||||
[rn/view {:style style/title-container}
|
||||
[quo/text
|
||||
{:accessibility-label :communities-join-community
|
||||
:weight :semi-bold
|
||||
:size :heading-2}
|
||||
(i18n/label :t/request-to-join)]]
|
||||
[rn/view {:style style/community-icon}
|
||||
[quo/context-tag
|
||||
{:type :community
|
||||
:size 24
|
||||
:community-logo (:thumbnail images)
|
||||
:community-name name}]]
|
||||
[quo/text
|
||||
{:style style/rules-text
|
||||
:accessibility-label :communities-rules-title
|
||||
:weight :semi-bold
|
||||
:size :paragraph-1}
|
||||
(i18n/label :t/community-rules)]
|
||||
[community-rules/view community-rules/standard-rules false]]]
|
||||
[rn/view {:style style/bottom-container}
|
||||
[quo/button
|
||||
{:accessibility-label :cancel
|
||||
:on-press #(rf/dispatch [:navigate-back])
|
||||
:type :grey
|
||||
:container-style style/cancel-button}
|
||||
(i18n/label :t/cancel)]
|
||||
[quo/button
|
||||
{:accessibility-label :join-community-button
|
||||
:on-press (if keycard?
|
||||
keycard-feature-unavailable
|
||||
#(join-community-and-navigate-back id))
|
||||
:container-style {:flex 1}
|
||||
:inner-style {:background-color (colors/resolve-color color theme)}}
|
||||
(i18n/label :t/request-to-join)]]
|
||||
[rn/view {:style style/final-disclaimer-container}
|
||||
[quo/text
|
||||
{:size :paragraph-2
|
||||
:style style/final-disclaimer-text}
|
||||
(i18n/label :t/request-to-join-disclaimer)]]])))
|
||||
@@ -70,34 +70,6 @@
|
||||
community-id
|
||||
err))}]})))
|
||||
|
||||
(defn request-to-join
|
||||
[{:keys [db]} [{:keys [community-id]}]]
|
||||
(let [pub-key (get-in db [:profile/profile :public-key])]
|
||||
{:fx [[:effects.community/generate-requests-for-signing
|
||||
{:pub-key pub-key
|
||||
:community-id community-id
|
||||
:on-success #(rf/dispatch [:communities/sign-data community-id %])
|
||||
:on-error #(rf/dispatch [:communities/requested-to-join-error community-id])}]]}))
|
||||
|
||||
;; Event to be called to request to join a community.
|
||||
;; This event will generate the data to be signed and then call the sign-data event.
|
||||
;; This is the only event that should be called from the UI.
|
||||
(rf/reg-event-fx :communities/request-to-join request-to-join)
|
||||
|
||||
(defn sign-data
|
||||
[_ [community-id sign-params]]
|
||||
{:fx [[:dispatch
|
||||
[:standard-auth/authorize-and-sign
|
||||
{:sign-payload sign-params
|
||||
:auth-button-label (i18n/label :t/request-to-join)
|
||||
:on-sign-success #(rf/dispatch [:communities/request-to-join-with-addresses
|
||||
{:community-id community-id
|
||||
:signature-data %}])
|
||||
:on-sign-error #(rf/dispatch [:communities/requested-to-join-error community-id
|
||||
%])}]]]})
|
||||
|
||||
(rf/reg-event-fx :communities/sign-data sign-data)
|
||||
|
||||
(rf/reg-event-fx :communities/requested-to-join-error
|
||||
(fn [{:keys [db]} [community-id error]]
|
||||
(log/error "failed to request to join community"
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
(ns status-im.contexts.communities.overview.events-test
|
||||
(:require [cljs.test :refer [deftest is]]
|
||||
matcher-combinators.test
|
||||
[native-module.core :as native-module]
|
||||
[status-im.contexts.communities.overview.events :as sut]))
|
||||
|
||||
(def password (native-module/sha3 "password123"))
|
||||
(def community-id "0x99")
|
||||
(def account-pub-key "0x1")
|
||||
|
||||
(deftest request-to-join-test
|
||||
(let [cofx {:db {:profile/profile {:public-key account-pub-key}}}
|
||||
expected {:fx [[:json-rpc/call
|
||||
[{:method "wakuext_generateJoiningCommunityRequestsForSigning"
|
||||
:params [account-pub-key community-id []]
|
||||
:on-success [:communities/sign-data community-id password]
|
||||
:on-error [:communities/requested-to-join-error community-id]}]]]}]
|
||||
(is (match? expected
|
||||
(sut/request-to-join cofx
|
||||
[{:community-id community-id
|
||||
:password password}])))))
|
||||
|
||||
;;TODO: add tests
|
||||
@@ -11,7 +11,6 @@
|
||||
[status-im.common.resources :as resources]
|
||||
[status-im.common.scroll-page.style :as scroll-page.style]
|
||||
[status-im.common.scroll-page.view :as scroll-page]
|
||||
[status-im.config :as config]
|
||||
[status-im.constants :as constants]
|
||||
[status-im.contexts.communities.actions.chat.view :as chat-actions]
|
||||
[status-im.contexts.communities.actions.community-options.view :as options]
|
||||
@@ -106,14 +105,10 @@
|
||||
[quo/text (i18n/label :t/network-not-supported)])
|
||||
|
||||
(defn- request-access-button
|
||||
[id color keycard? keycard-feature-unavailable]
|
||||
[id color]
|
||||
[quo/button
|
||||
{:on-press (if keycard?
|
||||
keycard-feature-unavailable
|
||||
(if config/community-accounts-selection-enabled?
|
||||
#(rf/dispatch [:open-modal :community-account-selection-sheet
|
||||
{:community-id id}])
|
||||
#(rf/dispatch [:open-modal :community-requests-to-join {:id id}])))
|
||||
{:on-press #(rf/dispatch [:open-modal :community-account-selection-sheet
|
||||
{:community-id id}])
|
||||
:accessibility-label :show-request-to-join-screen-button
|
||||
:customization-color color
|
||||
:container-style {:margin-bottom 12}
|
||||
@@ -131,31 +126,24 @@
|
||||
(let
|
||||
[{:keys [can-request-access? no-member-permission? networks-not-supported?
|
||||
highest-permission-role
|
||||
tokens]} (rf/sub [:community/token-gated-overview id])
|
||||
highest-role-text (i18n/label
|
||||
(communities.utils/role->translation-key highest-permission-role
|
||||
:t/member))
|
||||
on-press (rn/use-callback
|
||||
(fn []
|
||||
(if config/community-accounts-selection-enabled?
|
||||
(rf/dispatch [:open-modal :community-account-selection-sheet
|
||||
{:community-id id}])
|
||||
(rf/dispatch [:open-modal :community-requests-to-join
|
||||
{:id id}])))
|
||||
[id])
|
||||
on-press-info #(rf/dispatch
|
||||
[:show-bottom-sheet {:content token-gated-communities-info}])
|
||||
keycard? (rf/sub [:keycard/keycard-profile?])
|
||||
keycard-feature-unavailable (rn/use-callback
|
||||
#(rf/dispatch [:keycard/feature-unavailable-show
|
||||
{:feature-name :community.request-to-join}]))]
|
||||
tokens]} (rf/sub [:community/token-gated-overview id])
|
||||
highest-role-text (i18n/label
|
||||
(communities.utils/role->translation-key highest-permission-role
|
||||
:t/member))
|
||||
on-press (rn/use-callback
|
||||
(fn []
|
||||
(rf/dispatch [:open-modal :community-account-selection-sheet
|
||||
{:community-id id}]))
|
||||
[id])
|
||||
on-press-info #(rf/dispatch
|
||||
[:show-bottom-sheet {:content token-gated-communities-info}])]
|
||||
|
||||
(cond
|
||||
networks-not-supported?
|
||||
[network-not-supported]
|
||||
|
||||
(or (not role-permissions?) no-member-permission?)
|
||||
[request-access-button id color keycard? keycard-feature-unavailable]
|
||||
[request-access-button id color]
|
||||
|
||||
:else
|
||||
[quo/community-token-gating
|
||||
@@ -163,7 +151,7 @@
|
||||
:tokens tokens
|
||||
:community-color color
|
||||
:satisfied? can-request-access?
|
||||
:on-press (if keycard? keycard-feature-unavailable on-press)
|
||||
:on-press on-press
|
||||
:on-press-info on-press-info}])))
|
||||
|
||||
(defn- join-community
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
[status-im.contexts.communities.actions.channel-view-details.view :as
|
||||
channel-view-channel-members-and-details]
|
||||
[status-im.contexts.communities.actions.invite-contacts.view :as communities.invite]
|
||||
[status-im.contexts.communities.actions.request-to-join.view :as join-menu]
|
||||
[status-im.contexts.communities.actions.share-community-channel.view :as share-community-channel]
|
||||
[status-im.contexts.communities.actions.share-community.view :as share-community]
|
||||
[status-im.contexts.communities.discover.view :as communities.discover]
|
||||
@@ -230,12 +229,6 @@
|
||||
:options {:insets {:top? true}}
|
||||
:component communities.accounts-selection/view}
|
||||
|
||||
{:name :community-requests-to-join
|
||||
:metrics {:track? true
|
||||
:alias-id :community.request-to-join}
|
||||
:options {:sheet? true}
|
||||
:component join-menu/view}
|
||||
|
||||
{:name :screen/share-community
|
||||
:metrics {:track? true
|
||||
:alias-id :community.share-community}
|
||||
|
||||
Reference in New Issue
Block a user