feat: let platforms disable we are using cookies prompt

This commit is contained in:
Andrew Bastin
2023-11-07 20:49:07 +05:30
parent 736f83a70c
commit 663134839f
3 changed files with 14 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ import { applySetting } from "~/newstore/settings"
import { getLocalConfig, setLocalConfig } from "~/newstore/localpersistence"
import { useToast } from "~/composables/toast"
import { useI18n } from "~/composables/i18n"
import { platform } from "~/platform"
const router = useRouter()
@@ -98,7 +99,10 @@ onBeforeMount(() => {
onMounted(() => {
const cookiesAllowed = getLocalConfig("cookiesAllowed") === "yes"
if (!cookiesAllowed) {
const platformAllowsCookiePrompts =
platform.platformFeatureFlags.promptAsUsingCookies ?? true
if (!cookiesAllowed && platformAllowsCookiePrompts) {
toast.show(`${t("app.we_use_cookies")}`, {
duration: 0,
action: [

View File

@@ -35,6 +35,14 @@ export type PlatformDef = {
* If a value is not given, then the value is assumed to be false
*/
cookiesEnabled?: boolean
/**
* Whether the platform should prompt the user that cookies are being used.
* This will result in the user being notified a cookies advisory and is meant for web apps.
*
* If a value is not given, then the value is assumed to be true
*/
promptAsUsingCookies?: boolean
}
}

View File

@@ -53,6 +53,7 @@ createHoppApp("#app", {
exportAsGIST: false,
hasTelemetry: false,
cookiesEnabled: true,
promptAsUsingCookies: false,
},
})