Respond to CR.
This commit is contained in:
parent
39f1be65f3
commit
4ab281346a
|
@ -263,7 +263,7 @@ CHECKOUT OPTIONS:
|
|||
:commit: 358ec16833d9b8b6e1410d83fa47c819c533fe91
|
||||
:git: https://github.com/signalapp/SignalCoreKit.git
|
||||
SignalMetadataKit:
|
||||
:commit: 0434fc7ade6e0eb27540291357a3382476dece52
|
||||
:commit: 954cbfa767e130626d2e87cc029769a1977c8edd
|
||||
:git: https://github.com/signalapp/SignalMetadataKit-Private
|
||||
SocketRocket:
|
||||
:commit: 9f9563a83cd8960503074aa8de72206f83fb7a69
|
||||
|
|
2
Pods
2
Pods
|
@ -1 +1 @@
|
|||
Subproject commit 4c450a8a1702d3b00eaa476dbddff487d3a91c53
|
||||
Subproject commit 536fb61dc6b3b29db9ffe9210bbff1eefb75bef9
|
|
@ -107,9 +107,9 @@ public class AccountManager: NSObject {
|
|||
func updatePushTokens(pushToken: String, voipToken: String) -> Promise<Void> {
|
||||
return Promise { fulfill, reject in
|
||||
tsAccountManager.registerForPushNotifications(pushToken: pushToken,
|
||||
voipToken: voipToken,
|
||||
success: fulfill,
|
||||
failure: reject)
|
||||
voipToken: voipToken,
|
||||
success: fulfill,
|
||||
failure: reject)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,14 +117,7 @@ public class AccountManager: NSObject {
|
|||
tsAccountManager.setIsManualMessageFetchEnabled(true)
|
||||
|
||||
// Try to update the account attributes to reflect this change.
|
||||
let request = OWSRequestFactory.updateAttributesRequest()
|
||||
let promise: Promise<Void> = self.networkManager.makePromise(request: request)
|
||||
.then(execute: { (_, _) in
|
||||
Logger.info("updated server with account attributes to enableManualFetching")
|
||||
}).catch(execute: { (error) in
|
||||
Logger.error("failed to update server with account attributes with error: \(error)")
|
||||
})
|
||||
return promise
|
||||
return SignalServiceRestClient().updateAcountAttributes()
|
||||
}
|
||||
|
||||
// MARK: Turn Server
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
//
|
||||
|
||||
import Foundation
|
||||
import SignalServiceKit
|
||||
|
||||
@objc
|
||||
public class OWS111UDAttributesMigration: OWSDatabaseMigration {
|
||||
|
@ -32,8 +33,7 @@ public class OWS111UDAttributesMigration: OWSDatabaseMigration {
|
|||
}
|
||||
|
||||
private func doMigration(completion: @escaping OWSDatabaseMigrationCompletion) {
|
||||
let request = OWSRequestFactory.updateAttributesRequest()
|
||||
self.networkManager.makePromise(request: request).then(execute: { (_, _) in
|
||||
return SignalServiceRestClient().updateAcountAttributes().then(execute: { _ in
|
||||
self.dbReadWriteConnection().readWrite { transaction in
|
||||
self.save(with: transaction)
|
||||
}
|
||||
|
|
|
@ -10,10 +10,12 @@ protocol SignalServiceClient {
|
|||
func registerPreKeys(identityKey: IdentityKey, signedPreKeyRecord: SignedPreKeyRecord, preKeyRecords: [PreKeyRecord]) -> Promise<Void>
|
||||
func setCurrentSignedPreKey(_ signedPreKey: SignedPreKeyRecord) -> Promise<Void>
|
||||
func requestUDSenderCertificate() -> Promise<Data>
|
||||
func updateAcountAttributes() -> Promise<Void>
|
||||
}
|
||||
|
||||
/// Based on libsignal-service-java's PushServiceSocket class
|
||||
class SignalServiceRestClient: SignalServiceClient {
|
||||
@objc
|
||||
public class SignalServiceRestClient: NSObject, SignalServiceClient {
|
||||
|
||||
var networkManager: TSNetworkManager {
|
||||
return TSNetworkManager.shared()
|
||||
|
@ -70,4 +72,15 @@ class SignalServiceRestClient: SignalServiceClient {
|
|||
|
||||
return try parser.requiredBase64EncodedData(key: "certificate")
|
||||
}
|
||||
|
||||
public func updateAcountAttributes() -> Promise<Void> {
|
||||
let request = OWSRequestFactory.updateAttributesRequest()
|
||||
let promise: Promise<Void> = networkManager.makePromise(request: request)
|
||||
.then(execute: { (_, _) in
|
||||
Logger.info("updated account attributes on server")
|
||||
}).catch(execute: { (error) in
|
||||
Logger.error("failed to update account attributes on server with error: \(error)")
|
||||
})
|
||||
return promise
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue