Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,8 @@ export default {
},
Force_Screen_Lock_After: {
type: 'valueAsNumber'
},
Allow_Save_Media_to_Gallery: {
type: 'valueAsBoolean'
}
};
18 changes: 13 additions & 5 deletions app/views/AttachmentView.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class AttachmentView extends React.Component {
user: PropTypes.shape({
id: PropTypes.string,
token: PropTypes.string
})
}),
Allow_Save_Media_to_Gallery: PropTypes.bool
}

constructor(props) {
Expand All @@ -68,7 +69,9 @@ class AttachmentView extends React.Component {
}

setHeader = () => {
const { route, navigation, theme } = this.props;
const {
route, navigation, theme, Allow_Save_Media_to_Gallery
} = this.props;
const attachment = route.params?.attachment;
let { title } = attachment;
try {
Expand All @@ -79,10 +82,14 @@ class AttachmentView extends React.Component {
const options = {
title,
headerLeft: () => <CloseModalButton testID='close-attachment-view' navigation={navigation} buttonStyle={{ color: themes[theme].previewTintColor }} />,
headerRight: () => <SaveButton testID='save-image' onPress={this.handleSave} buttonStyle={{ color: themes[theme].previewTintColor }} />,
headerRight: () => (
Allow_Save_Media_to_Gallery
? <SaveButton testID='save-image' onPress={this.handleSave} buttonStyle={{ color: themes[theme].previewTintColor }} />
: null
),
headerBackground: () => <View style={{ flex: 1, backgroundColor: themes[theme].previewBackground }} />,
headerTintColor: themes[theme].previewTintColor,
headerTitleStyle: { color: themes[theme].previewTintColor }
headerTitleStyle: { color: themes[theme].previewTintColor, marginHorizontal: 10 }
};
navigation.setOptions(options);
}
Expand Down Expand Up @@ -180,7 +187,8 @@ class AttachmentView extends React.Component {

const mapStateToProps = state => ({
baseUrl: state.server.server,
user: getUserSelector(state)
user: getUserSelector(state),
Allow_Save_Media_to_Gallery: state.settings.Allow_Save_Media_to_Gallery ?? true
});

export default connect(mapStateToProps)(withTheme(withDimensions(withSafeAreaInsets(AttachmentView))));