Debug UI for screenshots without assets.

This commit is contained in:
Riya Abraham 2020-04-29 17:17:48 -03:00 committed by Matthew Chen
parent 98a822abdd
commit e2d813cf8d
11 changed files with 1402 additions and 3 deletions

View File

@ -346,6 +346,8 @@
34D2CCDA2062E7D000CB1A14 /* OWSScreenLockUI.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCD92062E7D000CB1A14 /* OWSScreenLockUI.m */; };
34D2CCDF206939B400CB1A14 /* DebugUIMessagesAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDB206939B100CB1A14 /* DebugUIMessagesAction.m */; };
34D2CCE0206939B400CB1A14 /* DebugUIMessagesAssetLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D2CCDC206939B200CB1A14 /* DebugUIMessagesAssetLoader.m */; };
34D3E57B245A189D00F5E4A1 /* DebugUIScreenshots.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34D3E579245A189D00F5E4A1 /* DebugUIScreenshots.swift */; };
34D3E57C245A189D00F5E4A1 /* DebugUIScreenshots.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D3E57A245A189D00F5E4A1 /* DebugUIScreenshots.m */; };
34D5872F208E2C4200D2255A /* OWS109OutgoingMessageState.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D5872D208E2C4100D2255A /* OWS109OutgoingMessageState.m */; };
34D58730208E2C4200D2255A /* OWS109OutgoingMessageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 34D5872E208E2C4100D2255A /* OWS109OutgoingMessageState.h */; settings = {ATTRIBUTES = (Public, ); }; };
34D5CCA91EAE3D30005515DB /* AvatarViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 34D5CCA81EAE3D30005515DB /* AvatarViewHelper.m */; };
@ -1261,6 +1263,9 @@
34D2CCDD206939B200CB1A14 /* DebugUIMessagesAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAction.h; sourceTree = "<group>"; };
34D2CCDE206939B400CB1A14 /* DebugUIMessagesAssetLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesAssetLoader.h; sourceTree = "<group>"; };
34D2CCE220693A1700CB1A14 /* DebugUIMessagesUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIMessagesUtils.h; sourceTree = "<group>"; };
34D3E578245A189D00F5E4A1 /* DebugUIScreenshots.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUIScreenshots.h; sourceTree = "<group>"; };
34D3E579245A189D00F5E4A1 /* DebugUIScreenshots.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DebugUIScreenshots.swift; sourceTree = "<group>"; };
34D3E57A245A189D00F5E4A1 /* DebugUIScreenshots.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUIScreenshots.m; sourceTree = "<group>"; };
34D5872D208E2C4100D2255A /* OWS109OutgoingMessageState.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWS109OutgoingMessageState.m; sourceTree = "<group>"; };
34D5872E208E2C4100D2255A /* OWS109OutgoingMessageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWS109OutgoingMessageState.h; sourceTree = "<group>"; };
34D5CCA71EAE3D30005515DB /* AvatarViewHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AvatarViewHelper.h; sourceTree = "<group>"; };
@ -2621,6 +2626,9 @@
34E3EF0E1EFC2684007F6822 /* DebugUIPage.h */,
34E3EF0F1EFC2684007F6822 /* DebugUIPage.m */,
4556FA671F54AA9500AF40DD /* DebugUIProfile.swift */,
34D3E578245A189D00F5E4A1 /* DebugUIScreenshots.h */,
34D3E57A245A189D00F5E4A1 /* DebugUIScreenshots.m */,
34D3E579245A189D00F5E4A1 /* DebugUIScreenshots.swift */,
452037CF1EE84975004E4CDF /* DebugUISessionState.h */,
452037D01EE84975004E4CDF /* DebugUISessionState.m */,
34BECE291F74C12700D7438D /* DebugUIStress.h */,
@ -4546,6 +4554,7 @@
348433DF243CA94600C7F64A /* ReplaceAdminViewController.swift in Sources */,
34E3EF0D1EFC235B007F6822 /* DebugUIDiskUsage.m in Sources */,
887EEC1F23F0B20600F8C26D /* PinReminderMegaphone.swift in Sources */,
34D3E57B245A189D00F5E4A1 /* DebugUIScreenshots.swift in Sources */,
454A84042059C787008B8C75 /* MediaTileViewController.swift in Sources */,
340FC8B4204DAC8D007AEB0F /* OWSBackupSettingsViewController.m in Sources */,
34995F1A2411838D00C70546 /* NewGroupViewController.m in Sources */,
@ -4571,6 +4580,7 @@
88905E9E229CCA96004E4234 /* ExpirationNagView.swift in Sources */,
881D85B822D92C2B00E118DF /* OWSPinSetupViewController.swift in Sources */,
340FC8BA204DAC8D007AEB0F /* FingerprintViewScanController.m in Sources */,
34D3E57C245A189D00F5E4A1 /* DebugUIScreenshots.m in Sources */,
8835DDF9230CEDC300DC6B66 /* RecipientPickerViewController.m in Sources */,
4585C4681ED8F8D200896AEA /* SafetyNumberConfirmationAlert.swift in Sources */,
4C20B2B920CA10DE001BAC90 /* ConversationSearchViewController.swift in Sources */,

