Skip to content
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

Added sleep prevention during file transfer #107

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Polyfish0
Copy link

When I was transferring a large file, my MacBook went into sleep mode and this caused the transfer to stop. The screen can still dim or turn off. But MacOS itself does not go into sleep mode.

NearbyShare/SleepManager.swift Outdated Show resolved Hide resolved
NearbyShare/NearbyConnection.swift Outdated Show resolved Hide resolved
@@ -329,6 +329,7 @@ class InboundNearbyConnection: NearbyConnection{
private func acceptTransfer(){
do{
for (id, file) in transferredFiles{
SleepManager.shared.disableSleep()

Choose a reason for hiding this comment

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

Could you move this outside of the for loop.
also you enableSleep when the connection is terminated, why not enableSleep after the for loop?
it is quite disconnect to have disable in this file and enable in the other file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants