From 19c9629197a66a07d9eb8f737a1aa53ac7d781aa Mon Sep 17 00:00:00 2001 From: natjms Date: Sat, 22 May 2021 21:36:31 -0300 Subject: [PATCH] Enable hiding, muting and blocking from ViewProfile --- src/components/context-menu.js | 2 +- src/components/pages/profile.js | 56 ++++++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 5 deletions(-) diff --git a/src/components/context-menu.js b/src/components/context-menu.js index 6f9a4cb..22418f2 100644 --- a/src/components/context-menu.js +++ b/src/components/context-menu.js @@ -37,7 +37,7 @@ const ContextMenuJsx = (props) => { + color = { props.colour ? props.colour : "#666" } /> { props.children } diff --git a/src/components/pages/profile.js b/src/components/pages/profile.js index de2a0e4..13e9c12 100644 --- a/src/components/pages/profile.js +++ b/src/components/pages/profile.js @@ -21,7 +21,8 @@ import { ScreenWithBackBarJsx, } from "src/components/navigation/navigators"; -import ModerateMenuJsx from "src/components/moderate-menu.js"; +import { MenuOption } from "react-native-popup-menu"; +import ContextMenuJsx from "src/components/context-menu.js"; function getMutuals(yourFollowing, theirFollowers) { // Where yours and theirs are arrays of followers, as returned by the API @@ -125,6 +126,39 @@ const ViewProfileJsx = ({navigation}) => { }); }; + const _handleHide = async () => { + await requests.muteAccount( + state.instance, + state.profile.id, + state.accessToken, + + // Thus, only "mute" statuses + { notifications: false, } + ); + + navigation.goBack(); + }; + + const _handleMute = async () => { + await requests.muteAccount( + state.instance, + state.profile.id, + state.accessToken, + ); + + navigation.goBack(); + }; + + const _handleBlock = async () => { + await requests.blockAccount( + state.instance, + state.profile.id, + state.accessToken, + ); + + navigation.goBack(); + }; + return ( <> { state.loaded @@ -134,6 +168,9 @@ const ViewProfileJsx = ({navigation}) => { { style = { styles.profileHeaderIcon } /> - : + : + + + + }