Skip to content
Merged
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
31 changes: 25 additions & 6 deletions src/pages/RequestCallPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import * as ValidationUtils from '../libs/ValidationUtils';
import * as PersonalDetails from '../libs/actions/PersonalDetails';
import * as User from '../libs/actions/User';
import FormElement from '../components/FormElement';
import {withNetwork} from '../components/OnyxProvider';
import networkPropTypes from '../components/networkPropTypes';

const propTypes = {
...withLocalizePropTypes,
Expand Down Expand Up @@ -79,6 +81,9 @@ const propTypes = {
// The date that the user will be unblocked
expiresAt: PropTypes.string,
}),

/** Information about the network from Onyx */
network: networkPropTypes.isRequired,
};

const defaultProps = {
Expand Down Expand Up @@ -117,14 +122,15 @@ class RequestCallPage extends Component {
}

componentDidMount() {
// If it is the weekend don't check the wait time
if (moment().day() === 0 || moment().day() === 6) {
this.setState({
onTheWeekend: true,
});
this.fetchData();
}

componentDidUpdate(prevProps) {
if (!prevProps.network.isOffline || this.props.network.isOffline) {
return;
}
Inbox.getInboxCallWaitTime();

this.fetchData();
}

onSubmit() {
Expand Down Expand Up @@ -219,6 +225,18 @@ class RequestCallPage extends Component {
return `${this.props.translate(waitTimeKey, {minutes: this.props.inboxCallUserWaitTime})} ${this.props.translate('requestCallPage.waitTime.guides')}`;
}

fetchData() {
// If it is the weekend don't check the wait time
if (moment().day() === 0 || moment().day() === 6) {
this.setState({
onTheWeekend: true,
});
return;
}

Inbox.getInboxCallWaitTime();
}

validatePhoneInput() {
this.setState({phoneNumberError: this.getPhoneNumberError()});
}
Expand Down Expand Up @@ -333,6 +351,7 @@ RequestCallPage.defaultProps = defaultProps;

export default compose(
withLocalize,
withNetwork(),
withOnyx({
myPersonalDetails: {
key: ONYXKEYS.MY_PERSONAL_DETAILS,
Expand Down