From 2d50083588f724cd3cc7aa5787b110f9b4955543 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Fri, 23 Aug 2019 20:24:44 -0400 Subject: [PATCH] Remove dedicated port number field --- screens/AddServerScreen.js | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/screens/AddServerScreen.js b/screens/AddServerScreen.js index 0c1e382..0af9c82 100644 --- a/screens/AddServerScreen.js +++ b/screens/AddServerScreen.js @@ -6,35 +6,22 @@ import StorageKeys from '../constants/Storage'; import CachingStorage from '../utils/CachingStorage'; import JellyfinValidator from '../utils/JellyfinValidator'; -const DEFAULT_PORT = 8096; - const sanitizeHost = (url = '') => url.trim(); -const sanitizePort = (port = '') => { - if (port === '') { - return ''; - } - port = Number.parseInt(port, 10); - if (Number.isNaN(port)) { - return DEFAULT_PORT; - } - return port; -} export default class AddServerScreen extends React.Component { state = { host: '', - port: `${DEFAULT_PORT}`, isValidating: false } async onAddServer() { - const { host, port } = this.state; - console.log('add server', host, port); - if (host && port) { + const { host } = this.state; + console.log('add server', host); + if (host) { this.setState({ isValidating: true }); // Parse the entered url - const url = JellyfinValidator.parseUrl(host, port); + const url = JellyfinValidator.parseUrl(host); console.log('parsed url', url); // Validate the server is available @@ -73,13 +60,6 @@ export default class AddServerScreen extends React.Component { value={this.state.host} onChangeText={text => this.setState({ host: sanitizeHost(text) })} /> - this.setState({ port: `${sanitizePort(text)}` })} - />