Add defaults to FML, add control behaviour
parent
480ab3dca7
commit
2b36ca75bf
@ -1,81 +0,0 @@
|
|||||||
{
|
|
||||||
"default-browser-message": {
|
|
||||||
"description": "A small feature allowing experiments on the placement of a default browser message.",
|
|
||||||
"hasExposure": true,
|
|
||||||
"exposureDescription": "",
|
|
||||||
"variables": {
|
|
||||||
"message-location": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Where is the message to be put."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"homescreen": {
|
|
||||||
"description": "The homescreen that the user goes to when they press home or new tab.",
|
|
||||||
"hasExposure": true,
|
|
||||||
"exposureDescription": "",
|
|
||||||
"variables": {
|
|
||||||
"sections-enabled": {
|
|
||||||
"type": "json",
|
|
||||||
"description": "This property provides a lookup table of whether or not the given section should be enabled. If the section is enabled, it should be toggleable in the settings screen, and on by default."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"messaging": {
|
|
||||||
"description": "Configuration for the messaging system.\n\nIn practice this is a set of growable lookup tables for the\nmessage controller to piece together.\n",
|
|
||||||
"hasExposure": true,
|
|
||||||
"exposureDescription": "",
|
|
||||||
"variables": {
|
|
||||||
"actions": {
|
|
||||||
"type": "json",
|
|
||||||
"description": "A growable map of action URLs."
|
|
||||||
},
|
|
||||||
"message-under-experiment": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Id or prefix of the message under experiment."
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"type": "json",
|
|
||||||
"description": "A growable collection of messages"
|
|
||||||
},
|
|
||||||
"styles": {
|
|
||||||
"type": "json",
|
|
||||||
"description": "A map of styles to configure message appearance.\n"
|
|
||||||
},
|
|
||||||
"triggers": {
|
|
||||||
"type": "json",
|
|
||||||
"description": "A collection of out the box trigger expressions. Each entry maps to a valid JEXL expression.\n"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nimbus-validation": {
|
|
||||||
"description": "A feature that does not correspond to an application feature suitable for showing that Nimbus is working. This should never be used in production.",
|
|
||||||
"hasExposure": true,
|
|
||||||
"exposureDescription": "",
|
|
||||||
"variables": {
|
|
||||||
"settings-icon": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The drawable displayed in the app menu for Settings"
|
|
||||||
},
|
|
||||||
"settings-punctuation": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The emoji displayed in the Settings screen title."
|
|
||||||
},
|
|
||||||
"settings-title": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "The title of displayed in the Settings screen and app menu."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"search-term-groups": {
|
|
||||||
"description": "A feature allowing the grouping of URLs around the search term that it came from.",
|
|
||||||
"hasExposure": true,
|
|
||||||
"exposureDescription": "",
|
|
||||||
"variables": {
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "If true, the feature shows up on the homescreen and on the new tab screen."
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
default-browser-message:
|
||||||
|
description: A small feature allowing experiments on the placement of a default browser message.
|
||||||
|
hasExposure: true
|
||||||
|
exposureDescription: ""
|
||||||
|
variables:
|
||||||
|
message-location:
|
||||||
|
type: string
|
||||||
|
description: Where is the message to be put.
|
||||||
|
homescreen:
|
||||||
|
description: The homescreen that the user goes to when they press home or new tab.
|
||||||
|
hasExposure: true
|
||||||
|
exposureDescription: ""
|
||||||
|
variables:
|
||||||
|
sections-enabled:
|
||||||
|
type: json
|
||||||
|
description: "This property provides a lookup table of whether or not the given section should be enabled. If the section is enabled, it should be toggleable in the settings screen, and on by default."
|
||||||
|
messaging:
|
||||||
|
description: "Configuration for the messaging system.\n\nIn practice this is a set of growable lookup tables for the\nmessage controller to piece together.\n"
|
||||||
|
hasExposure: true
|
||||||
|
exposureDescription: ""
|
||||||
|
variables:
|
||||||
|
actions:
|
||||||
|
type: json
|
||||||
|
description: A growable map of action URLs.
|
||||||
|
messages:
|
||||||
|
type: json
|
||||||
|
description: A growable collection of messages
|
||||||
|
styles:
|
||||||
|
type: json
|
||||||
|
description: "A map of styles to configure message appearance.\n"
|
||||||
|
triggers:
|
||||||
|
type: json
|
||||||
|
description: "A collection of out the box trigger expressions. Each entry maps to a valid JEXL expression.\n"
|
||||||
|
nimbus-validation:
|
||||||
|
description: A feature that does not correspond to an application feature suitable for showing that Nimbus is working. This should never be used in production.
|
||||||
|
hasExposure: true
|
||||||
|
exposureDescription: ""
|
||||||
|
variables:
|
||||||
|
settings-icon:
|
||||||
|
type: string
|
||||||
|
description: The drawable displayed in the app menu for Settings
|
||||||
|
settings-punctuation:
|
||||||
|
type: string
|
||||||
|
description: The emoji displayed in the Settings screen title.
|
||||||
|
settings-title:
|
||||||
|
type: string
|
||||||
|
description: The title of displayed in the Settings screen and app menu.
|
||||||
|
search-term-groups:
|
||||||
|
description: A feature allowing the grouping of URLs around the search term that it came from.
|
||||||
|
hasExposure: true
|
||||||
|
exposureDescription: ""
|
||||||
|
variables:
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
description: "If true, the feature shows up on the homescreen and on the new tab screen."
|
@ -0,0 +1,34 @@
|
|||||||
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
|
package org.mozilla.fenix.gleanplumb
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import org.json.JSONObject
|
||||||
|
import org.mozilla.fenix.utils.BrowsersCache
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
import java.util.Calendar
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Custom attributes that the messaging framework will use to evaluate if message is eligible
|
||||||
|
* to be shown.
|
||||||
|
*/
|
||||||
|
object CustomAttributeProvider {
|
||||||
|
private val formatter = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a [JSONObject] that contains all the custom attributes, evaluated when the function
|
||||||
|
* was called.
|
||||||
|
*/
|
||||||
|
fun getCustomAttributes(context: Context): JSONObject {
|
||||||
|
val now = Calendar.getInstance()
|
||||||
|
return JSONObject(
|
||||||
|
mapOf(
|
||||||
|
"is_default_browser" to BrowsersCache.all(context).isDefaultBrowser,
|
||||||
|
"date_string" to formatter.format(now.time)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue