No Description

FIRInstanceIDUtilities.h 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright 2019 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. /// FIRMessaging Class that responds to the FIRMessaging SDK version selector.
  18. /// Verify at runtime if the class exists and implements the required method.
  19. FOUNDATION_EXPORT NSString *const kFIRInstanceIDFCMSDKClassString;
  20. /// locale key stored in GULUserDefaults
  21. FOUNDATION_EXPORT NSString *const kFIRInstanceIDUserDefaultsKeyLocale;
  22. #pragma mark - Test Blocks
  23. /**
  24. * Response block for mock registration requests made during tests.
  25. *
  26. * @param data The data as returned by the mock request.
  27. * @param response The response as returned by the mock request.
  28. * @param error The error if any as returned by the mock request.
  29. */
  30. typedef void (^FIRInstanceIDURLRequestTestResponseBlock)(NSData *data,
  31. NSURLResponse *response,
  32. NSError *error);
  33. /**
  34. * Test block to mock registration requests response.
  35. *
  36. * @param request The request to mock response for.
  37. * @param response The response block for the mocked request.
  38. */
  39. typedef void (^FIRInstanceIDURLRequestTestBlock)(NSURLRequest *request,
  40. FIRInstanceIDURLRequestTestResponseBlock response);
  41. #pragma mark - URL Helpers
  42. FOUNDATION_EXPORT NSString *FIRInstanceIDRegisterServer(void);
  43. #pragma mark - Time
  44. FOUNDATION_EXPORT int64_t FIRInstanceIDCurrentTimestampInSeconds(void);
  45. FOUNDATION_EXPORT int64_t FIRInstanceIDCurrentTimestampInMilliseconds(void);
  46. #pragma mark - App Info
  47. FOUNDATION_EXPORT NSString *FIRInstanceIDCurrentAppVersion(void);
  48. FOUNDATION_EXPORT NSString *FIRInstanceIDAppIdentifier(void);
  49. FOUNDATION_EXPORT NSString *FIRInstanceIDFirebaseAppID(void);
  50. #pragma mark - Device Info
  51. FOUNDATION_EXPORT NSString *FIRInstanceIDDeviceModel(void);
  52. FOUNDATION_EXPORT NSString *FIRInstanceIDOperatingSystemVersion(void);
  53. FOUNDATION_EXPORT BOOL FIRInstanceIDHasLocaleChanged(void);
  54. #pragma mark - Helpers
  55. FOUNDATION_EXPORT BOOL FIRInstanceIDIsValidGCMScope(NSString *scope);
  56. FOUNDATION_EXPORT NSString *FIRInstanceIDStringForAPNSDeviceToken(NSData *deviceToken);
  57. FOUNDATION_EXPORT NSString *FIRInstanceIDAPNSTupleStringForTokenAndServerType(NSData *deviceToken,
  58. BOOL isSandbox);
  59. #pragma mark - GCM Helpers
  60. /// Returns the current GCM version if GCM library is found else returns nil.
  61. FOUNDATION_EXPORT NSString *FIRInstanceIDCurrentGCMVersion(void);
  62. /// Returns the current locale. If GCM is present it queries GCM for a
  63. /// Context Manager specific locale. Otherwise, it returns the system's first
  64. /// preferred language (which may be set independently from locale). If the
  65. /// system returns no preferred languages, this method returns the most common
  66. /// language for the user's given locale. Guaranteed to return a nonnull value.
  67. FOUNDATION_EXPORT NSString *FIRInstanceIDCurrentLocale(void);