diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m b/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m index 56ecea710..9942b3741 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m @@ -12,7 +12,9 @@ #import "ThreadUtil.h" #import #import +#import #import +#import #import #import #import @@ -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]; } diff --git a/SignalMessaging/attachments/AttachmentSharing.h b/SignalMessaging/attachments/AttachmentSharing.h index bd52e57be..66bf2b833 100644 --- a/SignalMessaging/attachments/AttachmentSharing.h +++ b/SignalMessaging/attachments/AttachmentSharing.h @@ -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 diff --git a/SignalMessaging/attachments/AttachmentSharing.m b/SignalMessaging/attachments/AttachmentSharing.m index 2989ae3a0..7508a3645 100644 --- a/SignalMessaging/attachments/AttachmentSharing.m +++ b/SignalMessaging/attachments/AttachmentSharing.m @@ -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);