Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trusted Web Activity Bubblewrap with PostMessage #472

Open
UnknownRoboto opened this issue May 18, 2024 · 0 comments
Open

Trusted Web Activity Bubblewrap with PostMessage #472

UnknownRoboto opened this issue May 18, 2024 · 0 comments

Comments

@UnknownRoboto
Copy link

UnknownRoboto commented May 18, 2024

Is your feature request related to a problem? Please describe.

I am currently working on a project where I need to manage the sending of post messages to the browser. I have successfully overridden the getCustomTabsCallback method in the LauncherActivity class to return a custom class extended from the QualityEnforcer class. This extended class contains the logic of CustomTabsCallback as described in the documentation. However, to do this, I need access to the session created in the onCustomTabsServiceConnected method of the TwaCustomTabsServiceConnection subclass in the TwaLauncher class.

Describe the solution you’d like

I would like to have a getter method or some other way to access the mSession property from the TwaLauncher class. Currently, this property is private and there is no getter method to retrieve it.

Describe alternatives you’ve considered

As an alternative, I've tried overriding the createTwaLauncher method in the LauncherActivity class to return an extended custom class from the TwaLauncher class to access the mSession property of CustomTabsSession, or overriding the TwaCustomTabsServiceConnection subclass. However, they are still private, so this requires modifying the library's source code, which isn't ideal.

Additional context

I have successfully made postal messages work based on the twa-post-message demo and the documentation without any problem where I was able to communicate between the TWA application and my Web app. The thing is, I use Bubblewrap to generate the project and the structure has nothing to do with that of the demo. I would simply like to add a new class to the project generated by Bubblewrap without having to modify the entire project structure and having to maintain it with each new update of the “android-browser-helper” repo.

If it is possible to find a solution to use post messages in a project generated by Bubblewrap without having to make hacks, it would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant