Skip to content

Commit

Permalink
VPN-6473 check for OS (#9689)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcleinman committed Jun 26, 2024
1 parent 2c0ca14 commit 943bf76
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/message_update_v2.23/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"name": "Update to Mozilla VPN 2.23",
"type": "message",
"conditions": {
"max_client_version": "2.22.9"
"max_client_version": "2.22.9",
"javascript": "osCheck.js"
},
"javascript": {
"enable": "enable.js"
Expand Down
23 changes: 23 additions & 0 deletions addons/message_update_v2.23/osCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Disable on iOS 13 and earlier
(function(api, condition) {
// First check for iOS...
const isIOS = (api.env.platform === "ios");
if (!isIOS) {
condition.enable();
return;
}

// ...then check for iOS 14 or later
const minVersion = 14;
const osVersion = api.env.osVersion;
if (!osVersion || (typeof osVersion !== "string") || osVersion.length === 0) {
// Something unexpected happened. Enable on failure.
condition.enable();
return;
}
const majorVersionString = osVersion.split(".", 1)[0];
const majorVersion = Number(majorVersionString);

majorVersion >= minVersion ? condition.enable() : condition.disable();
});

0 comments on commit 943bf76

Please sign in to comment.