parent
f5ffe3734c
commit
67f3b63ae5
|
@ -12,9 +12,18 @@ import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.RemoteViews
|
import android.widget.RemoteViews
|
||||||
|
import org.mozilla.fenix.utils.Settings
|
||||||
|
|
||||||
class SearchWidgetProvider : AppWidgetProvider() {
|
class SearchWidgetProvider : AppWidgetProvider() {
|
||||||
|
|
||||||
|
override fun onEnabled(context: Context) {
|
||||||
|
Settings.instance?.addSearchWidgetInstalled(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onDeleted(context: Context, appWidgetIds: IntArray) {
|
||||||
|
Settings.instance?.addSearchWidgetInstalled(-appWidgetIds.size)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
override fun onUpdate(context: Context, appWidgetManager: AppWidgetManager, appWidgetIds: IntArray) {
|
||||||
val textSearchIntent = createTextSearchIntent(context)
|
val textSearchIntent = createTextSearchIntent(context)
|
||||||
val voiceSearchIntent = createVoiceSearchIntent(context)
|
val voiceSearchIntent = createVoiceSearchIntent(context)
|
||||||
|
|
|
@ -73,7 +73,8 @@ class LeanplumMetricsService(private val application: Application) : MetricsServ
|
||||||
"focus_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.FOCUS.productName),
|
"focus_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.FOCUS.productName),
|
||||||
"klar_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.KLAR.productName),
|
"klar_installed" to installedApps.contains(MozillaProductDetector.MozillaProducts.KLAR.productName),
|
||||||
"fxa_signed_in" to (Settings.instance?.fxaSignedIn ?: false),
|
"fxa_signed_in" to (Settings.instance?.fxaSignedIn ?: false),
|
||||||
"fxa_has_synced_items" to (Settings.instance?.fxaHasSyncedItems ?: false)
|
"fxa_has_synced_items" to (Settings.instance?.fxaHasSyncedItems ?: false),
|
||||||
|
"search_widget_installed" to (Settings.instance?.searchWidgetInstalled ?: false)
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,6 +257,19 @@ class Settings private constructor(
|
||||||
appContext.getPreferenceKey(R.string.pref_key_fxa_has_synced_items), true
|
appContext.getPreferenceKey(R.string.pref_key_fxa_has_synced_items), true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
fun addSearchWidgetInstalled(count: Int) {
|
||||||
|
val key = appContext.getPreferenceKey(R.string.pref_key_search_widget_installed)
|
||||||
|
val newValue = preferences.getInt(key, 0) + count
|
||||||
|
preferences.edit()
|
||||||
|
.putInt(key, newValue)
|
||||||
|
.apply()
|
||||||
|
}
|
||||||
|
|
||||||
|
val searchWidgetInstalled: Boolean
|
||||||
|
get() = 0 < preferences.getInt(
|
||||||
|
appContext.getPreferenceKey(R.string.pref_key_search_widget_installed), 0
|
||||||
|
)
|
||||||
|
|
||||||
private val SitePermissionsRules.Action.id: Int
|
private val SitePermissionsRules.Action.id: Int
|
||||||
get() {
|
get() {
|
||||||
return when (this) {
|
return when (this) {
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
<string name="pref_key_push_project_id" translatable="false">project_id</string>
|
<string name="pref_key_push_project_id" translatable="false">project_id</string>
|
||||||
<string name="pref_key_fxa_signed_in" translatable="false">pref_key_fxa_signed_in</string>
|
<string name="pref_key_fxa_signed_in" translatable="false">pref_key_fxa_signed_in</string>
|
||||||
<string name="pref_key_fxa_has_synced_items" translatable="false">pref_key_fxa_has_synced_items</string>
|
<string name="pref_key_fxa_has_synced_items" translatable="false">pref_key_fxa_has_synced_items</string>
|
||||||
|
<string name="pref_key_search_widget_installed" translatable="false">pref_key_search_widget_installed</string>
|
||||||
|
|
||||||
<!-- Search Settings -->
|
<!-- Search Settings -->
|
||||||
<string name="pref_key_show_search_suggestions" translatable="false">pref_key_show_search_suggestions</string>
|
<string name="pref_key_show_search_suggestions" translatable="false">pref_key_show_search_suggestions</string>
|
||||||
|
|
|
@ -139,6 +139,11 @@ User Attributes
|
||||||
<td>A boolean indicating that the user has opted to sync at least one category of items with FxA</td>
|
<td>A boolean indicating that the user has opted to sync at least one category of items with FxA</td>
|
||||||
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4568#issuecomment-519159545">#4568</a></td>
|
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4568#issuecomment-519159545">#4568</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>`search_widget_installed`</td>
|
||||||
|
<td>A boolean indicating that the user has at least one search widget placed on the home screen</td>
|
||||||
|
<td><a href="https://github.com/mozilla-mobile/fenix/pull/4694#issuecomment-520591275">#4694</a></td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
Events
|
Events
|
||||||
|
|
Loading…
Reference in New Issue