diff --git a/app/components/DeleteHistoryModal.js b/app/components/DeleteHistoryModal.js index 904b5bf..d9ed9b6 100644 --- a/app/components/DeleteHistoryModal.js +++ b/app/components/DeleteHistoryModal.js @@ -1,196 +1,198 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import autoBind from 'auto-bind'; import { View } from 'react-native'; import UserIcon from './UserIcon'; import { Chip, Dialog, Portal, Text, Button, Surface, TextInput, Paragraph, RadioButton, Checkbox } from 'react-native-paper'; import KeyboardAwareDialog from './KeyBoardAwareDialog'; const DialogType = Platform.OS === 'ios' ? KeyboardAwareDialog : Dialog; import styles from '../assets/styles/blink/_DeleteHistoryModal.scss'; class DeleteHistoryModal extends Component { constructor(props) { super(props); autoBind(this); this.state = { displayName: this.props.displayName, show: this.props.show, uri: this.props.uri, period: "0", remoteDelete: false, confirm: false, hasMessages: this.props.hasMessages } } UNSAFE_componentWillReceiveProps(nextProps) { this.setState({show: nextProps.show, displayName: nextProps.displayName, uri: nextProps.uri, confirm: nextProps.confirm, hasMessages: nextProps.hasMessages }); } deleteMessages(event) { event.preventDefault(); if (this.state.confirm) { this.setState({confirm: false}); this.props.deleteMessages(this.state.uri, true, this.state.period, this.state.remoteDelete); this.props.close(); } else { this.setState({confirm: true}); } } setPeriod(value) { this.setState({period: value}); } toggleRemoteDelete() { this.setState({remoteDelete: !this.state.remoteDelete}) } render() { let identity = {uri: this.state.uri, displayName: this.state.displayName}; let canDeleteRemote = this.state.uri && this.state.uri.indexOf('@videoconference') === -1; canDeleteRemote = false; let canDeleteByTime = false; let deleteLabel = this.state.confirm ? 'Confirm': 'Delete'; - if (this.state.hasMessages) { - return ( + if (this.state.hasMessages || !this.state.uri) { + return ( { this.state.uri ? : null} Delete messages { this.state.uri ? Confirm deletion of all messages with {this.state.uri}. The messages will not be removed from remote party. : - Please confirm the deletion of all messages. This cannot be undone. + Please confirm the deletion of all messages from this device. + {"\n"}{"\n"} + The messages can still be retrieved later from the server. } { canDeleteByTime ? this.setPeriod(newValue)} value={this.state.period}> Last hour Last day All : null} {canDeleteRemote ? Delete from recipient too {this.toggleRemoteDelete()}} /> : null} ); } else { return ( { this.state.uri ? : null} Delete contact Confirm deletion of contact {this.state.uri} ); } } } DeleteHistoryModal.propTypes = { show : PropTypes.bool.isRequired, close : PropTypes.func.isRequired, uri : PropTypes.string, displayName : PropTypes.string, deleteMessages : PropTypes.func, hasMessages : PropTypes.bool }; export default DeleteHistoryModal;