AppManager.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. @class FIRApp;
  18. @class FIRAuth;
  19. @class FIROptions;
  20. @class FIRPhoneAuthProvider;
  21. NS_ASSUME_NONNULL_BEGIN
  22. /** @class AppManager
  23. @brief A manager of global FIRApp instances.
  24. */
  25. @interface AppManager : NSObject
  26. /** @property count
  27. @brief The total count of apps under management, including the default app.
  28. */
  29. @property(nonatomic, assign, readonly) int count;
  30. /** @property active
  31. @brief The index of the currently active app, 0 being the default app.
  32. */
  33. @property(nonatomic, assign) int active;
  34. /** @fn appAtIndex:
  35. @brief Retrieves the app at the given index.
  36. @param index The index of the app to be retrieved, 0 being the default app.
  37. @return The app at the given index.
  38. */
  39. - (nullable FIRApp *)appAtIndex:(int)index;
  40. /** @fn recreateAppAtIndex:withOptions:completion:
  41. @brief Deletes the app at the given index, and optionally creates it again with given options.
  42. @param index The index of the app to be recreated, 0 being the default app.
  43. @param options Optionally, the new options with which app should be created.
  44. @param completion The block to call when completes.
  45. */
  46. - (void)recreateAppAtIndex:(int)index
  47. withOptions:(nullable FIROptions *)options
  48. completion:(void (^)())completion;
  49. /** @fn sharedInstance
  50. @brief Gets a shared instance of the class.
  51. */
  52. + (instancetype)sharedInstance;
  53. /** @fn app
  54. @brief A shortcut to get the currently active app.
  55. */
  56. + (FIRApp *)app;
  57. /** @fn auth
  58. @brief A shortcut to get the auth instance for the currently active app.
  59. */
  60. + (FIRAuth *)auth;
  61. /** @fn phoneAuthProvider
  62. @brief A shortcut to get the phone auth provider for the currently active app.
  63. */
  64. + (FIRPhoneAuthProvider *)phoneAuthProvider;
  65. @end
  66. NS_ASSUME_NONNULL_END