session-ios/Session/Meta/SignalApp.h

63 lines
1.8 KiB
C
Raw Normal View History

//
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
//
2021-02-19 05:46:52 +01:00
#import "ConversationViewAction.h"
2018-05-02 16:08:47 +02:00
2018-06-11 21:31:54 +02:00
NS_ASSUME_NONNULL_BEGIN
@class AccountManager;
@class CallService;
@class CallUIAdapter;
2019-11-28 06:42:07 +01:00
@class HomeVC;
@class OWSMessageFetcherJob;
@class OWSNavigationController;
@class OutboundCallInitiator;
@class TSThread;
@interface SignalApp : NSObject
2019-11-28 06:42:07 +01:00
@property (nonatomic, nullable, weak) HomeVC *homeViewController;
2018-06-11 21:31:54 +02:00
@property (nonatomic, nullable, weak) OWSNavigationController *signUpFlowNavigationController;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)sharedApp;
2018-10-15 20:34:41 +02:00
- (void)setup;
2018-09-17 15:27:58 +02:00
Faster conversation presentation. There are multiple places in the codebase we present a conversation. We used to have some very conservative machinery around how this was done, for fear of failing to present the call view controller, which would have left a hidden call in the background. We've since addressed that concern more thoroughly via the separate calling UIWindow. As such, the remaining presentation machinery is overly complex and inflexible for what we need. Sometimes we want to animate-push the conversation. (tap on home, tap on "send message" in contact card/group members) Sometimes we want to dismiss a modal, to reveal the conversation behind it (contact picker, group creation) Sometimes we want to present the conversation with no animation (becoming active from a notification) We also want to ensure that we're never pushing more than one conversation view controller, which was previously a problem since we were "pushing" a newly constructed VC in response to these myriad actions. It turned out there were certain code paths that caused multiple actions to be fired in rapid succession which pushed multiple ConversationVC's. The built-in method: `setViewControllers:animated` easily ensures we only have one ConversationVC on the stack, while being composable enough to faciliate the various more efficient animations we desire. The only thing lost with the complex methods is that the naive `presentViewController:` can fail, e.g. if another view is already presented. E.g. if an alert appears *just* before the user taps compose, the contact picker will fail to present. Since we no longer depend on this for presenting the CallViewController, this isn't catostrophic, and in fact, arguable preferable, since we want the user to read and dismiss any alert explicitly. // FREEBIE
2018-08-18 22:54:35 +02:00
#pragma mark - Conversation Presentation
- (void)presentConversationForRecipientId:(NSString *)recipientId animated:(BOOL)isAnimated;
- (void)presentConversationForRecipientId:(NSString *)recipientId
action:(ConversationViewAction)action
animated:(BOOL)isAnimated;
- (void)presentConversationForThreadId:(NSString *)threadId animated:(BOOL)isAnimated;
- (void)presentConversationForThread:(TSThread *)thread animated:(BOOL)isAnimated;
- (void)presentConversationForThread:(TSThread *)thread action:(ConversationViewAction)action animated:(BOOL)isAnimated;
2018-06-11 21:31:54 +02:00
- (void)presentConversationForThread:(TSThread *)thread
action:(ConversationViewAction)action
Faster conversation presentation. There are multiple places in the codebase we present a conversation. We used to have some very conservative machinery around how this was done, for fear of failing to present the call view controller, which would have left a hidden call in the background. We've since addressed that concern more thoroughly via the separate calling UIWindow. As such, the remaining presentation machinery is overly complex and inflexible for what we need. Sometimes we want to animate-push the conversation. (tap on home, tap on "send message" in contact card/group members) Sometimes we want to dismiss a modal, to reveal the conversation behind it (contact picker, group creation) Sometimes we want to present the conversation with no animation (becoming active from a notification) We also want to ensure that we're never pushing more than one conversation view controller, which was previously a problem since we were "pushing" a newly constructed VC in response to these myriad actions. It turned out there were certain code paths that caused multiple actions to be fired in rapid succession which pushed multiple ConversationVC's. The built-in method: `setViewControllers:animated` easily ensures we only have one ConversationVC on the stack, while being composable enough to faciliate the various more efficient animations we desire. The only thing lost with the complex methods is that the naive `presentViewController:` can fail, e.g. if another view is already presented. E.g. if an alert appears *just* before the user taps compose, the contact picker will fail to present. Since we no longer depend on this for presenting the CallViewController, this isn't catostrophic, and in fact, arguable preferable, since we want the user to read and dismiss any alert explicitly. // FREEBIE
2018-08-18 22:54:35 +02:00
focusMessageId:(nullable NSString *)focusMessageId
animated:(BOOL)isAnimated;
2019-03-28 23:01:49 +01:00
- (void)presentConversationAndScrollToFirstUnreadMessageForThreadId:(NSString *)threadId animated:(BOOL)isAnimated;
#pragma mark - Methods
+ (void)resetAppData;
2019-12-03 00:28:09 +01:00
+ (void)resetAppData:(void (^__nullable)(void))onReset;
2018-05-11 21:37:13 +02:00
2018-11-19 23:35:35 +01:00
- (void)showHomeView;
2021-08-05 06:40:52 +02:00
- (nullable UIView *)snapshotSplitViewControllerAfterScreenUpdates:(BOOL)afterScreenUpdates;
@end
2018-06-11 21:31:54 +02:00
NS_ASSUME_NONNULL_END