Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
f486e0b
[ADD/#380] Intern 딥링크 경로 추가
arinming May 1, 2025
834d580
[FEAT/#380] Intern 딥링크 스플래시 로직 추가
arinming May 3, 2025
83b4e81
[FEAT/#380] Intern 딥링크 상세 아이디
arinming May 4, 2025
ff82fa2
[FEAT/#380] internId 넘기기
arinming May 7, 2025
8685b71
[FEAT/#380] 스키마 분리
arinming May 7, 2025
59a6c8d
[FIX/#380] lint -> link 수정
arinming May 8, 2025
c89ce65
[FIX/#380] 매니패스트 삭제
arinming May 10, 2025
d9576a7
[FEAT/#380] 메니페스트 변경
leeeyubin May 10, 2025
d269b6a
[FEAT/#380] 메니페스트 빈 줄 삭제
leeeyubin May 10, 2025
0ae0aba
[FEAT/#380] NotificationRedirect 네이밍 변경
leeeyubin May 10, 2025
0dbb8e8
[FEAT/#380] MainActivity handleDeeplink 함수 변경
leeeyubin May 10, 2025
e964bee
[FEAT/#380] HomeNavigation 클래스명 수정 및 네비게이션 루트에 internId 추가
leeeyubin May 10, 2025
63b0cc1
[FEAT/#380] 공고상세페이지로 이동하도록 수정
leeeyubin May 10, 2025
ed50dc5
[FEAT/#380] 인턴 딥링크 삭제
leeeyubin May 10, 2025
45189ba
[FEAT/#380] Home 라우트에 맞게 네비게이터 수정
leeeyubin May 10, 2025
e69d0c1
[FEAT/#380] Home 라우트에 맞게 MainScreen 수정
leeeyubin May 10, 2025
30d2945
[FEAT/#380] Home 라우트에 맞게 MainTab 수정
leeeyubin May 10, 2025
8e4fe39
[FEAT/#380] Splash 분기처리 적용
leeeyubin May 10, 2025
c2c11ef
[FEAT/#380] EOF 수정
leeeyubin May 10, 2025
bcfc49f
[FEAT/#380] EOF 수정
leeeyubin May 10, 2025
20e0631
[FEAT/#380] MainActivity 코드 수정
leeeyubin May 10, 2025
ddfdb09
[FEAT/#380] 줄바꿈 추가
leeeyubin May 10, 2025
e93ef5d
[FEAT/#380] MainActivity 코드 수정
leeeyubin May 10, 2025
3e57f05
[FEAT/#380] by 제거
leeeyubin May 10, 2025
da94977
[FEAT/#380] 알림 딥링크 오류 수정
leeeyubin May 10, 2025
ffa0337
[FEAT/#380] 알림 딥링크 오류 수정
leeeyubin May 10, 2025
b3f828a
[FEAT/#380] 파라미터 base -> host 수정
leeeyubin May 10, 2025
eca85d3
[FEAT/#380] 줄바꿈 넣기
leeeyubin May 10, 2025
6aa0f73
[FEAT/#380] scheme 상수화
leeeyubin May 10, 2025
104793d
[FEAT/#380] hasHandledInternDeeplink 변수명 변경
leeeyubin May 10, 2025
54cc999
[FEAT/#380] DeeplinkType 네이밍 변경
leeeyubin May 10, 2025
301fd2a
[FIX/#380] iOS 분기처리 추가
arinming May 11, 2025
f1fa9ce
[FEAT/#380] iOS 형식 통일
arinming May 11, 2025
de4d515
[FEAT/#380] action -> redirect, id -> internId 복구
leeeyubin May 11, 2025
9c8f5c3
[FEAT/#380] Timber 삭제
leeeyubin May 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
android:host="oauth"
android:scheme="kakao${NATIVE_APP_KEY}" />

<data android:host="kakaolink" />
</intent-filter>
</activity>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.terning.core.designsystem.type

enum class NotificationRedirect(val path: String) {
enum class DeeplinkType(val path: String) {
CALENDAR("calendar"),
HOME("home"),
SEARCH("search");
SEARCH("search"),
KAKAOLINK("kakaolink"),
INTERN("intern");

companion object {
fun from(type: String?): NotificationRedirect? =
fun from(type: String?): DeeplinkType? =
entries.firstOrNull { it.path.equals(type, ignoreCase = true) }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
package com.terning.core.designsystem.util

import android.net.Uri

object DeeplinkDefaults {
private const val SCHEME: String = "terning"
const val REDIRECT: String = "redirect"
const val INTERN_ID: String = "internId"

fun build(
host: String,
redirect: String? = null,
internId: String? = null
): String {
val uriBuilder = Uri.Builder()
.scheme(SCHEME)
.authority(host)

redirect?.let { uriBuilder.appendQueryParameter(REDIRECT, it) }
internId?.let { uriBuilder.appendQueryParameter(INTERN_ID, it) }

fun build(base: String) = "terning://${base}"
}
return uriBuilder.build().toString()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class KakaoUtil @Inject constructor(
} catch (e: Exception) {
Timber.e("웹 공유 실패: ${e.message}")
}

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.terning.core.analytics.AmplitudeTracker
import com.terning.core.analytics.EventType
import com.terning.core.designsystem.type.NotificationRedirect
import com.terning.core.designsystem.type.DeeplinkType
import com.terning.core.designsystem.util.DeeplinkDefaults
import com.terning.core.designsystem.util.DeeplinkDefaults.REDIRECT
import com.terning.core.firebase.R
import com.terning.domain.user.repository.UserRepository
import com.terning.navigator.NavigatorProvider
Expand Down Expand Up @@ -162,10 +161,10 @@ class TerningMessagingService : FirebaseMessagingService() {
}

private fun buildDeeplink(type: String, isForeground: Boolean): String {
val base = NotificationRedirect.from(type) ?: return ""
val base = DeeplinkType.from(type) ?: return ""

return if (isForeground) DeeplinkDefaults.build(base.path)
else DeeplinkDefaults.build("splash?$REDIRECT=${base.path}")
return if (isForeground) DeeplinkDefaults.build(host = base.path)
else DeeplinkDefaults.build(host = BACKGROUND_HOST, redirect = base.path)
}

companion object {
Expand All @@ -174,6 +173,7 @@ class TerningMessagingService : FirebaseMessagingService() {
private const val BODY: String = "body"
private const val TYPE: String = "type"
private const val IMAGE_URL: String = "imageUrl"
private const val BACKGROUND_HOST: String = "splash"
const val FROM_NOTIFICATION: String = "fromNotification"
}
}
11 changes: 11 additions & 0 deletions feature/home/src/main/java/com/terning/feature/home/HomeRoute.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.runtime.snapshotFlow
import androidx.compose.ui.Alignment
Expand Down Expand Up @@ -81,6 +82,7 @@ private const val ZERO_TOTAL_COUNT = 0
@OptIn(ExperimentalPermissionsApi::class)
@Composable
fun HomeRoute(
internId: String?,
paddingValues: PaddingValues,
viewModel: HomeViewModel = hiltViewModel(),
navigateToCalendar: () -> Unit,
Expand All @@ -103,6 +105,15 @@ fun HomeRoute(
}
}

var hasHandledInternDeeplink by rememberSaveable { mutableStateOf(false) }

LaunchedEffect(internId, hasHandledInternDeeplink) {
if (internId != null && !hasHandledInternDeeplink) {
navigateToIntern(internId.toLong())
hasHandledInternDeeplink = true
}
}

LaunchedEffect(key1 = true) {
viewModel.getProfile()
viewModel.getFilteringInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,19 @@ import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import androidx.navigation.navDeepLink
import androidx.navigation.toRoute
import com.terning.core.designsystem.util.DeeplinkDefaults
import com.terning.core.navigation.MainTabRoute
import com.terning.feature.home.HomeRoute
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

fun NavController.navigateHome(navOptions: NavOptions? = null) {
fun NavController.navigateHome(
internId: String?,
navOptions: NavOptions? = null
) {
navigate(
route = Home,
route = Home(internId),
navOptions = navOptions
)
}
Expand All @@ -33,7 +38,9 @@ fun NavGraphBuilder.homeNavGraph(
)
)
) {
val args = it.toRoute<Home>()
HomeRoute(
internId = args.internId,
paddingValues = paddingValues,
navigateToCalendar = navigateToCalendar,
navigateToIntern = navigateToIntern
Expand All @@ -42,4 +49,7 @@ fun NavGraphBuilder.homeNavGraph(
}

@Serializable
data object Home : MainTabRoute
data class Home(
@SerialName("internId")
val internId: String? = null
) : MainTabRoute
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ fun InternRoute(
navController = navController,
onClickShareButton = {
viewModel.onKakaoShareClicked(
(internState.loadState as UiState.Success).data
(internState.loadState as UiState.Success).data,
announcementId.toString()
)
},
onDismissCancelDialog = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import javax.inject.Inject
@HiltViewModel
class InternViewModel @Inject constructor(
private val internRepository: InternRepository,
private val kakaoUtil: KakaoUtil
private val kakaoUtil: KakaoUtil,
) : ViewModel() {

private val _internUiState = MutableStateFlow(InternUiState())
Expand Down Expand Up @@ -68,16 +68,24 @@ class InternViewModel @Inject constructor(
}

fun onKakaoShareClicked(
internInfo: InternInfo
internInfo: InternInfo,
announcementId: String,
) {
val templateArgs = mapOf(
"COMPANY_IMG" to internInfo.companyImage,
"TITLE" to internInfo.title,
"DEADLINE" to internInfo.deadline,
"START_DATE" to internInfo.startYearMonth,
"PERIOD" to internInfo.workingPeriod,
"REGI_WEB_DOMAIN" to internInfo.url
)
"A_E" to "kakaolink",
"A_E_D" to "intern",
"I_E" to "kakaolink",
"I_E_D" to "jobDetail",
"redirect" to "intern",
"internId" to announcementId,
"action" to "jobDetail",
"JOB_ID" to announcementId
)
kakaoUtil.shareToKakaoTalk(templateArgs)
}
}

This file was deleted.

17 changes: 17 additions & 0 deletions feature/main/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
import com.terning.build_logic.extension.setNamespace
import java.util.Properties

plugins {
alias(libs.plugins.terning.feature)
}

val properties = Properties().apply {
load(rootProject.file("local.properties").inputStream())
}

android {
buildFeatures {
buildConfig = true
}

setNamespace("feature.main")

defaultConfig {
buildConfigField(
"String",
"NATIVE_APP_KEY",
properties.getProperty("native.app.key"),
)
}
}

dependencies {
Expand Down
12 changes: 12 additions & 0 deletions feature/main/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@

<data android:scheme="terning" />
</intent-filter>

<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="kakao${NATIVE_APP_KEY}"
android:host="kakaolink" />
</intent-filter>

</activity>
<service
android:name="com.terning.core.firebase.messageservice.TerningMessagingService"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import com.terning.core.analytics.AmplitudeTracker
import com.terning.core.analytics.EventType
import com.terning.core.analytics.LocalTracker
import com.terning.core.designsystem.theme.TerningPointTheme
import com.terning.core.designsystem.util.DeeplinkDefaults.INTERN_ID
import com.terning.core.designsystem.util.DeeplinkDefaults.REDIRECT
import com.terning.core.firebase.messageservice.TerningMessagingService.Companion.FROM_NOTIFICATION
import dagger.hilt.android.AndroidEntryPoint
Expand All @@ -28,30 +29,33 @@ class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()

setContent {
val navigator: MainNavigator = rememberMainNavigator()
val (host, redirect) = handleDeeplink(intent)
val (host, redirect, internId) = handleDeeplink(intent)

TerningPointTheme {
CompositionLocalProvider(LocalTracker provides tracker) {
MainScreen(
host = host,
redirect = redirect,
internId = internId,
navigator = navigator
)
}
}
}
}

private fun handleDeeplink(intent: Intent?): Pair<String?, String?> {
private fun handleDeeplink(intent: Intent?): Triple<String?, String?, String?> {
val uri = intent?.data
val uriString = uri?.toString()

if (uriString.isNullOrEmpty()) return null to null
if (uriString.isNullOrEmpty()) return Triple(null, null, null)

val host = uri.host
val redirect = uri.getQueryParameter(REDIRECT)
val internId = uri.getQueryParameter(INTERN_ID)

if (!intent.getBooleanExtra(ALREADY_TRACKED, false)
&& intent.getBooleanExtra(FROM_NOTIFICATION, false)
Expand All @@ -64,7 +68,7 @@ class MainActivity : ComponentActivity() {

intent.putExtra(ALREADY_TRACKED, true)

return host to redirect
return Triple(host, redirect, internId)
}

companion object {
Expand All @@ -74,4 +78,4 @@ class MainActivity : ComponentActivity() {
context: Context,
) = Intent(context, MainActivity::class.java)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.currentBackStackEntryAsState
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navOptions
import com.terning.core.designsystem.type.NotificationRedirect
import com.terning.core.designsystem.type.DeeplinkType
import com.terning.feature.calendar.calendar.navigation.Calendar
import com.terning.feature.calendar.calendar.navigation.navigateCalendar
import com.terning.feature.home.navigation.Home
Expand All @@ -26,13 +26,18 @@ class MainNavigator(
@Composable get() = navController
.currentBackStackEntryAsState().value?.destination

fun getStartDestination(redirect: String?, host: String?) =
when (NotificationRedirect.from(host)) {
NotificationRedirect.SEARCH -> Search
NotificationRedirect.HOME -> Home
NotificationRedirect.CALENDAR -> Calendar
else -> Splash(redirect)
}
fun getStartDestination(
host: String?,
redirect: String?,
internId: String?
) = when (DeeplinkType.from(host)) {
DeeplinkType.SEARCH -> Search
DeeplinkType.HOME -> Home(internId = null)
DeeplinkType.CALENDAR -> Calendar
DeeplinkType.KAKAOLINK -> Splash(redirect = redirect, internId = internId)

else -> Splash(redirect = redirect)
}

val currentTab: MainTab?
@Composable get() = MainTab.find { tab ->
Expand All @@ -52,7 +57,7 @@ class MainNavigator(
}

when (tab) {
MainTab.HOME -> navController.navigateHome(navOptions)
MainTab.HOME -> navController.navigateHome(navOptions = navOptions, internId = null)
MainTab.CALENDAR -> navController.navigateCalendar(navOptions)
MainTab.SEARCH -> navController.navigateSearch(navOptions)
MainTab.MY_PAGE -> navController.navigateMyPage(navOptions)
Expand Down
Loading