Skip to content
This repository has been archived by the owner on Jan 12, 2023. It is now read-only.

Commit

Permalink
Update to AC 72.0.15 and GeckoView 86.0.20210217195321
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalmeida committed Feb 18, 2021
1 parent c44bfe6 commit e63680b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/src/main/java/org/mozilla/focus/Components.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package org.mozilla.focus

import android.content.Context
import android.util.AttributeSet
import android.util.JsonReader
import mozilla.components.browser.search.SearchEngineManager
import mozilla.components.browser.search.provider.AssetsSearchEngineProvider
import mozilla.components.browser.search.provider.localization.LocaleSearchLocalizationProvider
Expand Down Expand Up @@ -77,6 +78,10 @@ private class DummyEngine : Engine {
throw NotImplementedError()
}

override fun createSessionStateFrom(reader: JsonReader): EngineSessionState {
throw NotImplementedError()
}

override fun createView(context: Context, attrs: AttributeSet?): EngineView {
throw NotImplementedError()
}
Expand Down
25 changes: 19 additions & 6 deletions app/src/main/java/org/mozilla/focus/web/GeckoWebViewProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import kotlinx.coroutines.Job
import mozilla.components.browser.errorpages.ErrorPages
import mozilla.components.browser.errorpages.ErrorType
import mozilla.components.browser.session.Session
import mozilla.components.concept.fetch.Headers.Names.CONTENT_DISPOSITION
import mozilla.components.concept.fetch.Headers.Names.CONTENT_LENGTH
import mozilla.components.concept.fetch.Headers.Names.CONTENT_TYPE
import mozilla.components.lib.crash.handler.CrashHandlerService
import mozilla.components.support.utils.DownloadUtils
import org.mozilla.focus.R
import org.mozilla.focus.browser.LocalizedContent
import org.mozilla.focus.ext.savedGeckoSession
Expand All @@ -47,6 +51,7 @@ import org.mozilla.geckoview.GeckoSession.NavigationDelegate
import org.mozilla.geckoview.GeckoSessionSettings
import org.mozilla.geckoview.SessionFinder
import org.mozilla.geckoview.WebRequestError
import org.mozilla.geckoview.WebResponse
import kotlin.coroutines.CoroutineContext

/**
Expand Down Expand Up @@ -377,10 +382,7 @@ class GeckoWebViewProvider : IWebViewProvider {
}
}

override fun onExternalResponse(
session: GeckoSession,
response: GeckoSession.WebResponseInfo
) {
override fun onExternalResponse(session: GeckoSession, response: WebResponse) {
if (!AppConstants.supportsDownloadingFiles()) {
return
}
Expand All @@ -394,10 +396,21 @@ class GeckoWebViewProvider : IWebViewProvider {
return
}

val contentType = response.headers[CONTENT_TYPE]?.trim()
val contentLength = response.headers[CONTENT_LENGTH]?.trim()?.toLong() ?: 0
val contentDisposition = response.headers[CONTENT_DISPOSITION]?.trim()
val url = response.uri
val fileName = DownloadUtils.guessFileName(
contentDisposition,
destinationDirectory = null,
url = url,
mimeType = contentType
)

val download = Download(
response.uri, USER_AGENT,
response.filename, response.contentType, response.contentLength,
Environment.DIRECTORY_DOWNLOADS, response.filename
fileName, contentType, contentLength,
Environment.DIRECTORY_DOWNLOADS, fileName
)
callback?.onDownloadStart(download)
}
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
ext.espresso_version = '3.1.0-alpha4'
ext.kotlin_version = '1.3.61'
ext.coroutines_version = '1.3.0'
ext.gecko_release_version = '85.0.20210118153634'
ext.mozilla_components_version = '70.0.15'
ext.gecko_release_version = '86.0.20210217195321'
ext.mozilla_components_version = '72.0.15'
// Pinning the last working version of the service-telemetry component until we decide
// what we want to do with telemetry in the app.
ext.mozilla_components_version_telemetry = '57.0.9'
Expand Down

0 comments on commit e63680b

Please sign in to comment.