RCNPersonalization.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "Interop/Analytics/Public/FIRAnalyticsInterop.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. static NSString *const kAnalyticsOriginPersonalization = @"fp";
  19. static NSString *const kExternalEvent = @"personalization_assignment";
  20. static NSString *const kExternalRcParameterParam = @"arm_key";
  21. static NSString *const kExternalArmValueParam = @"arm_value";
  22. static NSString *const kPersonalizationId = @"personalizationId";
  23. static NSString *const kExternalPersonalizationIdParam = @"personalization_id";
  24. static NSString *const kArmIndex = @"armIndex";
  25. static NSString *const kExternalArmIndexParam = @"arm_index";
  26. static NSString *const kGroup = @"group";
  27. static NSString *const kExternalGroupParam = @"group";
  28. static NSString *const kInternalEvent = @"_fpc";
  29. static NSString *const kChoiceId = @"choiceId";
  30. static NSString *const kInternalChoiceIdParam = @"_fpid";
  31. @interface RCNPersonalization : NSObject
  32. /// Analytics connector
  33. @property(nonatomic, strong) id<FIRAnalyticsInterop> _Nullable analytics;
  34. @property(atomic, strong) NSMutableDictionary *loggedChoiceIds;
  35. - (instancetype)init NS_UNAVAILABLE;
  36. /// Designated initializer.
  37. - (instancetype)initWithAnalytics:(id<FIRAnalyticsInterop> _Nullable)analytics
  38. NS_DESIGNATED_INITIALIZER;
  39. /// Called when an arm is pulled from Remote Config. If the arm is personalized, log information to
  40. /// Google in another thread.
  41. - (void)logArmActive:(NSString *)rcParameter config:(NSDictionary *)config;
  42. @end
  43. NS_ASSUME_NONNULL_END