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
This commit is contained in:
John Knox
2018-07-16 10:56:33 -07:00
committed by Facebook Github Bot
parent 3d0cd38f7a
commit e83c8d31a2

View File

@@ -139,6 +139,21 @@ export default class Server extends EventEmitter {
const clientData = JSON.parse(connectRequest.data); const clientData = JSON.parse(connectRequest.data);
this.connectionTracker.logConnectionAttempt(clientData); 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 { return {
fireAndForget: (payload: {data: string}) => { fireAndForget: (payload: {data: string}) => {
if (typeof payload.data !== 'string') { if (typeof payload.data !== 'string') {