NativeScript/firebase

Displaying alert after canceling from firebase().ui().show() causes exception

dlcole opened this issue · 2 comments

dlcole commented

I’m using phone authentication in my javascript app:

let idp = await firebase().ui().show({ providers: [new PhoneProvider()] });

If I cancel out of the firebase UI and then display an alert, such as

} catch (e) {
      try {
        await dialogs.alert({
          title: "Log In",
          message: "Your login attempt failed; you will need to try again.\n\n" + e,
          okButtonText: "OK"
        });
      } catch (e) {
        console.log("login-page.onLoginTap alert error: " + e);
      }
}

I get an exception or crash. On Android, the exception is

android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@7dc810e is not valid; is your activity running?

Upon returning to the prior page, I can display alerts without error.

On iOS, there’s an immediate crash, even within a try/catch block.

I suspect this is more likely a firebase error than firebase-messaging plugin error, but is there any way guard against he exception/crash so that the app can continue and alert display? try/catch is not sufficient.

I'm using version 3.1.3 of the firebase plugins, and 8.5.9 of @nativescript/core.