mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
implement convertPlatformName function
This commit is contained in:
@@ -11,25 +11,28 @@ if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnab
|
|||||||
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
|
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||||
})
|
})
|
||||||
|
|
||||||
const rawPlatform = os.platform()
|
const validPlatformName = convertPlatformName(os.platform())
|
||||||
|
|
||||||
let actualPlatform
|
|
||||||
if (rawPlatform === 'darwin') {
|
|
||||||
actualPlatform = 'MacOS'
|
|
||||||
} else if (rawPlatform === 'win32') {
|
|
||||||
actualPlatform = 'Windows'
|
|
||||||
} else if (rawPlatform === 'linux') {
|
|
||||||
actualPlatform = 'Linux'
|
|
||||||
}
|
|
||||||
|
|
||||||
const mobileAnalyticsClient = new AMA.Manager({
|
const mobileAnalyticsClient = new AMA.Manager({
|
||||||
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||||
appTitle: 'xxxxxxxxxx',
|
appTitle: 'xxxxxxxxxx',
|
||||||
appVersionName: remote.app.getVersion().toString(),
|
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 () {
|
function initAwsMobileAnalytics () {
|
||||||
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
|
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
|
||||||
AWS.config.credentials.get((err) => {
|
AWS.config.credentials.get((err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user