diff --git a/core/webview/build.gradle.kts b/core/webview/build.gradle.kts index 3a4399a1b..08ab7c476 100644 --- a/core/webview/build.gradle.kts +++ b/core/webview/build.gradle.kts @@ -47,4 +47,5 @@ dependencies { implementation(libs.material) implementation(libs.constraintlayout) implementation(libs.swipe.refresh.layout) + implementation(libs.mozilla.component.utils) } diff --git a/core/webview/src/main/java/org/sopt/official/webview/view/WebViewActivity.kt b/core/webview/src/main/java/org/sopt/official/webview/view/WebViewActivity.kt index 249bd63df..e445db451 100644 --- a/core/webview/src/main/java/org/sopt/official/webview/view/WebViewActivity.kt +++ b/core/webview/src/main/java/org/sopt/official/webview/view/WebViewActivity.kt @@ -31,7 +31,6 @@ import android.net.Uri import android.os.Bundle import android.os.Environment import android.webkit.CookieManager -import android.webkit.URLUtil import android.webkit.ValueCallback import android.webkit.WebChromeClient import android.webkit.WebView @@ -43,6 +42,7 @@ import androidx.core.content.ContextCompat import androidx.core.content.getSystemService import com.airbnb.deeplinkdispatch.DeepLink import dagger.hilt.android.AndroidEntryPoint +import mozilla.components.support.utils.DownloadUtils import org.sopt.official.common.util.viewBinding import org.sopt.official.common.view.toast import org.sopt.official.webview.databinding.ActivityWebViewBinding @@ -96,8 +96,12 @@ class WebViewActivity : AppCompatActivity() { android.Manifest.permission.WRITE_EXTERNAL_STORAGE ) == android.content.pm.PackageManager.PERMISSION_GRANTED ) { - - val fileName = URLUtil.guessFileName(url, URLDecoder.decode(contentDisposition, "utf-8"), mimetype) + val fileName = DownloadUtils.guessFileName( + contentDisposition = URLDecoder.decode(contentDisposition, "utf-8"), + null, + url = url, + mimeType = mimetype + ) val downloadManager = getSystemService() ?: return@setDownloadListener val request = DownloadManager.Request(Uri.parse(url)) .setMimeType(mimetype) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6a950e6c4..845e7df35 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -56,6 +56,7 @@ coil = "2.7.0" lottie = "6.6.0" dotsindicator = "5.1.0" deepLinkDispatch = "6.2.2" +mozilla-component-utils = "107.0.3" google-services = "4.4.2" crashlytics = "3.0.2" @@ -183,23 +184,24 @@ profileinstaller = { group = "androidx.profileinstaller", name = "profileinstall dotsindicator = { module = "com.tbuonomo:dotsindicator", version.ref = "dotsindicator" } deeplink-dispatch = { group = "com.airbnb", name = "deeplinkdispatch", version.ref = "deepLinkDispatch" } deeplink-dispatch-processor = { group = "com.airbnb", name = "deeplinkdispatch-processor", version.ref = "deepLinkDispatch" } +mozilla-component-utils = { module = "org.mozilla.components:support-utils", version.ref = "mozilla-component-utils" } [bundles] compose = [ - "compose-ui", - "compose-foundation", - "compose-ui-tooling", - "compose-activity", - "compose-animation", - "compose-viewmodel", - "compose-material", - "compose-material-three", - "compose-material-icons-extended", - "compose-material-icons", - "compose-runtime", - "compose-ui-tooling-preview", - "compose-hilt-navigation", - "compose-lottie", + "compose-ui", + "compose-foundation", + "compose-ui-tooling", + "compose-activity", + "compose-animation", + "compose-viewmodel", + "compose-material", + "compose-material-three", + "compose-material-icons-extended", + "compose-material-icons", + "compose-runtime", + "compose-ui-tooling-preview", + "compose-hilt-navigation", + "compose-lottie", ] compose-test = ["compose-junit"] compose-android-test = ["compose-ui-test"] diff --git a/settings.gradle.kts b/settings.gradle.kts index 0340a6ea4..47d064826 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -13,6 +13,7 @@ dependencyResolutionManagement { mavenCentral() gradlePluginPortal() maven { setUrl("https://jitpack.io") } + maven { setUrl("https://maven.mozilla.org/maven2") } } } rootProject.name = "SOPT"