MCPcopy Create free account
hub / github.com/CommE2E/comm / hasMinCodeVersion

Function hasMinCodeVersion

lib/shared/version-utils.js:21–54  ·  view source on GitHub ↗
(
  platformDetails: ?PlatformDetails,
  minCodeVersion: Partial<{
    +native: number,
    +web: number,
    +majorDesktop: number,
  }>,
)

Source from the content-addressed store, hash-verified

19const NEXT_CODE_VERSION = 1000000;
20
21function hasMinCodeVersion(
22 platformDetails: ?PlatformDetails,
23 minCodeVersion: Partial<{
24 +native: number,
25 +web: number,
26 +majorDesktop: number,
27 }>,
28): boolean {
29 if (!platformDetails) {
30 return true;
31 }
32
33 const { codeVersion, majorDesktopVersion } = platformDetails;
34 const minVersion = isWebPlatform(platformDetails.platform)
35 ? minCodeVersion.web
36 : minCodeVersion.native;
37
38 const minMajorDesktopVersion = isDesktopPlatform(platformDetails.platform)
39 ? minCodeVersion.majorDesktop
40 : undefined;
41
42 if (minVersion && (!codeVersion || codeVersion < minVersion)) {
43 return false;
44 }
45
46 if (
47 minMajorDesktopVersion &&
48 (!majorDesktopVersion || majorDesktopVersion < minMajorDesktopVersion)
49 ) {
50 return false;
51 }
52
53 return true;
54}
55
56function hasMinStateVersion(
57 platformDetails: ?PlatformDetails,

Callers 15

policiesValidatorFunction · 0.90
processSuccessfulLoginFunction · 0.90
logInResponderFunction · 0.90
prepareAPNsNotificationFunction · 0.90
updateBadgeCountFunction · 0.90
verifyClientSupportedFunction · 0.90
fetchKnownUserInfosFunction · 0.90
fetchLoggedInUserInfoFunction · 0.90
verifyInviteLinkFunction · 0.90

Calls 2

isWebPlatformFunction · 0.90
isDesktopPlatformFunction · 0.90

Tested by

no test coverage detected