Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
feat: detect offline and online changes (#2088)
Browse files Browse the repository at this point in the history
  • Loading branch information
brenopolanski authored Jun 10, 2020
1 parent 9aacc5a commit 805f517
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/renderer/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export default {
isReady: false,
isUriTransactionOpen: false,
uriTransactionSchema: {},
aliveRouteComponents: []
aliveRouteComponents: [],
onLineStatus: window.navigator.onLine || false
}),
keepableRoutes: Object.freeze({
Expand Down Expand Up @@ -254,6 +255,13 @@ export default {
},
language (value) {
this.applyPluginLanguage(value)
},
onLineStatus (connected) {
if (connected) {
this.$success(this.$t('COMMON.INTERNET_STATUS.WITH_INTERNET_CONNECTION'))
} else {
this.$error(this.$t('COMMON.INTERNET_STATUS.NO_INTERNET_CONNECTION'))
}
}
},
Expand Down Expand Up @@ -284,9 +292,15 @@ export default {
mounted () {
this.__watchProcessURL()
window.addEventListener('online', this.updateOnlineStatus)
window.addEventListener('offline', this.updateOnlineStatus)
},
methods: {
updateOnlineStatus (event) {
this.onLineStatus = event.type === 'online'
},
async loadEssential () {
// We need to await plugins in order for all plugins to load properly
try {
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/i18n/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ export default {
IS_MARKET_CHART_ENABLED: 'Price chart on the dashboard',
INITIALIZING: 'Initializing...',
NO_INTERNET_CONNECTION: 'Initialization is taking longer than expected. Please check your internet connectivity.',
INTERNET_STATUS: {
NO_INTERNET_CONNECTION: 'No internet connection. Please check your internet connectivity!',
WITH_INTERNET_CONNECTION: 'Internet connectivity established!'
},
LANGUAGE: 'Application Language',
LEDGER: 'Ledger',
LEDGER_WALLET: 'This is a Ledger wallet',
Expand Down

0 comments on commit 805f517

Please sign in to comment.