Changeset View
Changeset View
Standalone View
Standalone View
lib/shared/version-utils.js
// @flow | // @flow | ||||
import type { PlatformDetails } from '../types/device-types.js'; | import { type PlatformDetails, isWebPlatform } from '../types/device-types.js'; | ||||
function hasMinCodeVersion( | function hasMinCodeVersion( | ||||
platformDetails: ?PlatformDetails, | platformDetails: ?PlatformDetails, | ||||
minCodeVersion: number, | minCodeVersion: number, | ||||
): boolean { | ): boolean { | ||||
if (!platformDetails || platformDetails.platform === 'web') { | if (!platformDetails || isWebPlatform(platformDetails.platform)) { | ||||
return true; | return true; | ||||
} | } | ||||
const { codeVersion } = platformDetails; | const { codeVersion } = platformDetails; | ||||
if (!codeVersion || codeVersion < minCodeVersion) { | if (!codeVersion || codeVersion < minCodeVersion) { | ||||
return false; | return false; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
export { hasMinCodeVersion }; | export { hasMinCodeVersion }; |