diff --git a/app/assets/styles/blink/_ReadyBox.scss b/app/assets/styles/blink/_ReadyBox.scss index a77c0ef..a7b1e5f 100644 --- a/app/assets/styles/blink/_ReadyBox.scss +++ b/app/assets/styles/blink/_ReadyBox.scss @@ -1,95 +1,100 @@ @import './variables'; .wholeContainer { flex: 1; flex-direction: column; justify-content: center; } .container { margin: 0 auto; width: 90%; padding-top: 20px; } .landscapeTitle { color: white; font-size: 20px; height: 0%; } .portraitTitle { color: white; font-size: 20px; } .footer { flex: 1; justify-content: flex-end; padding-bottom: 15px; } .button { background-color: rgba(#6DAA63, .9); margin: 10px; padding-top: 2px; padding-left: 1px; } .iosButton { background-color: rgba(#6DAA63, .9); margin: 10px; padding-top: 4px; padding-left: 1px; } .androidButton { background-color: rgba(#6DAA63, .9); margin: 10px; padding-top: 1px; padding-left: 1px; } .conferenceButton { background-color: rgba(#4572a6, 1); margin: 10px; } .landscapeUriButtonGroup { flex-direction: row; justify-content: space-between; } .portraitUriButtonGroup { flex-direction: column; } .buttonGroup { flex-direction: row; padding-top: 10px; justify-content: center; } .uriInputBox { align: left; padding-top: 10px; width: 100%; } .landscapeUriInputBox { align: left; padding-top: 10px; width: 350px; } .portraitUriInputBox { align: left; padding-top: 10px; width: 100%; } -.history { +.landscapeHistory { + width: 100%; + flex: 9; +} + +.portraitHistory { width: 100%; flex: 9; } diff --git a/app/components/ReadyBox.js b/app/components/ReadyBox.js index 2b2494e..15e0bed 100644 --- a/app/components/ReadyBox.js +++ b/app/components/ReadyBox.js @@ -1,207 +1,208 @@ import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; // import VizSensor = require('react-visibility-sensor').default; import autoBind from 'auto-bind'; import { View, Platform} from 'react-native'; import { IconButton, Title } from 'react-native-paper'; import ConferenceModal from './ConferenceModal'; import HistoryCard from './HistoryCard'; import HistoryTileBox from './HistoryTileBox'; import FooterBox from './FooterBox'; import URIInput from './URIInput'; import config from '../config'; import utils from '../utils'; import styles from '../assets/styles/blink/_ReadyBox.scss'; class ReadyBox extends Component { constructor(props) { super(props); autoBind(this); this.state = { targetUri: this.props.missedTargetUri, showConferenceModal: false, sticky: false, }; } getTargetUri() { const defaultDomain = this.props.account.id.substring(this.props.account.id.indexOf('@') + 1); return utils.normalizeUri(this.state.targetUri, defaultDomain); } handleTargetChange(value) { if (this.state.targetUri) { let currentUri = this.getTargetUri(); if (currentUri.trim() === value.trim()) { this.setState({targetUri: ''}); } else { this.setState({targetUri: value}); } } else { this.setState({targetUri: value}); } this.forceUpdate(); } handleTargetSelect() { if (this.props.connection === null) { this.props._notificationCenter.postSystemNotification("Server unreachable", {timeout: 2}); return; } // the user pressed enter, start a video call by default if (this.state.targetUri.endsWith(`@${config.defaultConferenceDomain}`)) { this.props.startConference(this.state.targetUri, {audio: true, video: true}); } else { this.props.startCall(this.getTargetUri(), {audio: true, video: true}); } } showConferenceModal(event) { event.preventDefault(); if (this.state.targetUri.length !== 0) { const uri = `${this.state.targetUri.split('@')[0].replace(/[\s()-]/g, '')}@${config.defaultConferenceDomain}`; this.handleConferenceCall(uri.toLowerCase()); } else { this.setState({showConferenceModal: true}); } } handleAudioCall(event) { if (this.props.connection === null) { this.props._notificationCenter.postSystemNotification("Server unreachable", {timeout: 2}); return; } event.preventDefault(); if (this.state.targetUri.endsWith(`@${config.defaultConferenceDomain}`)) { this.props.startConference(this.state.targetUri, {audio: true, video: false}); } else { this.props.startCall(this.getTargetUri(), {audio: true, video: false}); } } handleVideoCall(event) { if (this.props.connection === null) { this.props._notificationCenter.postSystemNotification("Server unreachable", {timeout: 2}); return; } event.preventDefault(); if (this.state.targetUri.endsWith(`@${config.defaultConferenceDomain}`)) { this.props.startConference(this.state.targetUri, {audio: true, video: false}); } else { this.props.startCall(this.getTargetUri(), {audio: true, video: true}); } } handleConferenceCall(targetUri, options={audio: true, video: true}) { if (targetUri) { if (!options.video) { console.log('Handle audio only conference call to',targetUri); } else { console.log('Handle video conference call to',targetUri); } this.props.startConference(targetUri, options); } this.setState({showConferenceModal: false}); } render() { const defaultDomain = `${config.defaultDomain}`; const buttonClass = (Platform.OS === 'ios') ? styles.iosButton : styles.androidButton; const uriGroupClass = this.props.orientation === 'landscape' ? styles.landscapeUriButtonGroup : styles.portraitUriButtonGroup; const uriClass = this.props.orientation === 'landscape' ? styles.landscapeUriInputBox : styles.portraitUriInputBox; const titleClass = this.props.orientation === 'landscape' ? styles.landscapeTitle : styles.portraitTitle; + const historyClass = this.props.orientation === 'landscape' ? styles.landscapeHistory : styles.portraitHistory; // Join URIs from local and server history for input let history = this.props.history.concat( this.props.serverHistory.map(e => e.remoteParty) ); history = [...new Set(history)]; //console.log('history from server is', this.props.serverHistory); const placehoder = 'Enter a SIP address like alice@' + defaultDomain; return ( Enter address or phone number - + {this.props.serverHistory.filter(historyItem => historyItem.remoteParty.startsWith(this.state.targetUri)).map((historyItem, idx) => () )} ); } } ReadyBox.propTypes = { account : PropTypes.object.isRequired, startCall : PropTypes.func.isRequired, startConference : PropTypes.func.isRequired, missedTargetUri : PropTypes.string, history : PropTypes.array, serverHistory : PropTypes.array, orientation : PropTypes.string }; export default ReadyBox;