Skip to content

Commit 3a32cc7

Browse files
committed
chore: Update browserlist config and show warning on mobile if browser doesn't match
Signed-off-by: Marcel Klehr <[email protected]>
1 parent c0ccc39 commit 3a32cc7

File tree

6 files changed

+137
-4
lines changed

6 files changed

+137
-4
lines changed

gulpfile.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,6 @@ const watch = function() {
303303
chunks: false,
304304
colors: true
305305
}))
306-
307-
const statsJson = stats.toJson()
308-
webpackCheck(statsJson)
309306
})
310307
}
311308

package-lock.json

Lines changed: 112 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"watch-win": "SET NODE_OPTIONS=--max-old-space-size=8000 & gulp watch",
1212
"test": "node --unhandled-rejections=strict test/selenium-runner.js",
1313
"lint": "eslint --ext .js,.vue src",
14-
"lint:fix": "eslint --ext .js,.vue src --fix"
14+
"lint:fix": "eslint --ext .js,.vue src --fix",
15+
"supportedBrowsers": "echo \"module.exports = $(browserslist-useragent-regexp --allowHigherVersions);\" > supportedBrowsers.js"
1516
},
1617
"repository": {
1718
"type": "git",
@@ -34,6 +35,7 @@
3435
"all-contributors-cli": "^6.19.0",
3536
"babel-eslint": "^10.1.0",
3637
"babel-loader": "8.x",
38+
"browserslist-useragent-regexp": "^4.1.3",
3739
"chai": "^4.2.0",
3840
"chai-as-promised": "^7.1.1",
3941
"chrome-webstore-upload": "^0.4.2",

src/ui/views/native/Home.vue

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
<template>
2+
<v-alert
3+
v-if="!isBrowserSupported"
4+
type="error">
5+
{{ 'This browser or WebView is not supported' }}
6+
</v-alert>
27
<v-progress-circular
8+
v-else
39
indeterminate
410
color="blue darken-1"
511
class="ma-auto" />
612
</template>
713

814
<script>
15+
/* global BROWSERSLIST_REGEX */
916
import { actions } from '../../store/definitions'
1017
import { routes } from '../../NativeRouter'
1118
import { SplashScreen } from '@capacitor/splash-screen'
@@ -17,6 +24,11 @@ import Logger from '../../../lib/Logger'
1724
1825
export default {
1926
name: 'Home',
27+
computed: {
28+
isBrowserSupported() {
29+
return BROWSERSLIST_REGEX.test(navigator.userAgent)
30+
}
31+
},
2032
async created() {
2133
SplashScreen.hide()
2234
await this.$store.dispatch(actions.LOAD_ACCOUNTS)

supportedBrowsers.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.common.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,12 @@ module.exports = [{
108108
),
109109
new webpack.DefinePlugin({
110110
'IS_BROWSER': 'true'
111+
}),
112+
new webpack.DefinePlugin({
113+
IS_BROWSER: 'false'
114+
}),
115+
new webpack.DefinePlugin({
116+
BROWSERSLIST_REGEX: require('./supportedBrowsers')
111117
})
112118
]
113119
}, {
@@ -130,6 +136,9 @@ module.exports = [{
130136
),
131137
new webpack.DefinePlugin({
132138
IS_BROWSER: 'false'
139+
}),
140+
new webpack.DefinePlugin({
141+
BROWSERSLIST_REGEX: require('./supportedBrowsers')
133142
})
134143
]
135144
},

0 commit comments

Comments
 (0)