Tealium / tealium-react-native

Other
12 stars 23 forks source link

terminateInstance does not terminate the WebView instance from the app #174

Closed ElAgroudyA closed 2 months ago

ElAgroudyA commented 3 months ago

tealium-react-native version: 2.4.0 Platfrom: Android/iOS

My case is that I initialize Tealium with user login, then destroy Tealium instance by calling Tealium.terminateInstance() on user logout. When I login with different/or same user (without closing the app) a new instance gets created but the old instance did not get deleted from the app as seen in the dev inspector.

Expected: Tealium.terminateInstance() should terminate the WebView and delete the instance.

Actual: Tealium.terminateInstance() does not terminate the WebView instance, it stays there but inactive.

Screenshots:

Enricoza commented 3 months ago

Hi @ElAgroudyA, thank you for opening this. We will look into this and let you know shortly.

Enricoza commented 3 months ago

Hi again @ElAgroudyA, from my tests this doesn't appear to happen. Did you manage to reproduce the issue with the sample app linked in this repo? Alternatively can you share the initialization code you are using? And maybe the logs when the issue happens?

Remember to redact any sensitive information if you are adding anything to this issue or just open a ticket to https://support.tealiumiq.com/ with the full log and code.

ElAgroudyA commented 3 months ago

Hello @Enricoza,

Thanks for getting back. Attached below are the initialization code and config used to initialize Tealium.

init config
Enricoza commented 3 months ago

Are you sure this is everything? Why are you adding RemoteCommands as a Dispatcher but then don't configure any Remote Command?

Also can you share the trackView and trackEvent implementations?

Finally can you share the logs in a ticket at https://support.tealiumiq.com/?

ElAgroudyA commented 3 months ago

I have Remote Commands but I've removed them not to confuse you, will attach full code. Also attaching trackView and trackEvent. But I don't get what logs do you mean ?

mainInit Screenshot 2024-05-28 at 12 29 53 PM
Enricoza commented 3 months ago

Thanks for the details. I mean the logs printed to the console by XCode or Android Studio, printed by the tealium sdk. They might be helpful to identify what is going on in your case.

ElAgroudyA commented 3 months ago

There is nothing in the logs being printed by Tealium on logging out (terminating the instance).

ElAgroudyA commented 3 months ago

Hello @Enricoza ,

Any updates regarding this issue ?

craigrouse commented 3 months ago

@ElAgroudyA yes - we're working on a resolution at the moment. It looks like an issue in our Android SDK, though we are unable to reproduce the issue at all on iOS. This would indicate that there's something else going on on iOS that's causing the webview to hang around after you terminate the Tealium instance. It might be best to troubleshoot this on a call, so if you'd like to do that, please raise a ticket at support.tealiumiq.com, and we can arrange that. For the Android side of things, we hope to have a resolution very soon.

ElAgroudyA commented 3 months ago

Hello @craigrouse ,

Thank you, let me tell you the steps to produce it on iOS

Put in mind my use case (I start tealium on user login and destorys the instance on user logout). For the first app launch and first login it will work normally and destroy normally, if I logged in again with the same app instance/launch (did not close the app or minimize it) it will get bugged. It will start new instances on login but wont destory them on logout.

craigrouse commented 3 months ago

@ElAgroudyA we tested with this exact scenario, and couldn't reproduce it on iOS. We'll take another look, but I think reviewing this with you on a call will be most efficient.

ElAgroudyA commented 2 months ago

Hello,

I've been investigating in the iOS issue and found out that it happens when I turn on the 'AppDynamics' SDK Any idea why would this happen?

https://www.npmjs.com/package/@appdynamics/react-native-agent

Thanks in advance @Enricoza @craigrouse

craigrouse commented 2 months ago

@ElAgroudyA Thanks for the update. We're not familiar with the AppDynamics SDK, but after a quick glance at their docs, it appears they do performance instrumentation - is that correct? Chances are, they are probably doing a lot of swizzling under the hood, and there's a chance that this is creating a strong reference to our webview somewhere. Unfortunately, I think you'll need to take this up with AppDynamics' support team. If they need any input from us, we'd be glad to help - just create a support ticket at support.tealiumiq.com. Sorry we can't be of further assistance.

ElAgroudyA commented 2 months ago

Hello @craigrouse @Enricoza ,

any updates regarding the android part of the issue ?

craigrouse commented 2 months ago

@ElAgroudyA yes - the fix for Android will be released in the next couple of days.

tamayok commented 2 months ago

@ElAgroudyA the latest release addresses this issue. Please check it out.

ElAgroudyA commented 1 month ago

@tamayok , the issue still exists in the latest version on android. Starting multiple instances doesn't close the old ones.