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.

63 lines
2.3 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. NS_ASSUME_NONNULL_BEGIN
  18. /** @typedef FIRAuthDispatcherImplBlock
  19. @brief The type of block which can be set as the implementation for @c
  20. dispatchAfterDelay:queue:callback: .
  21. @param delay The delay in seconds after which the task will be scheduled to execute.
  22. @param queue The dispatch queue on which the task will be submitted.
  23. @param task The task (block) to be scheduled for future execution.
  24. */
  25. typedef void(^FIRAuthDispatcherImplBlock)(NSTimeInterval delay,
  26. dispatch_queue_t queue,
  27. void (^task)(void));
  28. /** @class FIRAuthDispatchAfter
  29. @brief A utility class used to facilitate scheduling tasks to be executed in the future.
  30. */
  31. @interface FIRAuthDispatcher : NSObject
  32. /** @property dispatchAfterImplementation
  33. @brief Allows custom implementation of dispatchAfterDelay:queue:callback:.
  34. @remarks Set to nil to restore default implementation.
  35. */
  36. @property(nonatomic, nullable, copy) FIRAuthDispatcherImplBlock dispatchAfterImplementation;
  37. /** @fn dispatchAfterDelay:queue:callback:
  38. @brief Schedules task in the future after a specified delay.
  39. @param delay The delay in seconds after which the task will be scheduled to execute.
  40. @param queue The dispatch queue on which the task will be submitted.
  41. @param task The task (block) to be scheduled for future execution.
  42. */
  43. - (void)dispatchAfterDelay:(NSTimeInterval)delay
  44. queue:(dispatch_queue_t)queue
  45. task:(void (^)(void))task;
  46. /** @fn sharedInstance
  47. @brief Gets the shared instance of this class.
  48. @returns The shared instance of this clss
  49. */
  50. + (instancetype)sharedInstance;
  51. @end
  52. NS_ASSUME_NONNULL_END