CustomTokenDataEntryViewController.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 <UIKit/UIKit.h>
  17. NS_ASSUME_NONNULL_BEGIN
  18. /** @typedef CustomTokenDataEntryViewControllerCompletion
  19. @brief The type of callback block invoked when a @c CustomTokenDataEntryViewController is
  20. dismissed (by either being cancelled or completed by the user.)
  21. @param cancelled Indicates the user cancelled the flow and didn't want to enter a token.
  22. @param userEnteredTokenText The token text the user entered.
  23. */
  24. typedef void (^CustomTokenDataEntryViewControllerCompletion)
  25. (BOOL cancelled, NSString *_Nullable userEnteredTokenText);
  26. /** @class CustomTokenDataEntryViewController
  27. @brief Simple view controller to allow data entry of custom BYOAuth tokens.
  28. */
  29. @interface CustomTokenDataEntryViewController : UIViewController
  30. /** @fn initWithNibName:bundle:
  31. @brief Please use initWithCompletion:
  32. */
  33. - (instancetype)initWithNibName:(NSString *_Nullable)nibNameOrNil
  34. bundle:(NSBundle *_Nullable)nibBundleOrNil NS_UNAVAILABLE;
  35. /** @fn initWithCoder:
  36. @brief Please use initWithCompletion:
  37. */
  38. - (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
  39. /** @fn initWithCompletion:
  40. @brief Designated initializer.
  41. @param completion A block which will be invoked when the user either chooses "cancel" or "done".
  42. */
  43. - (nullable instancetype)initWithCompletion:
  44. (CustomTokenDataEntryViewControllerCompletion)completion NS_DESIGNATED_INITIALIZER;
  45. @end
  46. NS_ASSUME_NONNULL_END