Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2654] WebDialog: Support close event on Android

GitHub Issuen/a
Affected Version/sn/a
Fix Version/sn/a
ComponentsWeb Dialog
ReporterEwan Harris
AssigneeAakash Jain


In the webdialog module currently a developer can detect the closing of a webdialog using the close event. Currently Android has no equivalent for this event currently, however it is possible to support this Community PR: https://github.com/appcelerator-modules/titanium-web-dialog/pull/19


  1. Ewan Harris 2020-06-26

    Note from customer testing the PR. As Chrome is hardcoded as the package name [here](https://github.com/appcelerator-modules/titanium-web-dialog/pull/19/files#diff-ec97b2a8e27b236611c64d3d1ac0a50bR91) the close event only works is Chrome is set as the default browser. Setting another browser (e.g. Samsung Browser or Edge) as the default causes the event to not be fired
  2. Aakash Jain 2020-07-21

    The[PR#19](https://github.com/appcelerator-modules/titanium-web-dialog/pull/19)is fine per the code review. Also tested the close event functionality on sample application in this module. The close event is caught perfectly fine as required. However, if we call open method immediately after creating the object of the web-dialog module, then close event is not triggered for the first time. IMO, this scenario(calling open right after creating object) is very much possible hence this problem should be fixed as well. This would need some time to identify the best possible solutions for the same. [~ssingh]
  3. Michael Gangolf 2020-07-21

    As mentioned in: https://github.com/appcelerator-modules/titanium-web-dialog/pull/19#issuecomment-616761617 It needs a "warm-up" time (at least thats what they've called it in a stackoverflow ticket I think) to get ready. I'm not happy with the PR but I wasn't sure who to implement it correctly
  4. Ewan Harris 2020-08-19

    [~gmathews]/[~aajain] One further note from the customer on this, is there anything that we could possibly do to differentiate between the two, or would it have to be handled by the app code?
       So it looks like there is an issue with the pull request https://github.com/appcelerator-modules/titanium-web-dialog/pull/19 or, rather, googles implementation.
       The close method is called upon TABS_HIDDEN (6) navigation event. The problem is that this is triggered for both a user closing and a deeplink close (pragmatically / user closed). So it looks like we may need to find a different means to detect just a user close.
       When I initially tested this it only appeared to get fired on a user close but that does not seem to be the case.
       Unfortunately, there is no other event that signifies a user close.
  5. Aakash Jain 2021-01-15

    The close event is being caught upon user close and deep-link close. Tested the same on the code: (https://gist.github.com/ewanharris/16909adfbfb43978858d5e7169d1bc9c ). However, debugged the code and found no information is there in close event callback that can help in distinguish between the two. Also, looked into the CustomTabs apis which are being used but nothing useful for us in that. [~gmathews] can share incase he has any updates on the ticket.

JSON Source