After further testing with #63, I've found what seems to be a similar bug that also occurs on iOS. I'm trying to add a welcome message that will inform the user that they will be requested to allow push notifications, and then prompt them to enable AFTER they close that alert message. But, with that message added, the on-change event for the token isn't fired, just as with #63 on Android.
/* see existing token */
console.warn("Existing token: " + firebase.Messaging.token);
let i = 1;
setInterval(() => {
console.warn("token check " + (i++) + ": " + firebase.Messaging.token);
}, 1000);
/* add on-change event for token */
firebase.Messaging.on('tokenChanged', ({token}) => {
console.warn("Got updated Firebase token: " + token);
});
/* welcome messsage */
new AlertDialog({
title: "Welcome!",
message: "Thanks for downloading My App! Make sure to enable notifications when prompted!",
buttons: {
ok: 'OK'
}
})
.on('close', () => { // ask for permissions (only launches when it needs to)
if (device.platform == 'iOS') firebase.Messaging.requestPermissions();
})
.open();
Problem description
After further testing with #63, I've found what seems to be a similar bug that also occurs on iOS. I'm trying to add a welcome message that will inform the user that they will be requested to allow push notifications, and then prompt them to enable AFTER they close that alert message. But, with that message added, the on-change event for the token isn't fired, just as with #63 on Android.
Output:
As you can see, the token is indeed changing, but the event isn't firing.
Expected Behavior
Without the dialog, everything works as intended:
Output:
Environment