-
Notifications
You must be signed in to change notification settings - Fork 239
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
0.2.x: fix lifecycle if pass lifecycleOwner (Activity, Fragment) to Scarlet.… #71
base: 0.2.x
Are you sure you want to change the base?
Conversation
… implement LifecycleObserver
Any news in merging this? I also have this issue and have look at the code, it indeed only output |
@aaulia Now that I have more experience in working with WebSocket via Tider Scarlet, I think this PR isn't necessary. But if you have one special case which have to use and you think this PR will born for your issue, you will get it in here |
@hantrungkien could you elaborate? Am I using Scarlet wrong? My use case is to tie the Scarlet Lilfecycle to an Activity Lifecycle, so when the Activity is started it would open a connection and when the Activity destroyed, Scarlet would close and shutdown. But what happen now is, when the Activity is destroyed, Scarlet will close, and then immediately re-open, the connection. |
@aaulia |
thanks for the contribution! the lifecycle owner module is an example to show how android lifecycle would be intergraded. but i'm open to suggestions to make it extensible. |
Making some of the class |
We're facing the same issue in both |
is the scarlet-lifecycle-android module not included in the 0.1.9 version of the library. I am not able to find AndroidLifecycle class in this build. |
@vrjgamer have you tried 0.2.4 branch? |
I haven't, let me check that out. |
If we setup Scarlet with lifecycleOwner from Activity or Fragment then when onDestroy them Lifecycle's Scarlet will still retry again.
After debug I found this issue by the extension function List.combine(). In this only check and return Started or Stopped. If in list contains any state = Completed, it must have return Completed to Scarlet know observeWebSocketEvent which registed was completed.
unregister connectivity broadcast receiver when lifecycleState = Completed in FlowableLifecycle