Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug where Analytics is always enabled even Analytics is set to "Enable in JavaScript" #117

Merged
merged 2 commits into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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