mirror of
https://github.com/status-im/status-mobile.git
synced 2025-02-05 21:34:03 +00:00
parent
5ee5d70567
commit
f509d132f3
@ -365,20 +365,10 @@
|
|||||||
:sub-label nil
|
:sub-label nil
|
||||||
:chevron? false}))
|
:chevron? false}))
|
||||||
|
|
||||||
(defn add-members-entry
|
(defn add-manage-members-entry
|
||||||
[chat-id]
|
[chat-id admin?]
|
||||||
(entry {:icon :i/add-user
|
(entry {:icon :i/add-user
|
||||||
:label (i18n/label :t/add-members)
|
:label (i18n/label (if admin? :t/manage-members :t/add-members))
|
||||||
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
|
|
||||||
:danger? false
|
|
||||||
:accessibility-label :add-members
|
|
||||||
:sub-label nil
|
|
||||||
:chevron? false}))
|
|
||||||
|
|
||||||
(defn manage-members-entry
|
|
||||||
[chat-id]
|
|
||||||
(entry {:icon :i/add-user
|
|
||||||
:label (i18n/label :t/manage-members)
|
|
||||||
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
|
:on-press #(rf/dispatch [:open-modal :group-add-manage-members chat-id])
|
||||||
:danger? false
|
:danger? false
|
||||||
:accessibility-label :manage-members
|
:accessibility-label :manage-members
|
||||||
@ -433,8 +423,7 @@
|
|||||||
admin? (get admins current-pub-key)]
|
admin? (get admins current-pub-key)]
|
||||||
[(group-details-entry chat-id)
|
[(group-details-entry chat-id)
|
||||||
(when inside-chat?
|
(when inside-chat?
|
||||||
(when admin?
|
(add-manage-members-entry chat-id admin?))
|
||||||
(manage-members-entry chat-id)))
|
|
||||||
(when (and admin? inside-chat?)
|
(when (and admin? inside-chat?)
|
||||||
(when config/show-not-implemented-features?
|
(when config/show-not-implemented-features?
|
||||||
(edit-group-entry)))
|
(edit-group-entry)))
|
||||||
|
@ -27,29 +27,37 @@
|
|||||||
(rf/dispatch [:deselect-member public-key true]))))
|
(rf/dispatch [:deselect-member public-key true]))))
|
||||||
|
|
||||||
(defn add-member-contact-item-render
|
(defn add-member-contact-item-render
|
||||||
[{:keys [public-key] :as item} _ _ {:keys [group]}]
|
[{:keys [public-key] :as item} _ _ {:keys [group admin? current-pk]}]
|
||||||
(let [current-pk (rf/sub [:multiaccount/public-key])
|
(let [{:keys [contacts]} group
|
||||||
{:keys [contacts]} group
|
|
||||||
member? (contains? contacts public-key)
|
member? (contains? contacts public-key)
|
||||||
checked? (reagent/atom member?)]
|
checked? (reagent/atom member?)]
|
||||||
|
(if (or (= current-pk public-key) (and (not admin?) member?))
|
||||||
|
(fn []
|
||||||
|
[contact-list-item/contact-list-item
|
||||||
|
{:disabled? true
|
||||||
|
:accessory {:disabled? true
|
||||||
|
:type :checkbox
|
||||||
|
:checked? @checked?}}
|
||||||
|
item])
|
||||||
(fn []
|
(fn []
|
||||||
(let [on-toggle #(group-chat-member-toggle member? (swap! checked? not) public-key)]
|
(let [on-toggle #(group-chat-member-toggle member? (swap! checked? not) public-key)]
|
||||||
[contact-list-item/contact-list-item
|
[contact-list-item/contact-list-item
|
||||||
(when (not= current-pk public-key)
|
|
||||||
{:on-press on-toggle
|
{:on-press on-toggle
|
||||||
:allow-multiple-presses? true
|
:allow-multiple-presses? true
|
||||||
:accessory {:type :checkbox
|
:accessory {:type :checkbox
|
||||||
:checked? @checked?
|
:checked? @checked?
|
||||||
:on-check on-toggle}})
|
:on-check on-toggle}}
|
||||||
item]))))
|
item])))))
|
||||||
|
|
||||||
(defn add-manage-members
|
(defn add-manage-members
|
||||||
[{:keys [scroll-enabled? on-scroll]}]
|
[{:keys [scroll-enabled? on-scroll]}]
|
||||||
(let [selected-participants (rf/sub [:group-chat/selected-participants])
|
(let [theme (quo.theme/use-theme)
|
||||||
|
selected-participants (rf/sub [:group-chat/selected-participants])
|
||||||
deselected-members (rf/sub [:group-chat/deselected-members])
|
deselected-members (rf/sub [:group-chat/deselected-members])
|
||||||
chat-id (rf/sub [:get-screen-params :group-add-manage-members])
|
chat-id (rf/sub [:get-screen-params :group-add-manage-members])
|
||||||
group (rf/sub [:chats/chat-by-id chat-id])
|
{:keys [admins] :as group} (rf/sub [:chats/chat-by-id chat-id])
|
||||||
theme (quo.theme/use-theme)]
|
current-pk (rf/sub [:multiaccount/public-key])
|
||||||
|
admin? (get admins current-pk)]
|
||||||
[rn/view {:flex 1 :margin-top 20}
|
[rn/view {:flex 1 :margin-top 20}
|
||||||
[rn/touchable-opacity
|
[rn/touchable-opacity
|
||||||
{:on-press #(rf/dispatch [:navigate-back])
|
{:on-press #(rf/dispatch [:navigate-back])
|
||||||
@ -60,7 +68,7 @@
|
|||||||
{:size :heading-1
|
{:size :heading-1
|
||||||
:weight :semi-bold
|
:weight :semi-bold
|
||||||
:style {:margin-left 20}}
|
:style {:margin-left 20}}
|
||||||
(i18n/label :t/manage-members)]
|
(i18n/label (if admin? :t/manage-members :t/add-members))]
|
||||||
[gesture/section-list
|
[gesture/section-list
|
||||||
{:key-fn :title
|
{:key-fn :title
|
||||||
:scroll-enabled @scroll-enabled?
|
:scroll-enabled @scroll-enabled?
|
||||||
@ -70,7 +78,9 @@
|
|||||||
:render-section-header-fn contact-list/contacts-section-header
|
:render-section-header-fn contact-list/contacts-section-header
|
||||||
:render-section-footer-fn contact-list/contacts-section-footer
|
:render-section-footer-fn contact-list/contacts-section-footer
|
||||||
:content-container-style {:padding-bottom 20}
|
:content-container-style {:padding-bottom 20}
|
||||||
:render-data {:group group}
|
:render-data {:group group
|
||||||
|
:admin? admin?
|
||||||
|
:current-pk current-pk}
|
||||||
:render-fn add-member-contact-item-render}]
|
:render-fn add-member-contact-item-render}]
|
||||||
[rn/view {:style (style/bottom-container 30 theme)}
|
[rn/view {:style (style/bottom-container 30 theme)}
|
||||||
[quo/button
|
[quo/button
|
||||||
@ -159,17 +169,16 @@
|
|||||||
:on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted)
|
:on-press #(rf/dispatch [:chat.ui/mute chat-id (not muted)
|
||||||
(when-not muted
|
(when-not muted
|
||||||
constants/mute-till-unmuted)])}
|
constants/mute-till-unmuted)])}
|
||||||
(when admin?
|
|
||||||
{:accessibility-label :manage-members
|
{:accessibility-label :manage-members
|
||||||
:customization-color color
|
:customization-color color
|
||||||
:icon :i/add-user
|
:icon :i/add-user
|
||||||
:label (i18n/label :t/manage-members)
|
:label (i18n/label (if admin? :t/manage-members :t/add-members))
|
||||||
:counter-value (count contacts)
|
:counter-value (count contacts)
|
||||||
:on-press (fn []
|
:on-press (fn []
|
||||||
(rf/dispatch [:group/clear-added-participants])
|
(rf/dispatch [:group/clear-added-participants])
|
||||||
(rf/dispatch [:group/clear-removed-members])
|
(rf/dispatch [:group/clear-removed-members])
|
||||||
(rf/dispatch [:open-modal :group-add-manage-members
|
(rf/dispatch [:open-modal :group-add-manage-members
|
||||||
chat-id]))})]}]
|
chat-id]))}]}]
|
||||||
[rn/section-list
|
[rn/section-list
|
||||||
{:key-fn :title
|
{:key-fn :title
|
||||||
:sticky-section-headers-enabled false
|
:sticky-section-headers-enabled false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user