Skip to content

Commit

Permalink
MOBILE-3721 added getAllActiveUpdates method for goat (#1296)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilitvinenko authored Jun 28, 2023
1 parent 8a474f8 commit d422077
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ internal constructor(
}
}

/**
* Returns a list with all active live updates
*/
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public suspend fun getAllActiveUpdates(): List<LiveUpdate> = registrar.getAllActiveUpdates()

/**
* Cancels the notification associated with the given Live Update [name].
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,14 @@ internal class LiveUpdateRegistrar(
}
}

suspend fun getAllActiveUpdates(): List<LiveUpdate> {
return dao
.getAllActive()
.mapNotNull { item ->
item.content?.let { LiveUpdate.from(item.state, it) }
}
}

/**
* End any Live Updates notifications that are no longer displayed.
* On API 21 and 22, the notification manager does not provide a way to query for
Expand Down

0 comments on commit d422077

Please sign in to comment.