2017-03-09 15:26:28 +00:00
|
|
|
#import "RNFirebaseAnalytics.h"
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
#if __has_include(<FirebaseAnalytics/FIRAnalytics.h>)
|
|
|
|
#import <FirebaseAnalytics/FIRAnalytics.h>
|
|
|
|
#import <FirebaseAnalytics/FIRAnalyticsConfiguration.h>
|
2017-03-09 15:26:28 +00:00
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
@implementation RNFirebaseAnalytics
|
|
|
|
RCT_EXPORT_MODULE();
|
2017-03-09 15:26:28 +00:00
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
RCT_EXPORT_METHOD(logEvent:(NSString *)name props:(NSDictionary *)props) {
|
2017-03-09 15:26:28 +00:00
|
|
|
[FIRAnalytics logEventWithName:name parameters:props];
|
|
|
|
}
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
RCT_EXPORT_METHOD(setAnalyticsCollectionEnabled:(BOOL) enabled) {
|
2017-03-09 15:26:28 +00:00
|
|
|
[[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:enabled];
|
|
|
|
}
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
RCT_EXPORT_METHOD(setCurrentScreen:(NSString *) screenName screenClass:(NSString *) screenClassOverriew) {
|
2017-03-09 15:26:28 +00:00
|
|
|
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew];
|
|
|
|
}
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
RCT_EXPORT_METHOD(setUserId: (NSString *) id) {
|
2017-03-09 15:26:28 +00:00
|
|
|
[FIRAnalytics setUserID:id];
|
|
|
|
}
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
RCT_EXPORT_METHOD(setUserProperty: (NSString *) name value:(NSString *) value) {
|
2017-03-09 15:26:28 +00:00
|
|
|
[FIRAnalytics setUserPropertyString:value forName:name];
|
|
|
|
}
|
|
|
|
|
2017-05-25 14:03:08 +00:00
|
|
|
// not implemented on iOS sdk
|
|
|
|
RCT_EXPORT_METHOD(setMinimumSessionDuration:(nonnull NSNumber *) milliseconds) {}
|
|
|
|
RCT_EXPORT_METHOD(setSessionTimeoutDuration:(nonnull NSNumber *) milliseconds) {}
|
|
|
|
@end
|
|
|
|
|
|
|
|
#else
|
|
|
|
@implementation RNFirebaseAnalytics
|
2017-03-09 15:26:28 +00:00
|
|
|
@end
|
2017-05-25 14:03:08 +00:00
|
|
|
#endif
|