iOS Devices are not yet supported Displayed only when iOS physical device is selected
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/400 Reviewed By: jknoxville Differential Revision: D14663825 Pulled By: passy fbshipit-source-id: 6942668e63bb98ef2e0fa299b4b7dcf9ca6af3c6
This commit is contained in:
committed by
Facebook Github Bot
parent
6ba28232ce
commit
1e97d7683f
@@ -111,10 +111,7 @@ const INITAL_STATE: State = {
|
|||||||
deepLinkPayload: null,
|
deepLinkPayload: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(
|
const reducer = (state: State = INITAL_STATE, action: Action): State => {
|
||||||
state: State = INITAL_STATE,
|
|
||||||
action: Action,
|
|
||||||
): State {
|
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case 'SELECT_DEVICE': {
|
case 'SELECT_DEVICE': {
|
||||||
const {payload} = action;
|
const {payload} = action;
|
||||||
@@ -159,20 +156,12 @@ export default function reducer(
|
|||||||
selection = {};
|
selection = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const error =
|
|
||||||
payload.os === 'iOS' &&
|
|
||||||
payload.deviceType === 'physical' &&
|
|
||||||
!iosUtil.isAvailable()
|
|
||||||
? 'iOS Devices are not yet supported'
|
|
||||||
: null;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
devices,
|
devices,
|
||||||
// select device if none was selected before
|
// select device if none was selected before
|
||||||
selectedDevice,
|
selectedDevice,
|
||||||
...selection,
|
...selection,
|
||||||
error: error || state.error,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case 'UNREGISTER_DEVICES': {
|
case 'UNREGISTER_DEVICES': {
|
||||||
@@ -345,7 +334,24 @@ export default function reducer(
|
|||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
export default (state: State = INITAL_STATE, action: Action): State => {
|
||||||
|
const nextState = reducer(state, action);
|
||||||
|
|
||||||
|
if (nextState.selectedDevice) {
|
||||||
|
const {selectedDevice} = nextState;
|
||||||
|
const error =
|
||||||
|
selectedDevice.os === 'iOS' &&
|
||||||
|
selectedDevice.deviceType === 'physical' &&
|
||||||
|
!iosUtil.isAvailable()
|
||||||
|
? 'iOS Devices are not yet supported'
|
||||||
|
: null;
|
||||||
|
|
||||||
|
nextState.error = error || nextState.error;
|
||||||
|
}
|
||||||
|
return nextState;
|
||||||
|
};
|
||||||
|
|
||||||
export const selectDevice = (payload: BaseDevice): Action => ({
|
export const selectDevice = (payload: BaseDevice): Action => ({
|
||||||
type: 'SELECT_DEVICE',
|
type: 'SELECT_DEVICE',
|
||||||
|
|||||||
Reference in New Issue
Block a user