mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.2 KiB
Swift
63 lines
2.2 KiB
Swift
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SignalServiceKit
|
|
import SignalMessaging
|
|
|
|
class DebugUIProfile: DebugUIPage {
|
|
|
|
// MARK: - Dependencies
|
|
|
|
var messageSender: MessageSender {
|
|
return SSKEnvironment.shared.messageSender
|
|
}
|
|
var profileManager: OWSProfileManager {
|
|
return OWSProfileManager.shared()
|
|
}
|
|
|
|
// MARK: - Overrides
|
|
|
|
override func name() -> String {
|
|
return "Profile"
|
|
}
|
|
|
|
override func section(thread aThread: TSThread?) -> OWSTableSection? {
|
|
let profileManager = self.profileManager
|
|
let sectionItems = [
|
|
OWSTableItem(title: "Clear Profile Whitelist") {
|
|
profileManager.clearProfileWhitelist()
|
|
},
|
|
OWSTableItem(title: "Log Profile Whitelist") {
|
|
profileManager.logProfileWhitelist()
|
|
},
|
|
OWSTableItem(title: "Log User Profiles") {
|
|
profileManager.logUserProfiles()
|
|
},
|
|
OWSTableItem(title: "Log Profile Key") {
|
|
let localProfileKey = profileManager.localProfileKey()
|
|
Logger.info("localProfileKey: \(localProfileKey.keyData.hexadecimalString)")
|
|
profileManager.logUserProfiles()
|
|
},
|
|
OWSTableItem(title: "Regenerate Profile/ProfileKey") {
|
|
profileManager.regenerateLocalProfile()
|
|
},
|
|
OWSTableItem(title: "Send Profile Key Message") { [weak self] in
|
|
guard let strongSelf = self else { return }
|
|
|
|
// MJK TODO - should be safe to remove this senderTimestamp
|
|
let message = OWSProfileKeyMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: aThread)
|
|
strongSelf.messageSender.sendPromise(message: message).done {
|
|
Logger.info("Successfully sent profile key message to thread: \(String(describing: aThread))")
|
|
}.catch { _ in
|
|
owsFailDebug("Failed to send profile key message to thread: \(String(describing: aThread))")
|
|
}.retainUntilComplete()
|
|
}
|
|
]
|
|
|
|
return OWSTableSection(title: "Profile", items: sectionItems)
|
|
}
|
|
|
|
}
|