Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3887)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java

Issue 2755003003: Add Interstitial for user consent (Closed)
Patch Set: Teds Nits 1 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
index 0b0f6c277c1a962b4385776f762850a499d29c6a..c526d908c86958b4068403125cef639341392e43 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
@@ -27,6 +27,7 @@ import org.chromium.components.location.LocationUtils;
*/
public class PhysicalWeb {
public static final int OPTIN_NOTIFY_MAX_TRIES = 1;
+ private static final String PHYSICAL_WEB_SHARING_PREFERENCE = "physical_web_sharing";
private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_notify_count";
private static final String FEATURE_NAME = "PhysicalWeb";
private static final String PHYSICAL_WEB_SHARING_FEATURE_NAME = "PhysicalWebSharing";
@@ -61,6 +62,26 @@ public class PhysicalWeb {
}
/**
+ * Checks whether the user has consented to use the Sharing feature.
+ *
+ * @return boolean {@code true} if the feature is enabled
+ */
+ public static boolean sharingIsOptedIn() {
+ SharedPreferences sharedPrefs = ContextUtils.getAppSharedPreferences();
+ return sharedPrefs.getBoolean(PHYSICAL_WEB_SHARING_PREFERENCE, false);
+ }
+
+ /**
+ * Sets the preference that the user has opted into use the Sharing feature.
+ */
+ public static void setSharingOptedIn() {
+ ContextUtils.getAppSharedPreferences()
+ .edit()
+ .putBoolean(PHYSICAL_WEB_SHARING_PREFERENCE, true)
+ .apply();
+ }
+
+ /**
* Checks whether the Physical Web onboard flow is active and the user has
* not yet elected to either enable or decline the feature.
*

Powered by Google App Engine
This is Rietveld 408576698