Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
95e1da5
refactor: IntroActivity 새로운 Intent 구조 적용
PeraSite Oct 17, 2025
ccea94a
chore: companion object private 변경, androidx.core.content.IntentCompa…
PeraSite Oct 17, 2025
76a1f20
feat: ActivityCompanion, ActivityCompanionWithArgs 분리
PeraSite Oct 17, 2025
7786e8e
refactor: WebViewActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
e54505f
refactor: ForceUpdateDialogActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
27029a2
refactor: LoginActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
c79d3d1
refactor: MainActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
f9373c6
chore: ActivityUtil.kt startActivity deprecate
PeraSite Oct 17, 2025
f3cbe9a
feat: 기본값으로 만들 수 있는 ActivityCompanionWithArgsDefault 추가
PeraSite Oct 17, 2025
2b05847
refactor: SignOutActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
9e2860d
refactor: WebViewActivity 호출 구조 변경
PeraSite Oct 17, 2025
07a00fa
refactor: DeveloperActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
6e96014
refactor: MyReviewListActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
a03b597
refactor: AndroidMessageDialogActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
a9a8bc9
chore: Default start 추가
PeraSite Oct 17, 2025
a096d62
refactor: UserInfoActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
18e60af
refactor: ReportActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
3371d2e
refactor: ModifyReviewActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
b6f4318
refactor: ReviewActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
20db1c5
refactor: ReviewWriteRateActivity 새 Intent 구조 적용
PeraSite Oct 17, 2025
dec1a51
refactor: type-safe한 Fragment arguments
PeraSite Oct 17, 2025
37ea8ea
Merge branch 'develop' into refactor/typesafe-intent
PeraSite Oct 20, 2025
5a12705
docs: ActivityCompanion, FragmentCompanion 주석 추가
PeraSite Oct 20, 2025
49eabf7
feat: FragmentCompanionWithArgsDefault 추가
PeraSite Oct 20, 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.content.Intent
import androidx.core.app.NotificationCompat
import com.eatssu.android.R
import com.eatssu.android.presentation.intro.IntroActivity
import com.eatssu.common.enums.LaunchPath.REMOTE_NOTIFICATION
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import timber.log.Timber
Expand Down Expand Up @@ -44,8 +45,7 @@ class EatSsuFirebaseMessagingService : FirebaseMessagingService() {
}
notificationManager.createNotificationChannel(channel)

