From bdb3406dcb6e3c448bf1864701c32acbe5753b28 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Tue, 5 Dec 2017 19:23:49 +0900 Subject: [PATCH] modify: change the file where detect Internet disconnection --- browser/main/Main.js | 4 +--- browser/main/lib/AwsMobileAnalyticsConfig.js | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/browser/main/Main.js b/browser/main/Main.js index 90dbbebf..3fefdb45 100644 --- a/browser/main/Main.js +++ b/browser/main/Main.js @@ -20,9 +20,7 @@ class Main extends React.Component { constructor (props) { super(props) - const isOnline = window.navigator.onLine - - if (process.env.NODE_ENV === 'production' && isOnline) { + if (process.env.NODE_ENV === 'production') { mobileAnalytics.initAwsMobileAnalytics() } diff --git a/browser/main/lib/AwsMobileAnalyticsConfig.js b/browser/main/lib/AwsMobileAnalyticsConfig.js index f10d0b66..e6d028dc 100644 --- a/browser/main/lib/AwsMobileAnalyticsConfig.js +++ b/browser/main/lib/AwsMobileAnalyticsConfig.js @@ -7,7 +7,7 @@ const os = require('os') let mobileAnalyticsClient AWS.config.region = 'us-east-1' -if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnabled) { +if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnabled && window.navigator.onLine) { AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx' })