Skip to content

Commit

Permalink
feat: announcement creation 로직 추가 #111
Browse files Browse the repository at this point in the history
- 네비게이션 처리
- 업로드 완료 화면 처리
  • Loading branch information
easyhz committed Aug 20, 2024
1 parent 1be049f commit d2abd62
Show file tree
Hide file tree
Showing 26 changed files with 712 additions and 182 deletions.
1 change: 1 addition & 0 deletions app/src/main/java/com/easyhz/noffice/NofficeApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ internal fun NofficeApp(
navController = navController
)
announcementGraph(
snackBarHostState = snackBarHostState,
navController = navController,
)
myPageGraph(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.easyhz.noffice.navigation.announcement

import androidx.compose.material3.SnackbarHostState
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import androidx.navigation.compose.navigation
import androidx.navigation.navOptions
import androidx.navigation.toRoute
import com.easyhz.noffice.core.model.announcement.param.AnnouncementParam
import com.easyhz.noffice.feature.announcement.screen.creation.ContentScreen
Expand All @@ -17,13 +20,18 @@ import com.easyhz.noffice.feature.announcement.screen.creation.remind.RemindView
import com.easyhz.noffice.feature.announcement.screen.creation.selection.NofficeSelectionScreen
import com.easyhz.noffice.feature.announcement.screen.creation.task.TaskScreen
import com.easyhz.noffice.feature.announcement.screen.detail.AnnouncementDetailScreen
import com.easyhz.noffice.feature.announcement.screen.success.SuccessScreen
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementCreation
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementCreation.Promotion.Companion.decode
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementCreation.Promotion.Companion.encode
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementDetail
import com.easyhz.noffice.navigation.announcement.screen.AnnouncementSuccess
import com.easyhz.noffice.navigation.home.navigateToHome
import com.easyhz.noffice.navigation.home.screen.Home
import com.easyhz.noffice.navigation.util.sharedViewModel

internal fun NavGraphBuilder.announcementGraph(
snackBarHostState: SnackbarHostState,
navController: NavController,
) {
composable<AnnouncementDetail> {
Expand All @@ -46,8 +54,10 @@ internal fun NavGraphBuilder.announcementGraph(

composable<AnnouncementCreation.Content> {
val viewModel = it.sharedViewModel<CreationViewModel>(navController = navController)
val args = it.toRoute<AnnouncementCreation.Content>()
ContentScreen(
viewModel = viewModel,
organizationId = args.organizationId,
navigateToUp = navController::navigateUp,
navigateToDateTime = navController::navigateToDateTime,
navigateToPlace = navController::navigateToPlace,
Expand Down Expand Up @@ -93,7 +103,8 @@ internal fun NavGraphBuilder.announcementGraph(

composable<AnnouncementCreation.Remind> {
val viewModel = it.sharedViewModel<RemindViewModel>(navController = navController)
val creationViewModel = it.sharedViewModel<CreationViewModel>(navController = navController)
val creationViewModel =
it.sharedViewModel<CreationViewModel>(navController = navController)
val args = it.toRoute<AnnouncementCreation.Remind>()
RemindScreen(
viewModel = viewModel,
Expand All @@ -115,19 +126,48 @@ internal fun NavGraphBuilder.announcementGraph(
composable<AnnouncementCreation.Promotion>(
typeMap = AnnouncementCreation.Promotion.typeMap
) {
val navOptions = navOptions {
popUpTo(Home) {
inclusive = false
}
}
val args = it.toRoute<AnnouncementCreation.Promotion>()
PromotionScreen(
param = args.announcementParam.decode()
param = args.announcementParam.decode(),
snackBarHostState = snackBarHostState,
navigateToUp = navController::navigateUp,
navigateToSuccess = { id, title ->
navController.navigateToSuccess(
id,
title,
navOptions
)
}
)
}
}
composable<AnnouncementSuccess> {
val args = it.toRoute<AnnouncementSuccess>()
val navOptions = navOptions {
popUpTo(Home) {
inclusive = false
}
}
SuccessScreen(
id = args.announcementId,
title = args.title,
navigateToHome = { navController.navigateToHome(navOptions) },
navigateToAnnouncementDetail = { id, title -> navController.navigateToAnnouncementDetail(id, title, navOptions)}
)
}
}

internal fun NavController.navigateToAnnouncementDetail(
id: Int,
title: String
title: String,
navOptions: NavOptions? = null
) {
navigate(route = AnnouncementDetail(id, title))
navigate(route = AnnouncementDetail(id, title), navOptions)
}

internal fun NavController.navigateToAnnouncementNofficeSelection() {
Expand All @@ -136,9 +176,9 @@ internal fun NavController.navigateToAnnouncementNofficeSelection() {
)
}

internal fun NavController.navigateToAnnouncementCreationContent() {
internal fun NavController.navigateToAnnouncementCreationContent(organizationId: Int) {
navigate(
route = AnnouncementCreation.Content
route = AnnouncementCreation.Content(organizationId)
)
}

Expand Down Expand Up @@ -168,9 +208,15 @@ internal fun NavController.navigateToTask(taskList: List<String>?) {
)
}

internal fun NavController.navigateToRemind(remindList: List<String>?, isSelectedDateTime: Boolean) {
internal fun NavController.navigateToRemind(
remindList: List<String>?,
isSelectedDateTime: Boolean
) {
navigate(
route = AnnouncementCreation.Remind(remindList = remindList, isSelectedDateTime = isSelectedDateTime)
route = AnnouncementCreation.Remind(
remindList = remindList,
isSelectedDateTime = isSelectedDateTime
)
)
}

Expand All @@ -182,4 +228,12 @@ internal fun NavController.navigateToCustomRemind() {

internal fun NavController.navigateToPromotion(param: AnnouncementParam) {
navigate(route = AnnouncementCreation.Promotion(param.encode()))
}

internal fun NavController.navigateToSuccess(
id: Int,
title: String,
navOptions: NavOptions? = null
) {
navigate(route = AnnouncementSuccess(id, title), navOptions)
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ internal object AnnouncementCreation: Parcelable {
data object NofficeSelection

@Serializable
data object Content
data class Content(
val organizationId: Int
)

@Serializable
data class DateTime(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.easyhz.noffice.navigation.announcement.screen

import kotlinx.serialization.Serializable

@Serializable
data class AnnouncementSuccess(
val announcementId: Int,
val title: String
)
163 changes: 163 additions & 0 deletions core/design-system/src/main/res/drawable/ic_success_bell.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="143dp"
android:height="130dp"
android:viewportWidth="143"
android:viewportHeight="130">
<group>
<clip-path
android:pathData="M0.23,0h142.54v130h-142.54z"/>
<path
android:pathData="M20,115a54.5,10.58 0,1 0,109 0a54.5,10.58 0,1 0,-109 0z"
android:fillColor="#D9D9D9"
android:fillAlpha="0.4"/>
<path
android:pathData="M51.35,114.68C73.62,114.68 91.67,98.41 91.67,78.34C91.67,58.27 73.62,42 51.35,42C29.08,42 11.04,58.27 11.04,78.34C11.04,98.41 29.08,114.68 51.35,114.68Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="51.35"
android:startY="114.68"
android:endX="51.35"
android:endY="42"
android:type="linear">
<item android:offset="0" android:color="#FFFFEA8D"/>
<item android:offset="1" android:color="#FFFFEFB7"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M43.97,72.08C49.3,72.08 53.62,67.75 53.62,62.42C53.62,57.09 49.3,52.77 43.97,52.77C38.64,52.77 34.32,57.09 34.32,62.42C34.32,67.75 38.64,72.08 43.97,72.08Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M61.29,72.08C66.62,72.08 70.94,67.75 70.94,62.42C70.94,57.09 66.62,52.77 61.29,52.77C55.96,52.77 51.64,57.09 51.64,62.42C51.64,67.75 55.96,72.08 61.29,72.08Z"
android:fillColor="#ffffff"/>
<path
android:pathData="M46.1,67.2C50.02,67.2 53.2,64.02 53.2,60.1C53.2,56.18 50.02,53 46.1,53C42.18,53 39,56.18 39,60.1C39,64.02 42.18,67.2 46.1,67.2Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="41.08"
android:startY="55.08"
android:endX="51.12"
android:endY="65.12"
android:type="linear">
<item android:offset="0" android:color="#FFFFAF66"/>
<item android:offset="1" android:color="#FFFFCC66"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M63.1,67.2C67.02,67.2 70.2,64.02 70.2,60.1C70.2,56.18 67.02,53 63.1,53C59.18,53 56,56.18 56,60.1C56,64.02 59.18,67.2 63.1,67.2Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="58.08"
android:startY="55.08"
android:endX="68.12"
android:endY="65.12"
android:type="linear">
<item android:offset="0" android:color="#FFFFAF66"/>
<item android:offset="1" android:color="#FFFFCC66"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M52.35,79.74C56.82,79.74 60.44,78.03 60.44,75.91C60.44,73.79 56.82,72.08 52.35,72.08C47.88,72.08 44.26,73.79 44.26,75.91C44.26,78.03 47.88,79.74 52.35,79.74Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="52.35"
android:startY="79.74"
android:endX="52.35"
android:endY="72.08"
android:type="linear">
<item android:offset="0" android:color="#FFFFAF66"/>
<item android:offset="1" android:color="#FFFFCC66"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M23.98,85.04C25.5,74.97 21.99,66.08 16.14,65.19C10.28,64.3 4.29,71.75 2.76,81.83C1.24,91.91 4.75,100.79 10.61,101.68C16.46,102.57 22.45,95.12 23.98,85.04Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="5"
android:startY="67.7"
android:endX="14.32"
android:endY="101.23"
android:type="linear">
<item android:offset="0" android:color="#FFFFEA8D"/>
<item android:offset="1" android:color="#FFFFEFB7"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M94.5,101.68C100.35,100.79 103.86,91.91 102.34,81.83C100.81,71.75 94.82,64.3 88.97,65.19C83.11,66.08 79.6,74.97 81.12,85.04C82.65,95.12 88.64,102.57 94.5,101.68Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="79.08"
android:startY="70.88"
android:endX="97.92"
android:endY="100.15"
android:type="linear">
<item android:offset="0" android:color="#FFFFEA8D"/>
<item android:offset="1" android:color="#FFFFEFB7"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M106.76,50.48C105.99,52.38 104.88,53.95 103.55,55.04C102.22,56.13 100.71,56.71 99.17,56.71C97.63,56.71 96.12,56.13 94.79,55.04C93.46,53.95 92.35,52.38 91.58,50.48"
android:strokeLineJoin="round"
android:strokeWidth="7.21964"
android:fillColor="#00000000"
android:strokeColor="#FFD85A"
android:strokeLineCap="round"/>
<path
android:pathData="M99.17,1.98C93.56,1.98 88.19,4.21 84.23,8.17C80.26,12.13 78.04,17.51 78.04,23.11C78.04,33.23 75.87,39.52 73.88,43.17C72.88,45.01 71.9,46.21 71.22,46.93C70.89,47.29 70.62,47.52 70.46,47.66C70.38,47.73 70.32,47.77 70.3,47.78L70.29,47.79C69.21,48.53 68.73,49.89 69.11,51.15C69.5,52.43 70.67,53.3 72,53.3H126.33C127.67,53.3 128.84,52.43 129.22,51.15C129.61,49.89 129.13,48.53 128.04,47.79L128.04,47.78C128.01,47.77 127.96,47.73 127.88,47.66C127.72,47.52 127.45,47.29 127.11,46.93C126.43,46.21 125.46,45.01 124.46,43.17C122.46,39.52 120.3,33.23 120.3,23.11C120.3,17.51 118.07,12.13 114.11,8.17C110.15,4.21 104.77,1.98 99.17,1.98Z"
android:fillType="evenOdd">
<aapt:attr name="android:fillColor">
<gradient
android:startX="99.17"
android:startY="5"
android:endX="99.17"
android:endY="50.28"
android:type="linear">
<item android:offset="0" android:color="#FFFFE266"/>
<item android:offset="1" android:color="#FFFFBA34"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M116.54,64.02C118.94,63.82 120.77,65.9 121.76,67.85C122.92,70.15 123.16,72.78 121.58,74.96C120.39,76.6 117.86,78.25 115.75,77.87C114.67,77.68 113.74,76.88 113.31,75.87C112.3,73.51 113.96,71.07 115.95,69.88C121.56,66.52 130.42,68.63 133.26,74.75C134.2,76.78 134.42,79.13 133.84,81.29C132.61,85.81 127.71,89.04 123.14,89.18C120.31,89.27 117.57,87.92 116.02,85.51"
android:strokeLineJoin="round"
android:strokeWidth="3.37452"
android:fillColor="#00000000"
android:strokeLineCap="round">
<aapt:attr name="android:strokeColor">
<gradient
android:startX="115"
android:startY="62.95"
android:endX="129.62"
android:endY="88.96"
android:type="linear">
<item android:offset="0" android:color="#FFFFB753"/>
<item android:offset="1" android:color="#FFFFCC66"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M64.97,30.24C62.88,31.45 60.34,30.35 58.61,29.01C56.58,27.44 55.23,25.16 55.72,22.51C56.09,20.52 57.67,17.95 59.74,17.38C60.79,17.09 61.98,17.41 62.8,18.14C64.73,19.84 64.27,22.76 62.99,24.69C59.37,30.13 50.45,32.02 45.26,27.71C43.55,26.29 42.33,24.25 41.93,22.05C41.1,17.44 44.14,12.43 48.21,10.34C50.73,9.04 53.79,9.09 56.21,10.6"
android:strokeLineJoin="round"
android:strokeWidth="3.37452"
android:fillColor="#00000000"
android:strokeLineCap="round">
<aapt:attr name="android:strokeColor">
<gradient
android:startX="40.11"
android:startY="20.22"
android:endX="66.58"
android:endY="20.01"
android:type="linear">
<item android:offset="0" android:color="#FFFFB753"/>
<item android:offset="1" android:color="#FFFFCC66"/>
</gradient>
</aapt:attr>
</path>
</group>
</vector>
5 changes: 5 additions & 0 deletions core/design-system/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@
<string name="announcement_creation_option_promotion_promotion_button">프로모션 참여하러 가기</string>
<string name="announcement_creation_option_promotion_select_button">선택 완료</string>

<string name="announcement_creation_success_to_home">노티 홈으로</string>
<string name="announcement_creation_success_to_detail">확인하러 가기</string>
<string name="announcement_creation_success_title">노티가 등록되었어요</string>
<string name="announcement_creation_success_content">등록된 노티를 확인하러 갈까요?</string>

<string name="delete">삭제</string>

<string name="announcement_detail_date_time">이벤트 일시</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class AnnouncementParam(
val isFaceToFace: Boolean?,
val memberId: Int,
val noticeBefore: List<String>?,
val noticeDate: String?,
val noticeDate: List<String>?,
val organizationId: Int,
val placeLinkName: String?,
val placeLinkUrl: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class AnnouncementRequest(
val isFaceToFace: Boolean?,
val memberId: Int,
val noticeBefore: List<String>?,
val noticeDate: String?,
val noticeDate: List<String>?,
val organizationId: Int,
val placeLinkName: String?,
val placeLinkUrl: String?,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.easyhz.noffice.domain.my_page.usecase

import com.easyhz.noffice.core.common.base.BaseUseCase
import com.easyhz.noffice.data.member.repository.user.UserRepository
import javax.inject.Inject

class GetMemberIdUseCase @Inject constructor(
private val userRepository: UserRepository
): BaseUseCase<Unit, Int>() {

override suspend fun invoke(param: Unit): Result<Int> {
return userRepository.getMemberId()
}
}
Loading

0 comments on commit d2abd62

Please sign in to comment.