Add CommonPlaceClickActions Unit Tests (#4674)

This commit is contained in:
Madhur Gupta 2021-12-07 01:58:58 +05:30 committed by GitHub
parent 0269894c64
commit d1bf6d0e1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 9 deletions

View file

@ -74,7 +74,7 @@ class CommonPlaceClickActions @Inject constructor(
private fun openWebView(link: Uri): Boolean {
Utils.handleWebUrl(activity, link)
return true;
return true
}
private fun PopupMenu.enableBy(menuId: Int, hasLink: Boolean) {
@ -85,15 +85,19 @@ class CommonPlaceClickActions @Inject constructor(
AlertDialog.Builder(activity)
.setMessage(R.string.login_alert_message)
.setPositiveButton(R.string.login) { dialog, which ->
ActivityUtils.startActivityWithFlags(
activity,
LoginActivity::class.java,
Intent.FLAG_ACTIVITY_CLEAR_TOP,
Intent.FLAG_ACTIVITY_SINGLE_TOP
)
applicationKvStore.putBoolean("login_skipped", false)
activity.finish()
setPositiveButton()
}
.show()
}
private fun setPositiveButton() {
ActivityUtils.startActivityWithFlags(
activity,
LoginActivity::class.java,
Intent.FLAG_ACTIVITY_CLEAR_TOP,
Intent.FLAG_ACTIVITY_SINGLE_TOP
)
applicationKvStore.putBoolean("login_skipped", false)
activity.finish()
}
}