Professional List
The only view you must integrate inside you app is the professional list. Consists in a Fragment that shows a list of all professionals available for the current authenticated user and allows access to chats and professional profiles.
Create ProfessionalListFragment:
private val professionalList: ProfessionalListFragment by lazy { ProfessionalListFragment() }
Add it to your view:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
supportFragmentManager
.beginTransaction()
.replace(R.id.content, professionalList)
.commitAllowingStateLoss()
}
We strongly recommend adding a ProfessionalListListener for a better integration in your app.
Note: onProfessionalClick() allows you to control chat openings to suit your business logic.
hasAccess indicates that the authenticated patient has access to the chats (has a plan set via the Patients API).
private val listListener = object : ProfessionalListListener {
override fun onListLoaded() {
/* Called after list has been loaded */
}
override fun onProfessionalClick(
professionalId: Long,
specialityId: String?,
hasAccess: Boolean
): Boolean {
/* Return true to allow the chat opening */
return true
}
override fun onUnreadMessageCountChange(unreadMessageCount: Int?) {
/* Called when unread message count changes */
}
}
private fun setProfessionalListListener(listener: ProfessionalListListener) {
professionalList.setProfessionalListListener(listener)
}