diff --git a/app/components/offline_indicator/offline_indicator.js b/app/components/offline_indicator/offline_indicator.js index 2f23976d1..ee72c350e 100644 --- a/app/components/offline_indicator/offline_indicator.js +++ b/app/components/offline_indicator/offline_indicator.js @@ -126,7 +126,7 @@ export default class OfflineIndicator extends Component { switch (this.state.network) { case OFFLINE: i18nId = 'mobile.offlineIndicator.offline'; - defaultMessage = 'No internet connection'; + defaultMessage = 'Cannot connect to the server'; break; case CONNECTING: i18nId = 'mobile.offlineIndicator.connecting'; diff --git a/app/utils/network.js b/app/utils/network.js index a517929de..09b852bb0 100644 --- a/app/utils/network.js +++ b/app/utils/network.js @@ -1,9 +1,10 @@ import {NetInfo} from 'react-native'; +import {Client4} from 'mattermost-redux/client'; + export async function checkConnection() { - // If the websocket cannot connect probably is because the Mattermost server - // is down and we don't want to make the app think the device is offline - const server = 'https://www.google.com'; + // Ping the Mattermost server to detect if the we have network connection even if the websocket cannot connect + const server = `${Client4.getBaseRoute()}/system/ping?time=${Date.now()}`; try { await fetch(server); diff --git a/assets/base/i18n/en.json b/assets/base/i18n/en.json index 0249607df..abcf5b74b 100644 --- a/assets/base/i18n/en.json +++ b/assets/base/i18n/en.json @@ -2013,7 +2013,7 @@ "mobile.notification_settings_mobile.vibrate": "Vibrate", "mobile.offlineIndicator.connected": "Connected", "mobile.offlineIndicator.connecting": "Connecting...", - "mobile.offlineIndicator.offline": "No internet connection", + "mobile.offlineIndicator.offline": "Cannot connect to the server", "mobile.open_dm.error": "We couldn't open a direct message with {displayName}. Please check your connection and try again.", "mobile.open_gm.error": "We couldn't open a group message with those users. Please check your connection and try again.", "mobile.post.cancel": "Cancel",