mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
Merge pull request #1002 from BoostIO/add-ama-event-for-snippet-lang
Add ama event for snippet lang
This commit is contained in:
@@ -266,11 +266,16 @@ class SnippetNoteDetail extends React.Component {
|
||||
}
|
||||
|
||||
renameSnippetByIndex (index, name) {
|
||||
let snippets = this.state.note.snippets.slice()
|
||||
const snippets = this.state.note.snippets.slice()
|
||||
snippets[index].name = name
|
||||
let syntax = CodeMirror.findModeByFileName(name.trim())
|
||||
let mode = syntax != null ? syntax.name : null
|
||||
if (mode != null) snippets[index].mode = mode
|
||||
const syntax = CodeMirror.findModeByFileName(name.trim())
|
||||
const mode = syntax != null ? syntax.name : null
|
||||
if (mode != null) {
|
||||
snippets[index].mode = mode
|
||||
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SNIPPET_LANG', {
|
||||
name: mode
|
||||
})
|
||||
}
|
||||
this.setState({note: Object.assign(this.state.note, {snippets: snippets})})
|
||||
|
||||
this.setState({
|
||||
@@ -291,6 +296,10 @@ class SnippetNoteDetail extends React.Component {
|
||||
}, () => {
|
||||
this.save()
|
||||
})
|
||||
|
||||
AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SELECT_LANG', {
|
||||
name
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,10 +44,10 @@ function initAwsMobileAnalytics () {
|
||||
})
|
||||
}
|
||||
|
||||
function recordDynamicCustomEvent (type) {
|
||||
function recordDynamicCustomEvent (type, options = {}) {
|
||||
if (process.env.NODE_ENV !== 'production' || !ConfigManager.default.get().amaEnabled) return
|
||||
try {
|
||||
mobileAnalyticsClient.recordEvent(type)
|
||||
mobileAnalyticsClient.recordEvent(type, options)
|
||||
} catch (analyticsError) {
|
||||
if (analyticsError instanceof ReferenceError) {
|
||||
console.log(analyticsError.name + ': ' + analyticsError.message)
|
||||
|
||||
Reference in New Issue
Block a user