Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Make telemetry on/off setting available in-app #3445

Merged
merged 1 commit into from Jan 9, 2016
Merged

Conversation

friedbunny
Copy link
Contributor

Changes the ℹ️ action sheet to include a "Mapbox Telemetry" entry that pops up a modal dialog with the telemetry on/off setting. This replaces "Adjust privacy settings", which kicked the user out to the system Settings.app.

Because the telemetry on/off setting is now always available (so long as the ℹ️ button is not hidden), there is no longer the requirement that the developer provide such a setting in their app's Settings.bundle or specify in Info.plist that they were otherwise providing this setting in-app.

Providing the telemetry setting in Settings.app (via Settings.bundle) is still a recommended best-practice and completely supported, it's just no longer a requirement.

Blocked by #3336, which causes this in-app setting changing to not take immediate effect.

blah2-compressor

/cc @1ec5

@friedbunny friedbunny added iOS Mapbox Maps SDK for iOS refactor telemetry Integration with Mapbox Telemetry libraries labels Jan 6, 2016
@friedbunny friedbunny added this to the ios-v3.1.0 milestone Jan 6, 2016
@friedbunny
Copy link
Contributor Author

I'll squash this down before merging, but I wanted to preserve some code for discussion.

  1. I think we should remove +[MGLAccountManager mapboxMetricsEnabledSettingShownInApp] entirely before merging, but for now I've made it deprecated and throw an exception. This should never have been used externally.
  2. -[MGLMapboxEvents init] no longer has to care if Settings.bundle exists, so I ripped all of that out.

@1ec5
Copy link
Contributor

1ec5 commented Jan 6, 2016

for now I've made it deprecated and throw an exception

That would make the method unavailable, not deprecated. There’s an attribute for marking a method as unavailable, too, but I don’t think we need the backwards-incompatibility in this case. Just turn the method into a no-op with an NSLog about the deprecation.

-[MGLMapboxEvents init] no longer has to care if Settings.bundle exists, so I ripped all of that out.

What if the ℹ️ button is hidden? Presumably the developer will implement the attribution elsewhere in the application, but then we should clarify the MGLMapView.attributionButton documentation. Currently it only talks about copyright notices, but the user opt-out is also important to get right.

Whether in-app user metrics opt-out is configured. If set to the default value of `NO`, a user opt-out preference is expected in a `Settings.bundle` that shows in the application's section within the system Settings app.
*/
+ (BOOL)mapboxMetricsEnabledSettingShownInApp;
Whether in-app user telemetry opt-out is configured. If set to the default value of `NO`, a user opt-out preference was expected in a `Settings.bundle` that shows in the application's section within the system Settings app. Telemetry settings were added directly to the in-app ℹ️ menu, obseleting this method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jazzy doesn’t recognize the deprecated attribute yet. Our convention from the appledoc days is to omit documentation for deprecated and unavailable methods, but if this information is still valuable, I’d stick the last sentence in a @note.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately killed the docs here.

@friedbunny
Copy link
Contributor Author

What if the ℹ️ button is hidden?

We could repurpose/rename the MGLMapboxMetricsEnabledSettingShownInApp plist key, checking if ℹ️ is hidden and shouting if the key is not set, but I don't think I'm in favor of that — improved docs for MGLMapView.attributionButton will hopefully suffice.

@@ -60,7 +52,7 @@ + (instancetype) sharedManager {
}

+ (BOOL) mapboxMetricsEnabledSettingShownInApp {
return [MGLAccountManager sharedManager].mapboxMetricsEnabledSettingShownInApp;
NSLog(@"mapboxMetricsEnabledSettingShownInApp is no longer necessary, the Mapbox iOS SDK has changed to always provide a telemetry setting in-app.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: ,;.

@1ec5
Copy link
Contributor

1ec5 commented Jan 6, 2016

Looks good!

@friedbunny
Copy link
Contributor Author

Incoming MGLMapView.attributionButton docs updates:

screen shot 2016-01-06 at 4 28 30 pm

The new, second note links to https://www.mapbox.com/help/metrics-opt-out-for-users/, which will need updating.

@friedbunny friedbunny force-pushed the tell-me-more branch 2 times, most recently from 44952a8 to 09ab2ed Compare January 8, 2016 22:47
+ (void) validate;

// Main thread only
+ (void) ensureMetricsOptoutExists;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be asserting that we’re on the main thread, using MGLAssertIsMainThread(), instead of using these Java annotation–like comments, which mean nothing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do MGLAssertIsMainThread() in most cases here — I'll go ahead and do so for ensureMetricsOptoutExists, too.

@1ec5
Copy link
Contributor

1ec5 commented Jan 8, 2016

The setting is still called Mapbox Metrics in a couple places. (Don’t ask me why it’s duplicated…)

Mind updating the strings?

@"End users must be able to opt out of Mapbox Telemetry in your app, either inside Settings (via Settings.bundle) or inside this app. "
@"By default, this opt-out control is included as a menu item in the attribution action sheet. "
@"If you reimplement the opt-out control inside this app, disable this assertion by setting MGLMapboxMetricsEnabledSettingShownInApp to YES in Info.plist."
@"\r\n\r\nSee https://www.mapbox.com/ios-sdk/#telemetry_opt_out for more information."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\r is extraneous on Unix-based systems. (On the Mac, it results in Windows-style selection, so I wouldn’t be surprised if VoiceOver trips over it in iOS.)

- Deprecate and no-op `+[MGLAccountManager mapboxMetricsEnabledSettingShownInApp]`
- Check for attribution button hiding and make sure ToS are understood
@friedbunny friedbunny self-assigned this Jan 9, 2016
@friedbunny friedbunny merged commit 45a0f48 into master Jan 9, 2016
@mourner mourner removed the ready label Jan 9, 2016
@friedbunny friedbunny deleted the tell-me-more branch January 9, 2016 06:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS refactor telemetry Integration with Mapbox Telemetry libraries
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants