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

Cancelled Seafile Activity always returns "completed = true" #322

Open
seclorum opened this issue Nov 18, 2021 · 0 comments
Open

Cancelled Seafile Activity always returns "completed = true" #322

seclorum opened this issue Nov 18, 2021 · 0 comments

Comments

@seclorum
Copy link

seclorum commented Nov 18, 2021

Integrating the SEAFile ActivityViewController in my app, I am trying to properly handle the case where the user hits the "Cancel" button in the SEAFile VC - so that I can unwind any preparation done prior to sharing.

The following code is used:

    // Make the activityViewContoller which shows the share-view
    let shareViewController = UIActivityViewController(activityItems: filesToShare, applicationActivities: nil)

    // Show the share-view
    self.present(shareViewController, animated: true, completion: {
    // print("Activity finished...")
    })
    shareViewController.completionWithItemsHandler = { activity, completed, items, error in
        if !completed {
            // handle task not completed, put the original file back in place ..
            let _ = FileManager.default.secureMoveItem(at: destinationFileURL, to: sourceFileURL)
                        
            print("Restored database file from: " + destinationFileURL.absoluteString + " back to: " + sourceFileURL.absoluteString)
            return
        }
        else {
            if (activity != nil) {
                self.createEmptyDB()
            }
        }
                
        self.updateUI()
    }
}

The trouble is, "completed" is always true - even if the user cancels, and activity is always "com.seafile.seafilePro.SeafAction", so it cannot be checked for .. meaning that no matter if the user cancels the SEAFile upload, the "self.createEmptyDB()" function is called.

Seems to me this is a bug in SEAFile ActivityView - it should not return an activity if the user cancels, but I am not sure. Can other devs check this code and see if I'm missing something - otherwise, seems like a bug in SEAFile.

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

No branches or pull requests

1 participant