GIDMDMPasscodeState.m 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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/GIDMDMPasscodeState.h"
  15. #import "GoogleSignIn/Sources/GIDMDMPasscodeState_Private.h"
  16. #import <Foundation/Foundation.h>
  17. #import "GoogleSignIn/Sources/GIDMDMPasscodeCache.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. @implementation GIDMDMPasscodeState
  20. - (instancetype)initWithStatus:(NSString *)status info:(NSString *)info {
  21. self = [super init];
  22. if (self) {
  23. _status = [status copy];
  24. _info = [info copy];
  25. }
  26. return self;
  27. }
  28. + (instancetype)passcodeState {
  29. #if DEBUG
  30. NSDate *start = [NSDate date];
  31. #endif
  32. GIDMDMPasscodeState *passcodeState = [[GIDMDMPasscodeCache sharedInstance] passcodeState];
  33. #if DEBUG
  34. NSTimeInterval timeElapsed = [[NSDate date] timeIntervalSinceDate:start];
  35. NSLog(@"Retrieved device passcode state in %dms.", (int)round(timeElapsed * 1000));
  36. #endif
  37. return passcodeState;
  38. }
  39. @end
  40. NS_ASSUME_NONNULL_END