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

Dismiss View doesn't set the correct window as key #308

Closed
Zanatta99 opened this issue Sep 4, 2020 · 5 comments
Closed

Dismiss View doesn't set the correct window as key #308

Zanatta99 opened this issue Sep 4, 2020 · 5 comments

Comments

@Zanatta99
Copy link

Describe the bug
When the view presented using SwiftEntryKit (with windowLevel .alerts) is dismissed, the view doesn't set the main app window as key and visible

To Reproduce
1 present a view over the main windows setting WindoLever = .alerts
2 dismiss the view
3 the initial main window will not come back the key window

Expected behavior
When the present view is dismissed the starting key window have to return the key window

Screenshots
If applicable, add screenshots to help explain your problem.

iPhone (please complete the following information):

  • Device: All
  • iOS Version: [e.g. iOS13.7]
  • SwiftEntryKit Release #[1.2.5]

Additional context
Inside the EKWindowProvider class, in the methods displayRollbackWindow() in the first case of the swift you are getting the UIApplication.shared.keyWindow and you call the methods makeKeyAndVisible() to set the view as the keyWindow, but it will never works because UIApplication.shared.keyWindow it that moment is the view that present the SwiftEntryKit view and not the oldest window that have to come back the keyWindow.

If you need help, don't hesitate to contact me dude😊😉.

huri000 added a commit that referenced this issue Sep 4, 2020
…at the time of generating the entry window, to be used later if needed
@huri000
Copy link
Owner

huri000 commented Sep 4, 2020

@Zanatta99 that's a good point you just raised. definitely a logic gap that was ignored for some reason.
Worth mentioning that I couldn't repro with iOS 13.6.

I patched it for urgency reasons, but it def' deserves more love (in future) - Please review the linked PR and let me know your thoughts.

@Zanatta99
Copy link
Author

@huri000 Yeah, also for me it's the better solution.

huri000 added a commit that referenced this issue Sep 4, 2020
…at the time of generating the entry window, to be used later if needed (#309)
@huri000
Copy link
Owner

huri000 commented Sep 4, 2020

@Zanatta99, please try out 1.2.6.

@huri000 huri000 closed this as completed Sep 4, 2020
@Jayxiang
Copy link

@huri000
Although this is ok, but I cannot get the keyWindow immediately after the present view is dismissed.

            print(UIApplication.shared.keyWindow?.rootViewController)
            SwiftEntryKit.dismiss() {
                print(UIApplication.shared.keyWindow?.rootViewController)
            }

The print results are:

Optional(<SwiftEntryKit.EKRootViewController: 0x7ff6128b9800>)
Optional(<SwiftEntryKit.EKRootViewController: 0x7ff6128b9800>)

Inside the EKContentView class, in the method removeFromSuperview() is called dismissHandler?() before didFinishDisplaying, but at this time the keyWindow has not been set. So I think dismissHandler should be called after didFinishDisplaying.

The print results are:

Optional(<SwiftEntryKit.EKRootViewController: 0x7ff4878fa800>)
Optional(<UINavigationController: 0x7ff487857000>)

@RuttabHaroon
Copy link

Is this issue resolved?? i am still having this issue.

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

4 participants