Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,21 @@
android:windowSoftInputMode="adjustResize"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:theme="@style/Theme.Todakun">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</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="todakun" />
</intent-filter>

<!-- 카카오 공유 딥링크 -->
<intent-filter>
Expand Down
39 changes: 9 additions & 30 deletions app/src/main/java/com/kikidan/todakun/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package com.kikidan.todakun

import android.content.Intent
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.kikidan.designsystem.theme.TodakunTheme
import com.kikidan.domain.model.notification.PushNotificationEvent
import com.kikidan.navigation.TodakunRoute
import com.kikidan.navigation.parseDeepLink
import dagger.hilt.android.AndroidEntryPoint

@AndroidEntryPoint
Expand All @@ -21,32 +18,14 @@ class MainActivity : ComponentActivity() {
enableEdgeToEdge()
setContent {
TodakunTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
Greeting(
name = "Android",
modifier = Modifier.padding(innerPadding),
)
}
TodakunApp(deepLinkRoute = handleDeepLinkIntent(intent))
}
}
}
}

@Composable
fun Greeting(
name: String,
modifier: Modifier = Modifier,
) {
Text(
text = "Hello $name!",
modifier = modifier,
)
}

@Preview(showBackground = true)
@Composable
private fun GreetingPreview() {
TodakunTheme {
Greeting("Android")
/** FCM 백그라운드 알림의 PendingIntent extra를 우선 확인하고, 없으면 외부 공유 링크(intent.data)를 확인한다. */
private fun handleDeepLinkIntent(intent: Intent?): TodakunRoute? {
val deepLink = intent?.extras?.getString(PushNotificationEvent.DEEP_LINK_KEY)
return deepLink?.let { parseDeepLink(it) }
}
}
Loading
Loading