lint: delete trailing whitespaces
This commit is contained in:
parent
2ba6917710
commit
ed387069a4
59 changed files with 624 additions and 623 deletions
|
|
@ -12,33 +12,33 @@ import UIKit
|
|||
class SecurePasteboard {
|
||||
public static let shared = SecurePasteboard()
|
||||
private var backgroundTaskID = UIBackgroundTaskInvalid
|
||||
|
||||
|
||||
func copy(textToCopy: String?, expirationTime: Double = 45) {
|
||||
// copy to the pasteboard
|
||||
UIPasteboard.general.string = textToCopy ?? ""
|
||||
|
||||
|
||||
// clean the pasteboard after expirationTime
|
||||
guard expirationTime > 0 else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// exit the existing background task, if any
|
||||
if backgroundTaskID != UIBackgroundTaskInvalid {
|
||||
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid)
|
||||
self.backgroundTaskID = UIBackgroundTaskInvalid
|
||||
}
|
||||
|
||||
|
||||
backgroundTaskID = UIApplication.shared.beginBackgroundTask(expirationHandler: { [weak self] in
|
||||
UIPasteboard.general.string = ""
|
||||
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid)
|
||||
self?.backgroundTaskID = UIBackgroundTaskInvalid
|
||||
})
|
||||
|
||||
|
||||
DispatchQueue.global(qos: .utility).asyncAfter(deadline: .now() + expirationTime) { [weak self] in
|
||||
UIPasteboard.general.string = ""
|
||||
UIApplication.shared.endBackgroundTask(UIBackgroundTaskInvalid)
|
||||
self?.backgroundTaskID = UIBackgroundTaskInvalid
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue