From e83c8d31a242122f7add9c3879c411305ff0342d Mon Sep 17 00:00:00 2001 From: John Knox Date: Mon, 16 Jul 2018 10:56:33 -0700 Subject: [PATCH] Display warning to user when a physical iOS device is connected Summary: At the moment sonar doesn't work with physical iOS devices. Until we add that feature, to avoid confusion, tell the user that it won't work. Reviewed By: passy Differential Revision: D8859223 fbshipit-source-id: 318777406877e0f769c6d0dc5bbe745ca0565f55 --- src/server.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/server.js b/src/server.js index 168f3529c..5c946f9e5 100644 --- a/src/server.js +++ b/src/server.js @@ -139,6 +139,21 @@ export default class Server extends EventEmitter { const clientData = JSON.parse(connectRequest.data); this.connectionTracker.logConnectionAttempt(clientData); + if ( + clientData.os === 'iOS' && + !clientData.device.toLowerCase().includes('simulator') + ) { + this.emit( + 'error', + new Error( + "Sonar doesn't currently support physical iOS devices. You can still use it to view logs, but for now to use the majority of the sonar plugins you'll have to use the Simulator.", + ), + ); + console.warn( + 'Physical iOS device detected. This is not currently supported by sonar.', + ); + } + return { fireAndForget: (payload: {data: string}) => { if (typeof payload.data !== 'string') {