mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Sketch out debug UI.
// FREEBIE
This commit is contained in:
parent
00e88fefb0
commit
6b8d4ea7ae
|
@ -16,6 +16,8 @@
|
||||||
34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34330AA21E79686200DF2FB9 /* OWSProgressView.m */; };
|
34330AA31E79686200DF2FB9 /* OWSProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34330AA21E79686200DF2FB9 /* OWSProgressView.m */; };
|
||||||
344F2F671E57A932000D9322 /* UIViewController+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F2F661E57A932000D9322 /* UIViewController+OWS.m */; };
|
344F2F671E57A932000D9322 /* UIViewController+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 344F2F661E57A932000D9322 /* UIViewController+OWS.m */; };
|
||||||
34535D821E256BE9008A4747 /* UIView+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 34535D811E256BE9008A4747 /* UIView+OWS.m */; };
|
34535D821E256BE9008A4747 /* UIView+OWS.m in Sources */ = {isa = PBXBuildFile; fileRef = 34535D811E256BE9008A4747 /* UIView+OWS.m */; };
|
||||||
|
345671011E89A5F1006EE662 /* ThreadUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 345671001E89A5F1006EE662 /* ThreadUtil.m */; };
|
||||||
|
34802DD71E899CFB0032EA1D /* DebugUITableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34802DD61E899CFB0032EA1D /* DebugUITableViewController.m */; };
|
||||||
348A08421E6A044E0057E290 /* MessagesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 348A08411E6A044E0057E290 /* MessagesViewController.xib */; };
|
348A08421E6A044E0057E290 /* MessagesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 348A08411E6A044E0057E290 /* MessagesViewController.xib */; };
|
||||||
348A08441E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 348A08431E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib */; };
|
348A08441E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 348A08431E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib */; };
|
||||||
348A08511E6C73490057E290 /* AttachmentApprovalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 348A08501E6C73490057E290 /* AttachmentApprovalViewController.swift */; };
|
348A08511E6C73490057E290 /* AttachmentApprovalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 348A08501E6C73490057E290 /* AttachmentApprovalViewController.swift */; };
|
||||||
|
@ -400,6 +402,10 @@
|
||||||
344F2F661E57A932000D9322 /* UIViewController+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+OWS.m"; path = "util/UIViewController+OWS.m"; sourceTree = "<group>"; };
|
344F2F661E57A932000D9322 /* UIViewController+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+OWS.m"; path = "util/UIViewController+OWS.m"; sourceTree = "<group>"; };
|
||||||
34535D801E256BE9008A4747 /* UIView+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+OWS.h"; sourceTree = "<group>"; };
|
34535D801E256BE9008A4747 /* UIView+OWS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+OWS.h"; sourceTree = "<group>"; };
|
||||||
34535D811E256BE9008A4747 /* UIView+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+OWS.m"; sourceTree = "<group>"; };
|
34535D811E256BE9008A4747 /* UIView+OWS.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+OWS.m"; sourceTree = "<group>"; };
|
||||||
|
345670FF1E89A5F1006EE662 /* ThreadUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadUtil.h; sourceTree = "<group>"; };
|
||||||
|
345671001E89A5F1006EE662 /* ThreadUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ThreadUtil.m; sourceTree = "<group>"; };
|
||||||
|
34802DD51E899CFB0032EA1D /* DebugUITableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DebugUITableViewController.h; sourceTree = "<group>"; };
|
||||||
|
34802DD61E899CFB0032EA1D /* DebugUITableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DebugUITableViewController.m; sourceTree = "<group>"; };
|
||||||
348A08411E6A044E0057E290 /* MessagesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessagesViewController.xib; sourceTree = "<group>"; };
|
348A08411E6A044E0057E290 /* MessagesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessagesViewController.xib; sourceTree = "<group>"; };
|
||||||
348A08431E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OWSMessagesToolbarContentView.xib; sourceTree = "<group>"; };
|
348A08431E6A1D2C0057E290 /* OWSMessagesToolbarContentView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = OWSMessagesToolbarContentView.xib; sourceTree = "<group>"; };
|
||||||
348A08501E6C73490057E290 /* AttachmentApprovalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentApprovalViewController.swift; sourceTree = "<group>"; };
|
348A08501E6C73490057E290 /* AttachmentApprovalViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AttachmentApprovalViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -1227,12 +1233,9 @@
|
||||||
76EB04C818170B33006006FC /* util */ = {
|
76EB04C818170B33006006FC /* util */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
4579431C1E7C8CE9008ED0C0 /* Pastelog.h */,
|
|
||||||
4579431D1E7C8CE9008ED0C0 /* Pastelog.m */,
|
|
||||||
B68EF9B51C0B1E7D009C3DCD /* Animated GIFS */,
|
B68EF9B51C0B1E7D009C3DCD /* Animated GIFS */,
|
||||||
B6DA6B051B8A2F9A00CA6F98 /* AppStoreRating.h */,
|
B6DA6B051B8A2F9A00CA6F98 /* AppStoreRating.h */,
|
||||||
B6DA6B061B8A2F9A00CA6F98 /* AppStoreRating.m */,
|
B6DA6B061B8A2F9A00CA6F98 /* AppStoreRating.m */,
|
||||||
FCFA64B11A24F29E0007FB87 /* UI Categories */,
|
|
||||||
76EB04C918170B33006006FC /* ArrayUtil.h */,
|
76EB04C918170B33006006FC /* ArrayUtil.h */,
|
||||||
76EB04CA18170B33006006FC /* ArrayUtil.m */,
|
76EB04CA18170B33006006FC /* ArrayUtil.m */,
|
||||||
76EB04CF18170B33006006FC /* collections */,
|
76EB04CF18170B33006006FC /* collections */,
|
||||||
|
@ -1246,40 +1249,45 @@
|
||||||
B90418E5183E9DD40038554A /* DateUtil.m */,
|
B90418E5183E9DD40038554A /* DateUtil.m */,
|
||||||
76EB04E818170B33006006FC /* DictionaryUtil.h */,
|
76EB04E818170B33006006FC /* DictionaryUtil.h */,
|
||||||
76EB04E918170B33006006FC /* DictionaryUtil.m */,
|
76EB04E918170B33006006FC /* DictionaryUtil.m */,
|
||||||
|
453201241E71100C00F20761 /* DisplayableTextFilter.swift */,
|
||||||
76EB04EA18170B33006006FC /* FunctionalUtil.h */,
|
76EB04EA18170B33006006FC /* FunctionalUtil.h */,
|
||||||
76EB04EB18170B33006006FC /* FunctionalUtil.m */,
|
76EB04EB18170B33006006FC /* FunctionalUtil.m */,
|
||||||
BFB074C319A5611000F2947C /* FutureUtil.h */,
|
BFB074C319A5611000F2947C /* FutureUtil.h */,
|
||||||
BFB074C419A5611000F2947C /* FutureUtil.m */,
|
BFB074C419A5611000F2947C /* FutureUtil.m */,
|
||||||
|
B62F5E0E1C2980B4000D370C /* NSData+ows_StripToken.h */,
|
||||||
|
B62F5E0F1C2980B4000D370C /* NSData+ows_StripToken.m */,
|
||||||
76EB04EC18170B33006006FC /* NumberUtil.h */,
|
76EB04EC18170B33006006FC /* NumberUtil.h */,
|
||||||
76EB04ED18170B33006006FC /* NumberUtil.m */,
|
76EB04ED18170B33006006FC /* NumberUtil.m */,
|
||||||
BFB074C519A5611000F2947C /* ObservableValue.h */,
|
BFB074C519A5611000F2947C /* ObservableValue.h */,
|
||||||
BFB074C619A5611000F2947C /* ObservableValue.m */,
|
BFB074C619A5611000F2947C /* ObservableValue.m */,
|
||||||
76EB04EE18170B33006006FC /* Operation.h */,
|
76EB04EE18170B33006006FC /* Operation.h */,
|
||||||
76EB04EF18170B33006006FC /* Operation.m */,
|
76EB04EF18170B33006006FC /* Operation.m */,
|
||||||
|
45CD81F01DC03A22004C9430 /* OWSLogger.h */,
|
||||||
|
45CD81F11DC03A22004C9430 /* OWSLogger.m */,
|
||||||
|
45666F541D9B2827008FE134 /* OWSScrubbingLogFormatter.h */,
|
||||||
|
45666F551D9B2827008FE134 /* OWSScrubbingLogFormatter.m */,
|
||||||
|
4579431C1E7C8CE9008ED0C0 /* Pastelog.h */,
|
||||||
|
4579431D1E7C8CE9008ED0C0 /* Pastelog.m */,
|
||||||
|
450DF2041E0D74AC003D14BE /* Platform.swift */,
|
||||||
76EB04F018170B33006006FC /* protocols */,
|
76EB04F018170B33006006FC /* protocols */,
|
||||||
76EB04F518170B33006006FC /* StringUtil.h */,
|
76EB04F518170B33006006FC /* StringUtil.h */,
|
||||||
76EB04F618170B33006006FC /* StringUtil.m */,
|
76EB04F618170B33006006FC /* StringUtil.m */,
|
||||||
76EB04F718170B33006006FC /* ThreadManager.h */,
|
76EB04F718170B33006006FC /* ThreadManager.h */,
|
||||||
76EB04F818170B33006006FC /* ThreadManager.m */,
|
76EB04F818170B33006006FC /* ThreadManager.m */,
|
||||||
|
345670FF1E89A5F1006EE662 /* ThreadUtil.h */,
|
||||||
|
345671001E89A5F1006EE662 /* ThreadUtil.m */,
|
||||||
76EB04F918170B33006006FC /* TimeUtil.h */,
|
76EB04F918170B33006006FC /* TimeUtil.h */,
|
||||||
76EB04FA18170B33006006FC /* TimeUtil.m */,
|
76EB04FA18170B33006006FC /* TimeUtil.m */,
|
||||||
|
FCFA64B11A24F29E0007FB87 /* UI Categories */,
|
||||||
|
FCC81A961A44558300DFEC7D /* UIDevice+TSHardwareVersion.h */,
|
||||||
|
FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */,
|
||||||
B97940251832BD2400BD66CB /* UIUtil.h */,
|
B97940251832BD2400BD66CB /* UIUtil.h */,
|
||||||
B97940261832BD2400BD66CB /* UIUtil.m */,
|
B97940261832BD2400BD66CB /* UIUtil.m */,
|
||||||
76EB04FB18170B33006006FC /* Util.h */,
|
76EB04FB18170B33006006FC /* Util.h */,
|
||||||
76EB04FC18170B33006006FC /* Zid.h */,
|
|
||||||
76EB04FD18170B33006006FC /* Zid.m */,
|
|
||||||
FCC81A961A44558300DFEC7D /* UIDevice+TSHardwareVersion.h */,
|
|
||||||
FCC81A971A44558300DFEC7D /* UIDevice+TSHardwareVersion.m */,
|
|
||||||
B62F5E0E1C2980B4000D370C /* NSData+ows_StripToken.h */,
|
|
||||||
B62F5E0F1C2980B4000D370C /* NSData+ows_StripToken.m */,
|
|
||||||
45666F541D9B2827008FE134 /* OWSScrubbingLogFormatter.h */,
|
|
||||||
45666F551D9B2827008FE134 /* OWSScrubbingLogFormatter.m */,
|
|
||||||
45CD81F01DC03A22004C9430 /* OWSLogger.h */,
|
|
||||||
45CD81F11DC03A22004C9430 /* OWSLogger.m */,
|
|
||||||
450DF2041E0D74AC003D14BE /* Platform.swift */,
|
|
||||||
45F170D51E315310003FC1F2 /* Weak.swift */,
|
45F170D51E315310003FC1F2 /* Weak.swift */,
|
||||||
45F170CB1E310E22003FC1F2 /* WeakTimer.swift */,
|
45F170CB1E310E22003FC1F2 /* WeakTimer.swift */,
|
||||||
453201241E71100C00F20761 /* DisplayableTextFilter.swift */,
|
76EB04FC18170B33006006FC /* Zid.h */,
|
||||||
|
76EB04FD18170B33006006FC /* Zid.m */,
|
||||||
);
|
);
|
||||||
path = util;
|
path = util;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -1322,6 +1330,9 @@
|
||||||
340757C11E5602D6001F15DD /* AttachmentSharing.m */,
|
340757C11E5602D6001F15DD /* AttachmentSharing.m */,
|
||||||
451764261DE939F300EDB8B9 /* ContactsPicker.swift */,
|
451764261DE939F300EDB8B9 /* ContactsPicker.swift */,
|
||||||
E94066141DFC5B7B00B15392 /* ContactsPicker.xib */,
|
E94066141DFC5B7B00B15392 /* ContactsPicker.xib */,
|
||||||
|
34802DD51E899CFB0032EA1D /* DebugUITableViewController.h */,
|
||||||
|
34802DD61E899CFB0032EA1D /* DebugUITableViewController.m */,
|
||||||
|
4505C2C41E64977D00CEBF41 /* ExperienceUpgradesPageViewController.swift */,
|
||||||
45514DE11DDFA183003EFF90 /* InviteFlow.swift */,
|
45514DE11DDFA183003EFF90 /* InviteFlow.swift */,
|
||||||
B6BADBE51B88D1AC0086A80D /* LockInteractionController.h */,
|
B6BADBE51B88D1AC0086A80D /* LockInteractionController.h */,
|
||||||
B6BADBE61B88D1AC0086A80D /* LockInteractionController.m */,
|
B6BADBE61B88D1AC0086A80D /* LockInteractionController.m */,
|
||||||
|
@ -1330,7 +1341,6 @@
|
||||||
FC3196311A08141D0094C78E /* Settings */,
|
FC3196311A08141D0094C78E /* Settings */,
|
||||||
FC3196321A08142D0094C78E /* Signals */,
|
FC3196321A08142D0094C78E /* Signals */,
|
||||||
FCFD25791A1543D500F4C644 /* Signup */,
|
FCFD25791A1543D500F4C644 /* Signup */,
|
||||||
4505C2C41E64977D00CEBF41 /* ExperienceUpgradesPageViewController.swift */,
|
|
||||||
);
|
);
|
||||||
name = "View Controllers";
|
name = "View Controllers";
|
||||||
path = "view controllers";
|
path = "view controllers";
|
||||||
|
@ -2190,6 +2200,7 @@
|
||||||
45C681B71D305A580050903A /* OWSCall.m in Sources */,
|
45C681B71D305A580050903A /* OWSCall.m in Sources */,
|
||||||
76EB062618170B33006006FC /* Queue.m in Sources */,
|
76EB062618170B33006006FC /* Queue.m in Sources */,
|
||||||
D221A09A169C9E5E00537ABF /* main.m in Sources */,
|
D221A09A169C9E5E00537ABF /* main.m in Sources */,
|
||||||
|
345671011E89A5F1006EE662 /* ThreadUtil.m in Sources */,
|
||||||
45843D1F1D2236B30013E85A /* OWSContactsSearcher.m in Sources */,
|
45843D1F1D2236B30013E85A /* OWSContactsSearcher.m in Sources */,
|
||||||
76EB061618170B33006006FC /* AnonymousOccurrenceLogger.m in Sources */,
|
76EB061618170B33006006FC /* AnonymousOccurrenceLogger.m in Sources */,
|
||||||
450873C31D9D5149006B54F2 /* OWSExpirationTimerView.m in Sources */,
|
450873C31D9D5149006B54F2 /* OWSExpirationTimerView.m in Sources */,
|
||||||
|
@ -2289,6 +2300,7 @@
|
||||||
45B201761DAECBFE00C461E0 /* HighlightableLabel.swift in Sources */,
|
45B201761DAECBFE00C461E0 /* HighlightableLabel.swift in Sources */,
|
||||||
76EB064818170B33006006FC /* Zid.m in Sources */,
|
76EB064818170B33006006FC /* Zid.m in Sources */,
|
||||||
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */,
|
459311FC1D75C948008DD4F0 /* OWSDeviceTableViewCell.m in Sources */,
|
||||||
|
34802DD71E899CFB0032EA1D /* DebugUITableViewController.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
21
Signal/src/util/ThreadUtil.h
Normal file
21
Signal/src/util/ThreadUtil.h
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@class TSThread;
|
||||||
|
@class OWSMessageSender;
|
||||||
|
@class SignalAttachment;
|
||||||
|
|
||||||
|
@interface ThreadUtil : NSObject
|
||||||
|
|
||||||
|
+ (void)sendMessageWithText:(NSString *)text
|
||||||
|
inThread:(TSThread *)thread
|
||||||
|
messageSender:(OWSMessageSender *)messageSender;
|
||||||
|
|
||||||
|
+ (void)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||||
|
inThread:(TSThread *)thread
|
||||||
|
messageSender:(OWSMessageSender *)messageSender;
|
||||||
|
|
||||||
|
@end
|
97
Signal/src/util/ThreadUtil.m
Normal file
97
Signal/src/util/ThreadUtil.m
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "ThreadUtil.h"
|
||||||
|
#import "Signal-Swift.h"
|
||||||
|
#import <SignalServiceKit/NSDate+millisecondTimeStamp.h>
|
||||||
|
#import <SignalServiceKit/OWSDisappearingMessagesConfiguration.h>
|
||||||
|
#import <SignalServiceKit/OWSMessageSender.h>
|
||||||
|
#import <SignalServiceKit/TSOutgoingMessage.h>
|
||||||
|
#import <SignalServiceKit/TSThread.h>
|
||||||
|
|
||||||
|
@implementation ThreadUtil
|
||||||
|
|
||||||
|
+ (void)sendMessageWithText:(NSString *)text inThread:(TSThread *)thread messageSender:(OWSMessageSender *)messageSender
|
||||||
|
{
|
||||||
|
OWSAssert([NSThread isMainThread]);
|
||||||
|
OWSAssert(text.length > 0);
|
||||||
|
OWSAssert(thread);
|
||||||
|
OWSAssert(messageSender);
|
||||||
|
|
||||||
|
TSOutgoingMessage *message;
|
||||||
|
OWSDisappearingMessagesConfiguration *configuration =
|
||||||
|
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId];
|
||||||
|
if (configuration.isEnabled) {
|
||||||
|
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||||
|
inThread:thread
|
||||||
|
messageBody:text
|
||||||
|
attachmentIds:[NSMutableArray new]
|
||||||
|
expiresInSeconds:configuration.durationSeconds];
|
||||||
|
} else {
|
||||||
|
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||||
|
inThread:thread
|
||||||
|
messageBody:text];
|
||||||
|
}
|
||||||
|
|
||||||
|
[messageSender sendMessage:message
|
||||||
|
success:^{
|
||||||
|
DDLogInfo(@"%@ Successfully sent message.", self.tag);
|
||||||
|
}
|
||||||
|
failure:^(NSError *error) {
|
||||||
|
DDLogWarn(@"%@ Failed to deliver message with error: %@", self.tag, error);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (void)sendMessageWithAttachment:(SignalAttachment *)attachment
|
||||||
|
inThread:(TSThread *)thread
|
||||||
|
messageSender:(OWSMessageSender *)messageSender
|
||||||
|
{
|
||||||
|
OWSAssert([NSThread isMainThread]);
|
||||||
|
OWSAssert(attachment);
|
||||||
|
OWSAssert(![attachment hasError]);
|
||||||
|
OWSAssert([attachment mimeType].length > 0);
|
||||||
|
OWSAssert(thread);
|
||||||
|
OWSAssert(messageSender);
|
||||||
|
|
||||||
|
TSOutgoingMessage *message;
|
||||||
|
OWSDisappearingMessagesConfiguration *configuration =
|
||||||
|
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:thread.uniqueId];
|
||||||
|
if (configuration.isEnabled) {
|
||||||
|
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||||
|
inThread:thread
|
||||||
|
messageBody:nil
|
||||||
|
attachmentIds:[NSMutableArray new]
|
||||||
|
expiresInSeconds:configuration.durationSeconds];
|
||||||
|
} else {
|
||||||
|
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
||||||
|
inThread:thread
|
||||||
|
messageBody:nil
|
||||||
|
attachmentIds:[NSMutableArray new]];
|
||||||
|
}
|
||||||
|
|
||||||
|
[messageSender sendAttachmentData:attachment.data
|
||||||
|
contentType:[attachment mimeType]
|
||||||
|
inMessage:message
|
||||||
|
success:^{
|
||||||
|
DDLogDebug(@"%@ Successfully sent message attachment.", self.tag);
|
||||||
|
}
|
||||||
|
failure:^(NSError *error) {
|
||||||
|
DDLogError(@"%@ Failed to send message attachment with error: %@", self.tag, error);
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Logging
|
||||||
|
|
||||||
|
+ (NSString *)tag
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)tag
|
||||||
|
{
|
||||||
|
return self.class.tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
14
Signal/src/view controllers/DebugUITableViewController.h
Normal file
14
Signal/src/view controllers/DebugUITableViewController.h
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@class TSThread;
|
||||||
|
|
||||||
|
@interface DebugUITableViewController : UITableViewController
|
||||||
|
|
||||||
|
+ (void)presentDebugUIForThread:(TSThread *)thread
|
||||||
|
fromViewController:(UIViewController *)fromViewController;
|
||||||
|
|
||||||
|
@end
|
271
Signal/src/view controllers/DebugUITableViewController.m
Normal file
271
Signal/src/view controllers/DebugUITableViewController.m
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
//
|
||||||
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DebugUITableViewController.h"
|
||||||
|
#import "ThreadUtil.h"
|
||||||
|
#import "Environment.h"
|
||||||
|
#import <SignalServiceKit/TSThread.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@class OWSTableItem;
|
||||||
|
@class OWSTableSection;
|
||||||
|
|
||||||
|
@interface OWSTableContents : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic) NSString *title;
|
||||||
|
@property (nonatomic) NSMutableArray *sections;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
@implementation OWSTableContents
|
||||||
|
|
||||||
|
- (void)addSection:(OWSTableSection *)section {
|
||||||
|
OWSAssert(section);
|
||||||
|
|
||||||
|
if (!_sections) {
|
||||||
|
_sections = [NSMutableArray new];
|
||||||
|
}
|
||||||
|
|
||||||
|
[_sections addObject:section];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
@interface OWSTableSection : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic) NSString *title;
|
||||||
|
@property (nonatomic) NSMutableArray *items;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
@implementation OWSTableSection
|
||||||
|
|
||||||
|
+ (OWSTableSection *)sectionWithTitle:(NSString *)title
|
||||||
|
items:(NSArray *)items {
|
||||||
|
OWSTableSection *section = [OWSTableSection new];
|
||||||
|
section.title = title;
|
||||||
|
section.items = [items mutableCopy];
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addItem:(OWSTableItem *)item {
|
||||||
|
OWSAssert(item);
|
||||||
|
|
||||||
|
if (!_items) {
|
||||||
|
_items = [NSMutableArray new];
|
||||||
|
}
|
||||||
|
|
||||||
|
[_items addObject:item];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, OWSTableItemType) {
|
||||||
|
OWSTableItemTypeAction,
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef void (^OWSTableActionBlock)();
|
||||||
|
|
||||||
|
@interface OWSTableItem : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic) OWSTableItemType itemType;
|
||||||
|
@property (nonatomic) NSString *title;
|
||||||
|
@property (nonatomic) OWSTableActionBlock actionBlock;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
@implementation OWSTableItem
|
||||||
|
|
||||||
|
+ (OWSTableItem *)actionWithTitle:(NSString *)title
|
||||||
|
actionBlock:(OWSTableActionBlock)actionBlock {
|
||||||
|
OWSAssert(title.length > 0);
|
||||||
|
|
||||||
|
OWSTableItem *item = [OWSTableItem new];
|
||||||
|
item.itemType = OWSTableItemTypeAction;
|
||||||
|
item.actionBlock = actionBlock;
|
||||||
|
item.title = title;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
#pragma mark -
|
||||||
|
|
||||||
|
NSString * const kDebugUITableCellIdentifier = @"kDebugUITableCellIdentifier";
|
||||||
|
|
||||||
|
@interface DebugUITableViewController ()
|
||||||
|
|
||||||
|
@property (nonatomic) OWSTableContents *contents;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation DebugUITableViewController
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
[self.navigationController.navigationBar setTranslucent:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (instancetype)init
|
||||||
|
{
|
||||||
|
return [super initWithStyle:UITableViewStyleGrouped];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)loadView
|
||||||
|
{
|
||||||
|
[super loadView];
|
||||||
|
|
||||||
|
OWSAssert(self.contents);
|
||||||
|
|
||||||
|
self.title = self.contents.title;
|
||||||
|
|
||||||
|
OWSAssert(self.tableView);
|
||||||
|
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kDebugUITableCellIdentifier];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (OWSTableSection *)sectionForIndex:(NSInteger)sectionIndex
|
||||||
|
{
|
||||||
|
OWSAssert(self.contents);
|
||||||
|
OWSAssert(sectionIndex >= 0 && sectionIndex < (NSInteger) self.contents.sections.count);
|
||||||
|
|
||||||
|
OWSTableSection *section = self.contents.sections[(NSUInteger) sectionIndex];
|
||||||
|
return section;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (OWSTableItem *)itemForIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
OWSAssert(self.contents);
|
||||||
|
OWSAssert(indexPath.section >= 0 && indexPath.section < (NSInteger) self.contents.sections.count);
|
||||||
|
|
||||||
|
OWSTableSection *section = self.contents.sections[(NSUInteger) indexPath.section];
|
||||||
|
OWSAssert(indexPath.item >= 0 && indexPath.item < (NSInteger) section.items.count);
|
||||||
|
OWSTableItem *item = section.items[(NSUInteger) indexPath.item];
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Table view data source
|
||||||
|
|
||||||
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
|
OWSAssert(self.contents);
|
||||||
|
|
||||||
|
OWSAssert(self.contents.sections.count > 0);
|
||||||
|
return (NSInteger) self.contents.sections.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)sectionIndex {
|
||||||
|
OWSTableSection *section = [self sectionForIndex:sectionIndex];
|
||||||
|
OWSAssert(section.items.count > 0);
|
||||||
|
return (NSInteger) section.items.count;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (nullable NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)sectionIndex
|
||||||
|
{
|
||||||
|
OWSTableSection *section = [self sectionForIndex:sectionIndex];
|
||||||
|
return section.title;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||||
|
{
|
||||||
|
OWSTableItem *item = [self itemForIndexPath:indexPath];
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kDebugUITableCellIdentifier];
|
||||||
|
OWSAssert(cell);
|
||||||
|
|
||||||
|
cell.textLabel.text = item.title;
|
||||||
|
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
||||||
|
|
||||||
|
OWSTableItem *item = [self itemForIndexPath:indexPath];
|
||||||
|
if (item.itemType == OWSTableItemTypeAction) {
|
||||||
|
OWSAssert(item.actionBlock);
|
||||||
|
item.actionBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Logging
|
||||||
|
|
||||||
|
+ (NSString *)tag
|
||||||
|
{
|
||||||
|
return [NSString stringWithFormat:@"[%@]", self.class];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)tag
|
||||||
|
{
|
||||||
|
return self.class.tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma mark - Factory and presentation
|
||||||
|
|
||||||
|
+ (void)presentDebugUIForThread:(TSThread *)thread
|
||||||
|
fromViewController:(UIViewController *)fromViewController {
|
||||||
|
OWSAssert(thread);
|
||||||
|
OWSAssert(fromViewController);
|
||||||
|
|
||||||
|
OWSTableContents *contents = [OWSTableContents new];
|
||||||
|
contents.title = @"Debug: Conversation";
|
||||||
|
|
||||||
|
[contents addSection:[OWSTableSection sectionWithTitle:@"Messages View"
|
||||||
|
items:@[
|
||||||
|
[OWSTableItem actionWithTitle:@"Send 100 messages"
|
||||||
|
actionBlock:^{
|
||||||
|
[DebugUITableViewController sendTextMessage:100
|
||||||
|
thread:thread];
|
||||||
|
}],
|
||||||
|
]]];
|
||||||
|
|
||||||
|
DebugUITableViewController *viewController = [DebugUITableViewController new];
|
||||||
|
viewController.contents = contents;
|
||||||
|
[viewController presentFromViewController:fromViewController];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (void)sendTextMessage:(int)counter
|
||||||
|
thread:(TSThread *)thread {
|
||||||
|
OWSMessageSender *messageSender = [Environment getCurrent].messageSender;
|
||||||
|
if (counter < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[ThreadUtil sendMessageWithText:[@(counter) description]
|
||||||
|
inThread:thread
|
||||||
|
messageSender:messageSender];
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t) 1.f * NSEC_PER_SEC),
|
||||||
|
dispatch_get_main_queue(), ^{
|
||||||
|
[self sendTextMessage:counter - 1 thread:thread];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)presentFromViewController:(UIViewController *)fromViewController {
|
||||||
|
OWSAssert(fromViewController);
|
||||||
|
|
||||||
|
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self];
|
||||||
|
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop
|
||||||
|
target:self
|
||||||
|
action:@selector(donePressed:)];
|
||||||
|
|
||||||
|
[fromViewController presentViewController:navigationController
|
||||||
|
animated:YES
|
||||||
|
completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)donePressed:(id)sender {
|
||||||
|
[self dismissViewControllerAnimated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
|
@ -61,6 +61,8 @@
|
||||||
#import <SignalServiceKit/TSMessagesManager.h>
|
#import <SignalServiceKit/TSMessagesManager.h>
|
||||||
#import <SignalServiceKit/TSNetworkManager.h>
|
#import <SignalServiceKit/TSNetworkManager.h>
|
||||||
#import <YapDatabase/YapDatabaseView.h>
|
#import <YapDatabase/YapDatabaseView.h>
|
||||||
|
#import "ThreadUtil.h"
|
||||||
|
#import "DebugUITableViewController.h"
|
||||||
|
|
||||||
@import Photos;
|
@import Photos;
|
||||||
|
|
||||||
|
@ -619,6 +621,10 @@ typedef enum : NSUInteger {
|
||||||
self.navigationBarTitleView = [UIView new];
|
self.navigationBarTitleView = [UIView new];
|
||||||
[self.navigationBarTitleView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
|
[self.navigationBarTitleView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self
|
||||||
action:@selector(navigationTitleTapped:)]];
|
action:@selector(navigationTitleTapped:)]];
|
||||||
|
#ifdef DEBUG
|
||||||
|
[self.navigationBarTitleView addGestureRecognizer:[[UILongPressGestureRecognizer alloc] initWithTarget:self
|
||||||
|
action:@selector(navigationTitleLongPressed:)]];
|
||||||
|
#endif
|
||||||
|
|
||||||
self.navigationBarTitleLabel = [UILabel new];
|
self.navigationBarTitleLabel = [UILabel new];
|
||||||
self.navigationBarTitleLabel.textColor = [UIColor whiteColor];
|
self.navigationBarTitleLabel.textColor = [UIColor whiteColor];
|
||||||
|
@ -868,28 +874,9 @@ typedef enum : NSUInteger {
|
||||||
[JSQSystemSoundPlayer jsq_playMessageSentSound];
|
[JSQSystemSoundPlayer jsq_playMessageSentSound];
|
||||||
}
|
}
|
||||||
|
|
||||||
TSOutgoingMessage *message;
|
[ThreadUtil sendMessageWithText:text
|
||||||
OWSDisappearingMessagesConfiguration *configuration =
|
inThread:self.thread
|
||||||
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:self.thread.uniqueId];
|
messageSender:self.messageSender];
|
||||||
if (configuration.isEnabled) {
|
|
||||||
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
|
||||||
inThread:self.thread
|
|
||||||
messageBody:text
|
|
||||||
attachmentIds:[NSMutableArray new]
|
|
||||||
expiresInSeconds:configuration.durationSeconds];
|
|
||||||
} else {
|
|
||||||
message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp]
|
|
||||||
inThread:self.thread
|
|
||||||
messageBody:text];
|
|
||||||
}
|
|
||||||
|
|
||||||
[self.messageSender sendMessage:message
|
|
||||||
success:^{
|
|
||||||
DDLogInfo(@"%@ Successfully sent message.", self.tag);
|
|
||||||
}
|
|
||||||
failure:^(NSError *error) {
|
|
||||||
DDLogWarn(@"%@ Failed to deliver message with error: %@", self.tag, error);
|
|
||||||
}];
|
|
||||||
[self toggleDefaultKeyboard];
|
[self toggleDefaultKeyboard];
|
||||||
[self finishSendingMessage];
|
[self finishSendingMessage];
|
||||||
}
|
}
|
||||||
|
@ -2015,6 +2002,13 @@ typedef enum : NSUInteger {
|
||||||
OWSAssert([attachment mimeType].length > 0);
|
OWSAssert([attachment mimeType].length > 0);
|
||||||
|
|
||||||
DispatchMainThreadSafe(^{
|
DispatchMainThreadSafe(^{
|
||||||
|
DDLogVerbose(@"Sending attachment. Size in bytes: %lu, contentType: %@",
|
||||||
|
(unsigned long)attachment.data.length,
|
||||||
|
[attachment mimeType]);
|
||||||
|
[ThreadUtil sendMessageWithAttachment:attachment
|
||||||
|
inThread:self.thread
|
||||||
|
messageSender:self.messageSender];
|
||||||
|
|
||||||
TSOutgoingMessage *message;
|
TSOutgoingMessage *message;
|
||||||
OWSDisappearingMessagesConfiguration *configuration =
|
OWSDisappearingMessagesConfiguration *configuration =
|
||||||
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:self.thread.uniqueId];
|
[OWSDisappearingMessagesConfiguration fetchObjectWithUniqueID:self.thread.uniqueId];
|
||||||
|
@ -2030,20 +2024,6 @@ typedef enum : NSUInteger {
|
||||||
messageBody:nil
|
messageBody:nil
|
||||||
attachmentIds:[NSMutableArray new]];
|
attachmentIds:[NSMutableArray new]];
|
||||||
}
|
}
|
||||||
|
|
||||||
DDLogVerbose(@"Sending attachment. Size in bytes: %lu, contentType: %@",
|
|
||||||
(unsigned long)attachment.data.length,
|
|
||||||
[attachment mimeType]);
|
|
||||||
[self.messageSender sendAttachmentData:attachment.data
|
|
||||||
contentType:[attachment mimeType]
|
|
||||||
inMessage:message
|
|
||||||
success:^{
|
|
||||||
DDLogDebug(@"%@ Successfully sent message attachment.", self.tag);
|
|
||||||
}
|
|
||||||
failure:^(NSError *error) {
|
|
||||||
DDLogError(
|
|
||||||
@"%@ Failed to send message attachment with error: %@", self.tag, error);
|
|
||||||
}];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2539,6 +2519,15 @@ typedef enum : NSUInteger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
- (void)navigationTitleLongPressed:(UIGestureRecognizer *)gestureRecognizer {
|
||||||
|
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
|
||||||
|
[DebugUITableViewController presentDebugUIForThread:self.thread
|
||||||
|
fromViewController:self];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#pragma mark - JSQMessagesComposerTextViewPasteDelegate
|
#pragma mark - JSQMessagesComposerTextViewPasteDelegate
|
||||||
|
|
||||||
- (BOOL)composerTextView:(JSQMessagesComposerTextView *)textView
|
- (BOOL)composerTextView:(JSQMessagesComposerTextView *)textView
|
||||||
|
|
Loading…
Reference in a new issue