Check Flipper version when handling deeplinks

Summary: Check if Flipper is up to date before handling deeplink.

Reviewed By: nikoant

Differential Revision: D29846236

fbshipit-source-id: 011d05958346c3d18c76cf0ae63c3cb087f5933c
This commit is contained in:
Michel Weststrate
2021-08-10 13:23:05 -07:00
committed by Facebook GitHub Bot
parent b757bff9f6
commit 4b892e7373
4 changed files with 84 additions and 37 deletions

View File

@@ -49,32 +49,7 @@ export default function UpdateIndicator() {
placement: 'bottomLeft',
key: 'flipperupdatecheck',
message: 'Update available',
description: (
<>
Flipper version {versionCheckResult.version} is now available.
{fbConfig.isFBBuild ? (
fbConfig.getReleaseChannel() === ReleaseChannel.INSIDERS ? (
<> Restart Flipper to update to the latest version.</>
) : (
<>
{' '}
Run <code>arc pull</code> (optionally with{' '}
<code>--latest</code>) in <code>~/fbsource</code> and
restart Flipper to update to the latest version.
</>
)
) : (
<>
{' '}
Click to{' '}
<Typography.Link href={versionCheckResult.url}>
download
</Typography.Link>
.
</>
)}
</>
),
description: getUpdateAvailableMessage(versionCheckResult),
duration: null, // no auto close
});
break;
@@ -127,3 +102,35 @@ export default function UpdateIndicator() {
return null;
}
export function getUpdateAvailableMessage(versionCheckResult: {
url: string;
version: string;
}): React.ReactNode {
return (
<>
Flipper version {versionCheckResult.version} is now available.
{fbConfig.isFBBuild ? (
fbConfig.getReleaseChannel() === ReleaseChannel.INSIDERS ? (
<> Restart Flipper to update to the latest version.</>
) : (
<>
{' '}
Run <code>arc pull</code> (optionally with <code>--latest</code>) in{' '}
<code>~/fbsource</code> and restart Flipper to update to the latest
version.
</>
)
) : (
<>
{' '}
Click to{' '}
<Typography.Link href={versionCheckResult.url}>
download
</Typography.Link>
.
</>
)}
</>
);
}