1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

implement convertPlatformName function

This commit is contained in:
Sosuke Suzuki
2017-10-14 12:12:35 +09:00
parent d772551c60
commit 0d7155bda6

View File

@@ -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) => {