FPRProtoUtils.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Copyright 2020 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 <TargetConditionals.h>
  15. #if __has_include("CoreTelephony/CTTelephonyNetworkInfo.h") && !TARGET_OS_MACCATALYST
  16. #define TARGET_HAS_MOBILE_CONNECTIVITY
  17. #import <CoreTelephony/CTTelephonyNetworkInfo.h>
  18. #endif
  19. #import "FirebasePerformance/Sources/AppActivity/FPRTraceBackgroundActivityTracker.h"
  20. #import "FirebasePerformance/Sources/Instrumentation/FPRNetworkTrace.h"
  21. #import "FirebasePerformance/Sources/Public/FIRTrace.h"
  22. #import "FirebasePerformance/ProtoSupport/PerfMetric.pbobjc.h"
  23. /** Creates a new FPRMSGPerfMetric proto object populated with system metadata.
  24. * @param appID The Google app id to put into the message
  25. * @return Reference to a FPRMSGPerfMetric object.
  26. */
  27. extern FPRMSGPerfMetric* _Nullable FPRGetPerfMetricMessage(NSString* _Nonnull appID);
  28. /** Creates a new FPRMSGApplicationInfo proto object populated with system metadata.
  29. * @return Reference to a FPRMSGApplicationInfo object.
  30. */
  31. extern FPRMSGApplicationInfo* _Nullable FPRGetApplicationInfoMessage(void);
  32. /** Converts the FIRTrace object to a FPRMSGTraceMetric proto object.
  33. * @return Reference to a FPRMSGTraceMetric object.
  34. */
  35. extern FPRMSGTraceMetric* _Nullable FPRGetTraceMetric(FIRTrace* _Nonnull trace);
  36. /** Converts the FPRNetworkTrace object to a FPRMSGNetworkRequestMetric proto object.
  37. * @return Reference to a FPRMSGNetworkRequestMetric object.
  38. */
  39. extern FPRMSGNetworkRequestMetric* _Nullable FPRGetNetworkRequestMetric(
  40. FPRNetworkTrace* _Nonnull trace);
  41. /** Converts the gaugeData array object to a FPRMSGGaugeMetric proto object.
  42. * @return Reference to a FPRMSGGaugeMetric object.
  43. */
  44. extern FPRMSGGaugeMetric* _Nullable FPRGetGaugeMetric(NSArray* _Nonnull gaugeData,
  45. NSString* _Nonnull sessionId);
  46. /** Converts the FPRTraceState to a FPRMSGApplicationProcessState proto value.
  47. * @return FPRMSGApplicationProcessState value.
  48. */
  49. extern FPRMSGApplicationProcessState FPRApplicationProcessState(FPRTraceState state);
  50. #ifdef TARGET_HAS_MOBILE_CONNECTIVITY
  51. /** Obtain a CTTelephonyNetworkInfo object to determine device network attributes.
  52. * @return CTTelephonyNetworkInfo object.
  53. */
  54. extern CTTelephonyNetworkInfo* _Nullable FPRNetworkInfo(void);
  55. #endif