diff --git a/src/Client.js b/src/Client.js index a6916bd1c..722e3bdc7 100644 --- a/src/Client.js +++ b/src/Client.js @@ -138,7 +138,7 @@ export default class Client extends EventEmitter { error?: Object, |} = rawData; - console.log(data, 'message:receive'); + console.debug(data, 'message:receive'); const {id, method} = data; @@ -240,7 +240,7 @@ export default class Client extends EventEmitter { params, }; - console.log(data, 'message:call'); + console.debug(data, 'message:call'); this.startTimingRequestResponse({method, id, params}); this.connection.fireAndForget({data: JSON.stringify(data)}); }); @@ -273,7 +273,7 @@ export default class Client extends EventEmitter { method, params, }; - console.log(data, 'message:send'); + console.debug(data, 'message:send'); this.connection.fireAndForget({data: JSON.stringify(data)}); } diff --git a/src/chrome/WelcomeScreen.js b/src/chrome/WelcomeScreen.js index ff8393e14..699b8a3a9 100644 --- a/src/chrome/WelcomeScreen.js +++ b/src/chrome/WelcomeScreen.js @@ -103,10 +103,12 @@ export default class WelcomeScreen extends PureComponent { isMounted: false, }; + timer: ?TimeoutID; + componentDidMount() { // waiting sometime before showing the welcome screen to allow Flipper to // connect to devices, if there are any - setTimeout( + this.timer = setTimeout( () => this.setState({ isMounted: true, @@ -115,6 +117,12 @@ export default class WelcomeScreen extends PureComponent { ); } + componentWillUnmount() { + if (this.timer) { + clearTimeout(this.timer); + } + } + render() { return ( diff --git a/src/device-plugins/logs/index.js b/src/device-plugins/logs/index.js index f7f06bf2b..a0e890e21 100644 --- a/src/device-plugins/logs/index.js +++ b/src/device-plugins/logs/index.js @@ -244,6 +244,9 @@ export default class LogTable extends SonarDevicePlugin { static icon = 'arrow-right'; static keyboardActions = ['clear', 'goToBottom', 'createPaste']; + initTimer: ?TimeoutID; + batchTimer: ?TimeoutID; + onKeyboardAction = (action: string) => { if (action === 'clear') { this.clearLogs(); @@ -384,7 +387,7 @@ export default class LogTable extends SonarDevicePlugin { if (!queued) { queued = true; - setTimeout(() => { + this.batchTimer = setTimeout(() => { const thisBatch = batch; batch = []; queued = false; @@ -421,13 +424,22 @@ export default class LogTable extends SonarDevicePlugin { } }); - setTimeout(() => { + this.initTimer = setTimeout(() => { this.setState({ initialising: false, }); }, 2000); } + componentWillUnmount() { + if (this.initTimer) { + clearTimeout(this.initTimer); + } + if (this.batchTimer) { + clearTimeout(this.batchTimer); + } + } + addRowIfNeeded( rows: Array, row: TableBodyRow, diff --git a/src/server.js b/src/server.js index b244fcaf9..4fb96ad89 100644 --- a/src/server.js +++ b/src/server.js @@ -87,7 +87,7 @@ export default class Server extends EventEmitter { console.error(`Error opening server on port ${port}`, 'server'); }) .on('listening', () => { - console.warn( + console.debug( `${ sslConfig ? 'Secure' : 'Certificate' } server started on port ${port}`, @@ -121,7 +121,7 @@ export default class Server extends EventEmitter { conn.connectionStatus().subscribe({ onNext(payload) { if (payload.kind == 'ERROR' || payload.kind == 'CLOSED') { - console.warn(`Device disconnected ${client.id}`, 'connection'); + console.debug(`Device disconnected ${client.id}`, 'connection'); server.removeConnection(client.id); } }, @@ -175,7 +175,7 @@ export default class Server extends EventEmitter { destination: string, |} = rawData; if (json.method === 'signCertificate') { - console.warn('CSR received from device', 'server'); + console.debug('CSR received from device', 'server'); const {csr, destination} = json; return new Single(subscriber => { subscriber.onSubscribe(); @@ -217,7 +217,7 @@ export default class Server extends EventEmitter { destination: string, |} = rawData; if (json.method === 'signCertificate') { - console.warn('CSR received from device', 'server'); + console.debug('CSR received from device', 'server'); const {csr, destination} = json; this.certificateProvider .processCertificateSigningRequest(csr, clientData.os, destination) @@ -242,7 +242,7 @@ export default class Server extends EventEmitter { invariant(query, 'expected query'); const id = `${query.app}-${query.os}-${query.device}`; - console.warn(`Device connected: ${id}`, 'connection'); + console.debug(`Device connected: ${id}`, 'connection'); const client = new Client(id, query, conn, this.logger); @@ -252,7 +252,7 @@ export default class Server extends EventEmitter { }; client.init().then(() => { - console.log( + console.debug( `Device client initialised: ${id}. Supported plugins: ${client.plugins.join( ', ', )}`, diff --git a/src/utils/CertificateProvider.js b/src/utils/CertificateProvider.js index 355015c74..83a7d4a8b 100644 --- a/src/utils/CertificateProvider.js +++ b/src/utils/CertificateProvider.js @@ -125,7 +125,7 @@ export default class CertificateProvider { } generateClientCertificate(csr: string): Promise { - console.warn('Creating new client cert', logTag); + console.debug('Creating new client cert', logTag); const csrFile = this.writeToTempFile(csr); // Create a certificate for the client, using the details in the CSR. return openssl('x509', { @@ -258,7 +258,7 @@ export default class CertificateProvider { filename: string, contents: string, ): Promise { - console.warn(`Deploying ${filename} to ${deviceId}:${app}`, logTag); + console.debug(`Deploying ${filename} to ${deviceId}:${app}`, logTag); return this.executeCommandOnAndroid( deviceId, app, diff --git a/static/index.js b/static/index.js index d99157783..97f0e2287 100644 --- a/static/index.js +++ b/static/index.js @@ -16,6 +16,9 @@ const {exec} = require('child_process'); const compilePlugins = require('./compilePlugins.js'); const os = require('os'); +// disable electron security warnings: https://github.com/electron/electron/blob/master/docs/tutorial/security.md#security-native-capabilities-and-your-responsibility +process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true; + if (!process.env.ANDROID_HOME) { process.env.ANDROID_HOME = '/opt/android_sdk'; }