in azure-communication-ui/demo-app/src/chat/java/com/azure/android/communication/ui/chatdemoapp/ChatLauncherActivity.kt [48:121]
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (shouldFinish()) {
finish()
return
}
if (!AppCenter.isConfigured() && !BuildConfig.DEBUG) {
AppCenter.start(
application,
BuildConfig.APP_SECRET,
Analytics::class.java,
Crashes::class.java,
Distribute::class.java
)
}
// Register Memory Viewer with FeatureFlags
conditionallyRegisterDiagnostics(this)
FeatureFlags.registerAdditionalFeature(AdditionalFeatures.secondaryThemeFeature)
binding = ActivityChatLauncherBinding.inflate(layoutInflater)
setContentView(binding.root)
val data: Uri? = intent?.data
val endpointUrl = data?.getQueryParameter("endpointurl") ?: BuildConfig.END_POINT_URL
val threadId = data?.getQueryParameter("threadid") ?: BuildConfig.THREAD_ID
val acsToken = data?.getQueryParameter("acstoken") ?: BuildConfig.ACS_TOKEN
val userid = data?.getQueryParameter("userid") ?: BuildConfig.IDENTITY
val name = data?.getQueryParameter("name") ?: BuildConfig.USER_NAME
binding.run {
endPointURL.setText(endpointUrl)
acsTokenText.setText(acsToken)
userNameText.setText(name)
chatThreadID.setText(threadId)
identity.setText(userid)
launchButton.setOnClickListener {
launch()
launchButton.requestFocus()
hideKeyboard()
}
openChatUIButton.setOnClickListener {
showChatUI()
hideKeyboard()
}
openFullScreenChatUIButton.setOnClickListener {
showChatUIActivity()
hideKeyboard()
}
stopChatCompositeButton.setOnClickListener {
stopChatComposite()
}
acsTokenText.requestFocus()
acsTokenText.isEnabled = true
if (BuildConfig.DEBUG) {
versionText.text = "${BuildConfig.VERSION_NAME}"
} else {
versionText.text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
}
}
this.onBackPressedDispatcher.addCallback {
if (chatView != null) {
onChatCompositeExitRequested()
} else {
this.handleOnBackPressed()
}
}
}