FIRAnalyticsInterop.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2018 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. @protocol FIRAnalyticsInteropListener;
  18. NS_ASSUME_NONNULL_BEGIN
  19. /// Block typedef callback parameter to `getUserProperties(with:)`.
  20. typedef void (^FIRAInteropUserPropertiesCallback)(NSDictionary<NSString *, id> *userProperties)
  21. NS_SWIFT_UNAVAILABLE("Use Swift's closure syntax instead.");
  22. /// Connector for bridging communication between Firebase SDKs and FirebaseAnalytics APIs.
  23. @protocol FIRAnalyticsInterop
  24. /// Sets user property when trigger event is logged. This API is only available in the SDK.
  25. - (void)setConditionalUserProperty:(NSDictionary<NSString *, id> *)conditionalUserProperty;
  26. /// Clears user property if set.
  27. - (void)clearConditionalUserProperty:(NSString *)userPropertyName
  28. forOrigin:(NSString *)origin
  29. clearEventName:(NSString *)clearEventName
  30. clearEventParameters:(NSDictionary<NSString *, NSString *> *)clearEventParameters;
  31. /// Returns currently set user properties.
  32. - (NSArray<NSDictionary<NSString *, NSString *> *> *)conditionalUserProperties:(NSString *)origin
  33. propertyNamePrefix:
  34. (NSString *)propertyNamePrefix;
  35. /// Returns the maximum number of user properties.
  36. - (NSInteger)maxUserProperties:(NSString *)origin;
  37. /// Returns the user properties to a callback function.
  38. - (void)getUserPropertiesWithCallback:
  39. (void (^)(NSDictionary<NSString *, id> *userProperties))callback;
  40. /// Logs events.
  41. - (void)logEventWithOrigin:(NSString *)origin
  42. name:(NSString *)name
  43. parameters:(nullable NSDictionary<NSString *, id> *)parameters;
  44. /// Sets user property.
  45. - (void)setUserPropertyWithOrigin:(NSString *)origin name:(NSString *)name value:(id)value;
  46. /// Registers an Analytics listener for the given origin.
  47. - (void)registerAnalyticsListener:(id<FIRAnalyticsInteropListener>)listener
  48. withOrigin:(NSString *)origin;
  49. /// Unregisters an Analytics listener for the given origin.
  50. - (void)unregisterAnalyticsListenerWithOrigin:(NSString *)origin;
  51. @end
  52. NS_ASSUME_NONNULL_END