Skip to content

Commit

Permalink
feat: instrument open/save/example/run with analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ianatha committed Nov 10, 2023
1 parent cdfd56f commit 464f8ce
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/io/atha/bababasic/ActivityMain.kt
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ GOTO eventLoop"""
val examples = menu.findItem(R.id.examples_menu).subMenu!!
EXAMPLES.forEach { (name, code) ->
examples.add(name).setOnMenuItemClickListener {
firebaseAnalytics.logEvent("open", Bundle().apply {
putString("example", name)
})
setText(code, name)
true
}
Expand Down Expand Up @@ -545,6 +548,7 @@ GOTO eventLoop"""
val editor = binding.editor
when (id) {
R.id.open_file -> {
firebaseAnalytics.logEvent("open", null)
val intent = Intent()
.setType("text/plain")
.putExtra(EXTRA_LOCAL_ONLY, true)
Expand All @@ -560,6 +564,7 @@ GOTO eventLoop"""
}

R.id.save_file -> {
firebaseAnalytics.logEvent("save", null)
val intent = Intent()
.setType("text/plain")
.putExtra(EXTRA_LOCAL_ONLY, true)
Expand All @@ -579,6 +584,7 @@ GOTO eventLoop"""
R.id.text_redo -> editor.redo()

R.id.run_script -> {
firebaseAnalytics.logEvent("ran_script", null)
val text = editor.text.toString()
try {
checkSyntax("input.bas", text + "\n")
Expand Down

0 comments on commit 464f8ce

Please sign in to comment.