Created
January 31, 2022 18:12
-
-
Save amitkumar0000/aa65133fdf5fbcf90136337501c2f6d8 to your computer and use it in GitHub Desktop.
Producing party to consuming party communication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class SDKModule { | |
| private fun requestReactHost(listener: ContainerListener) { | |
| listener.onRequest(object: AppListener { | |
| override fun onResponse(reactHost: String) { | |
| Timber.d("Got the response: $reactHost") | |
| } | |
| }) | |
| } | |
| fun initSetup(listener: SDKListener) { | |
| listener.onRequest(object: AppListener { | |
| override fun onResponse(response: String) { | |
| print("Got the response") | |
| } | |
| }) | |
| } | |
| } | |
| interface SDKListener { | |
| fun onRequest(response: AppListener) | |
| } | |
| interface AppListener { | |
| fun onResponse(response: String) | |
| } | |
| class ConsumingApp: SDKListener { | |
| fun init() { | |
| SDKModule.initSetup(this) | |
| } | |
| override fun onRequest(req: AppListener) { | |
| req.onResponse("response") | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment