GIDSignInCallbackSchemes.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright 2021 Google LLC
  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. @protocol GIDBundle <NSObject>
  19. - (nullable id)objectForInfoDictionaryKey:(NSString *)key;
  20. @end
  21. @interface NSBundle (NSBundleGIDBundle) <GIDBundle>
  22. @end
  23. /// A utility class for dealing with callback schemes.
  24. @interface GIDSignInCallbackSchemes : NSObject
  25. /// Please call the designated initializer.
  26. - (instancetype)init NS_UNAVAILABLE;
  27. /// The designated initializer.
  28. - (instancetype)initWithClientIdentifier:(NSString *)clientIdentifier;
  29. /// The designated initializer.
  30. - (instancetype)initWithClientIdentifier:(NSString *)clientIdentifier
  31. bundle:(nullable id<GIDBundle>)bundle NS_DESIGNATED_INITIALIZER;
  32. /// The canonical client identifier callback scheme. Requires clientId to be set on GIDSignIn.
  33. - (NSString *)clientIdentifierScheme;
  34. /// An array of all schemes used for sign-in callbacks.
  35. - (NSArray *)allSchemes;
  36. /// Returns a list of URL schemes the current app host should support for Google Sign-In to work.
  37. - (NSMutableArray *)unsupportedSchemes;
  38. /// Indicates the scheme of an NSURL is a sign-in callback scheme.
  39. - (BOOL)URLSchemeIsCallbackScheme:(NSURL *)URL;
  40. @end
  41. NS_ASSUME_NONNULL_END