View File

@ -22,6 +22,7 @@
#import "DateUtil.h"
#import "DebugUIMessages.h"
#import "DebugUIPage.h"
#import "DebugUIScreenshots.h"
#import "DebugUITableViewController.h"
#import "FingerprintViewController.h"
#import "MediaDetailViewController.h"

View File

@ -0,0 +1,17 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
#import "DebugUIPage.h"
#ifdef DEBUG
NS_ASSUME_NONNULL_BEGIN
@interface DebugUIScreenshots : DebugUIPage
@end
NS_ASSUME_NONNULL_END
#endif

View File

@ -0,0 +1,62 @@
//
// Copyright (c) 2020 Open Whisper Systems. All rights reserved.
//
#import "DebugUIScreenshots.h"
#import "DebugContactsUtils.h"
#import "DebugUIContacts.h"
#import "OWSTableViewController.h"
#import "Signal-Swift.h"
#import <SignalCoreKit/NSDate+OWS.h>
#import <SignalCoreKit/Randomness.h>
#import <SignalMessaging/Environment.h>
#import <SignalServiceKit/MIMETypeUtil.h>
#import <SignalServiceKit/OWSBatchMessageProcessor.h>
#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
#import <SignalServiceKit/OWSGroupInfoRequestMessage.h>
#import <SignalServiceKit/OWSMessageUtils.h>
#import <SignalServiceKit/OWSVerificationStateChangeMessage.h>
#import <SignalServiceKit/SSKSessionStore.h>
#import <SignalServiceKit/SignalServiceKit-Swift.h>
#import <SignalServiceKit/TSIncomingMessage.h>
#import <SignalServiceKit/TSInvalidIdentityKeyReceivingErrorMessage.h>
#import <SignalServiceKit/TSOutgoingMessage.h>
#import <SignalServiceKit/TSThread.h>
#ifdef DEBUG
NS_ASSUME_NONNULL_BEGIN
@implementation DebugUIScreenshots
#pragma mark - Factory Methods
- (NSString *)name
{
return @"Screenshots";
}
- (nullable OWSTableSection *)sectionForThread:(nullable TSThread *)thread
{
NSMutableArray<OWSTableItem *> *items = [NSMutableArray new];
[items addObjectsFromArray:@[
[OWSTableItem itemWithTitle:@"Delete all threads"
actionBlock:^{
[DebugUIScreenshots deleteAllThreads];
}],
[OWSTableItem itemWithTitle:@"Make Threads for Screenshots"
actionBlock:^{
[DebugUIScreenshots makeThreadsForScreenshots];
}],
]];
return [OWSTableSection sectionWithTitle:self.name items:items];
}
@end
NS_ASSUME_NONNULL_END
#endif

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
#import "DebugUIDiskUsage.h"
#import "DebugUIMessages.h"
#import "DebugUIMisc.h"
#import "DebugUIScreenshots.h"
#import "DebugUISessionState.h"
#import "DebugUIStress.h"
#import "DebugUISyncMessages.h"
@ -94,8 +95,12 @@ NS_ASSUME_NONNULL_BEGIN
[subsectionItems addObject:[self itemForSubsection:[DebugUIProfile new] viewController:viewController thread:thread]];
[subsectionItems
addObject:[self itemForSubsection:[DebugUIStress new] viewController:viewController thread:thread]];
[subsectionItems
addObject:[self itemForSubsection:[DebugUISyncMessages new] viewController:viewController thread:thread]];
[subsectionItems addObject:[self itemForSubsection:[DebugUISyncMessages new]
viewController:viewController
thread:thread]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIScreenshots new]
viewController:viewController
thread:thread]];
OWSTableItem *sharedDataFileBrowserItem = [OWSTableItem
disclosureItemWithText:@"📁 Shared Container"
actionBlock:^{
@ -153,6 +158,9 @@ NS_ASSUME_NONNULL_BEGIN
addObject:[self itemForSubsection:[DebugUISyncMessages new] viewController:viewController thread:nil]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIBackup new] viewController:viewController thread:nil]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIGroupsV2 new] viewController:viewController thread:nil]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIScreenshots new]
viewController:viewController
thread:nil]];
[subsectionItems addObject:[self itemForSubsection:[DebugUIMisc new] viewController:viewController thread:nil]];
[contents addSection:[OWSTableSection sectionWithTitle:@"Sections" items:subsectionItems]];

