Migrate to Swift 4.
This commit is contained in:
parent
28e26e1f75
commit
da5ae63bbc
|
@ -80,7 +80,7 @@ import CloudKit
|
|||
// backups can reuse the same record.
|
||||
@objc
|
||||
public class func savePersistentFileOnceToCloud(fileId: String,
|
||||
fileUrlBlock: @escaping (()) -> URL?,
|
||||
fileUrlBlock: @escaping () -> URL?,
|
||||
success: @escaping (String) -> Void,
|
||||
failure: @escaping (Error) -> Void) {
|
||||
saveFileOnceToCloud(recordName: recordNameForPersistentFile(fileId: fileId),
|
||||
|
@ -208,7 +208,7 @@ import CloudKit
|
|||
@objc
|
||||
public class func saveFileOnceToCloud(recordName: String,
|
||||
recordType: String,
|
||||
fileUrlBlock: @escaping (()) -> URL?,
|
||||
fileUrlBlock: @escaping () -> URL?,
|
||||
success: @escaping (String) -> Void,
|
||||
failure: @escaping (Error) -> Void) {
|
||||
|
||||
|
@ -220,7 +220,7 @@ import CloudKit
|
|||
success(recordName)
|
||||
} else {
|
||||
// No record found, saving new record.
|
||||
guard let fileUrl = fileUrlBlock(()) else {
|
||||
guard let fileUrl = fileUrlBlock() else {
|
||||
Logger.error("\(self.logTag) error preparing file for upload.")
|
||||
failure(OWSErrorWithCodeDescription(.exportBackupError,
|
||||
NSLocalizedString("BACKUP_EXPORT_ERROR_SAVE_FILE_TO_CLOUD_FAILED",
|
||||
|
@ -242,7 +242,7 @@ import CloudKit
|
|||
|
||||
@objc
|
||||
public class func deleteRecordsFromCloud(recordNames: [String],
|
||||
success: @escaping (()) -> Void,
|
||||
success: @escaping () -> Void,
|
||||
failure: @escaping (Error) -> Void) {
|
||||
deleteRecordsFromCloud(recordNames: recordNames,
|
||||
remainingRetries: maxRetries,
|
||||
|
@ -252,7 +252,7 @@ import CloudKit
|
|||
|
||||
private class func deleteRecordsFromCloud(recordNames: [String],
|
||||
remainingRetries: Int,
|
||||
success: @escaping (()) -> Void,
|
||||
success: @escaping () -> Void,
|
||||
failure: @escaping (Error) -> Void) {
|
||||
|
||||
let recordIDs = recordNames.map { CKRecordID(recordName: $0) }
|
||||
|
@ -264,7 +264,7 @@ import CloudKit
|
|||
label: "Delete Records")
|
||||
switch outcome {
|
||||
case .success:
|
||||
success(())
|
||||
success()
|
||||
case .failureDoNotRetry(let outcomeError):
|
||||
failure(outcomeError)
|
||||
case .failureRetryAfterDelay(let retryDelay):
|
||||
|
@ -466,7 +466,7 @@ import CloudKit
|
|||
@objc
|
||||
public class func downloadFileFromCloud(recordName: String,
|
||||
toFileUrl: URL,
|
||||
success: @escaping (()) -> Void,
|
||||
success: @escaping () -> Void,
|
||||
failure: @escaping (Error) -> Void) {
|
||||
|
||||
downloadFromCloud(recordName: recordName,
|
||||
|
@ -475,7 +475,7 @@ import CloudKit
|
|||
DispatchQueue.global().async {
|
||||
do {
|
||||
try FileManager.default.copyItem(at: asset.fileURL, to: toFileUrl)
|
||||
success(())
|
||||
success()
|
||||
} catch {
|
||||
Logger.error("\(self.logTag) couldn't copy asset file: \(error).")
|
||||
failure(invalidServiceResponseError())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
@ -38,7 +38,7 @@ import UIKit
|
|||
|
||||
var acceptableSubstring = ""
|
||||
|
||||
for (_, char) in replacementString.characters.enumerated() {
|
||||
for (_, char) in replacementString.enumerated() {
|
||||
var maybeAcceptableSubstring = acceptableSubstring
|
||||
maybeAcceptableSubstring.append(char)
|
||||
if (byteLength(maybeAcceptableSubstring) <= availableSpace) {
|
||||
|
@ -48,7 +48,7 @@ import UIKit
|
|||
}
|
||||
}
|
||||
|
||||
textField.text = (existingString as NSString).replacingCharacters(in: editingRange, with:acceptableSubstring)
|
||||
textField.text = (existingString as NSString).replacingCharacters(in: editingRange, with: acceptableSubstring)
|
||||
|
||||
// We've already handled any valid editing manually, so prevent further changes.
|
||||
return false
|
||||
|
|
|
@ -20,7 +20,7 @@ public class OWS106EnsureProfileComplete: OWSDatabaseMigration {
|
|||
|
||||
// Overriding runUp since we have some specific completion criteria which
|
||||
// is more likely to fail since it involves network requests.
|
||||
override public func runUp(completion:@escaping ((Void)) -> Void) {
|
||||
override public func runUp(completion:@escaping () -> Void) {
|
||||
let job = CompleteRegistrationFixerJob(completionHandler: { (didSucceed) in
|
||||
|
||||
if (didSucceed) {
|
||||
|
@ -30,7 +30,7 @@ public class OWS106EnsureProfileComplete: OWSDatabaseMigration {
|
|||
Logger.error("\(self.TAG) Failed.")
|
||||
}
|
||||
|
||||
completion(())
|
||||
completion()
|
||||
})
|
||||
|
||||
type(of: self).sharedCompleteRegistrationFixerJob = job
|
||||
|
|
Loading…
Reference in New Issue