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.
55 lines
1.7 KiB
Swift
55 lines
1.7 KiB
Swift
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import SignalServiceKit
|
|
|
|
class DebugUIProfile: DebugUIPage {
|
|
|
|
let TAG = "[DebugUIProfile]"
|
|
|
|
// MARK: Dependencies
|
|
|
|
var messageSender: MessageSender {
|
|
return Environment.getCurrent().messageSender
|
|
}
|
|
var profileManager: OWSProfileManager {
|
|
return OWSProfileManager.shared()
|
|
}
|
|
|
|
// MARK: Overrides
|
|
|
|
override func name() -> String {
|
|
return "Profile"
|
|
}
|
|
|
|
override func section(thread aThread: TSThread?) -> OWSTableSection? {
|
|
let sectionItems = [
|
|
OWSTableItem(title: "Clear Profile Whitelist") {
|
|
self.profileManager.clearProfileWhitelist()
|
|
},
|
|
OWSTableItem(title: "Log Profile Whitelist") {
|
|
self.profileManager.logProfileWhitelist()
|
|
},
|
|
OWSTableItem(title: "Log User Profiles") {
|
|
self.profileManager.logUserProfiles()
|
|
},
|
|
OWSTableItem(title: "Regenerate Profile/ProfileKey") {
|
|
self.profileManager.regenerateLocalProfile()
|
|
},
|
|
OWSTableItem(title: "Send Profile Key Message") {
|
|
let message = OWSProfileKeyMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: aThread)
|
|
self.messageSender.sendPromise(message: message).then {
|
|
Logger.info("Successfully sent profile key message to thread: \(String(describing: aThread))")
|
|
}.catch { _ in
|
|
owsFail("Failed to send profile key message to thread: \(String(describing: aThread))")
|
|
}
|
|
}
|
|
]
|
|
|
|
return OWSTableSection(title: "Profile", items: sectionItems)
|
|
}
|
|
|
|
}
|