Convert to new Promise library
This commit is contained in:
parent
e07923ee39
commit
2814ab7629
@ -5,7 +5,6 @@
|
||||
import UserNotifications
|
||||
import SignalMessaging
|
||||
import SignalServiceKit
|
||||
import PromiseKit
|
||||
|
||||
// The lifecycle of the NSE looks something like the following:
|
||||
// 1) App receives notification
|
||||
|
||||
4
Podfile
4
Podfile
@ -11,7 +11,7 @@ source 'https://cdn.cocoapods.org/'
|
||||
|
||||
pod 'SwiftProtobuf', ">= 1.14.0"
|
||||
|
||||
pod 'SignalCoreKit', git: 'https://github.com/signalapp/SignalCoreKit', testspecs: ["Tests"]
|
||||
pod 'SignalCoreKit', git: 'ssh://git@github.com/signalapp/SignalCoreKit-Private', testspecs: ["Tests"], branch: 'nt/promises'
|
||||
# pod 'SignalCoreKit', path: '../SignalCoreKit', testspecs: ["Tests"]
|
||||
|
||||
pod 'SignalClient', git: 'https://github.com/signalapp/libsignal-client.git', testspecs: ["Tests"]
|
||||
@ -33,8 +33,6 @@ pod 'ZKGroup', git: 'https://github.com/signalapp/zkgroup', testspecs: ["Tests"]
|
||||
pod 'SignalArgon2', git: 'https://github.com/signalapp/Argon2.git', submodules: true, testspecs: ["Tests"]
|
||||
# pod 'SignalArgon2', path: '../Argon2', testspecs: ["Tests"]
|
||||
|
||||
pod 'PromiseKit'
|
||||
|
||||
# pod 'GRDB.swift/SQLCipher', path: '../GRDB.swift'
|
||||
pod 'GRDB.swift/SQLCipher'
|
||||
|
||||
|
||||
33
Podfile.lock
33
Podfile.lock
@ -83,15 +83,6 @@ PODS:
|
||||
- SwiftNIOHTTP1 (~> 2.18)
|
||||
- SwiftProtobuf (~> 1.5)
|
||||
- OpenSSL-Universal (1.1.1100)
|
||||
- PromiseKit (6.13.1):
|
||||
- PromiseKit/CorePromise (= 6.13.1)
|
||||
- PromiseKit/Foundation (= 6.13.1)
|
||||
- PromiseKit/UIKit (= 6.13.1)
|
||||
- PromiseKit/CorePromise (6.13.1)
|
||||
- PromiseKit/Foundation (6.13.1):
|
||||
- PromiseKit/CorePromise
|
||||
- PromiseKit/UIKit (6.13.1):
|
||||
- PromiseKit/CorePromise
|
||||
- PureLayout (3.1.4)
|
||||
- Reachability (3.2)
|
||||
- SAMKeychain (1.5.3)
|
||||
@ -120,11 +111,9 @@ PODS:
|
||||
- SignalCoreKit
|
||||
- SwiftProtobuf
|
||||
- SignalRingRTC (2.10.8):
|
||||
- PromiseKit
|
||||
- SignalCoreKit
|
||||
- SignalRingRTC/WebRTC (= 2.10.8)
|
||||
- SignalRingRTC/WebRTC (2.10.8):
|
||||
- PromiseKit
|
||||
- SignalCoreKit
|
||||
- SignalServiceKit (0.9.0):
|
||||
- AFNetworking/NSURLSession
|
||||
@ -136,7 +125,6 @@ PODS:
|
||||
- libwebp
|
||||
- Mantle
|
||||
- OpenSSL-Universal
|
||||
- PromiseKit (~> 6.0)
|
||||
- Reachability
|
||||
- SAMKeychain
|
||||
- SignalArgon2
|
||||
@ -156,7 +144,6 @@ PODS:
|
||||
- libwebp
|
||||
- Mantle
|
||||
- OpenSSL-Universal
|
||||
- PromiseKit (~> 6.0)
|
||||
- Reachability
|
||||
- SAMKeychain
|
||||
- SignalArgon2
|
||||
@ -236,15 +223,14 @@ DEPENDENCIES:
|
||||
- Mantle (from `https://github.com/signalapp/Mantle`, branch `signal-master`)
|
||||
- MobileCoin (from `https://github.com/mobilecoinofficial/MobileCoin-Swift.git`, tag `v1.1.0`)
|
||||
- OpenSSL-Universal (from `https://github.com/signalapp/GRKOpenSSLFramework`)
|
||||
- PromiseKit
|
||||
- PureLayout
|
||||
- Reachability
|
||||
- SignalArgon2 (from `https://github.com/signalapp/Argon2.git`)
|
||||
- SignalArgon2/Tests (from `https://github.com/signalapp/Argon2.git`)
|
||||
- SignalClient (from `https://github.com/signalapp/libsignal-client.git`)
|
||||
- SignalClient/Tests (from `https://github.com/signalapp/libsignal-client.git`)
|
||||
- SignalCoreKit (from `https://github.com/signalapp/SignalCoreKit`)
|
||||
- SignalCoreKit/Tests (from `https://github.com/signalapp/SignalCoreKit`)
|
||||
- "SignalCoreKit (from `ssh://git@github.com/signalapp/SignalCoreKit-Private`, branch `nt/promises`)"
|
||||
- "SignalCoreKit/Tests (from `ssh://git@github.com/signalapp/SignalCoreKit-Private`, branch `nt/promises`)"
|
||||
- "SignalMetadataKit (from `ssh://git@github.com/signalapp/SignalMetadataKit`, branch `feature/SignalClient-adoption`)"
|
||||
- "SignalMetadataKit/Tests (from `ssh://git@github.com/signalapp/SignalMetadataKit`, branch `feature/SignalClient-adoption`)"
|
||||
- SignalRingRTC (from `ThirdParty/SignalRingRTC.podspec`)
|
||||
@ -277,7 +263,6 @@ SPEC REPOS:
|
||||
- libwebp
|
||||
- Logging
|
||||
- lottie-ios
|
||||
- PromiseKit
|
||||
- PureLayout
|
||||
- Reachability
|
||||
- SAMKeychain
|
||||
@ -322,7 +307,8 @@ EXTERNAL SOURCES:
|
||||
SignalClient:
|
||||
:git: https://github.com/signalapp/libsignal-client.git
|
||||
SignalCoreKit:
|
||||
:git: https://github.com/signalapp/SignalCoreKit
|
||||
:branch: nt/promises
|
||||
:git: "ssh://git@github.com/signalapp/SignalCoreKit-Private"
|
||||
SignalMetadataKit:
|
||||
:branch: feature/SignalClient-adoption
|
||||
:git: "ssh://git@github.com/signalapp/SignalMetadataKit"
|
||||
@ -368,8 +354,8 @@ CHECKOUT OPTIONS:
|
||||
:commit: ffd2fe1664cd23d1ae7dc5d3a7c6c33bc702b93e
|
||||
:git: https://github.com/signalapp/libsignal-client.git
|
||||
SignalCoreKit:
|
||||
:commit: bacb5ab174e8638458ab2032a7a472422efdf165
|
||||
:git: https://github.com/signalapp/SignalCoreKit
|
||||
:commit: 6cf76bc71dd15c1c4e19391d4da9e06d639dd883
|
||||
:git: "ssh://git@github.com/signalapp/SignalCoreKit-Private"
|
||||
SignalMetadataKit:
|
||||
:commit: 4c8ddf0b04afd179f00d7b024b1c611e3ddd2b7d
|
||||
:git: "ssh://git@github.com/signalapp/SignalMetadataKit"
|
||||
@ -407,7 +393,6 @@ SPEC CHECKSUMS:
|
||||
Mantle: 2fa750afa478cd625a94230fbf1c13462f29395b
|
||||
MobileCoin: 59f940b9f71e6fdcfd206150ebda839a132b58be
|
||||
OpenSSL-Universal: d8fb58afffcf2dafe4ad99e17efe236bcd216c2e
|
||||
PromiseKit: 28fda91c973cc377875d8c0ea4f973013c05b6db
|
||||
PureLayout: f08c01b8dec00bb14a1fefa3de4c7d9c265df85e
|
||||
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
|
||||
SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c
|
||||
@ -415,8 +400,8 @@ SPEC CHECKSUMS:
|
||||
SignalClient: 2353bbeaaa062b98457690c26e1d5e3c2cb772a0
|
||||
SignalCoreKit: 87da14c58d57760793b892ff03838c5ef2ce1167
|
||||
SignalMetadataKit: eb928ec98376ab5a6ef2108a7fcd3b2d792b8c65
|
||||
SignalRingRTC: 0b51c21e0424b156b45a28910c677b29b7840691
|
||||
SignalServiceKit: 5e25915a8275f4deff7f830a343c0fcb085d062b
|
||||
SignalRingRTC: 665575d98c82e766f9248e3bd66cb775e7e4b9e7
|
||||
SignalServiceKit: aaaad497e0597ea5049acfe04ac78cbc6e271583
|
||||
SQLCipher: d305a7bd9af4b64f095c79bdc1a1fa50f2a15116
|
||||
SSZipArchive: 41455d4b8d2b6ab93990820b50dc697c2554a322
|
||||
Starscream: 8aaf1a7feb805c816d0e7d3190ef23856f6665b9
|
||||
@ -434,6 +419,6 @@ SPEC CHECKSUMS:
|
||||
YYImage: f1ddd15ac032a58b78bbed1e012b50302d318331
|
||||
ZKGroup: 81ba58bf87b5614b03d49364db221390bf257dd7
|
||||
|
||||
PODFILE CHECKSUM: 4de3037acfe442a115b15e5f87d45cc73865bc86
|
||||
PODFILE CHECKSUM: 76ac182b70983a83ffd9c40a554d9653e61e1bd0
|
||||
|
||||
COCOAPODS: 1.10.1
|
||||
|
||||
2
Pods
2
Pods
@ -1 +1 @@
|
||||
Subproject commit f1206bdd95b378c817b9cbbccd61b612d41fb0a3
|
||||
Subproject commit 2f17b95a0409ba838a066ac9912f5110f351c1b5
|
||||
@ -4878,7 +4878,6 @@
|
||||
"${BUILT_PRODUCTS_DIR}/Logging/Logging.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Mantle/Mantle.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/MobileCoin/MobileCoin.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SAMKeychain/SAMKeychain.framework",
|
||||
@ -4931,7 +4930,6 @@
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mantle.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileCoin.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SAMKeychain.framework",
|
||||
@ -5012,7 +5010,6 @@
|
||||
"${BUILT_PRODUCTS_DIR}/Logging/Logging.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Mantle/Mantle.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/MobileCoin/MobileCoin.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SAMKeychain/SAMKeychain.framework",
|
||||
@ -5062,7 +5059,6 @@
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mantle.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileCoin.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SAMKeychain.framework",
|
||||
@ -5162,7 +5158,6 @@
|
||||
"${BUILT_PRODUCTS_DIR}/Logging/Logging.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Mantle/Mantle.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/MobileCoin/MobileCoin.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PromiseKit/PromiseKit.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/PureLayout/PureLayout.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
|
||||
"${BUILT_PRODUCTS_DIR}/SAMKeychain/SAMKeychain.framework",
|
||||
@ -5212,7 +5207,6 @@
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Logging.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Mantle.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MobileCoin.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PromiseKit.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/PureLayout.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
|
||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SAMKeychain.framework",
|
||||
|
||||
@ -1515,23 +1515,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>Copyright 2016-present, Max Howell; mxcl@me.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
</string>
|
||||
<key>License</key>
|
||||
<string>MIT</string>
|
||||
<key>Title</key>
|
||||
<string>PromiseKit</string>
|
||||
<key>Type</key>
|
||||
<string>PSGroupSpecifier</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>FooterText</key>
|
||||
<string>This code is distributed under the terms and conditions of the MIT license.
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#import "SignalApp.h"
|
||||
#import "ViewControllerUtils.h"
|
||||
#import <Intents/Intents.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/SignalCoreKit-Swift.h>
|
||||
#import <SignalCoreKit/iOSVersions.h>
|
||||
#import <SignalMessaging/AppSetup.h>
|
||||
#import <SignalMessaging/Environment.h>
|
||||
@ -1110,7 +1110,7 @@ void uncaughtExceptionHandler(NSException *exception)
|
||||
{
|
||||
OWSLogInfo(@"performing background fetch");
|
||||
AppReadinessRunNowOrWhenAppDidBecomeReadySync(^{
|
||||
[self.messageFetcherJob runObjc].then(^{
|
||||
[self.messageFetcherJob runObjc].done(^(id value) {
|
||||
// HACK: Call completion handler after n seconds.
|
||||
//
|
||||
// We don't currently have a convenient API to know when message fetching is *done* when
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import SignalRingRTC
|
||||
import PromiseKit
|
||||
|
||||
// All Observer methods will be invoked from the main thread.
|
||||
@objc(OWSCallServiceObserver)
|
||||
@ -745,7 +744,7 @@ extension CallService {
|
||||
|
||||
firstly {
|
||||
self.fetchGroupMembershipProof(for: thread)
|
||||
}.then(on: .main) { (proof: Data) -> Promise<PeekInfo> in
|
||||
}.then(on: .main) { (proof: Data) -> Guarantee<PeekInfo> in
|
||||
let sfuURL = DebugFlags.callingUseTestSFU.get() ? TSConstants.sfuTestURL : TSConstants.sfuURL
|
||||
return self.callManager.peekGroupCall(sfuUrl: sfuURL, membershipProof: proof, groupMembers: memberInfo)
|
||||
}.done(on: .main) { info in
|
||||
@ -919,9 +918,9 @@ extension CallService: CallManagerDelegate {
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done { _ in
|
||||
}.done(on: .main) { _ in
|
||||
// TODO: Tell RingRTC we succeeded in sending the message. API TBD
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
if error.isNetworkFailureOrTimeout {
|
||||
Logger.warn("Failed to send opaque message \(error)")
|
||||
} else if error is UntrustedIdentityError {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SignalRingRTC
|
||||
import WebRTC
|
||||
import SignalServiceKit
|
||||
@ -498,7 +497,7 @@ import SignalMessaging
|
||||
Logger.info("call: \(call)")
|
||||
|
||||
// Start the call, asynchronously.
|
||||
getIceServers().done { iceServers in
|
||||
getIceServers().done(on: .main) { iceServers in
|
||||
guard self.callService.currentCall === call else {
|
||||
Logger.debug("call has since ended")
|
||||
return
|
||||
@ -864,10 +863,10 @@ import SignalMessaging
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done {
|
||||
}.done(on: .main) {
|
||||
Logger.info("sent offer message to \(call.individualCall.thread.contactAddress) device: \((destinationDeviceId != nil) ? String(destinationDeviceId!) : "nil")")
|
||||
try self.callManager.signalingMessageDidSend(callId: callId)
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
Logger.error("failed to send offer message to \(call.individualCall.thread.contactAddress) with error: \(error)")
|
||||
self.callManager.signalingMessageDidFail(callId: callId)
|
||||
}
|
||||
@ -891,10 +890,10 @@ import SignalMessaging
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done {
|
||||
}.done(on: .main) {
|
||||
Logger.debug("sent answer message to \(call.individualCall.thread.contactAddress) device: \((destinationDeviceId != nil) ? String(destinationDeviceId!) : "nil")")
|
||||
try self.callManager.signalingMessageDidSend(callId: callId)
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
Logger.error("failed to send answer message to \(call.individualCall.thread.contactAddress) with error: \(error)")
|
||||
self.callManager.signalingMessageDidFail(callId: callId)
|
||||
}
|
||||
@ -931,10 +930,10 @@ import SignalMessaging
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done {
|
||||
}.done(on: .main) {
|
||||
Logger.debug("sent ice update message to \(call.individualCall.thread.contactAddress) device: \((destinationDeviceId != nil) ? String(destinationDeviceId!) : "nil")")
|
||||
try self.callManager.signalingMessageDidSend(callId: callId)
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
Logger.error("failed to send ice update message to \(call.individualCall.thread.contactAddress) with error: \(error)")
|
||||
callManager.signalingMessageDidFail(callId: callId)
|
||||
}
|
||||
@ -977,10 +976,10 @@ import SignalMessaging
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done {
|
||||
}.done(on: .main) {
|
||||
Logger.debug("sent hangup message to \(call.individualCall.thread.contactAddress) device: \((destinationDeviceId != nil) ? String(destinationDeviceId!) : "nil")")
|
||||
try self.callManager.signalingMessageDidSend(callId: callId)
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
Logger.error("failed to send hangup message to \(call.individualCall.thread.contactAddress) with error: \(error)")
|
||||
self.callManager.signalingMessageDidFail(callId: callId)
|
||||
}
|
||||
@ -1003,10 +1002,10 @@ import SignalMessaging
|
||||
transaction: transaction
|
||||
)
|
||||
}
|
||||
}.done {
|
||||
}.done(on: .main) {
|
||||
Logger.debug("sent busy message to \(call.individualCall.thread.contactAddress) device: \((destinationDeviceId != nil) ? String(destinationDeviceId!) : "nil")")
|
||||
try self.callManager.signalingMessageDidSend(callId: callId)
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
Logger.error("failed to send busy message to \(call.individualCall.thread.contactAddress) with error: \(error)")
|
||||
self.callManager.signalingMessageDidFail(callId: callId)
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import CallKit
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import WebRTC
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import SignalRingRTC
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class ConversationConfigurationSyncOperation: OWSOperation {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
|
||||
@objc(OWSSessionResetJobQueue)
|
||||
|
||||
@ -2,7 +2,6 @@
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
|
||||
@objc(OWSSyncPushTokensJob)
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
|
||||
public enum AccountManagerError: Error {
|
||||
@ -62,8 +61,8 @@ public class AccountManager: NSObject {
|
||||
return firstly {
|
||||
return self.pushRegistrationManager.requestPushTokens()
|
||||
}.then { (vanillaToken: String, voipToken: String?) -> Promise<String?> in
|
||||
let (pushPromise, pushResolver) = Promise<String>.pending()
|
||||
self.pushRegistrationManager.preauthChallengeResolver = pushResolver
|
||||
let (pushPromise, pushFuture) = Promise<String>.pending()
|
||||
self.pushRegistrationManager.preauthChallengeFuture = pushFuture
|
||||
|
||||
return self.accountServiceClient.requestPreauthChallenge(
|
||||
recipientId: recipientId,
|
||||
@ -322,7 +321,7 @@ public class AccountManager: NSObject {
|
||||
BenchEventComplete(eventId: "initial-contact-sync")
|
||||
}
|
||||
|
||||
return when(fulfilled: [storageServiceRestorePromise, initialSyncMessagePromise])
|
||||
return Promise.when(fulfilled: [storageServiceRestorePromise, initialSyncMessagePromise])
|
||||
}
|
||||
}
|
||||
|
||||
@ -334,7 +333,7 @@ public class AccountManager: NSObject {
|
||||
private func registerForTextSecure(verificationCode: String, pin: String?, checkForAvailableTransfer: Bool) -> Promise<RegistrationResponse> {
|
||||
let serverAuthToken = generateServerAuthToken()
|
||||
|
||||
return Promise<Any?> { resolver in
|
||||
return Promise<Any?> { future in
|
||||
guard let phoneNumber = tsAccountManager.phoneNumberAwaitingVerification else {
|
||||
throw OWSAssertionError("phoneNumberAwaitingVerification was unexpectedly nil")
|
||||
}
|
||||
@ -346,8 +345,8 @@ public class AccountManager: NSObject {
|
||||
checkForAvailableTransfer: checkForAvailableTransfer)
|
||||
|
||||
tsAccountManager.verifyAccount(request: request,
|
||||
success: resolver.fulfill,
|
||||
failure: resolver.reject)
|
||||
success: future.resolve,
|
||||
failure: future.reject)
|
||||
}.map(on: .global()) { responseObject throws -> RegistrationResponse in
|
||||
self.databaseStorage.write { transaction in
|
||||
self.tsAccountManager.setStoredServerAuthToken(serverAuthToken,
|
||||
@ -407,9 +406,9 @@ public class AccountManager: NSObject {
|
||||
}
|
||||
|
||||
private func createPreKeys() -> Promise<Void> {
|
||||
return Promise { resolver in
|
||||
TSPreKeyManager.createPreKeys(success: { resolver.fulfill(()) },
|
||||
failure: resolver.reject)
|
||||
return Promise { future in
|
||||
TSPreKeyManager.createPreKeys(success: { future.resolve() },
|
||||
failure: future.reject)
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,11 +427,11 @@ public class AccountManager: NSObject {
|
||||
// MARK: Message Delivery
|
||||
|
||||
func updatePushTokens(pushToken: String, voipToken: String?) -> Promise<Void> {
|
||||
return Promise { resolver in
|
||||
return Promise { future in
|
||||
tsAccountManager.registerForPushNotifications(pushToken: pushToken,
|
||||
voipToken: voipToken,
|
||||
success: { resolver.fulfill(()) },
|
||||
failure: resolver.reject)
|
||||
success: { future.resolve() },
|
||||
failure: future.reject)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import SignalServiceKit
|
||||
import MessageUI
|
||||
import PromiseKit
|
||||
|
||||
struct SupportEmailModel: Dependencies {
|
||||
|
||||
@ -168,12 +167,12 @@ final class ComposeSupportEmailOperation: NSObject {
|
||||
}
|
||||
|
||||
private func open(mailURL url: URL) -> Promise<Void> {
|
||||
Promise { (resolver) in
|
||||
Promise { future in
|
||||
UIApplication.shared.open(url, options: [:]) { (success) in
|
||||
if success {
|
||||
resolver.fulfill_()
|
||||
future.resolve()
|
||||
} else {
|
||||
resolver.reject(EmailError.failedToOpenURL)
|
||||
future.reject(EmailError.failedToOpenURL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SafariServices
|
||||
|
||||
@objc(OWSSupportConstants)
|
||||
@ -248,10 +247,9 @@ final class ContactSupportViewController: OWSTableViewController2 {
|
||||
comment: "Message for alert dialog presented when a support email failed to send")
|
||||
OWSActionSheets.showActionSheet(title: alertTitle, message: alertMessage)
|
||||
|
||||
}.finally(on: .main) {
|
||||
}.ensure(on: .main) {
|
||||
self.currentEmailComposeOperation = nil
|
||||
self.showSpinnerOnNextButton = false
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import PassKit
|
||||
import PromiseKit
|
||||
import BonMot
|
||||
|
||||
/* From BonMot 6.0.0: If you're targeting iOS 15 or higher, you may want to check out [AttributedString](https://developer.apple.com/documentation/foundation/attributedstring) instead.
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import AVFoundation
|
||||
import PromiseKit
|
||||
import Vision
|
||||
|
||||
@objc
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class PaymentsSendRecipientViewController: OWSViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class ProfileSettingsViewController: OWSTableViewController2 {
|
||||
@ -193,12 +192,12 @@ class ProfileSettingsViewController: OWSTableViewController2 {
|
||||
profileBioEmoji: normalizedBioEmoji,
|
||||
profileAvatarData: avatarData,
|
||||
userProfileWriter: .localUser)
|
||||
}.done { _ in
|
||||
}.done(on: .main) { _ in
|
||||
modalActivityIndicator.dismiss { [weak self] in
|
||||
AssertIsOnMainThread()
|
||||
self?.profileCompleted()
|
||||
}
|
||||
}.catch { error in
|
||||
}.catch(on: .main) { error in
|
||||
owsFailDebug("Error: \(error)")
|
||||
modalActivityIndicator.dismiss { [weak self] in
|
||||
AssertIsOnMainThread()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol AttachmentFormatPickerDelegate: AnyObject {
|
||||
func didTapCamera()
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
protocol AttachmentKeyboardDelegate {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import Foundation
|
||||
import Photos
|
||||
import PhotosUI
|
||||
import PromiseKit
|
||||
|
||||
protocol RecentPhotosDelegate: AnyObject {
|
||||
var isMediaLibraryAccessGranted: Bool { get }
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public protocol CameraFirstCaptureDelegate: AnyObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class BlockingAnnouncementOnlyView: UIStackView {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class BlockingGroupMigrationView: UIStackView {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// Caching builder used for a single CVC load.
|
||||
// CVC loads often build the same avatars over and over.
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
fileprivate extension CVComponentState {
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
public class CVComponentState: Equatable, Dependencies {
|
||||
let messageCellType: CVMessageCellType
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// CVItemViewState represents the transient, un-persisted values
|
||||
// that may affect item appearance.
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
|
||||
protocol CVLoadCoordinatorDelegate: UIScrollViewDelegate {
|
||||
@ -79,7 +78,7 @@ public class CVLoadCoordinator: NSObject {
|
||||
// TODO: Remove. This model will get stale.
|
||||
private let thread: TSThread
|
||||
|
||||
private var loadDidLandResolver: Resolver<Void>?
|
||||
private var loadDidLandFuture: Future<Void>?
|
||||
|
||||
required init(viewState: CVViewState) {
|
||||
self.viewState = viewState
|
||||
@ -605,7 +604,7 @@ public class CVLoadCoordinator: NSObject {
|
||||
private func loadLandWhenSafePromise(update: CVUpdate) -> Promise<Void> {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
let (loadPromise, loadResolver) = Promise<Void>.pending()
|
||||
let (loadPromise, loadFuture) = Promise<Void>.pending()
|
||||
|
||||
loadLandWhenSafe(update: update, loadResolver: loadResolver)
|
||||
|
||||
@ -734,12 +733,12 @@ public class CVLoadCoordinator: NSObject {
|
||||
|
||||
public func loadDidLand() {
|
||||
AssertIsOnMainThread()
|
||||
guard let loadDidLandResolver = loadDidLandResolver else {
|
||||
owsFailDebug("Missing loadDidLandResolver.")
|
||||
guard let loadDidLandFuture = loadDidLandFuture else {
|
||||
owsFailDebug("Missing loadDidLandFuture.")
|
||||
return
|
||||
}
|
||||
loadDidLandResolver.fulfill(())
|
||||
self.loadDidLandResolver = nil
|
||||
loadDidLandFuture.resolve()
|
||||
self.loadDidLandFuture = nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// This entity performs a single load.
|
||||
public class CVLoader: NSObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// This captures the CV view state that can affect the load.
|
||||
// It is used when building, measuring & configuring components and their views.
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
public protocol CVViewStateDelegate: AnyObject {
|
||||
func viewStateUIModeDidChange(oldValue: ConversationUIMode)
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
public class CVMediaView: ManualLayoutViewWithLayer {
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// MARK: -
|
||||
|
||||
@ -381,13 +380,13 @@ class MediaViewAdapterStill: MediaViewAdapterSwift {
|
||||
guard attachmentStream.isValidImage else {
|
||||
return Promise(error: ReusableMediaError.invalidMedia)
|
||||
}
|
||||
let (promise, resolver) = Promise<AnyObject>.pending()
|
||||
let (promise, future) = Promise<AnyObject>.pending()
|
||||
attachmentStream.thumbnailImage(quality: thumbnailQuality,
|
||||
success: { (image) in
|
||||
resolver.fulfill(image)
|
||||
future.resolve(image)
|
||||
},
|
||||
failure: {
|
||||
resolver.reject(OWSAssertionError("Could not load thumbnail"))
|
||||
future.reject(OWSAssertionError("Could not load thumbnail"))
|
||||
})
|
||||
return promise
|
||||
}
|
||||
@ -440,13 +439,13 @@ class MediaViewAdapterVideo: MediaViewAdapterSwift {
|
||||
guard attachmentStream.isValidVideo else {
|
||||
return Promise(error: ReusableMediaError.invalidMedia)
|
||||
}
|
||||
let (promise, resolver) = Promise<AnyObject>.pending()
|
||||
let (promise, future) = Promise<AnyObject>.pending()
|
||||
attachmentStream.thumbnailImage(quality: thumbnailQuality,
|
||||
success: { (image) in
|
||||
resolver.fulfill(image)
|
||||
future.resolve(image)
|
||||
},
|
||||
failure: {
|
||||
resolver.reject(OWSAssertionError("Could not load thumbnail"))
|
||||
future.reject(OWSAssertionError("Could not load thumbnail"))
|
||||
})
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#import "Signal-Swift.h"
|
||||
#import "UIFont+OWS.h"
|
||||
#import "ViewControllerUtils.h"
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/SignalCoreKit-Swift.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalMessaging/UIView+OWS.h>
|
||||
#import <SignalServiceKit/NSTimer+OWS.h>
|
||||
@ -1434,7 +1434,7 @@ const CGFloat kMaxIPadTextViewHeight = 142;
|
||||
|
||||
__weak ConversationInputToolbar *weakSelf = self;
|
||||
[self.linkPreviewManager fetchLinkPreviewForUrl:previewUrl]
|
||||
.then(^(OWSLinkPreviewDraft *linkPreviewDraft) {
|
||||
.done(^(OWSLinkPreviewDraft *linkPreviewDraft) {
|
||||
ConversationInputToolbar *_Nullable strongSelf = weakSelf;
|
||||
if (!strongSelf) {
|
||||
return;
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import QuickLook
|
||||
import PromiseKit
|
||||
import PassKit
|
||||
|
||||
extension ConversationViewController: CVComponentDelegate {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
extension ConversationViewController: ConversationInputToolbarDelegate {
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import SafariServices
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
extension ConversationViewController: MessageRequestDelegate {
|
||||
@ -164,7 +163,7 @@ extension ConversationViewController: MessageRequestDelegate {
|
||||
promises.append(networkManager.makePromise(request: request).asVoid())
|
||||
}
|
||||
|
||||
when(fulfilled: promises).done {
|
||||
Promise.when(fulfilled: promises).done {
|
||||
Logger.info("Successfully reported \(guidsToReport.count) message(s) from \(senderPhoneNumber) as spam.")
|
||||
}.catch { error in
|
||||
owsFailDebug("Failed to report message(s) from \(senderPhoneNumber) as spam with error: \(error)")
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class MemberRequestView: UIStackView {
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import Foundation
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import PromiseKit
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
||||
@ -4,8 +4,8 @@
|
||||
|
||||
#import "DebugUIMessagesAssetLoader.h"
|
||||
#import <AFNetworking/AFHTTPSessionManager.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/Randomness.h>
|
||||
#import <SignalCoreKit/SignalCoreKit-Swift.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/MIMETypeUtil.h>
|
||||
#import <SignalServiceKit/OWSFileSystem.h>
|
||||
@ -696,11 +696,11 @@ typedef void (^OWSImageDrawBlock)(CGContextRef context);
|
||||
|
||||
for (DebugUIMessagesAssetLoader *assetLoader in assetLoaders) {
|
||||
// Use chained promises to make the code more readable.
|
||||
AnyPromise *promise = [AnyPromise promiseWithResolverBlock:^(PMKResolver resolve) {
|
||||
AnyPromise *promise = AnyPromise.withFuture(^(AnyFuture *future) {
|
||||
assetLoader.prepareBlock(
|
||||
^{
|
||||
// The value doesn't matter, we just need any non-NSError value.
|
||||
resolve(@(1));
|
||||
[future resolveWithValue:@1];
|
||||
},
|
||||
^{
|
||||
NSError *error =
|
||||
@ -710,14 +710,13 @@ typedef void (^OWSImageDrawBlock)(CGContextRef context);
|
||||
@synchronized(errors) {
|
||||
[errors addObject:error];
|
||||
}
|
||||
resolve(error);
|
||||
[future rejectWithError:error];
|
||||
});
|
||||
}];
|
||||
});
|
||||
[promises addObject:promise];
|
||||
}
|
||||
|
||||
// We could use PMKJoin() or PMKWhen().
|
||||
PMKJoin(promises).then(^(id value) { success(); }).catch(^(id error) {
|
||||
[AnyPromise whenResolved:promises].done(^(id value) { success(); }).catch(^(id error) {
|
||||
OWSLogError(@"Could not prepare fake asset loaders: %@.", error);
|
||||
failure();
|
||||
});
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import Foundation
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import PromiseKit
|
||||
|
||||
#if DEBUG
|
||||
|
||||
@ -79,10 +78,10 @@ class DebugUINotifications: DebugUIPage {
|
||||
// Notifications won't sound if the app is suspended.
|
||||
let taskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
|
||||
|
||||
return after(seconds: kNotificationDelay).done {
|
||||
return Guarantee.after(seconds: kNotificationDelay).done {
|
||||
block()
|
||||
}.then {
|
||||
after(seconds: 2.0)
|
||||
Guarantee.after(seconds: 2.0)
|
||||
}.done {
|
||||
// We don't want to endBackgroundTask until *after* the notifications manager is done,
|
||||
// but it dispatches async without a completion handler, so we just wait a while extra.
|
||||
@ -110,9 +109,7 @@ class DebugUINotifications: DebugUIPage {
|
||||
func notifyForEverythingInSequence(contactThread: TSContactThread) -> Guarantee<Void> {
|
||||
let taskIdentifier = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
|
||||
|
||||
return firstly {
|
||||
self.notifyForIncomingCall(thread: contactThread)
|
||||
}.then {
|
||||
return self.notifyForIncomingCall(thread: contactThread).then {
|
||||
self.notifyForMissedCall(thread: contactThread)
|
||||
}.then {
|
||||
self.notifyForMissedCallBecauseOfNewIdentity(thread: contactThread)
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import Foundation
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import PromiseKit
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
#if DEBUG
|
||||
|
||||
|
||||
@ -6,7 +6,6 @@
|
||||
#import "DebugUIContacts.h"
|
||||
#import "Signal-Swift.h"
|
||||
#import "ThreadUtil.h"
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/Randomness.h>
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalMessaging/OWSTableViewController.h>
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import PromiseKit
|
||||
|
||||
public protocol ForwardMessageDelegate: AnyObject {
|
||||
func forwardMessageFlowDidComplete(items: [ForwardMessageItem],
|
||||
recipientThreads: [TSThread])
|
||||
@ -296,7 +294,7 @@ extension ForwardMessageViewController {
|
||||
self.send(item: item, toRecipientThreads: recipientThreads)
|
||||
}
|
||||
return firstly(on: .main) { () -> Promise<Void> in
|
||||
when(resolved: promises).asVoid()
|
||||
Promise.when(resolved: promises).asVoid()
|
||||
}.then(on: .main) { _ -> Promise<Void> in
|
||||
// The user may have added an additional text message to the forward.
|
||||
// It should be sent last.
|
||||
@ -419,7 +417,7 @@ extension ForwardMessageViewController {
|
||||
enqueueBlock: @escaping (RecipientThread) -> Promise<Void>) -> Promise<Void> {
|
||||
AssertIsOnMainThread()
|
||||
|
||||
return when(fulfilled: recipientThreads.map { thread in enqueueBlock(thread) }).asVoid()
|
||||
return Promise.when(fulfilled: recipientThreads.map { thread in enqueueBlock(thread) }).asVoid()
|
||||
}
|
||||
|
||||
fileprivate func recipientThreads(for conversationItems: [ConversationItem]) -> Promise<[RecipientThread]> {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import YYImage
|
||||
@ -108,7 +107,7 @@ class GifPickerCell: UICollectionViewCell {
|
||||
return Promise(error: GiphyError.assertionError(description: "fullSizeAsset was unexpectedly nil"))
|
||||
}
|
||||
|
||||
let (promise, resolver) = Promise<ProxiedContentAsset>.pending()
|
||||
let (promise, future) = Promise<ProxiedContentAsset>.pending()
|
||||
|
||||
// We don't retain a handle on the asset request, since there will only ever
|
||||
// be one selected asset, and we never want to cancel it.
|
||||
@ -116,13 +115,13 @@ class GifPickerCell: UICollectionViewCell {
|
||||
assetDescription: fullSizeAsset,
|
||||
priority: .high,
|
||||
success: { _, asset in
|
||||
resolver.fulfill(asset)
|
||||
future.resolve(asset)
|
||||
},
|
||||
failure: { _ in
|
||||
// TODO GiphyDownloader API should pass through a useful failing error
|
||||
// so we can pass it through here
|
||||
Logger.error("request failed")
|
||||
resolver.reject(GiphyError.fetchFailure)
|
||||
future.reject(GiphyError.fetchFailure)
|
||||
})
|
||||
|
||||
return promise
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
import Foundation
|
||||
import SignalServiceKit
|
||||
import SignalMessaging
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class GifPickerNavigationViewController: OWSNavigationController {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class GroupInviteLinksUI: UIView {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
class CustomActionSheet: ActionSheetController {
|
||||
public override func viewWillDisappear(_ animated: Bool) {
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class GroupMigrationActionSheet: UIView {
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#import "TSAccountManager.h"
|
||||
#import "TSGroupThread.h"
|
||||
#import "ViewControllerUtils.h"
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/NSDate+OWS.h>
|
||||
#import <SignalCoreKit/SignalCoreKit-Swift.h>
|
||||
#import <SignalCoreKit/Threading.h>
|
||||
#import <SignalCoreKit/iOSVersions.h>
|
||||
#import <SignalMessaging/OWSContactsManager.h>
|
||||
@ -773,9 +773,9 @@ NSString *const kArchiveButtonPseudoGroup = @"kArchiveButtonPseudoGroup";
|
||||
OWSLogInfo(@"beggining refreshing.");
|
||||
|
||||
[self.messageFetcherJob runObjc]
|
||||
.then(^{
|
||||
.then(^(id value) {
|
||||
if (TSAccountManager.shared.isRegisteredPrimaryDevice) {
|
||||
return [AnyPromise promiseWithValue:nil];
|
||||
return [AnyPromise promiseWithValue:@1];
|
||||
}
|
||||
|
||||
return [SSKEnvironment.shared.syncManager sendAllSyncRequestMessagesWithTimeout:20];
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
//
|
||||
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
// The initial presentation is intended to be indistinguishable from the Launch Screen.
|
||||
// After a delay we present some "loading" UI so the user doesn't think the app is frozen.
|
||||
|
||||
@ -10,7 +10,6 @@
|
||||
import UIKit
|
||||
import MapKit
|
||||
import CoreLocation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public protocol LocationPickerDelegate {
|
||||
@ -428,7 +427,7 @@ public class Location: NSObject {
|
||||
}
|
||||
|
||||
public func generateSnapshot() -> Promise<UIImage> {
|
||||
return Promise { resolver in
|
||||
return Promise { future in
|
||||
let options = MKMapSnapshotter.Options()
|
||||
|
||||
// this is the plus/minus meter range from the given coordinate
|
||||
@ -445,12 +444,12 @@ public class Location: NSObject {
|
||||
MKMapSnapshotter(options: options).start(with: .global()) { snapshot, error in
|
||||
guard error == nil else {
|
||||
owsFailDebug("Unexpectedly failed to capture map snapshot \(error!)")
|
||||
return resolver.reject(LocationError.assertion)
|
||||
return future.reject(LocationError.assertion)
|
||||
}
|
||||
|
||||
guard let snapshot = snapshot else {
|
||||
owsFailDebug("snapshot unexpectedly nil")
|
||||
return resolver.reject(LocationError.assertion)
|
||||
return future.reject(LocationError.assertion)
|
||||
}
|
||||
|
||||
// Draw our location pin on the snapshot
|
||||
@ -477,10 +476,10 @@ public class Location: NSObject {
|
||||
|
||||
guard let finalImage = image else {
|
||||
owsFailDebug("image unexpectedly nil")
|
||||
return resolver.reject(LocationError.assertion)
|
||||
return future.reject(LocationError.assertion)
|
||||
}
|
||||
|
||||
resolver.fulfill(finalImage)
|
||||
future.resolve(finalImage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
// Objc wrapper for the MediaGalleryItem struct
|
||||
@objc
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
class MediaDismissAnimationController: NSObject {
|
||||
private let item: Media
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol GroupMemberViewDelegate: AnyObject {
|
||||
var groupMemberViewRecipientSet: OrderedSet<PickedRecipient> { get }
|
||||
@ -356,10 +355,10 @@ extension BaseGroupMemberViewController: RecipientPickerDelegate {
|
||||
let address = recipient.address,
|
||||
!GroupManager.doesUserHaveAnnouncementOnlyGroupsCapability(address: address,
|
||||
transaction: transaction) {
|
||||
|
||||
|
||||
// Re-fetch profile for this user.
|
||||
ProfileFetcherJob.fetchProfile(address: address, ignoreThrottling: true)
|
||||
|
||||
|
||||
return .memberHasOutdatedClient
|
||||
}
|
||||
return .canBeSelected
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import SafariServices
|
||||
|
||||
@objc
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
import SafariServices
|
||||
|
||||
@objc(OWSPinSetupViewController)
|
||||
@ -693,7 +692,7 @@ extension PinSetupViewController {
|
||||
return showRegistrationLockConfirmation(fromViewController: fromViewController)
|
||||
}
|
||||
|
||||
let (promise, resolver) = Promise<Bool>.pending()
|
||||
let (promise, future) = Promise<Bool>.pending()
|
||||
|
||||
let actionSheet = ActionSheetController(
|
||||
title: NSLocalizedString("PIN_CREATION_DISABLE_CONFIRMATION_TITLE",
|
||||
@ -703,7 +702,7 @@ extension PinSetupViewController {
|
||||
)
|
||||
|
||||
let cancelAction = ActionSheetAction(title: CommonStrings.cancelButton, style: .cancel) { _ in
|
||||
resolver.fulfill(false)
|
||||
future.resolve(false)
|
||||
}
|
||||
actionSheet.addAction(cancelAction)
|
||||
|
||||
@ -720,7 +719,7 @@ extension PinSetupViewController {
|
||||
KeyBackupService.useDeviceLocalMasterKey(transaction: transaction)
|
||||
|
||||
transaction.addAsyncCompletionOnMain {
|
||||
modal.dismiss { resolver.fulfill(true) }
|
||||
modal.dismiss { future.resolve(true) }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -733,7 +732,7 @@ extension PinSetupViewController {
|
||||
}
|
||||
|
||||
private class func showRegistrationLockConfirmation(fromViewController: UIViewController) -> Promise<Bool> {
|
||||
let (promise, resolver) = Promise<Bool>.pending()
|
||||
let (promise, future) = Promise<Bool>.pending()
|
||||
|
||||
let actionSheet = ActionSheetController(
|
||||
title: NSLocalizedString("PIN_CREATION_REGLOCK_CONFIRMATION_TITLE",
|
||||
@ -743,7 +742,7 @@ extension PinSetupViewController {
|
||||
)
|
||||
|
||||
let cancelAction = ActionSheetAction(title: CommonStrings.cancelButton, style: .cancel) { _ in
|
||||
resolver.fulfill(false)
|
||||
future.resolve(false)
|
||||
}
|
||||
actionSheet.addAction(cancelAction)
|
||||
|
||||
@ -757,15 +756,15 @@ extension PinSetupViewController {
|
||||
canCancel: false
|
||||
) { modal in
|
||||
OWS2FAManager.shared.disableRegistrationLockV2().then {
|
||||
Promise { resolver in
|
||||
modal.dismiss { resolver.fulfill(()) }
|
||||
Guarantee { resolve in
|
||||
modal.dismiss { resolve(()) }
|
||||
}
|
||||
}.then { () -> Promise<Bool> in
|
||||
disablePinWithConfirmation(fromViewController: fromViewController)
|
||||
}.done { success in
|
||||
resolver.fulfill(success)
|
||||
future.resolve(success)
|
||||
}.catch { error in
|
||||
modal.dismiss { resolver.reject(error) }
|
||||
modal.dismiss { future.reject(error) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
import Lottie
|
||||
|
||||
@objc
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
public struct SendPaymentInfo {
|
||||
let recipient: SendPaymentRecipient
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
import Lottie
|
||||
|
||||
@objc
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
protocol ImagePickerGridControllerDelegate: AnyObject {
|
||||
func imagePickerDidCompleteSelection(_ imagePicker: ImagePickerGridController)
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol PhotoCaptureDelegate: AnyObject {
|
||||
|
||||
@ -862,9 +861,9 @@ class MovieRecording {
|
||||
state = .finished
|
||||
audioInput.markAsFinished()
|
||||
videoInput.markAsFinished()
|
||||
return Promise<URL> { resolver -> Void in
|
||||
return Promise<URL> { future -> Void in
|
||||
self.assetWriter.finishWriting {
|
||||
resolver.fulfill(self.assetWriter.outputURL)
|
||||
future.resolve(self.assetWriter.outputURL)
|
||||
}
|
||||
}
|
||||
default:
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import AVFoundation
|
||||
import PromiseKit
|
||||
import Lottie
|
||||
|
||||
protocol PhotoCaptureViewControllerDelegate: AnyObject {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
//
|
||||
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
protocol PhotoCollectionPickerDelegate: AnyObject {
|
||||
func photoCollectionPicker(_ photoCollectionPicker: PhotoCollectionPickerController, didPickCollection collection: PhotoCollection)
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
protocol PhotoLibraryDelegate: AnyObject {
|
||||
func photoLibraryDidChange(_ photoLibrary: PhotoLibrary)
|
||||
@ -141,7 +140,7 @@ class PhotoCollectionContents {
|
||||
}
|
||||
|
||||
private func requestImageDataSource(for asset: PHAsset) -> Promise<(dataSource: DataSource, dataUTI: String)> {
|
||||
return Promise { resolver in
|
||||
return Promise { future in
|
||||
|
||||
let options: PHImageRequestOptions = PHImageRequestOptions()
|
||||
options.isNetworkAccessAllowed = true
|
||||
@ -151,27 +150,27 @@ class PhotoCollectionContents {
|
||||
_ = imageManager.requestImageData(for: asset, options: options) { imageData, dataUTI, _, _ in
|
||||
|
||||
guard let imageData = imageData else {
|
||||
resolver.reject(PhotoLibraryError.assertionError(description: "imageData was unexpectedly nil"))
|
||||
future.reject(PhotoLibraryError.assertionError(description: "imageData was unexpectedly nil"))
|
||||
return
|
||||
}
|
||||
|
||||
guard let dataUTI = dataUTI else {
|
||||
resolver.reject(PhotoLibraryError.assertionError(description: "dataUTI was unexpectedly nil"))
|
||||
future.reject(PhotoLibraryError.assertionError(description: "dataUTI was unexpectedly nil"))
|
||||
return
|
||||
}
|
||||
|
||||
guard let dataSource = DataSourceValue.dataSource(with: imageData, utiType: dataUTI) else {
|
||||
resolver.reject(PhotoLibraryError.assertionError(description: "dataSource was unexpectedly nil"))
|
||||
future.reject(PhotoLibraryError.assertionError(description: "dataSource was unexpectedly nil"))
|
||||
return
|
||||
}
|
||||
|
||||
resolver.fulfill((dataSource: dataSource, dataUTI: dataUTI))
|
||||
future.resolve((dataSource: dataSource, dataUTI: dataUTI))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func requestVideoDataSource(for asset: PHAsset) -> Promise<SignalAttachment> {
|
||||
return Promise { resolver in
|
||||
return Promise { future in
|
||||
|
||||
let options: PHVideoRequestOptions = PHVideoRequestOptions()
|
||||
options.isNetworkAccessAllowed = true
|
||||
@ -180,7 +179,7 @@ class PhotoCollectionContents {
|
||||
_ = imageManager.requestAVAsset(forVideo: asset, options: options) { video, _, info in
|
||||
guard let video = video else {
|
||||
let error = info?[PHImageErrorKey] as! Error?
|
||||
resolver.reject(PhotoLibraryError.failedToExportAsset(underlyingError: error))
|
||||
future.reject(PhotoLibraryError.failedToExportAsset(underlyingError: error))
|
||||
return
|
||||
}
|
||||
|
||||
@ -192,7 +191,7 @@ class PhotoCollectionContents {
|
||||
|
||||
if let dataSource = try? DataSourcePath.dataSource(with: url, shouldDeleteOnDeallocation: false) {
|
||||
if !SignalAttachment.isVideoThatNeedsCompression(dataSource: dataSource, dataUTI: dataUTI) {
|
||||
resolver.fulfill(SignalAttachment.attachment(dataSource: dataSource, dataUTI: dataUTI))
|
||||
future.resolve(SignalAttachment.attachment(dataSource: dataSource, dataUTI: dataUTI))
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -206,7 +205,9 @@ class PhotoCollectionContents {
|
||||
let (compressPromise, _) = SignalAttachment.compressVideoAsMp4(asset: video,
|
||||
baseFilename: baseFilename,
|
||||
dataUTI: dataUTI)
|
||||
compressPromise.pipe { resolver.resolve($0) }
|
||||
compressPromise
|
||||
.done { future.resolve($0) }
|
||||
.catch { future.reject($0) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
import Foundation
|
||||
import Photos
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
protocol SendMediaNavDelegate: AnyObject {
|
||||
@ -551,9 +550,9 @@ extension SendMediaNavigationController: ImagePickerGridControllerDelegate {
|
||||
|
||||
func showApprovalAfterProcessingAnyMediaLibrarySelections() {
|
||||
let backgroundBlock: (ModalActivityIndicatorViewController) -> Void = { modal in
|
||||
let approvalItemsPromise = when(fulfilled: self.attachmentDraftCollection.attachmentApprovalItemPromises)
|
||||
let approvalItemsPromise: Promise<[AttachmentApprovalItem]> = Promise.when(fulfilled: self.attachmentDraftCollection.attachmentApprovalItemPromises)
|
||||
firstly { () -> Promise<Swift.Result<[AttachmentApprovalItem], Error>> in
|
||||
return race(
|
||||
return Promise.race(
|
||||
approvalItemsPromise.map { attachmentApprovalItems -> Swift.Result<[AttachmentApprovalItem], Error> in
|
||||
Swift.Result.success(attachmentApprovalItems)
|
||||
},
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
protocol AddToBlockListDelegate: AnyObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
class ComposeViewController: OWSViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public enum RecipientPickerRecipientState: Int {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#import "SignalApp.h"
|
||||
#import "UIView+OWS.h"
|
||||
#import <MessageUI/MessageUI.h>
|
||||
#import <PromiseKit/AnyPromise.h>
|
||||
#import <SignalCoreKit/SignalCoreKit-Swift.h>
|
||||
#import <SignalMessaging/Environment.h>
|
||||
#import <SignalMessaging/OWSTableViewController.h>
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
@ -184,9 +184,9 @@ const NSUInteger kMinimumSearchLength = 1;
|
||||
OWSLogInfo(@"beggining refreshing.");
|
||||
|
||||
[self.contactsManagerImpl userRequestedSystemContactsRefresh]
|
||||
.then(^{
|
||||
.then(^(id value) {
|
||||
if (TSAccountManager.shared.isRegisteredPrimaryDevice) {
|
||||
return [AnyPromise promiseWithValue:nil];
|
||||
return [AnyPromise promiseWithValue:@1];
|
||||
}
|
||||
|
||||
return [SSKEnvironment.shared.syncManager sendAllSyncRequestMessagesWithTimeout:20];
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingBaseViewController: OWSViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingCountryState: NSObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingDroppedYdbViewController: OnboardingBaseViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
import Contacts
|
||||
import Lottie
|
||||
|
||||
@ -83,7 +82,7 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
|
||||
private func requestContactsAccess() -> Promise<Void> {
|
||||
Logger.info("")
|
||||
|
||||
let (promise, resolver) = Promise<Void>.pending()
|
||||
let (promise, future) = Promise<Void>.pending()
|
||||
CNContactStore().requestAccess(for: CNEntityType.contacts) { (granted, error) -> Void in
|
||||
if granted {
|
||||
Logger.info("Granted.")
|
||||
@ -91,7 +90,7 @@ public class OnboardingPermissionsViewController: OnboardingBaseViewController {
|
||||
Logger.error("Error: \(String(describing: error)).")
|
||||
}
|
||||
// Always fulfill.
|
||||
resolver.fulfill(())
|
||||
future.resolve()
|
||||
}
|
||||
return promise
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingPhoneNumberDiscoverabilityViewController: OnboardingBaseViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingPhoneNumberViewController: OnboardingBaseViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class OnboardingProfileCreationViewController: OnboardingBaseViewController {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
import SafariServices
|
||||
|
||||
@objc
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
private protocol OnboardingCodeViewTextFieldDelegate: AnyObject {
|
||||
func textFieldDidDeletePrevious()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class ProvisioningController: NSObject {
|
||||
@ -14,17 +13,17 @@ public class ProvisioningController: NSObject {
|
||||
let provisioningSocket: ProvisioningSocket
|
||||
|
||||
var deviceIdPromise: Promise<String>
|
||||
var deviceIdResolver: Resolver<String>
|
||||
var deviceIdFuture: Future<String>
|
||||
|
||||
var provisionEnvelopePromise: Promise<ProvisioningProtoProvisionEnvelope>
|
||||
var provisionEnvelopeResolver: Resolver<ProvisioningProtoProvisionEnvelope>
|
||||
var provisionEnvelopeFuture: Future<ProvisioningProtoProvisionEnvelope>
|
||||
|
||||
public init(onboardingController: OnboardingController) {
|
||||
self.onboardingController = onboardingController
|
||||
provisioningCipher = ProvisioningCipher.generate()
|
||||
|
||||
(self.deviceIdPromise, self.deviceIdResolver) = Promise.pending()
|
||||
(self.provisionEnvelopePromise, self.provisionEnvelopeResolver) = Promise.pending()
|
||||
(self.deviceIdPromise, self.deviceIdFuture) = Promise.pending()
|
||||
(self.provisionEnvelopePromise, self.provisionEnvelopeFuture) = Promise.pending()
|
||||
|
||||
provisioningSocket = ProvisioningSocket()
|
||||
|
||||
@ -35,8 +34,8 @@ public class ProvisioningController: NSObject {
|
||||
|
||||
public func resetPromises() {
|
||||
_awaitProvisionMessage = nil
|
||||
(self.deviceIdPromise, self.deviceIdResolver) = Promise.pending()
|
||||
(self.provisionEnvelopePromise, self.provisionEnvelopeResolver) = Promise.pending()
|
||||
(self.deviceIdPromise, self.deviceIdFuture) = Promise.pending()
|
||||
(self.provisionEnvelopePromise, self.provisionEnvelopeFuture) = Promise.pending()
|
||||
}
|
||||
|
||||
@objc
|
||||
@ -71,8 +70,8 @@ public class ProvisioningController: NSObject {
|
||||
navigationController: UINavigationController) {
|
||||
|
||||
awaitProvisionMessage.done { [weak self, weak navigationController] message in
|
||||
guard let self = self else { throw PMKError.cancelled }
|
||||
guard let navigationController = navigationController else { throw PMKError.cancelled }
|
||||
guard let self = self else { throw PromiseError.cancelled }
|
||||
guard let navigationController = navigationController else { throw PromiseError.cancelled }
|
||||
|
||||
// Verify the primary device is new enough to link us. Right now this is a simple check
|
||||
// of >= the latest version, but when we bump the version we may need to be more specific
|
||||
@ -96,7 +95,7 @@ public class ProvisioningController: NSObject {
|
||||
navigationController.pushViewController(confirmVC, animated: true)
|
||||
}.catch { error in
|
||||
switch error {
|
||||
case PMKError.cancelled:
|
||||
case PromiseError.cancelled:
|
||||
Logger.info("cancelled")
|
||||
default:
|
||||
Logger.warn("error: \(error)")
|
||||
@ -183,7 +182,7 @@ public class ProvisioningController: NSObject {
|
||||
|
||||
public func getProvisioningURL() -> Promise<URL> {
|
||||
return getDeviceId().map { [weak self] deviceId in
|
||||
guard let self = self else { throw PMKError.cancelled }
|
||||
guard let self = self else { throw PromiseError.cancelled }
|
||||
|
||||
return try self.buildProvisioningUrl(deviceId: deviceId)
|
||||
}
|
||||
@ -193,7 +192,7 @@ public class ProvisioningController: NSObject {
|
||||
public var awaitProvisionMessage: Promise<ProvisionMessage> {
|
||||
if _awaitProvisionMessage == nil {
|
||||
_awaitProvisionMessage = provisionEnvelopePromise.map { [weak self] envelope in
|
||||
guard let self = self else { throw PMKError.cancelled }
|
||||
guard let self = self else { throw PromiseError.cancelled }
|
||||
return try self.provisioningCipher.decrypt(envelope: envelope)
|
||||
}
|
||||
}
|
||||
@ -202,7 +201,7 @@ public class ProvisioningController: NSObject {
|
||||
|
||||
public func completeLinking(deviceName: String) -> Promise<Void> {
|
||||
return awaitProvisionMessage.then { [weak self] provisionMessage -> Promise<Void> in
|
||||
guard let self = self else { throw PMKError.cancelled }
|
||||
guard let self = self else { throw PromiseError.cancelled }
|
||||
|
||||
return self.accountManager.completeSecondaryLinking(provisionMessage: provisionMessage,
|
||||
deviceName: deviceName)
|
||||
@ -249,20 +248,20 @@ public class ProvisioningController: NSObject {
|
||||
|
||||
extension ProvisioningController: ProvisioningSocketDelegate {
|
||||
public func provisioningSocket(_ provisioningSocket: ProvisioningSocket, didReceiveDeviceId deviceId: String) {
|
||||
assert(deviceIdPromise.isPending)
|
||||
deviceIdResolver.fulfill(deviceId)
|
||||
owsAssertDebug(!deviceIdPromise.isSealed)
|
||||
deviceIdFuture.resolve(deviceId)
|
||||
}
|
||||
|
||||
public func provisioningSocket(_ provisioningSocket: ProvisioningSocket, didReceiveEnvelope envelope: ProvisioningProtoProvisionEnvelope) {
|
||||
// After receiving the provisioning message, there's nothing else to retreive from the provisioning socket
|
||||
provisioningSocket.disconnect()
|
||||
|
||||
assert(provisionEnvelopePromise.isPending)
|
||||
return provisionEnvelopeResolver.fulfill(envelope)
|
||||
owsAssertDebug(!provisionEnvelopePromise.isSealed)
|
||||
return provisionEnvelopeFuture.resolve(envelope)
|
||||
}
|
||||
|
||||
public func provisioningSocket(_ provisioningSocket: ProvisioningSocket, didError error: Error) {
|
||||
deviceIdResolver.reject(error)
|
||||
provisionEnvelopeResolver.reject(error)
|
||||
deviceIdFuture.reject(error)
|
||||
provisionEnvelopeFuture.reject(error)
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import Lottie
|
||||
|
||||
@objc
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
class SecondaryLinkingSetDeviceNameViewController: OnboardingBaseViewController {
|
||||
|
||||
|
||||
@ -2,8 +2,6 @@
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public protocol SendMessageDelegate: AnyObject {
|
||||
func sendMessageFlowDidComplete(threads: [TSThread])
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol AddGroupMembersViewControllerDelegate: AnyObject {
|
||||
func addGroupMembersViewDidUpdate()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class AddToGroupViewController: OWSTableViewController2 {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
@objc
|
||||
public class ConversationInternalViewController: OWSTableViewController2 {
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
//
|
||||
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
|
||||
// Copyright (c) 2021 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import PromiseKit
|
||||
|
||||
class LegacyGroupView: UIView {
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import UIKit
|
||||
import ContactsUI
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
class DisappearingMessagesTimerSettingsViewController: OWSTableViewController2 {
|
||||
let thread: TSThread?
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import UIKit
|
||||
|
||||
protocol GroupAttributesEditorHelperDelegate: AnyObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
import UIKit
|
||||
|
||||
protocol GroupAttributesViewControllerDelegate: AnyObject {
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol GroupLinkViewControllerDelegate: AnyObject {
|
||||
func groupLinkViewViewDidUpdate()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol GroupMemberRequestsAndInvitesViewControllerDelegate: AnyObject {
|
||||
func requestsAndInvitesViewDidUpdate()
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
protocol GroupPermissionsSettingsDelegate: AnyObject {
|
||||
func groupPermissionSettingsDidUpdate()
|
||||
@ -64,7 +63,7 @@ class GroupPermissionsSettingsViewController: OWSTableViewController2 {
|
||||
let promises = membersWithoutCapability.map { address in
|
||||
ProfileFetcherJob.fetchProfilePromise(address: address, ignoreThrottling: true)
|
||||
}
|
||||
return when(resolved: promises).asVoid()
|
||||
return Promise.when(resolved: promises).asVoid()
|
||||
}.done { [weak self] in
|
||||
self?.updateAnnouncementOnlyCapabilityState()
|
||||
}.catch { error in
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import PromiseKit
|
||||
|
||||
extension GroupViewHelper {
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user