(
platformDetails: ?PlatformDetails,
minStateVersion: Partial<{ +native: number, +web: number }>,
)
| 54 | } |
| 55 | |
| 56 | function hasMinStateVersion( |
| 57 | platformDetails: ?PlatformDetails, |
| 58 | minStateVersion: Partial<{ +native: number, +web: number }>, |
| 59 | ): boolean { |
| 60 | if (!platformDetails) { |
| 61 | return true; |
| 62 | } |
| 63 | const { stateVersion } = platformDetails; |
| 64 | const minVersion = isWebPlatform(platformDetails.platform) |
| 65 | ? minStateVersion.web |
| 66 | : minStateVersion.native; |
| 67 | |
| 68 | if (!minVersion) { |
| 69 | return true; |
| 70 | } |
| 71 | if (!stateVersion || stateVersion < minVersion) { |
| 72 | return false; |
| 73 | } |
| 74 | |
| 75 | return true; |
| 76 | } |
| 77 | |
| 78 | function extractMajorDesktopVersion(desktopVersion: string): number { |
| 79 | return desktopVersion.split('.').map(Number)[0]; |
no test coverage detected