From 795eca8ad2980698c6eab5a83e3ab1d3d15d57b0 Mon Sep 17 00:00:00 2001 From: Sungyong An Date: Sun, 27 Oct 2024 23:01:10 +0900 Subject: [PATCH] Remove all codes for deeplink (#290) --- app/build.gradle | 2 - app/dependencies/releaseRuntimeClasspath.txt | 2 - app/src/main/AndroidManifest.xml | 13 --- .../java/soup/movie/ui/main/MainActivity.kt | 17 ---- .../core/designsystem/icon/MovieIcons.kt | 2 - .../src/main/res/values-ko/strings.xml | 2 - .../resources/src/main/res/values/strings.xml | 2 - feature/deeplink/.gitignore | 1 - feature/deeplink/build.gradle | 16 ---- feature/deeplink/src/main/AndroidManifest.xml | 1 - .../movie/feature/deeplink/FirebaseLink.kt | 82 ------------------- feature/detail/build.gradle | 1 - .../movie/feature/detail/DetailContent.kt | 6 -- .../soup/movie/feature/detail/DetailHeader.kt | 16 ---- .../movie/feature/detail/DetailNavGraph.kt | 46 ----------- .../soup/movie/feature/detail/DetailScreen.kt | 5 -- .../movie/feature/detail/DetailViewModel.kt | 4 - gradle/libs.versions.toml | 1 - 18 files changed, 219 deletions(-) delete mode 100644 feature/deeplink/.gitignore delete mode 100644 feature/deeplink/build.gradle delete mode 100644 feature/deeplink/src/main/AndroidManifest.xml delete mode 100644 feature/deeplink/src/main/java/soup/movie/feature/deeplink/FirebaseLink.kt diff --git a/app/build.gradle b/app/build.gradle index e66096a0d..b8d764df9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -101,7 +101,6 @@ dependencies { runtimeOnly projects.feature.notification.impl implementation projects.feature.tasks.api runtimeOnly projects.feature.tasks.impl - implementation projects.feature.deeplink runtimeOnly projects.data.network.impl runtimeOnly projects.data.database.impl runtimeOnly projects.data.repository.impl @@ -126,7 +125,6 @@ dependencies { implementation platform(libs.firebase.bom) implementation libs.firebase.cloudmessaging implementation libs.firebase.crashlytics - implementation libs.firebase.dynamiclinks implementation libs.firebase.performance implementation libs.firebase.remoteconfig diff --git a/app/dependencies/releaseRuntimeClasspath.txt b/app/dependencies/releaseRuntimeClasspath.txt index 618ebb40e..62a21bc0a 100644 --- a/app/dependencies/releaseRuntimeClasspath.txt +++ b/app/dependencies/releaseRuntimeClasspath.txt @@ -158,7 +158,6 @@ com.google.errorprone:error_prone_annotations:2.26.0 com.google.firebase:firebase-abt:21.1.1 com.google.firebase:firebase-analytics:22.0.0 com.google.firebase:firebase-annotations:16.2.0 -com.google.firebase:firebase-auth-interop:20.0.0 com.google.firebase:firebase-bom:33.0.0 com.google.firebase:firebase-common-ktx:21.0.0 com.google.firebase:firebase-common:21.0.0 @@ -167,7 +166,6 @@ com.google.firebase:firebase-config-interop:16.0.1 com.google.firebase:firebase-config:22.0.0 com.google.firebase:firebase-crashlytics:19.0.0 com.google.firebase:firebase-datatransport:18.2.0 -com.google.firebase:firebase-dynamic-links:22.0.0 com.google.firebase:firebase-encoders-json:18.0.1 com.google.firebase:firebase-encoders-proto:16.0.0 com.google.firebase:firebase-encoders:17.0.0 diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0bd2c9eb7..2b6e19795 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -52,19 +52,6 @@ - - - - - - - - - - if (movieId != null) { - viewModel.requestMovie(movieId) - } - } - } } diff --git a/core/designsystem/src/main/java/soup/movie/core/designsystem/icon/MovieIcons.kt b/core/designsystem/src/main/java/soup/movie/core/designsystem/icon/MovieIcons.kt index 1ae6252fa..0fe8aec19 100644 --- a/core/designsystem/src/main/java/soup/movie/core/designsystem/icon/MovieIcons.kt +++ b/core/designsystem/src/main/java/soup/movie/core/designsystem/icon/MovieIcons.kt @@ -31,7 +31,6 @@ import androidx.compose.material.icons.rounded.Map import androidx.compose.material.icons.rounded.Palette import androidx.compose.material.icons.rounded.Search import androidx.compose.material.icons.rounded.Settings -import androidx.compose.material.icons.rounded.Share import androidx.compose.material.icons.rounded.Star import androidx.compose.material.icons.rounded.ViewModule import soup.movie.core.designsystem.R @@ -51,7 +50,6 @@ object MovieIcons { val PrivacyTip = Icons.Outlined.PrivacyTip val Search = Icons.Rounded.Search val Settings = Icons.Rounded.Settings - val Share = Icons.Rounded.Share val Star = Icons.Rounded.Star val Subject = Icons.AutoMirrored.Rounded.Subject val ViewModule = Icons.Rounded.ViewModule diff --git a/core/resources/src/main/res/values-ko/strings.xml b/core/resources/src/main/res/values-ko/strings.xml index 07d4d362b..3406123a3 100644 --- a/core/resources/src/main/res/values-ko/strings.xml +++ b/core/resources/src/main/res/values-ko/strings.xml @@ -18,8 +18,6 @@ 연령 필터 장르 필터 - 공유하기 - 공유하기가 실패했어요. ⏰ 영화가 개봉할 때, 알려드릴게요. %d분 diff --git a/core/resources/src/main/res/values/strings.xml b/core/resources/src/main/res/values/strings.xml index ffffb7597..5033a3f9b 100644 --- a/core/resources/src/main/res/values/strings.xml +++ b/core/resources/src/main/res/values/strings.xml @@ -18,8 +18,6 @@ Age Filter Genre Filter - Share - Failed to share movie. ⏰ I\'ll let you know when released. %d min. diff --git a/feature/deeplink/.gitignore b/feature/deeplink/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/feature/deeplink/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/feature/deeplink/build.gradle b/feature/deeplink/build.gradle deleted file mode 100644 index d7ea47ba2..000000000 --- a/feature/deeplink/build.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "moop.android.library" -} - -android { - namespace "soup.movie.feature.deeplink" -} - -dependencies { - implementation projects.core.logger - - implementation libs.kotlin.stdlib - - implementation platform(libs.firebase.bom) - implementation libs.firebase.dynamiclinks -} diff --git a/feature/deeplink/src/main/AndroidManifest.xml b/feature/deeplink/src/main/AndroidManifest.xml deleted file mode 100644 index cc947c567..000000000 --- a/feature/deeplink/src/main/AndroidManifest.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/feature/deeplink/src/main/java/soup/movie/feature/deeplink/FirebaseLink.kt b/feature/deeplink/src/main/java/soup/movie/feature/deeplink/FirebaseLink.kt deleted file mode 100644 index fc7605d4f..000000000 --- a/feature/deeplink/src/main/java/soup/movie/feature/deeplink/FirebaseLink.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2021 SOUP - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package soup.movie.feature.deeplink - -import android.content.Intent -import android.net.Uri -import com.google.firebase.dynamiclinks.DynamicLink -import com.google.firebase.dynamiclinks.FirebaseDynamicLinks -import com.google.firebase.dynamiclinks.ShortDynamicLink -import soup.movie.log.Logger - -// TODO: Make this class to private -object FirebaseLink { - - private const val PATH_DETAIL = "detail" - private const val MOVIE_ID = "movieId" - - fun extractMovieId(intent: Intent?, onResult: (String?) -> Unit) { - FirebaseDynamicLinks.getInstance() - .getDynamicLink(intent) - .addOnSuccessListener { - val deepLink = it?.link - if (deepLink?.lastPathSegment == PATH_DETAIL) { - onResult(deepLink.getQueryParameter(MOVIE_ID)) - return@addOnSuccessListener - } - onResult(null) - } - .addOnFailureListener { - Logger.w(it) - onResult(null) - } - } - - fun createDetailLink( - movieId: String, - imageUrl: String, - title: String, - description: String, - onResult: (Uri?) -> Unit, - ) { - FirebaseDynamicLinks.getInstance().createDynamicLink() - .setLink(Uri.parse("https://moop.link/$PATH_DETAIL?$MOVIE_ID=$movieId")) - .setDomainUriPrefix("https://moop.page.link") - .setAndroidParameters( - DynamicLink.AndroidParameters.Builder("soup.movie") - .setMinimumVersion(92) - .build(), - ) - .setIosParameters( - DynamicLink.IosParameters.Builder("com.kor45cw.Moop") - .build(), - ) - .setSocialMetaTagParameters( - DynamicLink.SocialMetaTagParameters.Builder() - .setImageUrl(Uri.parse(imageUrl)) - .setTitle(title) - .setDescription(description) - .build(), - ) - .buildShortDynamicLink(ShortDynamicLink.Suffix.SHORT) - .addOnSuccessListener { - it.shortLink?.let { link -> onResult(link) } - } - .addOnFailureListener { - Logger.w(it) - } - } -} diff --git a/feature/detail/build.gradle b/feature/detail/build.gradle index 3867301ad..5f5570730 100644 --- a/feature/detail/build.gradle +++ b/feature/detail/build.gradle @@ -19,7 +19,6 @@ dependencies { implementation projects.data.repository.api implementation projects.data.model implementation projects.domain - implementation projects.feature.deeplink implementation projects.feature.home implementation libs.kotlin.stdlib diff --git a/feature/detail/src/main/java/soup/movie/feature/detail/DetailContent.kt b/feature/detail/src/main/java/soup/movie/feature/detail/DetailContent.kt index 393d140b6..6a8e6b554 100644 --- a/feature/detail/src/main/java/soup/movie/feature/detail/DetailContent.kt +++ b/feature/detail/src/main/java/soup/movie/feature/detail/DetailContent.kt @@ -29,7 +29,6 @@ internal fun DetailContent( viewModel: DetailViewModel, uiModel: DetailUiModel, onPosterClick: () -> Unit, - onShareClick: () -> Unit, onItemClick: (ContentItemUiModel) -> Unit, modifier: Modifier = Modifier, ) { @@ -53,11 +52,6 @@ internal fun DetailContent( viewModel.onFavoriteButtonClick(isFavorite) }, ) - ShareButton( - onClick = { - onShareClick() - }, - ) }, ) }, diff --git a/feature/detail/src/main/java/soup/movie/feature/detail/DetailHeader.kt b/feature/detail/src/main/java/soup/movie/feature/detail/DetailHeader.kt index d4c6e66cf..c360d85f6 100644 --- a/feature/detail/src/main/java/soup/movie/feature/detail/DetailHeader.kt +++ b/feature/detail/src/main/java/soup/movie/feature/detail/DetailHeader.kt @@ -38,7 +38,6 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha -import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight @@ -287,18 +286,3 @@ internal fun FavoriteButton( ) } } - -@Composable -internal fun ShareButton( - onClick: () -> Unit, -) { - IconButton(onClick = onClick) { - Image( - MovieIcons.Share, - contentDescription = null, - modifier = Modifier.requiredSize(48.dp), - contentScale = ContentScale.Inside, - colorFilter = ColorFilter.tint(color = MovieTheme.colors.onBackground), - ) - } -} diff --git a/feature/detail/src/main/java/soup/movie/feature/detail/DetailNavGraph.kt b/feature/detail/src/main/java/soup/movie/feature/detail/DetailNavGraph.kt index a6c841280..ecfe21e39 100644 --- a/feature/detail/src/main/java/soup/movie/feature/detail/DetailNavGraph.kt +++ b/feature/detail/src/main/java/soup/movie/feature/detail/DetailNavGraph.kt @@ -15,7 +15,6 @@ */ package soup.movie.feature.detail -import android.content.Context import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut @@ -28,11 +27,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.platform.LocalContext -import androidx.core.app.ShareCompat import soup.movie.core.designsystem.showToast -import soup.movie.feature.deeplink.FirebaseLink -import soup.movie.model.MovieModel -import soup.movie.resources.R @Composable fun DetailNavGraph( @@ -46,13 +41,6 @@ fun DetailNavGraph( DetailScreen( viewModel = viewModel, uiModel = uiModel, - onShareClick = { - if (movie != null) { - context.shareText(movie) - } else { - context.showToast(R.string.action_share_failed) - } - }, onPosterClick = { showPoster = true }, @@ -79,37 +67,3 @@ fun DetailNavGraph( } } } - -private fun Context.shareText(movie: MovieModel) { - FirebaseLink.createDetailLink( - movieId = movie.id, - imageUrl = movie.posterUrl, - title = movie.title, - description = buildString { - if (movie.isNow) { - append("현재상영중") - } else { - append("${movie.openDate}개봉") - } - val ageLabel = getString( - when { - movie.age >= 19 -> R.string.movie_age_19 - movie.age >= 15 -> R.string.movie_age_15 - movie.age >= 12 -> R.string.movie_age_12 - movie.age >= 0 -> R.string.movie_age_all - else -> R.string.movie_age_unknown - }, - ) - append(" / $ageLabel") - movie.genres?.let { genres -> - append(" / ${genres.joinToString()}") - } - }, - ) { link -> - ShareCompat.IntentBuilder(this) - .setChooserTitle(R.string.action_share) - .setText("[뭅] ${movie.title}\n$link") - .setType("text/plain") - .startChooser() - } -} diff --git a/feature/detail/src/main/java/soup/movie/feature/detail/DetailScreen.kt b/feature/detail/src/main/java/soup/movie/feature/detail/DetailScreen.kt index 523ad1aac..cd5a965f1 100644 --- a/feature/detail/src/main/java/soup/movie/feature/detail/DetailScreen.kt +++ b/feature/detail/src/main/java/soup/movie/feature/detail/DetailScreen.kt @@ -44,7 +44,6 @@ import soup.movie.resources.R internal fun DetailScreen( viewModel: DetailViewModel, uiModel: DetailUiModel, - onShareClick: () -> Unit, onPosterClick: () -> Unit, ) { var showPrivacyDialog by remember { mutableStateOf(false) } @@ -57,10 +56,6 @@ internal fun DetailScreen( viewModel.clickPoster() onPosterClick() }, - onShareClick = { - viewModel.clickShare() - onShareClick() - }, onItemClick = { item -> when (item) { is BoxOfficeItemUiModel -> { diff --git a/feature/detail/src/main/java/soup/movie/feature/detail/DetailViewModel.kt b/feature/detail/src/main/java/soup/movie/feature/detail/DetailViewModel.kt index b740a25d4..a29cbc495 100644 --- a/feature/detail/src/main/java/soup/movie/feature/detail/DetailViewModel.kt +++ b/feature/detail/src/main/java/soup/movie/feature/detail/DetailViewModel.kt @@ -246,10 +246,6 @@ class DetailViewModel @Inject constructor( analytics.clickPoster() } - fun clickShare() { - analytics.clickShare() - } - fun clickTrailer() { analytics.clickTrailer() } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index af2818add..58311757f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -139,7 +139,6 @@ firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "fir firebase-analytics = { module = "com.google.firebase:firebase-analytics" } firebase-cloudmessaging = { module = "com.google.firebase:firebase-messaging" } firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics" } -firebase-dynamiclinks = { module = "com.google.firebase:firebase-dynamic-links" } firebase-performance = { module = "com.google.firebase:firebase-perf" } firebase-remoteconfig = { module = "com.google.firebase:firebase-config" }