Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications are broken #20

Open
haroldadmin opened this issue Nov 10, 2019 · 2 comments
Open

Notifications are broken #20

haroldadmin opened this issue Nov 10, 2019 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@haroldadmin
Copy link
Owner

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 haroldadmin added the bug Something isn't working label Nov 10, 2019
@haroldadmin haroldadmin self-assigned this Nov 10, 2019
@haroldadmin
Copy link
Owner Author

Fixed in version 0.9.5.

@haroldadmin
Copy link
Owner Author

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

@haroldadmin haroldadmin reopened this Jan 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant