mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
0c281cab95
// FREEBIE
53 lines
1.7 KiB
Swift
53 lines
1.7 KiB
Swift
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
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)
|
|
}
|
|
|
|
}
|