2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-19 09:25:34 +00:00

[fenix] Disabling StrictMode policy for Top Sites changes

This commit is contained in:
Jonathan Almeida 2020-08-26 17:47:23 -04:00 committed by Jonathan Almeida
parent df886ca4cb
commit 150755800e

View File

@ -7,6 +7,7 @@ package org.mozilla.fenix.components
import GeckoProvider
import android.content.Context
import android.content.res.Configuration
import android.os.StrictMode
import io.sentry.Sentry
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
@ -58,6 +59,7 @@ import org.mozilla.fenix.HomeActivity
import org.mozilla.fenix.R
import org.mozilla.fenix.downloads.DownloadService
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.resetPoliciesAfter
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.media.MediaService
import org.mozilla.fenix.search.telemetry.ads.AdsTelemetry
@ -266,31 +268,33 @@ class Core(private val context: Context, private val crashReporter: CrashReporti
val topSiteStorage by lazy {
val defaultTopSites = mutableListOf<Pair<String, String>>()
if (!context.settings().defaultTopSitesAdded) {
defaultTopSites.add(
Pair(
context.getString(R.string.default_top_site_google),
SupportUtils.GOOGLE_URL
)
)
if (LocaleManager.getSelectedLocale(context).language == "en") {
StrictMode.allowThreadDiskReads().resetPoliciesAfter {
if (!context.settings().defaultTopSitesAdded) {
defaultTopSites.add(
Pair(
context.getString(R.string.pocket_pinned_top_articles),
SupportUtils.POCKET_TRENDING_URL
context.getString(R.string.default_top_site_google),
SupportUtils.GOOGLE_URL
)
)
}
defaultTopSites.add(
Pair(
context.getString(R.string.default_top_site_wikipedia),
SupportUtils.WIKIPEDIA_URL
if (LocaleManager.getSelectedLocale(context).language == "en") {
defaultTopSites.add(
Pair(
context.getString(R.string.pocket_pinned_top_articles),
SupportUtils.POCKET_TRENDING_URL
)
)
}
defaultTopSites.add(
Pair(
context.getString(R.string.default_top_site_wikipedia),
SupportUtils.WIKIPEDIA_URL
)
)
)
context.settings().defaultTopSitesAdded = true
context.settings().defaultTopSitesAdded = true
}
}
DefaultTopSitesStorage(