View File

@ -2978,6 +2978,141 @@
/* Label for button on lock screen that lets users unlock Signal. */
"SCREEN_LOCK_UNLOCK_SIGNAL" = "Unlock Signal";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. This should be a unique non-public figure's name. This will have a female profile photo. */
"SCREENSHOT_NAME_CONTACT_EIGHT" = "Tina Ukuku";
/* This is a contact's name. Please keep the nick name Ali and change the last name to a popular lastname in your language. This will have male profile photo. */
"SCREENSHOT_NAME_CONTACT_FIVE" = "Ali Smith";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. This should be a unique non-public figure's name. This profile photo will be either male or female. Choose a unisex name if possible. */
"SCREENSHOT_NAME_CONTACT_FOUR" = "Artemis Cheng";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. Include two last names if that is represented in your locale. This should be a unique non-public figure's name. This will have a female profile photo. */
"SCREENSHOT_NAME_CONTACT_NINE" = "Zeus Lehtonen";
/* This is a contact's name. A male leadership/presidential position + the sound a cat makes. This will have a cat profile photo. */
"SCREENSHOT_NAME_CONTACT_ONE" = "Chairman Meow";
/* This is a contact's name. Please keep a similar unisex first name (Kai) if this name isn't common and only post the last initial. This will have a female profile photo. */
"SCREENSHOT_NAME_CONTACT_SEVEN" = "Jordan B.";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. This will have a male profile photo. */
"SCREENSHOT_NAME_CONTACT_SIX" = "Michael Kirk";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. This should be a unique non-public figure's name. This will have a female profile photo. */
"SCREENSHOT_NAME_CONTACT_TEN" = "Maya Dorai";
/* This is a contact's name. Please keep a similar nickname for Nikola/Nikita/etc in your language and only post the last initial. This profile photo will be either male or female but mostly female. */
"SCREENSHOT_NAME_CONTACT_THREE" = "Nikki Romanov";
/* This is a contact's name. Replace the name for a more common name in your locale if this sounds too foreign. This should be a unique non-public figure's name. This profile photo will be either male or female. */
"SCREENSHOT_NAME_CONTACT_TWO" = "Myles Larson";
/* This is a group chat of family members. Please keep Kirk or replace with a common last name in your locale. Translate 'Family' */
"SCREENSHOT_NAME_GROUP_FIVE" = "Kirk Family";
/* Please include emoji. This is a group name/channel name for pictures of the sun in the sky. */
"SCREENSHOT_NAME_GROUP_FOUR" = "Sunsets 🌅";
/* This is for a group of people interested in discussing books they've read. */
"SCREENSHOT_NAME_GROUP_ONE" = "Book Club";
/* This is group chat name for members talking about cats. Please include the emoji. */
"SCREENSHOT_NAME_GROUP_SIX" = "Cat Chat 🐈 🐱";
/* Please include emoji. This is a group name for people who climb rocks/climb trees/hike mountains/outside mountaineering. */
"SCREENSHOT_NAME_GROUP_THREE" = "🧗🏽‍♀️ Rock Climbers";
/* This is for a group chat for people who want weather updates. */
"SCREENSHOT_NAME_GROUP_TWO" = "Weather Forecasts";
/* This appears in Signal > Settings. A female leadership/presidential/chairwoman position + female name Freyja or similar spelling. This will have a cat profile photo. */
"SCREENSHOT_NAME_LOCAL_PROFILE" = "Chairwoman Freya";
/* This is a message expressing support/happiness/awe/shock. */
"SCREENSHOT_THREAD_DIRECT_FIVE_MESSAGE_ONE" = "Congrats! I can't believe it!";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_FIVE_MESSAGE_THREE" = "See you tomorrow?";
/* This is a message. Please include the emoji. */
"SCREENSHOT_THREAD_DIRECT_FIVE_MESSAGE_TWO" = "Thank you ☺️";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_FOUR_MESSAGE_ONE" = "Your wisdom has saved me.";
/* This is a message. Include 'Thanks' + a similar phrase with the :) emoji. */
"SCREENSHOT_THREAD_DIRECT_FOUR_MESSAGE_TWO" = "Thanks! What a wonderful message to read :)";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_ONE_MESSAGE_ONE" = "The rain is pouring down and I'm sitting here just listening to it.";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_ONE_MESSAGE_TWO" = "That's what I did this morning too.";
/* This is a message before a call. */
"SCREENSHOT_THREAD_DIRECT_SEVEN_MESSAGE_ONE" = "Free for a call?";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_SIX_MESSAGE_ONE" = "Yes!";
/* Replace crepes with similar item that you bake or cook i.e. bread, croissants, naan. */
"SCREENSHOT_THREAD_DIRECT_THREE_MESSAGE_ONE" = "We're making crepes tomorrow";
/* This is a message before an image of mountains + a lake. */
"SCREENSHOT_THREAD_DIRECT_TWO_MESSAGE_ONE" = "Hey check this out!";
/* This is a message. */
"SCREENSHOT_THREAD_DIRECT_TWO_MESSAGE_THREE" = "New Zealand!";
/* This is a message after an image of mountains + a lake. */
"SCREENSHOT_THREAD_DIRECT_TWO_MESSAGE_TWO" = "Whoa where are you!?";
/* This is a message in the group chat of family members. */
"SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_ONE" = "Today is ...";
/* This is a message in the group chat of family members. */
"SCREENSHOT_THREAD_GROUP_FIVE_MESSAGE_TWO" = "Happy birthday to you. Happy birthday to you!";
/* This is a message in the Sunsets group chat. */
"SCREENSHOT_THREAD_GROUP_FOUR_MESSAGE_ONE" = "It's too cloudy here.";
/* 1984 is the book title. The file extension is a text file. */
"SCREENSHOT_THREAD_GROUP_ONE_FILE_NAME" = "1984.txt";
/* This is for a message in the 'Book Club' group chat */
"SCREENSHOT_THREAD_GROUP_ONE_MESSAGE_ONE" = "Did you read this yet?";
/* This is a file name 'Instructions' for the cat chat group. */
"SCREENSHOT_THREAD_GROUP_SIX_FILE_NAME" = "Instructions.PDF";
/* This is a message in the cat chat group. */
"SCREENSHOT_THREAD_GROUP_SIX_MESSAGE_FIVE" = "This is the instruction manual.";
/* This is a message in the cat chat group. */
"SCREENSHOT_THREAD_GROUP_SIX_MESSAGE_FOUR" = "Pictures, please!";
/* This is a message after seeing a picture. */
"SCREENSHOT_THREAD_GROUP_SIX_MESSAGE_ONE" = "This is peaceful.";
/* This is a message in the cat chat group. */
"SCREENSHOT_THREAD_GROUP_SIX_MESSAGE_THREE" = "Shes walking a cat on a leash...";
/* This is a message. */
"SCREENSHOT_THREAD_GROUP_SIX_MESSAGE_TWO" = "🌅 Good Morning!";
/* This is a message in the 'Rock Climbers' group chat. Please translate to make sense for the translated group name. For example: Which way should we go? */
"SCREENSHOT_THREAD_GROUP_THREE_MESSAGE_ONE" = "Which route should we take?";
/* This is a message. Please include the emoji if possible. */
"SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_ONE" = "See you all there 🤗";
/* This is a message sent with an attachment. */
"SCREENSHOT_THREAD_GROUP_TWO_MESSAGE_TWO" = "Raining all day";
/* An example name for a user we use in the screenshots. */
"SCREENSHOT_USERNAME_1" = "SCREENSHOT_USERNAME_1";
/* Placeholder text indicating the user can search for contacts by name, username, or phone number. */
"SEARCH_BY_NAME_OR_USERNAME_OR_NUMBER_PLACEHOLDER_TEXT" = "Name, username, or number";

