How to remove important label in [Gmail]/Important folder ?
sasinderann opened this issue · 0 comments
sasinderann commented
Here is the chunk code I have used, It works if the folders are other than [Gmail]/important.
IMAPFolderQueue = OperationQueue()
IMAPFolderQueue?.name = IMAPFolderQueuesNames.storeLabelsOperation.name()
IMAPFolderQueue?.qualityOfService = .background
let storeLabelsOperationQ = BlockOperation()
let semaphore = DispatchSemaphore(value: 0)
let uidSet = MCOIndexSet()
for uid in uids {
uidSet.add(MCOIndexSet(index: UInt64(uid)))
}
storeLabelsOperationQ.addExecutionBlock {
let storeLabelsOperation = self.mailCoreIMAPSession?.storeLabelsOperation(withFolder: folderPath, uids: uidSet, kind: kind, labels: labels)
storeLabelsOperation?.start({ (error) in
guard error == nil else {
semaphore.signal()
return
}
semaphore.signal()
status = true
return
})
semaphore.wait()
}
storeLabelsOperationQ.completionBlock = {
getCompleted(status)
}
IMAPFolderQueue?.addOperation(storeLabelsOperationQ)
Thanks in advance !