AppDelegate.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 <UIKit/UIKit.h>
  21. #import <CoreData/CoreData.h>
  22. #import "KKPasscodeLock.h"
  23. #import "JKLLockScreenViewController.h"
  24. #import <UserNotifications/UserNotifications.h>
  25. #define BACKGROUND_GRACE_TIME 5.0 // maximum amount of time to stay connected after moving to background (if not connected to Threema Web)
  26. #define BACKGROUND_GRACE_TIME_WEB 30.0 // maximum amount of time to stay connected after moving to background (if connected to Threema Web)
  27. #define PASTEBOARD_IMAGE_UTI @"ch.threema.app.imgenc"
  28. @protocol MagicTapHandler
  29. - (BOOL)handleMagicTap;
  30. @end
  31. @class AbstractMessage, BaseMessage;
  32. @interface AppDelegate : UIResponder <UIApplicationDelegate, JKLLockScreenViewControllerDelegate, UNUserNotificationCenterDelegate>
  33. @property (strong, nonatomic) UIWindow *window;
  34. @property (nonatomic) CFTimeInterval lastForegroundTransition;
  35. @property (nonatomic) BOOL active;
  36. @property (nonatomic) BOOL firstPushHandled;
  37. @property (nonatomic, strong) NSString *urlRestoreData;
  38. @property (nonatomic, strong) NSDate *appLaunchDate;
  39. @property (nonatomic) BOOL isAppLocked;
  40. @property (nonatomic) BOOL isLockscreenDismissed;
  41. @property (weak, nonatomic) id<MagicTapHandler> magicTapHandler;
  42. + (AppDelegate*)sharedAppDelegate;
  43. - (BOOL)isAppInBackground;
  44. + (UIAlertController *)isAlertViewShown;
  45. - (BOOL)isPresentingKeyGeneration;
  46. - (BOOL)isPresentingEnterLicense;
  47. - (void)presentKeyGeneration;
  48. - (void)presentIDBackupRestore;
  49. - (void)completedIDSetup;
  50. - (void)presentPasscodeView;
  51. - (UIViewController *)currentTopViewController;
  52. + (BOOL)hasBottomSafeAreaInsets;
  53. + (void)setupConnection;
  54. - (void)handleRemoteNotification:(NSDictionary*)userInfo receivedWhileRunning:(BOOL)receivedWhileRunning notification:(UNNotification *)notification;
  55. + (UIStoryboard *)getLaunchStoryboard;
  56. + (UIStoryboard *)getMainStoryboard;
  57. + (UIStoryboard *)getSettingsStoryboard;
  58. + (UIStoryboard *)getMyIdentityStoryboard;
  59. + (UITabBarController *)getMainTabBarController;
  60. @end