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

Added multilevel window support for stacked presentation #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ofgokce
Copy link

@ofgokce ofgokce commented Nov 23, 2023

Issue Link 🔗

How to display two view the same time by using SwiftEntry ? #340

Goals 🥅

Presenting multiple entries on different window levels at the same time.

Entries with the same window level attribute should be presented the same way as before, holding the queue logic same for the same window level. But different window levels should be able to stack on top of each other. Thus creating a window level hierarchy for entries.

Implementation Details ✏️

EKWindowProvider was a singleton, capable of holding only one window. The window level was being set when the new entry was being prepared to be presented.

I have removed the shared instance and created a static dictionary which holds the EKWindowProvider instances for different window levels. When the entry is requested to present, if there is a window provider instance present in the dictionary for the window level of that entry (read from it's attributes), that instance is being used for presentation. If not, a new EKWindowProvider instance is being initiated for that window level and being stored in the dictionary. When the last entry for a window level has been dismissed, the provider for that level is also being removed from the dictionary for memory management purposes.

All the presentation and dismissal logic has also been updated accordingly.

Testing Details 🔍

I have done some superficial tests and may need deeper testing for any functionalities may have been effected. In my tests, all the basics were working good.

Screenshot Links 📷

ezgif-5-b8540dcec3

@JivanHuang
Copy link

This multi-window function is really needed,I hope it will pass soon.

@alexandre-g
Copy link

Great stuff
Usage, for the lazy:

attributes.windowLevel = .alerts

// where level is:

public var value: UIWindow.Level {
    switch self {
    case .alerts:
        return .alert
    case .statusBar:
        return .statusBar
    case .normal:
        return .normal
    case .custom(level: let level):
        return level
    }
}

@DhbStudy
Copy link

Really useful feature

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

Successfully merging this pull request may close these issues.

4 participants