ChatViewController.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import <AudioToolbox/AudioToolbox.h>
  21. #import <CoreData/CoreData.h>
  22. #import "ChatBar.h"
  23. #import "PreviewImageViewController.h"
  24. #import "ChatViewHeader.h"
  25. #import "PlayRecordAudioViewController.h"
  26. #import "ThemedViewController.h"
  27. @class Conversation;
  28. @class BaseMessage;
  29. @class ImageMessage;
  30. @class LocationMessage;
  31. @class VideoMessage;
  32. @class AudioMessage;
  33. @class ChatMessageCell;
  34. @class BallotMessage;
  35. @class FileMessage;
  36. @class PPAssetsActionController;
  37. @class ChatViewControllerAction;
  38. typedef void (^ChatViewControllerCompletionBlock)(ChatViewController *chatViewController);
  39. @protocol ChatViewControllerDelegate <NSObject>
  40. - (void)presentChatViewController:(ChatViewController *)chatViewController onCompletion:(ChatViewControllerCompletionBlock)onCompletion;
  41. - (void)cancelSwipeGestureFromConversations;
  42. - (void)pushSettingChanged:(Conversation *)conversation;
  43. @end
  44. @interface ChatViewController : ThemedViewController <ChatBarDelegate, PreviewImageViewControllerDelegate, ChatViewHeaderDelegate, UIScrollViewDelegate, PlayRecordAudioDelegate> {
  45. }
  46. @property (nonatomic, assign) SystemSoundID sentMessageSound;
  47. @property (nonatomic, retain) UITableView *chatContent;
  48. @property ChatViewHeader *headerView;
  49. @property (weak, nonatomic) IBOutlet UIView *chatContentHeader;
  50. @property (nonatomic, strong) ChatBar *chatBar;
  51. @property (weak, nonatomic) IBOutlet UIButton *loadEarlierMessages;
  52. @property (nonatomic, strong) Conversation *conversation;
  53. @property (nonatomic) BOOL composing;
  54. @property (nonatomic) BOOL searching;
  55. @property (nonatomic) NSString *searchPattern;
  56. @property (nonatomic) BOOL isOpenWithForceTouch;
  57. @property (readwrite) NSString *messageText;
  58. @property (nonatomic, strong) NSData *imageDataToSend;
  59. @property (nonatomic) int deleteMediaTotal;
  60. @property (weak) id<ChatViewControllerDelegate> delegate;
  61. @property (nonatomic) BOOL showHeader;
  62. - (void)setCurrentAction:(ChatViewControllerAction *)newAction;
  63. - (BOOL)visible;
  64. - (CGFloat)visibleChatHeight;
  65. - (void)refresh;
  66. - (IBAction)loadEarlierMessagesAction:(id)sender;
  67. - (void)showContentAfterForceTouch;
  68. - (void)startRecordingAudio;
  69. - (void)createBallot;
  70. - (void)sendFile;
  71. - (void)imageMessageTapped:(ImageMessage *)message;
  72. - (void)fileImageMessageTapped:(FileMessage *)message;
  73. - (void)locationMessageTapped:(LocationMessage*)message;
  74. - (void)fileVideoMessageTapped:(FileMessage *)message;
  75. - (void)videoMessageTapped:(VideoMessage *)message;
  76. - (void)audioMessageTapped:(AudioMessage *)message;
  77. - (void)fileAudioMessageTapped:(FileMessage *)message;
  78. - (void)showMessageDetails:(BaseMessage *)message;
  79. - (void)messageBackgroundTapped:(BaseMessage*)message;
  80. - (void)ballotMessageTapped:(BallotMessage*)message;
  81. - (void)mentionTapped:(id)mentionObject;
  82. - (void)showQuotedMessage:(BaseMessage *)message;
  83. - (void)openPushSettings;
  84. - (void)updateConversation;
  85. - (void)updateConversationLastMessage;
  86. - (void)presentActivityViewController:(UIActivityViewController *)viewControllerToPresent animated:(BOOL)flag fromView:(UIView *)view;
  87. - (NSInteger)messageOffset;
  88. - (NSIndexPath *)indexPathForMessage:(BaseMessage *)message;
  89. - (id)objectAtIndexPath:(NSIndexPath *)indexPath;
  90. - (void)observeUpdatesForMessage:(BaseMessage *)message;
  91. - (void)startVoipCall:(BOOL)withVideo;
  92. - (void)removeConversationObservers;
  93. - (void)cleanCellHeightCache;
  94. - (void)showHeaderWithDuration:(CGFloat)duration completion:(void (^ __nullable)(BOOL finished))completion;
  95. @end