Replace launcher error bar with titlebar indicator

Summary:
When starting Flipper with `--launcher-msg`, it currently shows a red error bar at the bottom. That's not ideal for various reasons including it looking kinda bad and it only supporting a single error (the last one set).

This instead adds an action that shows an indicator next to the version at the top as we had it before with the previous system.

Reviewed By: danielbuechele

Differential Revision: D14778859

fbshipit-source-id: 28591de6262e090a4e59a7f5a8cd86d7b3abf8fe
This commit is contained in:
Pascal Hartig
2019-04-05 06:44:40 -07:00
committed by Facebook Github Bot
parent c6baeff5ed
commit ad4c2092a5
5 changed files with 85 additions and 7 deletions

View File

@@ -26,6 +26,11 @@ export type ActiveSheet =
| typeof ACTIVE_SHEET_SHARE_DATA_IN_FILE
| null;
export type LauncherMsg = {
message: string,
severity: 'warning' | 'error',
};
export type State = {
leftSidebarVisible: boolean,
rightSidebarVisible: boolean,
@@ -39,6 +44,7 @@ export type State = {
secure: number,
},
downloadingImportData: boolean,
launcherMsg: LauncherMsg,
};
type BooleanActionType =
@@ -67,6 +73,13 @@ export type Action =
insecure: number,
secure: number,
},
}
| {
type: 'LAUNCHER_MSG',
payload: {
severity: 'warning' | 'error',
message: string,
},
};
const initialState: () => State = () => ({
@@ -82,6 +95,10 @@ const initialState: () => State = () => ({
secure: 8088,
},
downloadingImportData: false,
launcherMsg: {
severity: 'warning',
message: '',
},
});
export default function reducer(state: State, action: Action): State {
@@ -118,12 +135,16 @@ export default function reducer(state: State, action: Action): State {
activeSheet: ACTIVE_SHEET_SHARE_DATA_IN_FILE,
exportFile: action.payload.file,
};
}
if (action.type === 'SET_SERVER_PORTS') {
} else if (action.type === 'SET_SERVER_PORTS') {
return {
...state,
serverPorts: action.payload,
};
} else if (action.type === 'LAUNCHER_MSG') {
return {
...state,
launcherMsg: action.payload,
};
} else {
return state;
}