You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.8 KiB

6 years ago
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <UIKit/UIKit.h>
  18. NS_ASSUME_NONNULL_BEGIN
  19. /** @protocol FIRAuthAppDelegateHandler
  20. @brief The protocol to handle app delegate methods.
  21. */
  22. @protocol FIRAuthAppDelegateHandler <NSObject>
  23. /** @fn setAPNSToken:
  24. @brief Sets the APNs device token.
  25. @param token The APNs device token.
  26. */
  27. - (void)setAPNSToken:(NSData *)token;
  28. /** @fn handleAPNSTokenError:
  29. @brief Handles APNs device token error.
  30. @param error The APNs device token error.
  31. */
  32. - (void)handleAPNSTokenError:(NSError *)error;
  33. /** @fn canHandleNotification:
  34. @brief Checks whether the notification can be handled by the receiver, and handles it if so.
  35. @param notification The notification in question, which will be consumed if returns @c YES.
  36. @return Whether the notification can be (and already has been) handled by the receiver.
  37. */
  38. - (BOOL)canHandleNotification:(nonnull NSDictionary *)notification;
  39. /** @fn canHandleURL:
  40. @brief Checks whether the URL can be handled by the receiver, and handles it if so.
  41. @param url The URL in question, which will be consumed if returns @c YES.
  42. @return Whether the URL can be (and already has been) handled by the receiver.
  43. */
  44. - (BOOL)canHandleURL:(nonnull NSURL *)url;
  45. @end
  46. /** @class FIRAuthAppDelegateProxy
  47. @brief A manager for swizzling @c UIApplicationDelegate methods.
  48. */
  49. @interface FIRAuthAppDelegateProxy : NSObject
  50. /** @fn initWithApplication
  51. @brief Initialize the instance with the given @c UIApplication.
  52. @returns An initialized instance, or @c nil if a proxy cannot be established.
  53. @remarks This method should only be called from tests if called outside of this class.
  54. */
  55. - (nullable instancetype)initWithApplication:(nullable UIApplication *)application
  56. NS_DESIGNATED_INITIALIZER;
  57. /** @fn init
  58. @brief Call @c sharedInstance to get an instance of this class.
  59. */
  60. - (instancetype)init NS_UNAVAILABLE;
  61. /** @fn addHandler:
  62. @brief Adds a handler for UIApplicationDelegate methods.
  63. @param handler The handler to be added.
  64. */
  65. - (void)addHandler:(__weak id<FIRAuthAppDelegateHandler>)handler;
  66. /** @fn sharedInstance
  67. @brief Gets the shared instance of this class.
  68. @returns The shared instance of this class.
  69. */
  70. + (nullable instancetype)sharedInstance;
  71. @end
  72. NS_ASSUME_NONNULL_END