Add Debug UI around sharing UIImage.

This commit is contained in:
Matthew Chen 2018-01-18 13:39:52 -05:00
parent 0c6639cf52
commit 79ee6fa318
3 changed files with 37 additions and 11 deletions

View File

@ -12,7 +12,9 @@
#import "ThreadUtil.h"
#import <AFNetworking/AFNetworking.h>
#import <AxolotlKit/PreKeyBundle.h>
#import <SignalMessaging/AttachmentSharing.h>
#import <SignalMessaging/Environment.h>
#import <SignalMessaging/UIImage+OWS.h>
#import <SignalServiceKit/OWSDisappearingConfigurationUpdateInfoMessage.h>
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
#import <SignalServiceKit/OWSVerificationStateChangeMessage.h>
@ -95,15 +97,24 @@ NS_ASSUME_NONNULL_BEGIN
[DebugUIMisc sendUnencryptedDatabase:thread];
}]];
}
[items addObject:[OWSTableItem
subPageItemWithText:@"Export Backup w/o Password"
actionBlock:^(UIViewController *viewController) {
OWSBackupExportViewController *backupViewController =
[OWSBackupExportViewController new];
[backupViewController exportBackup:thread skipPassword:YES];
[viewController.navigationController pushViewController:backupViewController
animated:YES];
}]];
[items addObject:[OWSTableItem subPageItemWithText:@"Export Backup w/o Password"
actionBlock:^(UIViewController *viewController) {
OWSBackupExportViewController *backupViewController =
[OWSBackupExportViewController new];
[backupViewController exportBackup:thread skipPassword:YES];
[viewController.navigationController
pushViewController:backupViewController
animated:YES];
}]];
#ifdef DEBUG
[items addObject:[OWSTableItem subPageItemWithText:@"Share UIImage"
actionBlock:^(UIViewController *viewController) {
UIImage *image =
[UIImage imageWithColor:UIColor.redColor size:CGSizeMake(1.f, 1.f)];
[AttachmentSharing showShareUIForUIImage:image];
}]];
#endif
return [OWSTableSection sectionWithTitle:self.name items:items];
}

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
@class TSAttachmentStream;
@ -12,4 +12,8 @@
+ (void)showShareUIForText:(NSString *)text;
#ifdef DEBUG
+ (void)showShareUIForUIImage:(UIImage *)image;
#endif
@end

View File

@ -1,5 +1,5 @@
//
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "AttachmentSharing.h"
@ -35,6 +35,17 @@
]];
}
#ifdef DEBUG
+ (void)showShareUIForUIImage:(UIImage *)image
{
OWSAssert(image);
[AttachmentSharing showShareUIForActivityItems:@[
image,
]];
}
#endif
+ (void)showShareUIForActivityItems:(NSArray *)activityItems
{
OWSAssert(activityItems);