Add server message parser validation

This commit is contained in:
Gerzon Z 2021-08-22 21:30:30 -04:00
parent 81c0d322c3
commit 73f4e815c0
2 changed files with 15 additions and 9 deletions

View File

@ -202,5 +202,8 @@ export default {
}, },
Jitsi_Enable_Channels: { Jitsi_Enable_Channels: {
type: 'valuesAsBoolean' type: 'valuesAsBoolean'
},
Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption: {
type: 'valueAsBoolean'
} }
}; };

View File

@ -17,6 +17,7 @@ import RocketChat from '../../lib/rocketchat';
const UserPreferencesView = ({ navigation }) => { const UserPreferencesView = ({ navigation }) => {
const user = useSelector(state => getUserSelector(state)); const user = useSelector(state => getUserSelector(state));
const isMessageParserServerEnabled = useSelector(state => state.settings.Accounts_Default_User_Preferences_enableMessageParserEarlyAdoption);
const [enableParser, setEnableParser] = useState(user.enableMessageParserEarlyAdoption); const [enableParser, setEnableParser] = useState(user.enableMessageParserEarlyAdoption);
useEffect(() => { useEffect(() => {
@ -61,15 +62,17 @@ const UserPreferencesView = ({ navigation }) => {
/> />
<List.Separator /> <List.Separator />
</List.Section> </List.Section>
<List.Section> {isMessageParserServerEnabled && (
<List.Separator /> <List.Section>
<List.Item <List.Separator />
title='Enable_Message_Parser' <List.Item
testID='preferences-view-enable-message-parser' title='Enable_Message_Parser'
right={() => renderMessageParserSwitch()} testID='preferences-view-enable-message-parser'
/> right={() => renderMessageParserSwitch()}
<List.Separator /> />
</List.Section> <List.Separator />
</List.Section>
)}
</List.Container> </List.Container>
</SafeAreaView> </SafeAreaView>
); );