82 lines
3.4 KiB
Swift
82 lines
3.4 KiB
Swift
//
|
|
// Copyright 2024 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
//
|
|
|
|
import Foundation
|
|
import SignalCoreKit
|
|
|
|
#if TESTABLE_BUILD
|
|
|
|
extension OWSFakeProfileManager: ProfileManager {
|
|
|
|
public func fetchLocalUsersProfile(mainAppOnly: Bool, authedAccount: AuthedAccount) -> Promise<FetchedProfile> {
|
|
return Promise(error: OWSGenericError("Not supported."))
|
|
}
|
|
|
|
public func fetchUserProfiles(for addresses: [SignalServiceAddress], tx: SDSAnyReadTransaction) -> [OWSUserProfile?] {
|
|
return addresses.map { fakeUserProfiles?[$0] }
|
|
}
|
|
|
|
public func downloadAndDecryptLocalUserAvatarIfNeeded(authedAccount: AuthedAccount) async throws {
|
|
throw OWSGenericError("Not supported.")
|
|
}
|
|
|
|
public func updateProfile(
|
|
address: SignalServiceAddress,
|
|
decryptedProfile: DecryptedProfile?,
|
|
avatarUrlPath: OptionalChange<String?>,
|
|
avatarFileName: OptionalChange<String?>,
|
|
profileBadges: [OWSUserProfileBadgeInfo],
|
|
lastFetchDate: Date,
|
|
userProfileWriter: UserProfileWriter,
|
|
localIdentifiers: LocalIdentifiers,
|
|
tx: SDSAnyWriteTransaction
|
|
) {
|
|
}
|
|
|
|
public func updateLocalProfile(
|
|
profileGivenName: OptionalChange<OWSUserProfile.NameComponent>,
|
|
profileFamilyName: OptionalChange<OWSUserProfile.NameComponent?>,
|
|
profileBio: OptionalChange<String?>,
|
|
profileBioEmoji: OptionalChange<String?>,
|
|
profileAvatarData: OptionalChange<Data?>,
|
|
visibleBadgeIds: OptionalChange<[String]>,
|
|
unsavedRotatedProfileKey: OWSAES256Key?,
|
|
userProfileWriter: UserProfileWriter,
|
|
authedAccount: AuthedAccount,
|
|
tx: SDSAnyWriteTransaction
|
|
) -> Promise<Void> {
|
|
return Promise(error: OWSGenericError("Not supported."))
|
|
}
|
|
|
|
public func reuploadLocalProfile(unsavedRotatedProfileKey: OWSAES256Key?, authedAccount: AuthedAccount, tx: DBWriteTransaction) -> Promise<Void> {
|
|
return Promise(error: OWSGenericError("Not supported."))
|
|
}
|
|
|
|
public func downloadAndDecryptAvatar(avatarUrlPath: String, profileKey: OWSAES256Key) async throws -> URL {
|
|
throw OWSGenericError("Not supported.")
|
|
}
|
|
|
|
public func didSendOrReceiveMessage(from address: SignalServiceAddress, localIdentifiers: LocalIdentifiers, transaction: SDSAnyWriteTransaction) {
|
|
}
|
|
|
|
public func setProfile(for address: SignalServiceAddress, givenName: OptionalChange<String?>, familyName: OptionalChange<String?>, avatarUrlPath: OptionalChange<String?>, userProfileWriter: UserProfileWriter, localIdentifiers: LocalIdentifiers, transaction: SDSAnyWriteTransaction) {
|
|
}
|
|
|
|
public func setProfileKeyDataAndFetchProfile(_ profileKeyData: Data, forAddress address: SignalServiceAddress, onlyFillInIfMissing: Bool, userProfileWriter: UserProfileWriter, authedAccount: AuthedAccount, transaction tx: SDSAnyWriteTransaction) {
|
|
let key = OWSAES256Key(data: profileKeyData)
|
|
owsAssert(key != nil)
|
|
self.profileKeys[address] = key
|
|
}
|
|
|
|
public func setProfileKeyData(_ profileKeyData: Data, for address: SignalServiceAddress, onlyFillInIfMissing: Bool, userProfileWriter: UserProfileWriter, localIdentifiers: LocalIdentifiers, transaction tx: SDSAnyWriteTransaction) -> Bool {
|
|
let key = OWSAES256Key(data: profileKeyData)
|
|
owsAssert(key != nil)
|
|
self.profileKeys[address] = key
|
|
return false
|
|
}
|
|
}
|
|
|
|
#endif
|