Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate browser compatibility data, drop IE11 support #11685

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions kolibri/core/assets/src/mixins/commonCoreStrings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1289,19 +1289,14 @@ export const coreStrings = createTranslator('CommonCoreStrings', {
},

// Device upgrades recommended
currentDeviceUsingIE11: {
message: 'You seem to be using Internet Explorer 11.',
context:
'Displayed on a device that is using Internet Explorer 11, as part of a message encouraging the user to upgrade.',
},
userDevicesUsingIE11: {
message: 'Some users seem to be accessing Kolibri via Internet Explorer 11',
message: 'Some users seem to have accessed Kolibri via Internet Explorer 11',
context:
'Displayed to an admin, where devices on their network are using Internet Explorer 11, as part of a message encouraging the user to upgrade.',
},
browserSupportWillBeDroppedIE11: {
browserSupportDroppedIE11: {
message:
'Please note that support for this browser will be dropped in the upcoming version, 0.17. We recommend installing other browsers, such as Mozilla Firefox or Google Chrome, in order to continue working with Kolibri.',
'Please note that support for this browser has been dropped. We recommend installing other browsers, such as Mozilla Firefox or Google Chrome, in order to continue working with Kolibri.',
context:
'Displayed to users of kolibri where one or more devices on the network are using Internet Explorer 11, as part of a message encouraging the user to upgrade.',
},
Expand Down
45 changes: 35 additions & 10 deletions kolibri/core/assets/src/utils/minimumBrowserRequirements.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
import isUndefined from 'lodash/isUndefined';
import browsers from 'browserslist-config-kolibri';
import { browser, passesRequirements } from './browserInfo';
import plugin_data from 'plugin_data';

const minimumBrowserRequirements = {
IE: {
major: 11,
},
Android: {
major: 4,
minor: 0,
patch: 2,
},
};
const minimumBrowserRequirements = {};

const browserRegex = /^([a-zA-Z]+) ([><=]+) (\d+)(?:\.(\d+))?(?:\.(\d+))?$/;

for (const browser of browsers) {
const [name, sign, major, minor, patch] = browserRegex.exec(browser).slice(1);
if (sign !== '>' && sign !== '>=') {
throw new Error('Unsupported browser requirement');
}

// This only supports > and >=, but that's all we need.
// In the case that it is > then we will need to add one to the version number
// we will add one to the smallest defined version number out of major, minor, patch
const addOne = sign === '>';
const entry = {
major: Number(major),
};
let valueToIncrement = 'major';
if (!isUndefined(minor)) {
entry.minor = Number(minor);
valueToIncrement = 'minor';
// We only check for patch if we have a minor version number
// as it is not possible to be defined without a minor version number
if (!isUndefined(patch)) {
entry.patch = Number(patch);
valueToIncrement = 'patch';
}
}
if (addOne) {
entry[valueToIncrement] += 1;
}
minimumBrowserRequirements[name] = entry;
}

if (!passesRequirements(browser, minimumBrowserRequirements)) {
window.location.href = plugin_data.unsupportedUrl;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>

<div
v-show="showBanner"
v-show="userDevicesUsingIE11"
class="alert"
:style="{ backgroundColor: $themePalette.yellow.v_100 }"
>
Expand All @@ -15,14 +15,11 @@
</div>

<div class="error-message">
<p v-if="currentUserOnIE11">
{{ coreString('currentDeviceUsingIE11') }}
</p>
<p v-if="userDevicesUsingIE11">
<p>
{{ coreString('userDevicesUsingIE11') }}
</p>
<p v-if="currentUserOnIE11 || userDevicesUsingIE11">
{{ coreString('browserSupportWillBeDroppedIE11') }}
<p>
{{ coreString('browserSupportDroppedIE11') }}
</p>
</div>
</div>
Expand All @@ -34,22 +31,15 @@
<script>

import commonCoreStrings from 'kolibri.coreVue.mixins.commonCoreStrings';
import { browser } from 'kolibri.utils.browserInfo';
import plugin_data from 'plugin_data';

export default {
name: 'DeprecationWarningBanner',
mixins: [commonCoreStrings],
computed: {
showBanner() {
return this.currentUserOnIE11 || this.userDevicesUsingIE11;
},
userDevicesUsingIE11() {
return plugin_data.deprecationWarnings.ie11;
},
currentUserOnIE11() {
return browser.name === 'IE';
},
},
};

Expand Down
1 change: 0 additions & 1 deletion packages/browserslist-config-kolibri/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module.exports = [
'Chrome >= 49',
'ChromeAndroid >= 49',
'Edge >= 18',
'IE >= 11',
'Firefox >= 52',
'FirefoxAndroid >= 68',
'iOS >= 9.3',
Expand Down