Skip to content

Commit

Permalink
Merge pull request #117 from Microsoft/fix/analytics-setenabled-bug
Browse files Browse the repository at this point in the history
Fix a bug where Analytics is always enabled even Analytics is set to "Enable in JavaScript"
  • Loading branch information
guperrot committed Sep 18, 2017
2 parents 52dfce4 + e50adb4 commit c9af69c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ public class RNAnalyticsModule extends BaseJavaModule {

public RNAnalyticsModule(Application application, boolean startEnabled) {
RNMobileCenterShared.configureMobileCenter(application);
MobileCenter.start(Analytics.class);
if (!startEnabled) {
// Avoid starting an analytics session.
// Note that we don't call this if startEnabled is true, because
// that causes a session to try and start before Analytics is started.
Analytics.setEnabled(false);
}
//Analytics.setAutoPageTrackingEnabled(false); // TODO: once the underlying SDK supports this, make sure to call this
MobileCenter.start(Analytics.class);
}

@Override
Expand Down
5 changes: 1 addition & 4 deletions mobile-center-analytics/ios/RNAnalytics/RNAnalytics.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,11 @@ @implementation RNAnalytics
+ (void)registerWithInitiallyEnabled:(BOOL) enabled
{
[RNMobileCenterShared configureMobileCenter];
[MSMobileCenter startService:[MSAnalytics class]];
if (!enabled) {
// Avoid starting an analytics session.
// Note that we don't call this if startEnabled is true, because
// that causes a session to try and start before MSAnalytics is started.
[MSAnalytics setEnabled:enabled];
}
//[MSAnalytics setAutoPageTrackingEnabled:false]; // TODO: once the underlying SDK supports this, make sure to call this
[MSMobileCenter startService:[MSAnalytics class]];
}

RCT_EXPORT_METHOD(isEnabled:(RCTPromiseResolveBlock)resolve
Expand Down

0 comments on commit c9af69c

Please sign in to comment.