View File

@ -118,6 +118,10 @@ NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:receivedAtTimestamp
// NOTE: This is only for use by the YDB-to-GRDB legacy migration.
- (void)replaceSortId:(uint64_t)sortId;
#if TESTABLE_BUILD
- (void)replaceReceivedAtTimestamp:(uint64_t)receivedAtTimestamp;
#endif
@end
NS_ASSUME_NONNULL_END

View File

@ -365,6 +365,12 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
_sortId = sortId;
}
#if TESTABLE_BUILD
- (void)replaceReceivedAtTimestamp:(uint64_t)receivedAtTimestamp {
_receivedAtTimestamp = receivedAtTimestamp;
}
#endif
@end
NS_ASSUME_NONNULL_END

View File

@ -144,4 +144,11 @@ public class TSOutgoingMessageBuilder: NSObject {
hasBuilt = true
return TSOutgoingMessage(outgoingMessageWithBuilder: self)
}
#if TESTABLE_BUILD
@objc
public func addAttachmentId(_ attachmentId: String) {
attachmentIds.add(attachmentId)
}
#endif
}

View File

@ -912,7 +912,7 @@ NSString *const OWSMessageSenderRateLimitedException = @"RateLimitedException";
- (nullable TSThread *)threadForMessage:(TSMessage *)message transaction:(SDSAnyWriteTransaction *)transaction
{
TSThread *_Nullable thread = [message threadWithTransaction:transaction];
OWSAssertDebug(thread != nil);
// OWSAssertDebug(thread != nil);
// For some legacy sync messages, thread may be nil.
// In this case, we should try to use the "local" thread.