1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

Add checkbox for ama

This commit is contained in:
asmsuechan
2017-07-22 08:59:27 +09:00
parent d0b835a825
commit 275e3317a3
4 changed files with 40 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ const AMA = require('aws-sdk-mobile-analytics')
const ConfigManager = require('browser/main/lib/ConfigManager')
AWS.config.region = 'us-east-1'
if (process.env.NODE_ENV === 'production') {
if (process.env.NODE_ENV === 'production' && ConfigManager.default.get().amaEnabled) {
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
})
@@ -14,7 +14,7 @@ if (process.env.NODE_ENV === 'production') {
}
function initAwsMobileAnalytics () {
if (process.env.NODE_ENV !== 'production') return
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
AWS.config.credentials.get((err) => {
if (!err) {
console.log('Cognito Identity ID: ' + AWS.config.credentials.identityId)
@@ -24,12 +24,12 @@ function initAwsMobileAnalytics () {
}
function recordDynamitCustomEvent (type) {
if (process.env.NODE_ENV !== 'production') return
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
mobileAnalyticsClient.recordEvent(type)
}
function recordStaticCustomEvent () {
if (process.env.NODE_ENV !== 'production') return
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
uiColorTheme: ConfigManager.default.get().ui.theme
})