Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Conversation

@rosen-vladimirov
Copy link
Collaborator

In case iOS Device is detached, the IOSDevice instance is kept alive. The reason is the handler for device logs, that IOSDevice passes to iOSDeviceOperations.
As iOSDeviceOperations is still alive, the IOSDevice instance is also alive. Reattaching the same device will cause duplicate logs. Detaching and attaching it again will lead to additional logs.

In order to fix the issue, convert iOSDeviceOpertations to event emitter and emit event when there's data for logging. Each IOSDevice will add handler for the event and will do its logic.
In case device is detached (i.e. DeviceLost event is fired in DevicesService), call a newly added method to the specific IDevice instance. It's purpose is to clean the used resource.
For iOS device, this method will remove the handler for devceLogData event of iOSDeviceOperations.

In case iOS Device is detached, the `IOSDevice` instance is kept alive. The reason is the handler for device logs, that `IOSDevice` passes to `iOSDeviceOperations`.
As `iOSDeviceOperations` is still alive, the `IOSDevice` instance is also alive. Reattaching the same device will cause duplicate logs. Detaching and attaching it again will lead to additional logs.

In order to fix the issue, convert `iOSDeviceOpertations` to event emitter and emit event when there's data for logging. Each `IOSDevice` will add handler for the event and will do its logic.
In case device is detached (i.e. `DeviceLost` event is fired in `DevicesService`), call a newly added method to the specific `IDevice` instance. It's purpose is to clean the used resource.
For iOS device, this method will remove the handler for `devceLogData` event of `iOSDeviceOperations`.
Copy link
Contributor

@Mitko-Kerezov Mitko-Kerezov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks okay to me

@rosen-vladimirov rosen-vladimirov merged commit 0812ce9 into master Nov 7, 2017
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/fix-sidekick-justlaunch branch November 7, 2017 09:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants