MoonShot icon indicating copy to clipboard operation
MoonShot copied to clipboard

Notifications are broken

Open haroldadmin opened this issue 5 years ago • 2 comments

Problem

// JustBeforeLaunchAlarmReceiver
repository.getNextLaunch()
  .first()
  .invoke()
  .takeIf { it != null && it.tentativeMaxPrecision == DatePrecision.hour }
  ?: run {
    log("Could not get next launch from database. Not scheduling notification")
    return
  }

Broadcast receivers for Launch alarms use the first item received in the Flow<Resource<Launch> or Flow<Resource<List<Launch>> for showing the notifications. This first item is always Resource.Loading.

Hence the invoke() operator always produces null and notifications are never scheduled.

Solution

Change the call from first() to last().

haroldadmin avatar Nov 10 '19 10:11 haroldadmin

Fixed in version 0.9.5.

haroldadmin avatar Dec 17 '19 02:12 haroldadmin

Notifications are flaky and unreliable in the current version. Reopening this issue.

haroldadmin avatar Jan 29 '20 11:01 haroldadmin