val intent = Intent(this, IntroActivity::class.java).apply {
putExtra("launch_path", "remote_notification")
val intent = IntroActivity.intent(this, IntroActivity.IntentOptions(REMOTE_NOTIFICATION)) {
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.content.Intent
import androidx.core.app.NotificationCompat
import com.eatssu.android.R
import com.eatssu.android.presentation.intro.IntroActivity
import com.eatssu.common.enums.LaunchPath
import java.time.DayOfWeek
import java.time.LocalDateTime

Expand Down Expand Up @@ -39,14 +40,17 @@ class NotificationReceiver : BroadcastReceiver() {
notificationManager.createNotificationChannel(channel)


val intent = Intent(context, IntroActivity::class.java).apply {
val intent = IntroActivity.intent(
context,
IntroActivity.IntentOptions(LaunchPath.LOCAL_NOTIFICATION)
) {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
}

val pendingIntent = PendingIntent.getActivity(
context,
0,
intent.putExtra("launch_path", "local_notification"),
intent,
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.eatssu.android.presentation.base

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Parcelable
import kotlin.reflect.KClass

abstract class ActivityCompanion<IntentOptions>(
private val activityClass: KClass<out Activity>,
private val optionsClass: KClass<IntentOptions>
) where IntentOptions : Parcelable {
companion object {
private const val INTENT_OPTIONS_KEY = "intent_options"
}

fun intent(
context: Context,
options: IntentOptions,
intentBuilder: Intent.() -> Unit = {}
): Intent =
Intent(context, activityClass.java).apply {
putExtra(INTENT_OPTIONS_KEY, options)
intentBuilder()
}

fun start(context: Context, options: IntentOptions, intentBuilder: Intent.() -> Unit = {}) {
context.startActivity(intent(context, options, intentBuilder))
}

val Activity.intentOptions: IntentOptions?
get() = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
this.intent.getParcelableExtra<IntentOptions>(INTENT_OPTIONS_KEY, optionsClass.java)
} else {
@Suppress("DEPRECATION")
this.intent.getParcelableExtra<IntentOptions>(INTENT_OPTIONS_KEY)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eatssu.android.presentation.intro

import android.os.Bundle
import android.os.Parcelable
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -9,6 +10,7 @@ import com.eatssu.android.databinding.ActivityIntroBinding
import com.eatssu.android.presentation.MainActivity
import com.eatssu.android.presentation.UiEvent
import com.eatssu.android.presentation.UiState
import com.eatssu.android.presentation.base.ActivityCompanion
import com.eatssu.android.presentation.login.LoginActivity
import com.eatssu.android.presentation.util.showToast
import com.eatssu.android.presentation.util.startActivity
Expand All @@ -18,10 +20,15 @@ import com.eatssu.common.enums.ScreenId
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import kotlinx.parcelize.Parcelize

@AndroidEntryPoint
class IntroActivity : AppCompatActivity() {

@Parcelize
data class IntentOptions(val launchPath: LaunchPath) : Parcelable
companion object : ActivityCompanion<IntentOptions>(IntroActivity::class, IntentOptions::class)

private val introViewModel: IntroViewModel by viewModels()
private lateinit var binding: ActivityIntroBinding

Expand Down Expand Up @@ -62,14 +69,8 @@ class IntroActivity : AppCompatActivity() {
}

private fun log() {
val launchPath = intent.getStringExtra("launch_path")
when (launchPath) {
"widget" -> EventLogger.appLaunch(LaunchPath.WIDGET)
"local_notification" -> EventLogger.appLaunch(LaunchPath.LOCAL_NOTIFICATION)
"remote_notification" -> EventLogger.appLaunch(LaunchPath.REMOTE_NOTIFICATION)
// launch_path가 없으면 일반적인 앱 아이콘 클릭으로 간주
else -> EventLogger.appLaunch(LaunchPath.ICON)
}
val launchPath = intentOptions?.launchPath ?: LaunchPath.ICON
EventLogger.appLaunch(launchPath)
}

override fun onResume() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.eatssu.android.presentation.widget.ui

import android.content.Context
import android.content.Intent
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -42,12 +43,13 @@ import androidx.glance.text.TextStyle
import com.eatssu.android.R
import com.eatssu.android.domain.model.WidgetMealInfo
import com.eatssu.android.domain.usecase.widget.LoadRestaurantByFileKeyUseCase
import com.eatssu.android.presentation.intro.IntroActivity
import com.eatssu.android.presentation.widget.MealInfoStateDefinition
import com.eatssu.android.presentation.widget.MealWorker
import com.eatssu.android.presentation.widget.theme.EATSSUWidgetColorScheme
import com.eatssu.android.presentation.widget.util.MealTime
import com.eatssu.android.presentation.widget.util.WidgetDataDisplayManager
import com.eatssu.android.presentation.widget.util.launchApp
import com.eatssu.common.enums.LaunchPath
import com.eatssu.common.enums.Restaurant
import dagger.hilt.EntryPoint
import dagger.hilt.InstallIn
Expand Down Expand Up @@ -255,7 +257,9 @@ class MealWidget : GlanceAppWidget() {
.cornerRadius(20.dp)
.clickable {
Timber.d("위젯 클릭")
context.launchApp()
IntroActivity.start(context, IntroActivity.IntentOptions(LaunchPath.WIDGET)) {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
},
) {
Row(
Expand Down

This file was deleted.