diff --git a/browser/main/lib/AwsMobileAnalyticsConfig.js b/browser/main/lib/AwsMobileAnalyticsConfig.js index 037513c2..6df5b329 100644 --- a/browser/main/lib/AwsMobileAnalyticsConfig.js +++ b/browser/main/lib/AwsMobileAnalyticsConfig.js @@ -11,25 +11,28 @@ if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnab IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx' }) - const rawPlatform = os.platform() - - let actualPlatform - if (rawPlatform === 'darwin') { - actualPlatform = 'MacOS' - } else if (rawPlatform === 'win32') { - actualPlatform = 'Windows' - } else if (rawPlatform === 'linux') { - actualPlatform = 'Linux' - } + const validPlatformName = convertPlatformName(os.platform()) const mobileAnalyticsClient = new AMA.Manager({ appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx', appTitle: 'xxxxxxxxxx', appVersionName: remote.app.getVersion().toString(), - platform: actualPlatform + platform: validPlatformName }) } +function convertPlatformName (platformName) { + if (platformName === 'darwin') { + return 'MacOS' + } else if (platformName === 'win32') { + return 'Windows' + } else if (platformName === 'linux') { + return 'Linux' + } else { + return '' + } +} + function initAwsMobileAnalytics () { if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return AWS.config.credentials.get((err) => {