mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
36 lines
920 B
Swift
36 lines
920 B
Swift
//
|
|
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import PromiseKit
|
|
|
|
@objc(SSKRotateSignedPreKeyOperation)
|
|
public class RotateSignedPreKeyOperation: OWSOperation {
|
|
private var tsAccountManager: TSAccountManager {
|
|
return TSAccountManager.sharedInstance()
|
|
}
|
|
|
|
private var primaryStorage: OWSPrimaryStorage {
|
|
return OWSPrimaryStorage.shared()
|
|
}
|
|
|
|
public override func run() {
|
|
Logger.debug("")
|
|
|
|
guard tsAccountManager.isRegistered() else {
|
|
Logger.debug("skipping - not registered")
|
|
return
|
|
}
|
|
|
|
DispatchQueue.global().async {
|
|
SessionManagementProtocol.rotateSignedPreKey()
|
|
self.reportSuccess()
|
|
}
|
|
}
|
|
|
|
override public func didFail(error: Error) {
|
|
Logger.debug("don't report SPK rotation failure w/ non NetworkManager error: \(error)")
|
|
}
|
|
}
|