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

Change the EKAttributes.Precedence.enqueue(priority: Priority) 's behavior. #352

Open
tospery opened this issue Aug 26, 2021 · 0 comments
Open

Comments

@tospery
Copy link

tospery commented Aug 26, 2021

  1. In case no previous entry is currently presented, display the new entry.
  2. In case there is an entry that is currently presented - Compare their priorities:
    (1) When new entry's priority is greater than old, present it and enqueue the old entry, the old entry will present just after the new entry is dismissed.
    (2) Otherwise, enqueue the new entry, an present it just after the previous one is dismissed.
    Like:
    case let .enqueue(curPriority):
    if !isCurrentlyDisplaying() {
    show(entryView: entryView, presentInsideKeyWindow: presentInsideKeyWindow, rollbackWindow: rollbackWindow)
    return
    }
    if let prev = isCurrentlyEntryView() {
    var prevPriority: EKAttributes.Precedence.Priority = .normal
    switch prev.attributes.precedence {
    case let .override(priority, _):
    prevPriority = priority
    case let .enqueue(priority):
    prevPriority = priority
    }
    if curPriority >= prevPriority {
    show(entryView: entryView, presentInsideKeyWindow: presentInsideKeyWindow, rollbackWindow: rollbackWindow)
    entryQueue.enqueue(entry: .init(view: prev, presentInsideKeyWindow: presentInsideKeyWindow, rollbackWindow: rollbackWindow))
    } else {
    entryQueue.enqueue(entry: .init(view: entryView, presentInsideKeyWindow: presentInsideKeyWindow, rollbackWindow: rollbackWindow))
    }
    }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant