diff --git a/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt b/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt index ed48dfa4..0a1c09f6 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/firebase/DynamicLink.kt @@ -4,14 +4,9 @@ package com.yapp.growth.presentation.firebase import android.content.Context import android.content.Intent import android.net.Uri -import com.google.firebase.dynamiclinks.ktx.androidParameters -import com.google.firebase.dynamiclinks.ktx.component1 -import com.google.firebase.dynamiclinks.ktx.component2 -import com.google.firebase.dynamiclinks.ktx.dynamicLinks -import com.google.firebase.dynamiclinks.ktx.shortLinkAsync +import com.google.firebase.dynamiclinks.ktx.* import com.google.firebase.ktx.Firebase import com.yapp.growth.presentation.BuildConfig -import timber.log.Timber const val DYNAMIC_LINK_PARAM = "dynamic_link_param" const val PLAN_ID_KEY_NAME = "planId" @@ -27,12 +22,23 @@ fun getDeepLink(scheme: String, key: String?, id: String?): Uri { fun onDynamicLinkClick( context: Context, scheme: SchemeType, - id: String? = null + id: String? = null, + thumbNailTitle: String, + thumbNailDescription: String, + thumbNailImageUrl: String, ) { Firebase.dynamicLinks.shortLinkAsync { link = getDeepLink(scheme.name, scheme.key, id) domainUriPrefix = BuildConfig.PLANZ_FIREBASE_PREFIX androidParameters(context.packageName) { } + iosParameters(context.packageName) { + setFallbackUrl(Uri.parse("https://jalynne.notion.site/3379be16ecc04914bb98f8a57c980a46")) + } + socialMetaTagParameters { + title = thumbNailTitle + description = thumbNailDescription + imageUrl = Uri.parse(thumbNailImageUrl) + } }.addOnSuccessListener { (shortLink, _) -> runCatching { @@ -43,7 +49,7 @@ fun onDynamicLinkClick( context.startActivity(Intent.createChooser(sendIntent, "Share")) } .onFailure { - Timber.tag("SHORTLINK").e(it) + } } diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/CreatePlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/CreatePlanScreen.kt index bd8e6670..3714eada 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/CreatePlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/CreatePlanScreen.kt @@ -2,15 +2,20 @@ package com.yapp.growth.presentation.ui.createPlan import android.content.Intent import androidx.compose.foundation.layout.padding +import androidx.compose.material.MaterialTheme import androidx.compose.material.Scaffold -import androidx.compose.runtime.Composable +import androidx.compose.runtime.* import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.navigation.NavHostController import androidx.navigation.NavType import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable +import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController import androidx.navigation.navArgument +import com.google.accompanist.systemuicontroller.rememberSystemUiController +import com.yapp.growth.presentation.theme.BackgroundColor1 import com.yapp.growth.presentation.ui.createPlan.date.DateScreen import com.yapp.growth.presentation.ui.createPlan.share.ShareScreen import com.yapp.growth.presentation.ui.createPlan.theme.ThemeScreen @@ -24,6 +29,22 @@ fun CreatePlanScreen( exitCreatePlan: () -> Unit, startShareActivity: (Intent) -> Unit, ) { + val navBackStackEntry by navController.currentBackStackEntryAsState() + val currentDestination = navBackStackEntry?.destination + + val systemUiController = rememberSystemUiController() + val useDarkIcons = MaterialTheme.colors.isLight + var statusBarColor: Color by remember { mutableStateOf(Color.White) } + + statusBarColor = when (currentDestination?.route) { + CreatePlanScreenRoute.SHARE.route -> { + BackgroundColor1 + } + else -> { + Color.White + } + } + Scaffold { innerPadding -> NavHost( modifier = Modifier.padding(innerPadding), @@ -92,6 +113,17 @@ fun CreatePlanScreen( } } } + + SideEffect { + systemUiController.setSystemBarsColor( + color = statusBarColor, + darkIcons = useDarkIcons + ) + + systemUiController.setNavigationBarColor( + color = BackgroundColor1 + ) + } } enum class CreatePlanScreenRoute(val route: String) { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareScreen.kt index 9d2949f3..285f8e92 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareScreen.kt @@ -110,9 +110,14 @@ fun ShareScreen( } } } - + LaunchedEffect(Unit) { - viewModel.getDynamicLink(context) + viewModel.getDynamicLink( + context = context, + thumbNailTitle = context.getString(R.string.share_thumbnail_title), + thumbNailDescription = context.getString(R.string.share_thumbnail_description), + thumbNailImageUrl = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url) + ) } LaunchedEffect(key1 = viewModel.effect) { diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareViewModel.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareViewModel.kt index edda236c..4bc2610e 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareViewModel.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/createPlan/share/ShareViewModel.kt @@ -1,11 +1,13 @@ package com.yapp.growth.presentation.ui.createPlan.share import android.content.Context +import android.net.Uri import androidx.lifecycle.SavedStateHandle import com.google.firebase.dynamiclinks.ktx.* import com.google.firebase.ktx.Firebase import com.yapp.growth.base.BaseViewModel import com.yapp.growth.presentation.BuildConfig +import com.yapp.growth.presentation.R import com.yapp.growth.presentation.firebase.SchemeType import com.yapp.growth.presentation.firebase.getDeepLink import com.yapp.growth.presentation.ui.createPlan.share.ShareContract.* @@ -45,12 +47,23 @@ class ShareViewModel @Inject constructor( fun getDynamicLink( context: Context, scheme: SchemeType = SchemeType.RESPOND, - id: String = planId.toString() + id: String = planId.toString(), + thumbNailTitle: String, + thumbNailDescription: String, + thumbNailImageUrl: String, ) { Firebase.dynamicLinks.shortLinkAsync { link = getDeepLink(scheme.name, scheme.key, id) domainUriPrefix = BuildConfig.PLANZ_FIREBASE_PREFIX androidParameters(context.packageName) { } + iosParameters(context.packageName) { + setFallbackUrl(Uri.parse("https://jalynne.notion.site/3379be16ecc04914bb98f8a57c980a46")) + } + socialMetaTagParameters { + title = thumbNailTitle + description = thumbNailDescription + imageUrl = Uri.parse(thumbNailImageUrl) + } }.addOnSuccessListener { (shortLink, _) -> updateState { copy(shareUrl = shortLink.toString()) } diff --git a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/confirm/FixPlanScreen.kt b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/confirm/FixPlanScreen.kt index 9f0564b8..76589048 100644 --- a/presentation/src/main/java/com/yapp/growth/presentation/ui/main/confirm/FixPlanScreen.kt +++ b/presentation/src/main/java/com/yapp/growth/presentation/ui/main/confirm/FixPlanScreen.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.res.stringResource import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import androidx.hilt.navigation.compose.hiltViewModel +import com.yapp.growth.presentation.BuildConfig import com.yapp.growth.presentation.R import com.yapp.growth.presentation.component.* import com.yapp.growth.presentation.firebase.SchemeType @@ -50,7 +51,14 @@ fun FixPlanScreen( PlanzBackAndShareAppBar( title = stringResource(id = R.string.fix_plan_title_text), onClickBackIcon = { viewModel.setEvent(FixPlanEvent.OnClickBackButton) }, - onClickShareIcon = { onDynamicLinkClick(context, SchemeType.RESPOND, uiState.planId.toString()) } + onClickShareIcon = { onDynamicLinkClick( + context, SchemeType.RESPOND, + uiState.planId.toString(), + thumbNailTitle = context.getString(R.string.share_thumbnail_title), + thumbNailDescription = context.getString(R.string.share_thumbnail_description), + thumbNailImageUrl = BuildConfig.BASE_URL + context.getString(R.string.share_plan_share_feed_template_image_url) + ) + } ) } ) { padding -> diff --git a/presentation/src/main/res/values/strings.xml b/presentation/src/main/res/values/strings.xml index 94f473ed..a0fbda92 100644 --- a/presentation/src/main/res/values/strings.xml +++ b/presentation/src/main/res/values/strings.xml @@ -123,8 +123,6 @@ 약속 요청이 도착했어요! 가능한 약속 날짜와 시간을 응답해 주세요! /images/share-feed.png - /images/share-feed.png - /images/share-feed.png 약속응답 @@ -156,6 +154,10 @@ 이미 확정된 약속입니다. + + "약속 조율 요청이 도착했어요!" + "정말 편리한 약속잡기, Planz" + Exit Icon Create Icon Check Icon