Skip to content

Commit 0375313

Browse files
authored
Deprecate flipper plugin rn performance android (#29)
* docs: fix whoopsy * docs(native): add dialog for deprecated package * v0.5.0
1 parent 8c5c686 commit 0375313

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ You also need to run these steps:
8181
Uninstall the package:
8282

8383
```
84-
yarn remove --dev react-native-flipper-performance-plugin
84+
yarn remove --dev flipper-plugin-rn-performance-android
8585
```
8686

8787
Then **remove** those lines in `./android/settings.gradle`:

flipper-desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://fbflipper.com/schemas/plugin-package/v2.json",
33
"name": "flipper-plugin-rn-perf-monitor",
44
"id": "rn-perf-monitor",
5-
"version": "0.4.1",
5+
"version": "0.5.0",
66
"main": "dist/bundle.js",
77
"flipperBundlerEntry": "src/index.tsx",
88
"license": "MIT",

flipper-desktop/src/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { useState } from "react";
22
import { createState, PluginClient, usePlugin, useValue } from "flipper-plugin";
33
import { Measure } from "./types/Measure";
44
import { PerfMonitorView } from "./PerfMonitorView";
5+
import { openMigrationDialog } from "./openMigrationDialog";
56

67
type Events = {
78
addRecord: Measure;
@@ -18,6 +19,13 @@ export function plugin(client: PluginClient<Events, Methods>) {
1819
});
1920

2021
client.onMessage("addRecord", (measure) => {
22+
// This happens only if users have the previous Android plugin installed
23+
// @ts-ignore
24+
if (measure.expected !== undefined) {
25+
stopMeasuring();
26+
openMigrationDialog();
27+
return;
28+
}
2129
measures.update((draft) => {
2230
draft.push(measure);
2331
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from "react";
2+
import { Dialog } from "flipper-plugin";
3+
4+
const MIGRATION_LINK =
5+
"https://github.com/bamlab/react-native-performance#install-androidios-plugin";
6+
7+
export const openMigrationDialog = () =>
8+
Dialog.show({
9+
defaultValue: false,
10+
children: () => (
11+
<div>
12+
This version of the Performance Android plugin is now <b>deprecated</b>.
13+
<br />
14+
<br />
15+
Please migrate to the <a href={MIGRATION_LINK}>new native plugin</a>,
16+
which features:
17+
<ul>
18+
<li> • iOS support 🎉</li>
19+
<li> • easier installation</li>
20+
<li> • more accurate reporting</li>
21+
</ul>
22+
</div>
23+
),
24+
title: "Migrate to new plugin",
25+
okText: "See how to migrate",
26+
onConfirm: () => require("electron").shell.openExternal(MIGRATION_LINK),
27+
});

0 commit comments

Comments
 (0)