Created
July 15, 2020 11:23
-
-
Save KryptKode/1066687873e967220e425611d20b0036 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LoginEvent (private val userId:String) : CustomEvent(){ | |
override fun getEventName() { | |
return "login" // the event tag | |
} | |
override fun getParameters(): MutableMap<String, Any> { | |
return hashMapOf("user_id" to userId) // map of parameters | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//imports | |
class MainActivity : BaseActivity() { | |
@Inject | |
lateinit var appAnalytics: AppAnalytics | |
override fun onCreate(savedInstanceState:Bundle?){ | |
super.onCreate(savedInstanceState) | |
myButton.setOnClickListener{ | |
appAnalytics.log(ButtonClickEvent()) | |
} | |
} | |
override fun onStart(){ | |
appAnalytics.log(ViewMainScreenEvent()) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainPresenter @Inject constructor ( | |
private val appAnalytics: AppAnalytics, | |
private val loginUseCase: LoginUseCase | |
) : BasePresenter(){ | |
fun login(){ | |
loginUseCase.execute({userId-> | |
appAnalytics.log(LoginEvent(userId)) | |
}, {error-> | |
//handle error | |
}) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewMainScreenEvent : ContentViewEvent(){ | |
override fun getName(){ | |
return "view_main_screen" //the tag of the view event | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment