-
Notifications
You must be signed in to change notification settings - Fork 113
feat(pocket): Use geo and locale to determine when to enable Pocket #3021
Conversation
stories_endpoint: "https://getpocket.com/v3/firefox/global-recs?consumer_key=$apiKey&locale_lang=$locale", | ||
stories_referrer: "https://getpocket.com/recommendations", | ||
survey_link: "https://www.surveymonkey.com/r/newtabffx", | ||
topics_endpoint: "https://getpocket.com/v3/firefox/trending-topics?consumer_key=$apiKey&locale_lang=$locale" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose with valueFunc
, at some point we could just insert args.locale
directly into these endpoints instead of having TopStoriesFeed
separately get the locale and insert it from #2991. @csadilek
Theoretically valueFunc
could be called when locale changes too (it doesn't do it in this PR), but that also means TopStoriesFeed
wouldn't need to watch for locale changes as its prefs will just update.
And if Pocket wants a client-provided geo (in addition to its own server computed geo from IP address), this would be a natural place to insert it too. E.g., this would support detecting, Firefox says it's a CA/Canada geo, but the current IP address is in San Francisco, so maybe this user is traveling.
system-addon/lib/ActivityStream.jsm
Outdated
}); | ||
|
||
// Configure default Activity Stream prefs with a plain `value` or a `valueFunc` | ||
// that computes a value. A `value_local_dev` is used for development defaults. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k88: I would probably name this getValue
, but up to you
Sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k88: R+ with nits, looks good to me, just a couple of naming-related comments. The prefs stuff could use some updated documentation, and possibly some refactoring for clarity in the future
Fix #3004. r?@k88hudson This cleans up
AS.jsm
a little bit to not have a separateSECTIONS
and just inlines it to the rest ofFEEDS_DATA
. Also sorts things alphabetically.The main core change is that prefs can have a
valueFunc
that will compute a value based on geo/locale. If geo isn't available, it'll observe the pref and update the pref config as well as updating the default.This should also greatly simplify things for #2776.