mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 17:56:25 +00:00
Merge pull request #664 from asmsuechan/auth-aws-only-production
Exclude auth of aws only production
This commit is contained in:
@@ -3,16 +3,18 @@ const AMA = require('aws-sdk-mobile-analytics')
|
|||||||
const ConfigManager = require('browser/main/lib/ConfigManager')
|
const ConfigManager = require('browser/main/lib/ConfigManager')
|
||||||
|
|
||||||
AWS.config.region = 'us-east-1'
|
AWS.config.region = 'us-east-1'
|
||||||
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
|
||||||
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
|
IdentityPoolId: 'us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxx'
|
||||||
})
|
})
|
||||||
|
const mobileAnalyticsClient = new AMA.Manager({
|
||||||
const mobileAnalyticsClient = new AMA.Manager({
|
|
||||||
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
appId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||||
appTitle: 'xxxxxxxxxx'
|
appTitle: 'xxxxxxxxxx'
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
function initAwsMobileAnalytics () {
|
function initAwsMobileAnalytics () {
|
||||||
|
if (process.env.NODE_ENV !== 'production') return
|
||||||
AWS.config.credentials.get((err) => {
|
AWS.config.credentials.get((err) => {
|
||||||
if (!err) {
|
if (!err) {
|
||||||
console.log('Cognito Identity ID: ' + AWS.config.credentials.identityId)
|
console.log('Cognito Identity ID: ' + AWS.config.credentials.identityId)
|
||||||
@@ -22,10 +24,12 @@ function initAwsMobileAnalytics () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function recordDynamitCustomEvent (type) {
|
function recordDynamitCustomEvent (type) {
|
||||||
|
if (process.env.NODE_ENV !== 'production') return
|
||||||
mobileAnalyticsClient.recordEvent(type)
|
mobileAnalyticsClient.recordEvent(type)
|
||||||
}
|
}
|
||||||
|
|
||||||
function recordStaticCustomEvent () {
|
function recordStaticCustomEvent () {
|
||||||
|
if (process.env.NODE_ENV !== 'production') return
|
||||||
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
|
mobileAnalyticsClient.recordEvent('UI_COLOR_THEME', {
|
||||||
uiColorTheme: ConfigManager.default.get().ui.theme
|
uiColorTheme: ConfigManager.default.get().ui.theme
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user