-
Notifications
You must be signed in to change notification settings - Fork 12
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
Close conversation screen #35
Comments
Hi, @Esteban-ortega-roy.
|
Thank you for your answer @leegeunhyeok
Yes, that's what I tried using this example repo: bridge + native code to rootController.dimiss. It seems to work
I have an open ticket with Zendesk talking about this. So far the only workaround they gave me is what we've discussed above about iOS, I'm still waiting for workaround for Android. I also asked them if it would be possible that they include this feature in their SDKs, for me it makes sense to have a ".closeMessaging", just as they have ".showMessaging". I'll update this ticket with the information I got from them, just in case it helps to someone else. |
Thanks! I'll follow up too. |
Hi @leegeunhyeok thank you for creating this package! Did you or @Esteban-ortega-roy hear back from Zendesk? |
@pwfcurry Not yet. |
Hi! Here's what we did to handle the "closeMessaging" behaviour on Android Unfortunately, having a "closeMessagingView" method might not be the best solution here as that would require the activity to run/call that code. Zendesk chat runs on a separate Activity, so we need to work around that. We have a similar use case where the application needs to close the chat window if the app has been in background for too long. Having tried a few things, we eventually settled for a new custom native module that listens to the Activity changes: class ActivityLifecycleListener : Application.ActivityLifecycleCallbacks {
override fun onActivityResumed(activity: Activity) {
if (activity.javaClass.simpleName != "MainActivity" && areConditionsMet()) {
activity.finish()
}
trackActivityResumed(activity.javaClass.simpleName);
}
override fun onActivityStopped(activity: Activity) {
trackActivityStopped(activity.javaClass.simpleName);
} (just an example with the gist of what we did, this is not actual code). Remember to override all methods within this public interface. Last thing to do is to register the listener. private fun registerLifecycleListener() {
val applicationContext = appContext.reactContext?.applicationContext as? Application
applicationContext?.registerActivityLifecycleCallbacks(ActivityLifecycleListener())
} (so you would call this within the or, if you're patching the init {
val applicationContext = reactContext.applicationContext as? Application
applicationContext?.registerActivityLifecycleCallbacks(ActivityLifecycleListener())
} Hope this helps! |
This is not a bug but a question:
Context: If the app is sent to background and opened it again X minutes later, the user has to authenticate/login again, just like most baking apps.
Problem: If the conversation was opened before the app was sent to background, when the app comes to foreground again, the conversation is visible.
Goal: Programmatically close the conversation when the app is sent to background.
I've tried using "reset" to invalidate the instance but that only makes the conversation unresponsive (can't send messages) but it is still visible/readable.
rootController.dismiss(animated: true, completion: nil)
, and it seems to work, but I have no idea about Swift and I don't even know how we could do this for Android too.The text was updated successfully, but these errors were encountered: