Browse Source

clean

pull/565/head
Ryan Zhao 11 months ago
parent
commit
a8c7f517eb
  1. 8
      Session.xcodeproj/project.pbxproj
  2. 1
      Session/Backups/OWSBackupSettingsViewController.m
  3. 1
      Session/Media Viewing & Editing/MediaDetailViewController.m
  4. 1
      Session/Meta/Signal-Bridging-Header.h
  5. 33
      SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.h
  6. 120
      SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.m
  7. 1
      SignalUtilitiesKit/Meta/SignalUtilitiesKit.h

8
Session.xcodeproj/project.pbxproj

@ -530,8 +530,6 @@
C38EF00C255B61CC007E1867 /* SignalUtilitiesKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C33FD9AB255A548A00E217F9 /* SignalUtilitiesKit.framework */; };
C38EF216255B6D3B007E1867 /* Theme.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF212255B6D3A007E1867 /* Theme.h */; settings = {ATTRIBUTES = (Public, ); }; };
C38EF218255B6D3B007E1867 /* Theme.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF214255B6D3A007E1867 /* Theme.m */; };
C38EF228255B6D5D007E1867 /* AttachmentSharing.m in Sources */ = {isa = PBXBuildFile; fileRef = C38EF223255B6D5D007E1867 /* AttachmentSharing.m */; };
C38EF22A255B6D5D007E1867 /* AttachmentSharing.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF225255B6D5D007E1867 /* AttachmentSharing.h */; settings = {ATTRIBUTES = (Public, ); }; };
C38EF22B255B6D5D007E1867 /* ShareViewDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */; };
C38EF22C255B6D5D007E1867 /* OWSVideoPlayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C38EF227255B6D5D007E1867 /* OWSVideoPlayer.swift */; };
C38EF243255B6D67007E1867 /* UIViewController+OWS.h in Headers */ = {isa = PBXBuildFile; fileRef = C38EF236255B6D65007E1867 /* UIViewController+OWS.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -1541,9 +1539,7 @@
C38EEF09255B49A8007E1867 /* SNProtoEnvelope+Conversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SNProtoEnvelope+Conversion.swift"; sourceTree = "<group>"; };
C38EF212255B6D3A007E1867 /* Theme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Theme.h; path = SignalUtilitiesKit/Utilities/Theme.h; sourceTree = SOURCE_ROOT; };
C38EF214255B6D3A007E1867 /* Theme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Theme.m; path = SignalUtilitiesKit/Utilities/Theme.m; sourceTree = SOURCE_ROOT; };
C38EF223255B6D5D007E1867 /* AttachmentSharing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AttachmentSharing.m; path = "SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.m"; sourceTree = SOURCE_ROOT; };
C38EF224255B6D5D007E1867 /* SignalAttachment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = SignalAttachment.swift; path = "SessionMessagingKit/Sending & Receiving/Attachments/SignalAttachment.swift"; sourceTree = SOURCE_ROOT; };
C38EF225255B6D5D007E1867 /* AttachmentSharing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AttachmentSharing.h; path = "SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.h"; sourceTree = SOURCE_ROOT; };
C38EF226255B6D5D007E1867 /* ShareViewDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShareViewDelegate.swift; path = SignalUtilitiesKit/Utilities/ShareViewDelegate.swift; sourceTree = SOURCE_ROOT; };
C38EF227255B6D5D007E1867 /* OWSVideoPlayer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OWSVideoPlayer.swift; path = "SignalUtilitiesKit/Media Viewing & Editing/OWSVideoPlayer.swift"; sourceTree = SOURCE_ROOT; };
C38EF236255B6D65007E1867 /* UIViewController+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+OWS.h"; path = "SignalUtilitiesKit/Utilities/UIViewController+OWS.h"; sourceTree = SOURCE_ROOT; };
@ -2966,8 +2962,6 @@
children = (
C379DCEA2567334F0002D4EB /* Attachment Approval */,
C379DCE9256733390002D4EB /* Image Editing */,
C38EF225255B6D5D007E1867 /* AttachmentSharing.h */,
C38EF223255B6D5D007E1867 /* AttachmentSharing.m */,
C38EF358255B6DCC007E1867 /* MediaMessageView.swift */,
C38EF357255B6DCC007E1867 /* MessageApprovalViewController.swift */,
C38EF227255B6D5D007E1867 /* OWSVideoPlayer.swift */,
@ -3633,7 +3627,6 @@
C38EF24C255B6D67007E1867 /* NSAttributedString+OWS.h in Headers */,
C38EF32B255B6DBF007E1867 /* OWSFormat.h in Headers */,
C33FDC2C255A581F00E217F9 /* OWSFailedAttachmentDownloadsJob.h in Headers */,
C38EF22A255B6D5D007E1867 /* AttachmentSharing.h in Headers */,
C33FDDB8255A582000E217F9 /* NSSet+Functional.h in Headers */,
C33FDDCC255A582000E217F9 /* TSConstants.h in Headers */,
C33FDDBD255A582000E217F9 /* ByteParser.h in Headers */,
@ -4528,7 +4521,6 @@
C38EF3BF255B6DE7007E1867 /* ImageEditorView.swift in Sources */,
C38EF365255B6DCC007E1867 /* OWSTableViewController.m in Sources */,
C38EF36B255B6DCC007E1867 /* ScreenLockViewController.m in Sources */,
C38EF228255B6D5D007E1867 /* AttachmentSharing.m in Sources */,
C38EF40C255B6DF7007E1867 /* GradientView.swift in Sources */,
C38EF35C255B6DCC007E1867 /* SelectThreadViewController.m in Sources */,
C38EF30E255B6DBF007E1867 /* FullTextSearcher.swift in Sources */,

1
Session/Backups/OWSBackupSettingsViewController.m

@ -7,7 +7,6 @@
#import "Session-Swift.h"
#import <PromiseKit/AnyPromise.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SessionMessagingKit/Environment.h>
#import <SignalUtilitiesKit/SignalUtilitiesKit-Swift.h>
#import <SignalUtilitiesKit/UIColor+OWS.h>

1
Session/Media Viewing & Editing/MediaDetailViewController.m

@ -3,7 +3,6 @@
//
#import "MediaDetailViewController.h"
#import "AttachmentSharing.h"
#import "ConversationViewItem.h"
#import "Session-Swift.h"
#import "TSAttachmentStream.h"

1
Session/Meta/Signal-Bridging-Header.h

@ -40,7 +40,6 @@
#import <SignalCoreKit/OWSAsserts.h>
#import <SignalCoreKit/OWSLogs.h>
#import <SignalCoreKit/Threading.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/ContactTableViewCell.h>
#import <SessionMessagingKit/Environment.h>
#import <SessionMessagingKit/OWSAudioPlayer.h>

33
SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.h

@ -1,33 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
NS_ASSUME_NONNULL_BEGIN
@class TSAttachmentStream;
typedef void (^AttachmentSharingCompletion)(UIActivityType __nullable activityType);
@interface AttachmentSharing : NSObject
+ (void)showShareUIForAttachments:(NSArray<TSAttachmentStream *> *)attachmentStreams
completion:(nullable AttachmentSharingCompletion)completion;
+ (void)showShareUIForAttachment:(TSAttachmentStream *)stream;
+ (void)showShareUIForAttachment:(TSAttachmentStream *)stream completion:(nullable AttachmentSharingCompletion)completion;
+ (void)showShareUIForURL:(NSURL *)url;
+ (void)showShareUIForURL:(NSURL *)url completion:(nullable AttachmentSharingCompletion)completion;
+ (void)showShareUIForURLs:(NSArray<NSURL *> *)urls completion:(nullable AttachmentSharingCompletion)completion;
+ (void)showShareUIForText:(NSString *)text;
+ (void)showShareUIForText:(NSString *)text completion:(nullable AttachmentSharingCompletion)completion;
#ifdef DEBUG
+ (void)showShareUIForUIImage:(UIImage *)image;
#endif
@end
NS_ASSUME_NONNULL_END

120
SignalUtilitiesKit/Media Viewing & Editing/AttachmentSharing.m

@ -1,120 +0,0 @@
//
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
//
#import "AttachmentSharing.h"
#import "UIUtil.h"
#import <SessionUtilitiesKit/AppContext.h>
#import <SessionMessagingKit/TSAttachmentStream.h>
NS_ASSUME_NONNULL_BEGIN
@implementation AttachmentSharing
+ (void)showShareUIForAttachments:(NSArray<TSAttachmentStream *> *)attachmentStreams
completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(attachmentStreams.count > 0);
NSMutableArray<NSURL *> *urls = [NSMutableArray new];
for (TSAttachmentStream *attachmentStream in attachmentStreams) {
[urls addObject:attachmentStream.originalMediaURL];
}
[AttachmentSharing showShareUIForActivityItems:urls completion:completion];
}
+ (void)showShareUIForAttachment:(TSAttachmentStream *)stream
{
OWSAssertDebug(stream);
[self showShareUIForAttachment:stream completion:nil];
}
+ (void)showShareUIForAttachment:(TSAttachmentStream *)stream completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(stream);
[self showShareUIForURL:stream.originalMediaURL completion:completion];
}
+ (void)showShareUIForURL:(NSURL *)url
{
[self showShareUIForURL:url completion:nil];
}
+ (void)showShareUIForURL:(NSURL *)url completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(url);
[AttachmentSharing showShareUIForActivityItems:@[ url ]
completion:completion];
}
+ (void)showShareUIForURLs:(NSArray<NSURL *> *)urls completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(urls.count > 0);
[AttachmentSharing showShareUIForActivityItems:urls
completion:completion];
}
+ (void)showShareUIForText:(NSString *)text
{
[self showShareUIForText:text completion:nil];
}
+ (void)showShareUIForText:(NSString *)text completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(text);
[AttachmentSharing showShareUIForActivityItems:@[ text, ]
completion:completion];
}
#ifdef DEBUG
+ (void)showShareUIForUIImage:(UIImage *)image
{
OWSAssertDebug(image);
[AttachmentSharing showShareUIForActivityItems:@[ image, ]
completion:nil];
}
#endif
+ (void)showShareUIForActivityItems:(NSArray *)activityItems completion:(nullable AttachmentSharingCompletion)completion
{
OWSAssertDebug(activityItems);
DispatchMainThreadSafe(^{
UIActivityViewController *activityViewController =
[[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:@[]];
[activityViewController setCompletionWithItemsHandler:^(UIActivityType __nullable activityType,
BOOL completed,
NSArray *__nullable returnedItems,
NSError *__nullable activityError) {
if (activityError) {
OWSLogInfo(@"Failed to share with activityError: %@", activityError);
} else if (completed) {
OWSLogInfo(@"Did share with activityType: %@", activityType);
}
if (completion) {
DispatchMainThreadSafe(^{ completion(activityType); });
}
}];
UIViewController *fromViewController = CurrentAppContext().frontmostViewController;
while (fromViewController.presentedViewController) {
fromViewController = fromViewController.presentedViewController;
}
OWSAssertDebug(fromViewController);
[fromViewController presentViewController:activityViewController animated:YES completion:nil];
});
}
@end
NS_ASSUME_NONNULL_END

1
SignalUtilitiesKit/Meta/SignalUtilitiesKit.h

@ -9,7 +9,6 @@ FOUNDATION_EXPORT const unsigned char SignalUtilitiesKitVersionString[];
#import <SignalUtilitiesKit/AppSetup.h>
#import <SignalUtilitiesKit/AppVersion.h>
#import <SignalUtilitiesKit/AttachmentSharing.h>
#import <SignalUtilitiesKit/BlockListUIUtils.h>
#import <SignalUtilitiesKit/ByteParser.h>
#import <SignalUtilitiesKit/ContactCellView.h>

Loading…
Cancel
Save