Dedicated "Profile" debug section

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent 9c56660618
commit 6c63009e9e

@ -149,6 +149,8 @@
45464DBC1DFA041F001D3FD6 /* DataChannelMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */; };
454EBAB31F2BC08800ACE0BB /* OWSSwiftUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D99C921F2937CC00D284D6 /* OWSSwiftUtils.swift */; };
454EBAB41F2BE14C00ACE0BB /* OWSAnalytics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D99C911F2937CC00D284D6 /* OWSAnalytics.swift */; };
4556FA681F54AA9500AF40DD /* DebugUIProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */; };
4556FA691F54AA9500AF40DD /* DebugUIProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */; };
455A16DD1F1FEA0000F86704 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 455A16DB1F1FEA0000F86704 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
455A16DE1F1FEA0000F86704 /* MetalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 455A16DC1F1FEA0000F86704 /* MetalKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
455AC69B1F4F79E500134004 /* ImageCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 455AC69A1F4F79E500134004 /* ImageCache.swift */; };
@ -608,6 +610,7 @@
4542F0951EBB9E9A00C7EE92 /* Promise+retainUntilComplete.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Promise+retainUntilComplete.swift"; sourceTree = "<group>"; };
45464DBB1DFA041F001D3FD6 /* DataChannelMessage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataChannelMessage.swift; sourceTree = "<group>"; };
454B35071D08EED80026D658 /* mk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = mk; path = translations/mk.lproj/Localizable.strings; sourceTree = "<group>"; };
4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugUIProfile.swift; sourceTree = "<group>"; };
455A16DB1F1FEA0000F86704 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = System/Library/Frameworks/Metal.framework; sourceTree = SDKROOT; };
455A16DC1F1FEA0000F86704 /* MetalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MetalKit.framework; path = System/Library/Frameworks/MetalKit.framework; sourceTree = SDKROOT; };
455AC69A1F4F79E500134004 /* ImageCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImageCache.swift; sourceTree = "<group>"; };
@ -1136,6 +1139,7 @@
34D8C0251ED3673300188D7C /* DebugUITableViewController.h */,
34D8C0261ED3673300188D7C /* DebugUITableViewController.m */,
45638BDB1F3DD0D400128435 /* DebugUICalling.swift */,
4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */,
);
path = DebugUI;
sourceTree = "<group>";
@ -2289,6 +2293,7 @@
34F3089F1ECA580B00BB7697 /* OWSUnreadIndicatorCell.m in Sources */,
34B3F8861E8DF1700035BE1A /* NotificationSettingsOptionsViewController.m in Sources */,
452ECA4D1E087E7200E2F016 /* MessageFetcherJob.swift in Sources */,
4556FA681F54AA9500AF40DD /* DebugUIProfile.swift in Sources */,
452EA0971EA662330078744B /* AttachmentPointerAdapter.swift in Sources */,
34DFCB851E8E04B500053165 /* AddToBlockListViewController.m in Sources */,
45855F371D9498A40084F340 /* OWSContactAvatarBuilder.m in Sources */,
@ -2452,6 +2457,7 @@
954AEE6A1DF33E01002E5410 /* ContactsPickerTest.swift in Sources */,
B660F77B1C29988E00687D6E /* Queue.m in Sources */,
455AC69C1F4F79E500134004 /* ImageCache.swift in Sources */,
4556FA691F54AA9500AF40DD /* DebugUIProfile.swift in Sources */,
45666F581D9B2880008FE134 /* OWSScrubbingLogFormatterTest.m in Sources */,
B660F77F1C29988E00687D6E /* DateUtil.m in Sources */,
B660F7811C29988E00687D6E /* FunctionalUtil.m in Sources */,

@ -70,6 +70,7 @@
#import <SignalServiceKit/OWSMessageReceiver.h>
#import <SignalServiceKit/OWSMessageSender.h>
#import <SignalServiceKit/OWSOutgoingCallMessage.h>
#import <SignalServiceKit/OWSProfileKeyMessage.h>
#import <SignalServiceKit/OWSRecipientIdentity.h>
#import <SignalServiceKit/OWSSignalService.h>
#import <SignalServiceKit/OWSSyncContactsMessage.h>

@ -54,32 +54,6 @@ NS_ASSUME_NONNULL_BEGIN
actionBlock:^{
[DebugUIMisc setManualCensorshipCircumventionEnabled:NO];
}]];
#ifdef DEBUG
[items addObject:[OWSTableItem itemWithTitle:@"Clear Profile Whitelist"
actionBlock:^{
[OWSProfileManager.sharedManager clearProfileWhitelist];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Log Profile Whitelist"
actionBlock:^{
[OWSProfileManager.sharedManager logProfileWhitelist];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Regenerate Profile/ProfileKey"
actionBlock:^{
[[OWSProfileManager sharedManager] regenerateLocalProfile];
}]];
#endif
[items addObject:[OWSTableItem itemWithTitle:@"Send profile key message."
actionBlock:^{
OWSProfileKeyMessage *message = [[OWSProfileKeyMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] inThread:thread];
[[Environment getCurrent].messageSender sendMessage:message
success:^{
DDLogInfo(@"Successfully sent profile key message to thread: %@", thread);
}
failure:^(NSError * _Nonnull error) {
OWSFail(@"Failed to send prifle key message to thread: %@", thread);
}];
}]];
[items addObject:[OWSTableItem itemWithTitle:@"Clear hasDismissedOffers"
actionBlock:^{
[DebugUIMisc clearHasDismissedOffers];

@ -0,0 +1,50 @@
//
// 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: "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)
}
}

@ -95,6 +95,7 @@ NS_ASSUME_NONNULL_BEGIN
[subsectionItems
addObject:[self itemForSubsection:[DebugUICalling new] viewController:viewController thread:thread]];
}
[subsectionItems addObject:[self itemForSubsection:[DebugUIProfile new] viewController:viewController thread:thread]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:thread]];
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];

Loading…
Cancel
Save