react-native-firebase/ios/RNFirebase/RNFirebaseAnalytics.m

59 lines
1.5 KiB
Mathematica
Raw Normal View History

2017-03-09 15:26:28 +00:00
#import "RNFirebase.h"
#import "RNFirebaseEvents.h"
#import "RNFirebaseAnalytics.h"
#import "Firebase.h"
@implementation RNFirebaseAnalytics
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
}
RCT_EXPORT_MODULE(RNFirebaseAnalytics);
// Implementation
RCT_EXPORT_METHOD(logEvent:(NSString *)name
props:(NSDictionary *)props)
{
NSString *debugMsg = [NSString stringWithFormat:@"%@: %@ with %@",
@"RNFirebaseAnalytics", name, props];
[[RNFirebase sharedInstance] debugLog:@"logEventWithName called"
msg:debugMsg];
[FIRAnalytics logEventWithName:name parameters:props];
}
RCT_EXPORT_METHOD(setAnalyticsCollectionEnabled:(BOOL) enabled)
{
[[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:enabled];
}
RCT_EXPORT_METHOD(setCurrentScreen:(NSString *) screenName
screenClass:(NSString *) screenClassOverriew)
{
[FIRAnalytics setScreenName:screenName screenClass:screenClassOverriew];
}
2017-03-10 14:43:09 +00:00
RCT_EXPORT_METHOD(setMinimumSessionDuration:(nonnull NSNumber *) milliseconds)
2017-03-09 15:26:28 +00:00
{
//Not implemented on iOS
}
2017-03-10 14:43:09 +00:00
RCT_EXPORT_METHOD(setSessionTimeoutDuration:(nonnull NSNumber *) milliseconds)
2017-03-09 15:26:28 +00:00
{
//Not implemented on iOS
}
2017-03-10 14:43:09 +00:00
RCT_EXPORT_METHOD(setUserId: (NSString *) id)
2017-03-09 15:26:28 +00:00
{
[FIRAnalytics setUserID:id];
}
RCT_EXPORT_METHOD(setUserProperty: (NSString *) name
value:(NSString *) value)
{
[FIRAnalytics setUserPropertyString:value forName:name];
}
@end