GIDSignInInternalOptions.m 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // Copyright 2021 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import "GoogleSignIn/Sources/GIDSignInInternalOptions.h"
  15. NS_ASSUME_NONNULL_BEGIN
  16. @implementation GIDSignInInternalOptions
  17. + (instancetype)defaultOptions {
  18. GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
  19. if (options) {
  20. options->_interactive = YES;
  21. options->_continuation = NO;
  22. }
  23. return options;
  24. }
  25. + (instancetype)silentOptionsWithCallback:(GIDSignInCallback)callback {
  26. GIDSignInInternalOptions *options = [self defaultOptions];
  27. if (options) {
  28. options->_interactive = NO;
  29. options->_callback = callback;
  30. }
  31. return options;
  32. }
  33. + (instancetype)optionsWithExtraParams:(NSDictionary *)extraParams {
  34. GIDSignInInternalOptions *options = [self defaultOptions];
  35. if (options) {
  36. options->_extraParams = [extraParams copy];
  37. }
  38. return options;
  39. }
  40. - (instancetype)optionsWithExtraParameters:(NSDictionary *)extraParams
  41. forContinuation:(BOOL)continuation {
  42. GIDSignInInternalOptions *options = [[GIDSignInInternalOptions alloc] init];
  43. if (options) {
  44. options->_interactive = _interactive;
  45. options->_continuation = continuation;
  46. options->_extraParams = [extraParams copy];
  47. }
  48. return options;
  49. }
  50. @end
  51. NS_ASSUME_NONNULL_END