Clean up old flipper rating system

Summary:
Found some unused code from the rating prototype before switching to itsr.
Deleting it.

Reviewed By: cekkaewnumchai

Differential Revision: D18298155

fbshipit-source-id: 3529db17494f4f5bf7d7841460203d1c3856299a
This commit is contained in:
John Knox
2019-11-04 09:22:18 -08:00
committed by Facebook Github Bot
parent ed2343b3c6
commit 42a77094f4
5 changed files with 6 additions and 48 deletions

View File

@@ -28,10 +28,6 @@ type PropsFromState = {
sessionId: string | null; sessionId: string | null;
}; };
type OwnProps = {
onRatingChanged: (rating: number) => void;
};
type State = { type State = {
promptData: FeedbackPrompt | null; promptData: FeedbackPrompt | null;
isShown: boolean; isShown: boolean;
@@ -287,14 +283,14 @@ class FeedbackComponent extends Component<
} }
} }
class RatingButton extends Component<PropsFromState & OwnProps, State> { class RatingButton extends Component<PropsFromState, State> {
state: State = { state: State = {
promptData: null, promptData: null,
isShown: false, isShown: false,
hasTriggered: false, hasTriggered: false,
}; };
constructor(props: PropsFromState & OwnProps) { constructor(props: PropsFromState) {
super(props); super(props);
if (GK.get('flipper_rating')) { if (GK.get('flipper_rating')) {
UserFeedback.getPrompt().then(prompt => { UserFeedback.getPrompt().then(prompt => {
@@ -378,6 +374,6 @@ class RatingButton extends Component<PropsFromState & OwnProps, State> {
} }
} }
export default connect<{sessionId: string | null}, null, OwnProps, Store>( export default connect<{sessionId: string | null}, null, {}, Store>(
({application: {sessionId}}) => ({sessionId}), ({application: {sessionId}}) => ({sessionId}),
)(RatingButton); )(RatingButton);

View File

@@ -15,7 +15,6 @@ import {
toggleLeftSidebarVisible, toggleLeftSidebarVisible,
toggleRightSidebarVisible, toggleRightSidebarVisible,
ACTIVE_SHEET_BUG_REPORTER, ACTIVE_SHEET_BUG_REPORTER,
setFlipperRating,
ACTIVE_SHEET_SETTINGS, ACTIVE_SHEET_SETTINGS,
} from '../reducers/application'; } from '../reducers/application';
import { import {
@@ -69,7 +68,6 @@ type DispatchFromProps = {
toggleLeftSidebarVisible: (visible?: boolean) => void; toggleLeftSidebarVisible: (visible?: boolean) => void;
toggleRightSidebarVisible: (visible?: boolean) => void; toggleRightSidebarVisible: (visible?: boolean) => void;
setActiveSheet: (sheet: ActiveSheet) => void; setActiveSheet: (sheet: ActiveSheet) => void;
setFlipperRating: (rating: number) => void;
}; };
type StateFromProps = { type StateFromProps = {
@@ -79,7 +77,6 @@ type StateFromProps = {
rightSidebarAvailable: boolean; rightSidebarAvailable: boolean;
downloadingImportData: boolean; downloadingImportData: boolean;
launcherMsg: LauncherMsg; launcherMsg: LauncherMsg;
flipperRating: number | null;
share: ShareType | null | undefined; share: ShareType | null | undefined;
navPluginIsActive: boolean; navPluginIsActive: boolean;
}; };
@@ -161,9 +158,7 @@ class TitleBar extends React.Component<Props, StateFromProps> {
share != null ? share.statusComponent : undefined, share != null ? share.statusComponent : undefined,
)} )}
<Spacer /> <Spacer />
{config.showFlipperRating ? ( {config.showFlipperRating ? <RatingButton /> : null}
<RatingButton onRatingChanged={this.props.setFlipperRating} />
) : null}
<Version>{this.props.version + (isProduction() ? '' : '-dev')}</Version> <Version>{this.props.version + (isProduction() ? '' : '-dev')}</Version>
{isAutoUpdaterEnabled() ? ( {isAutoUpdaterEnabled() ? (
@@ -221,7 +216,6 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, State>(
rightSidebarAvailable, rightSidebarAvailable,
downloadingImportData, downloadingImportData,
launcherMsg, launcherMsg,
flipperRating,
share, share,
}, },
pluginStates, pluginStates,
@@ -232,7 +226,6 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, State>(
rightSidebarAvailable, rightSidebarAvailable,
downloadingImportData, downloadingImportData,
launcherMsg, launcherMsg,
flipperRating,
share, share,
navPluginIsActive: Object.keys(pluginStates).some(key => navPluginIsActive: Object.keys(pluginStates).some(key =>
/#Navigation$/.test(key), /#Navigation$/.test(key),
@@ -242,6 +235,5 @@ export default connect<StateFromProps, DispatchFromProps, OwnProps, State>(
setActiveSheet, setActiveSheet,
toggleLeftSidebarVisible, toggleLeftSidebarVisible,
toggleRightSidebarVisible, toggleRightSidebarVisible,
setFlipperRating,
}, },
)(TitleBar); )(TitleBar);

View File

@@ -48,8 +48,6 @@ export default (store: Store, logger: Logger) => {
clients, clients,
} = store.getState().connections; } = store.getState().connections;
const {flipperRating} = store.getState().application;
if (!selectedDevice || !selectedPlugin) { if (!selectedDevice || !selectedPlugin) {
return; return;
} }
@@ -73,7 +71,6 @@ export default (store: Store, logger: Logger) => {
plugin: selectedPlugin, plugin: selectedPlugin,
app, app,
sdkVersion, sdkVersion,
flipperRating,
}; };
// reset dropped frames counter // reset dropped frames counter

View File

@@ -77,7 +77,6 @@ export type State = {
serverPorts: ServerPorts; serverPorts: ServerPorts;
downloadingImportData: boolean; downloadingImportData: boolean;
launcherMsg: LauncherMsg; launcherMsg: LauncherMsg;
flipperRating: number | null;
statusMessages: Array<string>; statusMessages: Array<string>;
xcodeCommandLineToolsDetected: boolean; xcodeCommandLineToolsDetected: boolean;
}; };
@@ -120,12 +119,6 @@ export type Action =
message: string; message: string;
}; };
} }
| {
type: 'SET_FLIPPER_RATING';
payload: {
rating: number;
};
}
| { | {
type: 'UNSET_SHARE'; type: 'UNSET_SHARE';
} }
@@ -169,7 +162,6 @@ export const initialState: () => State = () => ({
severity: 'warning', severity: 'warning',
message: '', message: '',
}, },
flipperRating: null,
statusMessages: [], statusMessages: [],
xcodeCommandLineToolsDetected: false, xcodeCommandLineToolsDetected: false,
}); });
@@ -242,11 +234,6 @@ export default function reducer(
...state, ...state,
launcherMsg: action.payload, launcherMsg: action.payload,
}; };
} else if (action.type === 'SET_FLIPPER_RATING') {
return {
...state,
flipperRating: action.payload.rating,
};
} else if (action.type === 'SET_EXPORT_STATUS_MESSAGE') { } else if (action.type === 'SET_EXPORT_STATUS_MESSAGE') {
if (state.share) { if (state.share) {
const {share} = state; const {share} = state;
@@ -344,13 +331,6 @@ export const toggleRightSidebarAvailable = (payload?: boolean): Action => ({
payload, payload,
}); });
export const setFlipperRating = (rating: number): Action => ({
type: 'SET_FLIPPER_RATING',
payload: {
rating,
},
});
export const setExportURL = (result: string): Action => ({ export const setExportURL = (result: string): Action => ({
type: 'SET_EXPORT_URL', type: 'SET_EXPORT_URL',
payload: result, payload: result,

View File

@@ -59,7 +59,7 @@ export type Actions =
| {type: 'INIT'}; | {type: 'INIT'};
export type State = { export type State = {
application: ApplicationState & PersistPartial; application: ApplicationState;
connections: DevicesState & PersistPartial; connections: DevicesState & PersistPartial;
pluginStates: PluginStatesState; pluginStates: PluginStatesState;
notifications: NotificationsState & PersistPartial; notifications: NotificationsState & PersistPartial;
@@ -81,14 +81,7 @@ const settingsStorage = new JsonFileStorage(
); );
export default combineReducers<State, Actions>({ export default combineReducers<State, Actions>({
application: persistReducer<ApplicationState, Actions>(
{
key: 'application',
storage,
whitelist: ['flipperRating'],
},
application, application,
),
connections: persistReducer<DevicesState, Actions>( connections: persistReducer<DevicesState, Actions>(
{ {
key: 'connections', key: 'connections',