distriqt / ANE-Message

Send messages from AIR using email and SMS
https://airnativeextensions.com/extension/com.distriqt.Message
0 stars 0 forks source link

Not receiving MessageEvent or ShareEvent #35

Closed richpixel closed 6 years ago

richpixel commented 6 years ago

When I open the native email composer on iPad, none of the events ever get triggered. Everything functions perfectly. I'm assuming I'm not setting up the events properly but I couldn't find any sample code that does it. Thanks.

Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_CANCELLED, onComposerClosed, false, 0, true);
Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_COMPLETE, onComposerClosed, false, 0, true);
Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_FAILED, onComposerClosed, false, 0, true);
Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_SAVED, onComposerClosed, false, 0, true);   
Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_SENT, onComposerClosed, false, 0, true);

// I tried these for good measure...
Message.service.addEventListener( ShareEvent.CANCELLED, onComposerClosed, false, 0, true);
Message.service.addEventListener( ShareEvent.COMPLETE, onComposerClosed, false, 0, true);
Message.service.addEventListener( ShareEvent.FAILED, onComposerClosed, false, 0, true);
marchbold commented 6 years ago

Have you tried not using weak references? These may be removed by AIR inadvertently.

ie.:

Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE_CANCELLED, onComposerClosed );
richpixel commented 6 years ago

Thanks for the reply...

I realize I must have been asking for deprecated events, and needed to listen for MESSAGE_MAIL_COMPOSE. The following code does indeed work:

Message.service.addEventListener( MessageEvent.MESSAGE_MAIL_COMPOSE, onComposerClosed);
marchbold commented 6 years ago

Ah, those aren't events you were listening for but the returned event states! Sorry I missed that.