|
| 1 | +package com.ku_stacks.ku_ring.club.detail |
| 2 | + |
| 3 | +import android.app.Activity |
| 4 | +import androidx.compose.foundation.background |
| 5 | +import androidx.compose.foundation.layout.fillMaxSize |
| 6 | +import androidx.compose.foundation.layout.safeDrawingPadding |
| 7 | +import androidx.compose.ui.Modifier |
| 8 | +import androidx.compose.ui.platform.LocalContext |
| 9 | +import androidx.navigation3.runtime.EntryProviderScope |
| 10 | +import androidx.navigation3.runtime.NavKey |
| 11 | +import com.ku_stacks.ku_ring.designsystem.kuringtheme.KuringTheme |
| 12 | +import com.ku_stacks.ku_ring.navigation.EntryBuilderProvider |
| 13 | +import com.ku_stacks.ku_ring.navigation.keys.ClubDetailKey |
| 14 | +import com.ku_stacks.ku_ring.util.navigateToExternalBrowser |
| 15 | +import dagger.Module |
| 16 | +import dagger.Provides |
| 17 | +import dagger.hilt.InstallIn |
| 18 | +import dagger.hilt.components.SingletonComponent |
| 19 | +import dagger.multibindings.IntoSet |
| 20 | + |
| 21 | +class ClubDetailEntryBuilder : EntryBuilderProvider { |
| 22 | + override fun EntryProviderScope<NavKey>.provide() { |
| 23 | + entry<ClubDetailKey> { key -> |
| 24 | + val context = LocalContext.current |
| 25 | + ClubDetailScreen( |
| 26 | + onBack = { (context as? Activity)?.finish() }, |
| 27 | + onMoveToRecruitmentLink = context::navigateToExternalBrowser, |
| 28 | + modifier = Modifier |
| 29 | + .background(KuringTheme.colors.background) |
| 30 | + .safeDrawingPadding() |
| 31 | + .fillMaxSize(), |
| 32 | + ) |
| 33 | + } |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +@Module |
| 38 | +@InstallIn(SingletonComponent::class) |
| 39 | +object ClubDetailEntryBuilderModule { |
| 40 | + @Provides |
| 41 | + @IntoSet |
| 42 | + fun provideClubDetailEntryBuilder(): EntryBuilderProvider = ClubDetailEntryBuilder() |
| 43 | +} |
0 commit comments