From 59f0cc4f985b8179d0c9ddb46c3d9eafed5e0e42 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 21 Oct 2017 16:59:33 +0900 Subject: [PATCH 1/5] send lang_name of snippet --- browser/main/Detail/SnippetNoteDetail.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index baacc9f39..b3d64c675 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -291,6 +291,10 @@ class SnippetNoteDetail extends React.Component { }, () => { this.save() }) + + AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SELECT_LANG', { + name + }) } } From 35b9bf5d34c81288d6501f8f3641367b37f72e9f Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Sat, 21 Oct 2017 18:18:02 +0900 Subject: [PATCH 2/5] enable recordDynamicEvent func to passed attribute arg --- browser/main/lib/AwsMobileAnalyticsConfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/browser/main/lib/AwsMobileAnalyticsConfig.js b/browser/main/lib/AwsMobileAnalyticsConfig.js index 503adae99..4c0e15b53 100644 --- a/browser/main/lib/AwsMobileAnalyticsConfig.js +++ b/browser/main/lib/AwsMobileAnalyticsConfig.js @@ -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) From 642fae3ac794979ba988336e009f565df0a47da0 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Mon, 23 Oct 2017 13:51:32 +0900 Subject: [PATCH 3/5] some let => const --- browser/main/Detail/SnippetNoteDetail.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index b3d64c675..11cc7d1dd 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -266,10 +266,10 @@ 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 + const syntax = CodeMirror.findModeByFileName(name.trim()) + const mode = syntax != null ? syntax.name : null if (mode != null) snippets[index].mode = mode this.setState({note: Object.assign(this.state.note, {snippets: snippets})}) From 4b158af9f6315a24f5f9c9aac3a981d3ae6ed31d Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Mon, 23 Oct 2017 16:35:15 +0900 Subject: [PATCH 4/5] send snippet_lang --- browser/main/Detail/SnippetNoteDetail.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index 11cc7d1dd..f1024f948 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -270,7 +270,12 @@ class SnippetNoteDetail extends React.Component { snippets[index].name = name const syntax = CodeMirror.findModeByFileName(name.trim()) const mode = syntax != null ? syntax.name : null - if (mode != null) snippets[index].mode = mode + 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({ From 955ade0b8aeaa11e2b59166a72de4079af05ca85 Mon Sep 17 00:00:00 2001 From: Sosuke Suzuki Date: Mon, 23 Oct 2017 21:12:42 +0900 Subject: [PATCH 5/5] add space --- browser/main/Detail/SnippetNoteDetail.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/main/Detail/SnippetNoteDetail.js b/browser/main/Detail/SnippetNoteDetail.js index f1024f948..ad376e3a0 100644 --- a/browser/main/Detail/SnippetNoteDetail.js +++ b/browser/main/Detail/SnippetNoteDetail.js @@ -270,7 +270,7 @@ class SnippetNoteDetail extends React.Component { snippets[index].name = name const syntax = CodeMirror.findModeByFileName(name.trim()) const mode = syntax != null ? syntax.name : null - if (mode != null){ + if (mode != null) { snippets[index].mode = mode AwsMobileAnalyticsConfig.recordDynamicCustomEvent('SNIPPET_LANG', { name: mode