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 9392cb9 commit 3837b12
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 @@ -497,6 +497,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 @@ -546,6 +549,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 @@ -561,6 +565,7 @@ GOTO eventLoop"""
}

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

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

0 comments on commit 3837b12

Please sign in to comment.