From 1c43c78cf471e15a694cd9c3e29c4e8575124f52 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 16 Aug 2021 18:08:34 -0300 Subject: [PATCH 1/2] [FIX] Unarchive permission not honored (#3237) * [FIX] Show alert when unarchive error * Title in alert * Disable button when the user donesn't have the role permission * Use ARCHIVE/UNARCHIVE instead of their lowercase in alert and removed capitalize lodash * Check if the error eis translated before parse through i18n * Remove unnecessary code Co-authored-by: Diego Mello Co-authored-by: Levy Costa --- app/views/RoomInfoEditView/index.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/views/RoomInfoEditView/index.js b/app/views/RoomInfoEditView/index.js index 28666b2ca..8dd7e0865 100644 --- a/app/views/RoomInfoEditView/index.js +++ b/app/views/RoomInfoEditView/index.js @@ -415,11 +415,6 @@ class RoomInfoEditView extends React.Component { return permissions[PERMISSION_DELETE_C]; } - hasArchivePermission = () => { - const { permissions } = this.state; - return (permissions[PERMISSION_ARCHIVE] || permissions[PERMISSION_UNARCHIVE]); - }; - renderSystemMessages = () => { const { systemMessages, enableSysMes } = this.state; const { theme } = this.props; @@ -691,11 +686,11 @@ class RoomInfoEditView extends React.Component { style={[ styles.buttonInverted, styles.buttonContainer_inverted, - !this.hasArchivePermission() && sharedStyles.opacity5, + archived ? !permissions[PERMISSION_UNARCHIVE] && sharedStyles.opacity5 : !permissions[PERMISSION_ARCHIVE] && sharedStyles.opacity5, { flex: 1, marginLeft: 10, borderColor: dangerColor } ]} onPress={this.toggleArchive} - disabled={!this.hasArchivePermission()} + disabled={archived ? !permissions[PERMISSION_UNARCHIVE] : !permissions[PERMISSION_ARCHIVE]} testID={archived ? 'room-info-edit-view-unarchive' : 'room-info-edit-view-archive'} > Date: Mon, 16 Aug 2021 18:14:56 -0300 Subject: [PATCH 2/2] [FIX] Hardcoded backdrop opacity on loading component (#3255) * Added withTheme and themes to Loading * Added animation to backdrop opacity * Minor tweak * Fix internal image impacted by opacity Co-authored-by: Diego Mello Co-authored-by: Levy Costa --- app/containers/Loading.js | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/app/containers/Loading.js b/app/containers/Loading.js index 656e476af..76ca8a3f2 100644 --- a/app/containers/Loading.js +++ b/app/containers/Loading.js @@ -1,15 +1,16 @@ import React from 'react'; import PropTypes from 'prop-types'; import { - StyleSheet, View, Modal, Animated + StyleSheet, Modal, Animated, View } from 'react-native'; +import { withTheme } from '../theme'; +import { themes } from '../constants/colors'; const styles = StyleSheet.create({ container: { flex: 1, alignItems: 'center', - justifyContent: 'center', - backgroundColor: 'rgba(0, 0, 0, 0.25)' + justifyContent: 'center' }, image: { width: 100, @@ -18,9 +19,10 @@ const styles = StyleSheet.create({ } }); -export default class Loading extends React.PureComponent { +class Loading extends React.PureComponent { static propTypes = { - visible: PropTypes.bool.isRequired + visible: PropTypes.bool, + theme: PropTypes.string } state = { @@ -36,7 +38,7 @@ export default class Loading extends React.PureComponent { opacity, { toValue: 1, - duration: 1000, + duration: 200, useNativeDriver: true } ); @@ -91,23 +93,39 @@ export default class Loading extends React.PureComponent { render() { const { opacity, scale } = this.state; - const { visible } = this.props; + const { visible, theme } = this.props; const scaleAnimation = scale.interpolate({ inputRange: [0, 0.5, 1], outputRange: [1, 1.1, 1] }); + + const opacityAnimation = opacity.interpolate({ + inputRange: [0, 1], + outputRange: [0, themes[theme].backdropOpacity], + extrapolate: 'clamp' + }); + return ( {}} > - + +