darwin-morocho / flutter-facebook-auth

A flutter plugin to add login with facebook in your flutter app
191 stars 124 forks source link

fix: #389 [macOS] Terminating app due to uncaught exception 'NSIntern… #390

Closed potatojoayo closed 2 months ago

potatojoayo commented 2 months ago

Issue

389 [macOS] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'dismissViewController:: Error: maybe this view controller was not presented?'

Cause

webView function in FacebookAuthDesktopPlugin class was calling dismiss(self). It threw the exception that the function was trying to dismissViewController which is not presented (or already closed; maybe it was being called twice).

Solution

Instead of calling dismiss(self), created var window: NSWindow? and set self.view.window of the WebViewController as below.

public override func viewDidAppear() {
        window = self.view.window!
    } 

Then replace dismiss(self) with window?.performClose(nil) in webView function.

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0e8d308) 96.77% compared to head (f4e3c13) 96.77%.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/darwin-morocho/flutter-facebook-auth/pull/390/graphs/tree.svg?width=650&height=150&src=pr&token=XEXUNVP0UK&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MEEDU.APP)](https://app.codecov.io/gh/darwin-morocho/flutter-facebook-auth/pull/390?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=MEEDU.APP) ```diff @@ Coverage Diff @@ ## master #390 +/- ## ======================================= Coverage 96.77% 96.77% ======================================= Files 6 6 Lines 93 93 ======================================= Hits 90 90 Misses 3 3 ```
darwin-morocho commented 2 months ago

@potatojoayo thanks for your PR