Skip to content

Commit

Permalink
Improved closeNotificationDrawerIfOpened
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiek2010 committed Sep 5, 2024
1 parent cd6ec74 commit e3ee0ca
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,8 @@ class NotificationDrawer {
*/
private fun closeNotificationDrawerIfOpened() {
val device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
device.wait(Until.hasObject(By.text("Manage")), TimeInMs.ONE_SECOND)
val manageButton = device.findObject(By.text("Manage"))
if (manageButton != null) {
val isManageButtonGone = device.wait(Until.gone(By.text("Manage")), TimeInMs.THREE_SECONDS)
if (!isManageButtonGone) {
device.pressBack()
}
}
Expand Down
1 change: 1 addition & 0 deletions shared/src/main/java/org/odk/collect/shared/TimeInMs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package org.odk.collect.shared

object TimeInMs {
const val ONE_SECOND = 1000L
const val THREE_SECONDS = 3000L
const val ONE_MINUTE = 60000L
const val ONE_HOUR = 3600000L
const val ONE_DAY = 86400000L
Expand Down

0 comments on commit e3ee0ca

Please sign in to comment.