diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 7e511740e..0a20cff75 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -123,12 +123,10 @@ dependencies { implementation(projects.domain.soptamp) implementation(projects.domain.mypage) implementation(projects.domain.poke) - implementation(projects.domain.fortune) implementation(projects.domain.notification) implementation(projects.domain.home) implementation(projects.domain.auth) - implementation(projects.data.fortune) implementation(projects.data.soptamp) implementation(projects.data.mypage) implementation(projects.data.poke) @@ -146,7 +144,6 @@ dependencies { implementation(projects.feature.mypage) implementation(projects.feature.poke) implementation(projects.feature.notification) - implementation(projects.feature.fortune) implementation(projects.feature.home) implementation(projects.feature.main) implementation(projects.feature.schedule) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 004697456..2898f8547 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -148,11 +148,6 @@ android:name=".feature.notification.SchemeActivity" android:exported="true" android:launchMode="singleTop"/> - - - - - - diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt deleted file mode 100644 index 02d21dc08..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/ApiModule.kt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * MIT License - * Copyright 2023-2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.di - -import dagger.Module -import dagger.Provides -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import org.sopt.official.common.di.AppRetrofit -import org.sopt.official.data.fortune.remote.api.FortuneApi -import retrofit2.Retrofit -import retrofit2.create -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -internal object ApiModule { - - @Provides - @Singleton - internal fun provideFortuneApi(@AppRetrofit(true) retrofit: Retrofit): FortuneApi = retrofit.create() -} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt deleted file mode 100644 index 5e13a4457..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/di/RepositoryModule.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * MIT License - * Copyright 2023-2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.di - -import dagger.Binds -import dagger.Module -import dagger.hilt.InstallIn -import dagger.hilt.components.SingletonComponent -import org.sopt.official.data.fortune.repository.DefaultFortuneRepository -import org.sopt.official.domain.fortune.repository.FortuneRepository -import javax.inject.Singleton - -@Module -@InstallIn(SingletonComponent::class) -internal interface RepositoryModule { - - @Binds - @Singleton - abstract fun bindDefaultFortuneRepository(defaultFortuneRepository: DefaultFortuneRepository): FortuneRepository -} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt deleted file mode 100644 index 8e1673477..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/mapper/FortuneMapper.kt +++ /dev/null @@ -1,42 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.mapper - -import org.sopt.official.data.fortune.remote.response.TodayFortuneCardResponse -import org.sopt.official.data.fortune.remote.response.TodayFortuneWordResponse -import org.sopt.official.domain.fortune.model.TodayFortuneCard -import org.sopt.official.domain.fortune.model.TodayFortuneWord - -internal fun TodayFortuneCardResponse.toDomain(): TodayFortuneCard = TodayFortuneCard( - description = description, - imageColorCode = imageColorCode, - imageUrl = imageUrl, - name = name, -) - -internal fun TodayFortuneWordResponse.toDomain(): TodayFortuneWord = TodayFortuneWord( - userName = userName, - title = title, -) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt deleted file mode 100644 index 2898bce3c..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/api/FortuneApi.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.remote.api - -import org.sopt.official.data.fortune.remote.response.TodayFortuneCardResponse -import org.sopt.official.data.fortune.remote.response.TodayFortuneWordResponse -import retrofit2.http.GET -import retrofit2.http.Query - -internal interface FortuneApi { - - @GET("fortune/word") - suspend fun getTodayFortuneWord( - @Query("todayDate") todayDate: String, - ): TodayFortuneWordResponse - - @GET("fortune/card/today") - suspend fun getTodayFortuneCard(): TodayFortuneCardResponse -} diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt deleted file mode 100644 index 56a68179d..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneCardResponse.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.remote.response - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -internal data class TodayFortuneCardResponse( - @SerialName("description") - val description: String, - @SerialName("imageColorCode") - val imageColorCode: String, - @SerialName("imageUrl") - val imageUrl: String, - @SerialName("name") - val name: String, -) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt deleted file mode 100644 index 1882c5bea..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/remote/response/TodayFortuneWordResponse.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.remote.response - -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable - -@Serializable -internal data class TodayFortuneWordResponse( - @SerialName("userName") - val userName: String, - @SerialName("title") - val title: String, -) diff --git a/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt b/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt deleted file mode 100644 index 77a64c995..000000000 --- a/data/fortune/src/main/java/org/sopt/official/data/fortune/repository/DefaultFortuneRepository.kt +++ /dev/null @@ -1,41 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.data.fortune.repository - -import org.sopt.official.data.fortune.mapper.toDomain -import org.sopt.official.data.fortune.remote.api.FortuneApi -import org.sopt.official.domain.fortune.model.TodayFortuneCard -import org.sopt.official.domain.fortune.model.TodayFortuneWord -import org.sopt.official.domain.fortune.repository.FortuneRepository -import javax.inject.Inject - -internal class DefaultFortuneRepository @Inject constructor( - private val fortuneApi: FortuneApi, -) : FortuneRepository { - - override suspend fun fetchTodayFortuneWord(date: String): TodayFortuneWord = fortuneApi.getTodayFortuneWord(date).toDomain() - - override suspend fun fetchTodayFortuneCard(): TodayFortuneCard = fortuneApi.getTodayFortuneCard().toDomain() -} diff --git a/data/soptlog/src/main/java/org/sopt/official/data/soptlog/dto/SoptLogInfoResponse.kt b/data/soptlog/src/main/java/org/sopt/official/data/soptlog/dto/SoptLogInfoResponse.kt index fc5c2e942..760162e8f 100644 --- a/data/soptlog/src/main/java/org/sopt/official/data/soptlog/dto/SoptLogInfoResponse.kt +++ b/data/soptlog/src/main/java/org/sopt/official/data/soptlog/dto/SoptLogInfoResponse.kt @@ -31,10 +31,10 @@ import kotlinx.serialization.Serializable data class SoptLogInfoResponse( @SerialName("isActive") val isActive: Boolean, - @SerialName("isFortuneChecked") - val isFortuneChecked: Boolean, - @SerialName("todayFortuneText") - val todayFortuneText: String, + @SerialName("isAppjamMode") + val isAppjamMode: Boolean = false, + @SerialName("isAppjamParticipant") + val isAppjamParticipant: Boolean = false, @SerialName("soptampCount") val soptampCount: Int? = null, @SerialName("viewCount") diff --git a/data/soptlog/src/main/java/org/sopt/official/data/soptlog/mapper/SoptLogMapper.kt b/data/soptlog/src/main/java/org/sopt/official/data/soptlog/mapper/SoptLogMapper.kt index 68b9b465b..2b3c9e0de 100644 --- a/data/soptlog/src/main/java/org/sopt/official/data/soptlog/mapper/SoptLogMapper.kt +++ b/data/soptlog/src/main/java/org/sopt/official/data/soptlog/mapper/SoptLogMapper.kt @@ -29,8 +29,8 @@ import org.sopt.official.domain.soptlog.model.SoptLogInfo internal fun SoptLogInfoResponse.toDomain() = SoptLogInfo( isActive = this.isActive, - isFortuneChecked = this.isFortuneChecked, - todayFortuneText = this.todayFortuneText, + isAppjamMode = this.isAppjamMode, + isAppjamParticipant = this.isAppjamParticipant, soptampCount = this.soptampCount, viewCount = this.viewCount, myClapCount = this.myClapCount, diff --git a/domain/fortune/.gitignore b/domain/fortune/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/domain/fortune/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/domain/fortune/build.gradle.kts b/domain/fortune/build.gradle.kts deleted file mode 100644 index 1a7954873..000000000 --- a/domain/fortune/build.gradle.kts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * MIT License - * Copyright 2023-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -plugins { - sopt("kotlin.jvm") -} - -kotlin { - jvmToolchain(17) -} - -dependencies { - implementation(libs.javax.inject) -} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt deleted file mode 100644 index 58393fc65..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneCard.kt +++ /dev/null @@ -1,32 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.model - -data class TodayFortuneCard( - val description: String, - val imageColorCode: String, - val imageUrl: String, - val name: String, -) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt deleted file mode 100644 index 88d6b3128..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/model/TodayFortuneWord.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.model - -data class TodayFortuneWord( - val userName: String, - val title: String, -) diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt deleted file mode 100644 index 8d38c7b58..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/repository/FortuneRepository.kt +++ /dev/null @@ -1,33 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.repository - -import org.sopt.official.domain.fortune.model.TodayFortuneCard -import org.sopt.official.domain.fortune.model.TodayFortuneWord - -interface FortuneRepository { - suspend fun fetchTodayFortuneWord(date: String): TodayFortuneWord - suspend fun fetchTodayFortuneCard(): TodayFortuneCard -} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt deleted file mode 100644 index dd8747fad..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayDateUseCase.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.usecase - -import java.text.SimpleDateFormat -import java.util.Locale -import javax.inject.Inject - -class GetTodayDateUseCase @Inject constructor() { - - operator fun invoke(): String { - val currentDate = System.currentTimeMillis() - - return SimpleDateFormat("yyyy-MM-dd", Locale.KOREAN).format(currentDate) - } -} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt deleted file mode 100644 index 545098f6f..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneCardUseCase.kt +++ /dev/null @@ -1,35 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.usecase - -import org.sopt.official.domain.fortune.model.TodayFortuneCard -import org.sopt.official.domain.fortune.repository.FortuneRepository -import javax.inject.Inject - -class GetTodayFortuneCardUseCase @Inject constructor( - private val fortuneRepository: FortuneRepository, -) { - suspend operator fun invoke(): TodayFortuneCard = fortuneRepository.fetchTodayFortuneCard() -} diff --git a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt b/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt deleted file mode 100644 index b8f8ff159..000000000 --- a/domain/fortune/src/main/java/org/sopt/official/domain/fortune/usecase/GetTodayFortuneUseCase.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.domain.fortune.usecase - -import org.sopt.official.domain.fortune.model.TodayFortuneWord -import org.sopt.official.domain.fortune.repository.FortuneRepository -import javax.inject.Inject - -class GetTodayFortuneUseCase @Inject constructor( - private val fortuneRepository: FortuneRepository, - private val getTodayDateUseCase: GetTodayDateUseCase, -) { - - suspend operator fun invoke(): TodayFortuneWord = fortuneRepository.fetchTodayFortuneWord(getTodayDateUseCase()) -} diff --git a/domain/soptlog/src/main/java/org/sopt/official/domain/soptlog/model/SoptLogInfo.kt b/domain/soptlog/src/main/java/org/sopt/official/domain/soptlog/model/SoptLogInfo.kt index 923d518f8..6a1df8d28 100644 --- a/domain/soptlog/src/main/java/org/sopt/official/domain/soptlog/model/SoptLogInfo.kt +++ b/domain/soptlog/src/main/java/org/sopt/official/domain/soptlog/model/SoptLogInfo.kt @@ -26,8 +26,8 @@ package org.sopt.official.domain.soptlog.model data class SoptLogInfo( val isActive: Boolean = false, - val isFortuneChecked: Boolean, - val todayFortuneText: String, + val isAppjamMode: Boolean = false, + val isAppjamParticipant: Boolean = false, val soptampCount: Int? = null, val viewCount: Int? = null, val myClapCount: Int? = null, diff --git a/feature/fortune/.gitignore b/feature/fortune/.gitignore deleted file mode 100644 index 42afabfd2..000000000 --- a/feature/fortune/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/build \ No newline at end of file diff --git a/feature/fortune/build.gradle.kts b/feature/fortune/build.gradle.kts deleted file mode 100644 index 04566440d..000000000 --- a/feature/fortune/build.gradle.kts +++ /dev/null @@ -1,63 +0,0 @@ -/* - * MIT License - * Copyright 2023-2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -plugins { - sopt("feature") - sopt("compose") - sopt("test") - sopt("deeplink") -} - -android { - namespace = "org.sopt.official.feature.fortune" -} - -ksp { - arg("deepLink.incremental", "true") - arg("deepLink.customAnnotations", "com.airbnb.AppDeepLink|com.airbnb.WebDeepLink") -} - -dependencies { - // domain - implementation(projects.domain.fortune) - implementation(projects.domain.poke) - - // core - implementation(projects.core.common) - implementation(projects.core.designsystem) - implementation(projects.core.analytics) - - // compose - implementation(libs.compose.navigation) - - // etc - implementation(libs.kotlin.datetime) - implementation(libs.coil.compose) - - // test - testImplementation(libs.junit) - androidTestImplementation(libs.bundles.compose.test) - androidTestImplementation(libs.bundles.android.test) - debugImplementation(libs.bundles.compose.android.test) -} diff --git a/feature/fortune/consumer-rules.pro b/feature/fortune/consumer-rules.pro deleted file mode 100644 index e69de29bb..000000000 diff --git a/feature/fortune/proguard-rules.pro b/feature/fortune/proguard-rules.pro deleted file mode 100644 index 481bb4348..000000000 --- a/feature/fortune/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt b/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt deleted file mode 100644 index 6a8688e6d..000000000 --- a/feature/fortune/src/androidTest/java/org/sopt/official/feature/fortune/fortuneDetail/FortuneDetailScreenTest.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.fortuneDetail - -import androidx.compose.ui.semantics.SemanticsProperties -import androidx.compose.ui.semantics.getOrNull -import androidx.compose.ui.test.assertIsDisplayed -import androidx.compose.ui.test.junit4.createComposeRule -import androidx.compose.ui.test.onNodeWithContentDescription -import androidx.compose.ui.test.onNodeWithText -import org.junit.Rule -import org.junit.Test -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailScreen -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo - -internal class FortuneDetailScreenTest { - - @get:Rule - val composeRule = createComposeRule() - - @Test - fun 서버통신이_성공하면_이름_솝마디_날짜가_노출된다() { - // given: - val date = "2024-09-26" - val name = "이현우" - val content = "안녕하세요안녕하세요안녕하세요안녕하세요안녕하세요" - - // when: - composeRule.setContent { - SoptTheme { - FortuneDetailScreen( - date = date, - onFortuneAmuletClick = { }, - onPokeClick = { }, - onProfileClick = { }, - onErrorDialogCheckClick = { }, - uiState = Success( - todaySentence = TodaySentence( - userName = name, - content = content, - ), - userInfo = UserInfo( - userId = 0L, - profile = "", - userName = "동민", - generation = 111, - part = "기획 파트", - ) - ), - isEnabled = false, - ) - } - } - - // then: - val todayFortune = composeRule.onNodeWithContentDescription("todaySentence") - .fetchSemanticsNode().config.getOrNull(SemanticsProperties.Text)?.joinToString(separator = "").orEmpty() - - composeRule.waitForIdle() - - composeRule.onNodeWithText(date).assertIsDisplayed() - assert(todayFortune.contains(name)) - assert(todayFortune.contains(content)) - } -} diff --git a/feature/fortune/src/main/AndroidManifest.xml b/feature/fortune/src/main/AndroidManifest.xml deleted file mode 100644 index 5bffa280b..000000000 --- a/feature/fortune/src/main/AndroidManifest.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt deleted file mode 100644 index 1f028fe2e..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FortuneActivity.kt +++ /dev/null @@ -1,78 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune - -import android.content.Context -import android.content.Intent -import android.os.Bundle -import androidx.activity.compose.setContent -import androidx.activity.enableEdgeToEdge -import androidx.appcompat.app.AppCompatActivity -import com.airbnb.deeplinkdispatch.DeepLink -import dagger.hilt.android.AndroidEntryPoint -import dagger.hilt.android.EntryPointAccessors -import org.sopt.official.analytics.compose.ProvideTracker -import org.sopt.official.analytics.impl.AmplitudeTracker -import org.sopt.official.common.context.appContext -import org.sopt.official.common.navigator.NavigatorEntryPoint -import org.sopt.official.designsystem.SoptTheme -import javax.inject.Inject - -private val navigator by lazy { - EntryPointAccessors.fromApplication( - appContext, - NavigatorEntryPoint::class.java - ).navigatorProvider() -} - -@AndroidEntryPoint -@DeepLink("sopt://fortune") -class FortuneActivity : AppCompatActivity() { - - @Inject - lateinit var amplitudeTracker: AmplitudeTracker - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - enableEdgeToEdge() - setContent { - SoptTheme { - ProvideTracker(amplitudeTracker) { - FoundationScreen( - navigateToSoptLog = { - startActivity(navigator.getSoptLogIntent()) - } - ) - } - } - } - } - - companion object { - fun getIntent(context: Context): Intent { - return Intent(context, FortuneActivity::class.java) - } - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt deleted file mode 100644 index 4e086d3c1..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/FoundationScreen.kt +++ /dev/null @@ -1,157 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune - -import androidx.activity.compose.BackHandler -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.material3.Scaffold -import androidx.compose.material3.SnackbarHost -import androidx.compose.material3.SnackbarHostState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.setValue -import androidx.compose.ui.Alignment.Companion.TopCenter -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.navigation.NavHostController -import androidx.navigation.compose.NavHost -import androidx.navigation.compose.rememberNavController -import org.sopt.official.analytics.compose.ProvideTracker -import org.sopt.official.analytics.impl.FakeTracker -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.R.drawable.ic_alert -import org.sopt.official.feature.fortune.R.drawable.ic_poke_check -import org.sopt.official.feature.fortune.component.FortuneTopBar -import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.FortuneAmulet -import org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation.fortuneAmuletNavGraph -import org.sopt.official.feature.fortune.feature.fortuneDetail.component.PokeSnackBar -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.SnackBarUiState -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.SnackBarUiState.Anonymous -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.SnackBarUiState.Poke -import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.FortuneDetail -import org.sopt.official.feature.fortune.feature.fortuneDetail.navigation.fortuneDetailNavGraph -import org.sopt.official.feature.fortune.feature.home.navigation.Home -import org.sopt.official.feature.fortune.feature.home.navigation.homeNavGraph - -@Composable -fun FoundationScreen( - navigateToSoptLog: () -> Unit, - navController: NavHostController = rememberNavController(), -) { - var isBottomSheetVisible by remember { mutableStateOf(false) } - var snackBarUiState by remember { mutableStateOf(Anonymous) } - val snackBarHostState = remember { SnackbarHostState() } - val (icon, title) = remember { - when (snackBarUiState) { - is Poke -> ic_poke_check to "콕 찌르기를 완료했어요." - is Anonymous -> ic_alert to "익명 해제 시, 상대방이 나를 알 수 있어요." - } - } - - BackHandler { navigateToSoptLog() } - - Scaffold( - snackbarHost = { - Box(modifier = Modifier.fillMaxSize()) { - SnackbarHost( - hostState = snackBarHostState, - modifier = Modifier - .padding(top = 16.dp) - .align(alignment = TopCenter), - snackbar = { - PokeSnackBar( - icon = icon, - title = title, - ) - }, - ) - } - }, - modifier = Modifier - .fillMaxSize() - .statusBarsPadding(), - topBar = { - FortuneTopBar( - isEnabled = !isBottomSheetVisible, - onClickNavigationIcon = navigateToSoptLog, - ) - }, - content = { paddingValue -> - Box( - modifier = Modifier - .fillMaxSize() - .background(SoptTheme.colors.background) - .padding(paddingValue) - ) { - NavHost( - navController = navController, - startDestination = Home - ) { - homeNavGraph( - navigateToFortuneDetail = { date -> - navController.navigate(FortuneDetail(date)) - } - ) - - fortuneDetailNavGraph( - navigateToFortuneAmulet = { - navController.navigate(FortuneAmulet) - }, - isBottomSheetVisible = { - isBottomSheetVisible = it - }, - snackBarHostState = snackBarHostState, - showSnackBar = { case -> - snackBarUiState = case - }, - ) - - fortuneAmuletNavGraph( - navigateToSoptLog = navigateToSoptLog - ) - } - } - } - ) -} - -@Preview(showBackground = true) -@Composable -fun FoundationScreenPreview() { - SoptTheme { - ProvideTracker(FakeTracker) { - FoundationScreen( - navigateToSoptLog = {} - ) - } - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/CircleShapeBorderButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/CircleShapeBorderButton.kt deleted file mode 100644 index 0dec7a054..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/CircleShapeBorderButton.kt +++ /dev/null @@ -1,81 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.component - -import androidx.compose.foundation.border -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.BoxScope -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.CircleShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.Dp -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme - -@Composable -fun CircleShapeBorderButton( - content: @Composable BoxScope.() -> Unit, - modifier: Modifier = Modifier, - borderWidth: Dp = 1.dp, - borderColor: Color = SoptTheme.colors.primary, - contentAlignment: Alignment = Alignment.Center, - onClick: () -> Unit = {}, -) { - Box( - modifier = modifier - .border( - width = borderWidth, - color = borderColor, - shape = CircleShape - ) - .clickable(onClick = onClick), - contentAlignment = contentAlignment - ) { - content() - } -} - -@Preview -@Composable -fun RoundedCornerButtonPreview() { - SoptTheme { - CircleShapeBorderButton( - content = { - Text( - text = "홈으로 돌아가기", - style = SoptTheme.typography.label18SB, - color = SoptTheme.colors.onBackground, - modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp) - ) - } - ) { } - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt deleted file mode 100644 index ceed410da..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneButton.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme - -@Composable -fun FortuneButton( - title: String, - onClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Box( - modifier = modifier - .fillMaxWidth() - .clip(RoundedCornerShape(12.dp)) - .background(SoptTheme.colors.primary) - .clickable(onClick = onClick), - contentAlignment = Alignment.Center - ) { - Text( - text = title, - style = SoptTheme.typography.label18SB, - color = SoptTheme.colors.onPrimary, - modifier = Modifier.padding(horizontal = 26.dp, vertical = 16.dp) - ) - } -} - -@Preview -@Composable -fun FortuneButtonPreview() { - SoptTheme { - FortuneButton(title = "오늘의 부적 받기", onClick = {}) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt deleted file mode 100644 index 0925ff4ad..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/component/FortuneTopBar.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.component - -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.Close -import androidx.compose.material3.Icon -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.analytics.EventType -import org.sopt.official.analytics.compose.LocalTracker -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors - -@Composable -fun FortuneTopBar( - onClickNavigationIcon: () -> Unit, - modifier: Modifier = Modifier, - isEnabled: Boolean = true, -) { - val amplitudeTracker = LocalTracker.current - - Box(modifier = modifier.fillMaxWidth()) { - Icon( - imageVector = Icons.Filled.Close, - tint = colors.onBackground, - contentDescription = null, - modifier = Modifier.padding(start = 8.dp, top = 2.dp, bottom = 2.dp).padding(8.dp) - .clickable { - if (isEnabled) { - onClickNavigationIcon() - amplitudeTracker.track( - type = EventType.CLICK, - name = "leave_soptmadi_title", - ) - } - }, - ) - } -} - -@Preview(showBackground = true) -@Composable -private fun FortuneTopBarPreview() { - SoptTheme { - FortuneTopBar( - onClickNavigationIcon = { }, - isEnabled = false, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/deeplink/FortuneDeeplinkModule.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/deeplink/FortuneDeeplinkModule.kt deleted file mode 100644 index 6b7948ebf..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/deeplink/FortuneDeeplinkModule.kt +++ /dev/null @@ -1,30 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.deeplink - -import com.airbnb.deeplinkdispatch.DeepLinkModule - -@DeepLinkModule -class FortuneDeeplinkModule diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt deleted file mode 100644 index 72f031390..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletScreen.kt +++ /dev/null @@ -1,181 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneAmulet - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.ColumnScope -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.text.SpanStyle -import androidx.compose.ui.text.buildAnnotatedString -import androidx.compose.ui.text.withStyle -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.collectAsStateWithLifecycle -import org.sopt.official.analytics.EventType -import org.sopt.official.analytics.compose.LocalTracker -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.component.UrlImage -import org.sopt.official.feature.fortune.component.CircleShapeBorderButton - -@Composable -internal fun FortuneAmuletRoute( - navigateToSoptLog: () -> Unit, - viewModel: FortuneAmuletViewModel = hiltViewModel(), -) { - val amplitudeTracker = LocalTracker.current - val state by viewModel.state.collectAsStateWithLifecycle() - - when { - state.isLoading -> { - // Loading View - } - - state.isFailure -> { - // Error View - } - - else -> { - FortuneAmuletScreen( - description = state.description, - amuletDescription = { - Text( - text = buildAnnotatedString { - withStyle(style = SpanStyle(color = state.imageColor)) { - append(state.name) - } - withStyle(style = SpanStyle(color = SoptTheme.colors.onBackground)) { - append(state.nameSuffix) - } - }, - style = SoptTheme.typography.heading28B, - ) - }, - imageUrl = state.imageUrl, - onBackClick = { - amplitudeTracker.track( - type = EventType.CLICK, - name = "done_home", - ) - navigateToSoptLog() - } - ).also { - amplitudeTracker.track( - type = EventType.VIEW, - name = "soptmadi_charmcard", - ) - } - } - } -} - -@Composable -private fun FortuneAmuletScreen( - description: String, - amuletDescription: @Composable ColumnScope.() -> Unit, - imageUrl: String, - onBackClick: () -> Unit, -) { - Column( - modifier = Modifier - .fillMaxSize() - .background(SoptTheme.colors.background), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Spacer(modifier = Modifier.height(12.dp)) - - Text( - text = description, - style = SoptTheme.typography.title16SB, - color = SoptTheme.colors.onSurface300, - ) - - Spacer(modifier = Modifier.height(2.dp)) - - amuletDescription() - - Spacer(modifier = Modifier.height(34.dp)) - - UrlImage( - url = imageUrl, - contentDescription = null, - modifier = Modifier - .padding(horizontal = 33.dp) - .fillMaxWidth() - ) - - Spacer(modifier = Modifier.weight(1f)) - - CircleShapeBorderButton( - content = { - Text( - text = "돌아가기", - style = SoptTheme.typography.label18SB, - color = SoptTheme.colors.onBackground, - modifier = Modifier.padding(horizontal = 20.dp, vertical = 12.dp) - ) - }, - onClick = onBackClick - ) - - Spacer(modifier = Modifier.height(50.dp)) - } -} - -@Preview -@Composable -fun PreviewFortuneAmuletScreen() { - SoptTheme { - FortuneAmuletScreen( - description = "배고픔을 전부 극복할", - amuletDescription = { - Text( - text = buildAnnotatedString { - withStyle(style = SpanStyle(color = Color.Red)) { - append("포만감") - } - withStyle(style = SpanStyle(color = Color.White)) { - append("이 왔솝") - } - }, - style = SoptTheme.typography.heading28B, - ) - }, - imageUrl = "https://sopt-makers.s3.ap-northeast-2.amazonaws.com/mainpage/makers-app-img/test_fortune_card.png", - onBackClick = {} - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt deleted file mode 100644 index 351b5c3bb..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletState.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneAmulet - -import androidx.compose.ui.graphics.Color - -data class FortuneAmuletState( - val isLoading: Boolean = false, - val isFailure: Boolean = false, - val description: String = "", - val imageColor: Color = Color.White, - val imageUrl: String = "", - val name: String = "", - val nameSuffix: String = "이 왔솝", -) diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt deleted file mode 100644 index 7cc8a10f9..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/FortuneAmuletViewModel.kt +++ /dev/null @@ -1,74 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneAmulet - -import androidx.compose.ui.graphics.Color -import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.update -import kotlinx.coroutines.launch -import org.sopt.official.domain.fortune.usecase.GetTodayFortuneCardUseCase -import javax.inject.Inject - -typealias GraphicColor = android.graphics.Color - -@HiltViewModel -internal class FortuneAmuletViewModel @Inject constructor( - getTodayFortuneCardUseCase: GetTodayFortuneCardUseCase, -) : ViewModel() { - private val _state: MutableStateFlow = MutableStateFlow(FortuneAmuletState()) - val state: StateFlow = _state.asStateFlow() - - init { - viewModelScope.launch { - runCatching { - _state.value = _state.value.copy(isLoading = true) - getTodayFortuneCardUseCase() - }.onSuccess { todayFortuneCard -> - _state.update { - it.copy( - description = todayFortuneCard.description, - imageColor = parseColor(todayFortuneCard.imageColorCode), - imageUrl = todayFortuneCard.imageUrl, - name = todayFortuneCard.name, - isLoading = false - ) - } - }.onFailure { - _state.value = _state.value.copy(isFailure = true) - } - } - } - - private fun parseColor(colorCode: String): Color = try { - Color(GraphicColor.parseColor(colorCode)) - } catch (e: IllegalArgumentException) { - Color.White - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt deleted file mode 100644 index 89254082d..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneAmulet/navigation/FortuneAmuletNavGraph.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneAmulet.navigation - -import androidx.navigation.NavGraphBuilder -import androidx.navigation.compose.composable -import kotlinx.serialization.Serializable -import org.sopt.official.feature.fortune.feature.fortuneAmulet.FortuneAmuletRoute - -@Serializable -data object FortuneAmulet - -fun NavGraphBuilder.fortuneAmuletNavGraph( - navigateToSoptLog: () -> Unit, -) { - composable { - FortuneAmuletRoute( - navigateToSoptLog = navigateToSoptLog - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt deleted file mode 100644 index 750801f27..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailRoute.kt +++ /dev/null @@ -1,168 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail - -import android.content.Intent -import android.net.Uri -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.ModalBottomSheetLayout -import androidx.compose.material.ModalBottomSheetValue.Hidden -import androidx.compose.material.rememberModalBottomSheetState -import androidx.compose.material3.SnackbarHostState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect -import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue -import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.unit.dp -import androidx.hilt.navigation.compose.hiltViewModel -import androidx.lifecycle.compose.collectAsStateWithLifecycle -import kotlinx.coroutines.launch -import org.sopt.official.analytics.EventType.CLICK -import org.sopt.official.analytics.EventType.VIEW -import org.sopt.official.analytics.compose.LocalTracker -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.SnackBarUiState - -internal const val DEFAULT_ID = -1 - -@Composable -internal fun FortuneDetailRoute( - date: String, - onFortuneAmuletClick: () -> Unit, - isBottomSheetVisible: (isVisible: Boolean) -> Unit, - snackBarHostState: SnackbarHostState, - showSnackBar: (case: SnackBarUiState) -> Unit, - viewModel: FortuneDetailViewModel = hiltViewModel(), -) { - val context = LocalContext.current - val uiState by viewModel.uiState.collectAsStateWithLifecycle() - var isPokeEnabled by remember { mutableStateOf(true) } - // var isAnonymous by remember { mutableStateOf(true) } - // var selectedIndex by remember { mutableIntStateOf(DEFAULT_ID) } - val bottomSheetState = rememberModalBottomSheetState(initialValue = Hidden) - val scope = rememberCoroutineScope() - val amplitudeTracker = LocalTracker.current - - LaunchedEffect(key1 = uiState) { - if (uiState is Success) { - amplitudeTracker.track( - type = VIEW, - name = "soptmadi_todays", - ) - } - } - - /*LaunchedEffect(key1 = bottomSheetState.currentValue) { - if (bottomSheetState.currentValue == Hidden) isBottomSheetVisible(false) - }*/ - - ModalBottomSheetLayout( - sheetState = bottomSheetState, - sheetShape = RoundedCornerShape( - topStart = 20.dp, - topEnd = 20.dp, - ), - sheetBackgroundColor = colors.onSurface800, - sheetContent = { - /*PokeMessageBottomSheetScreen( - selectedIndex = selectedIndex, - onItemClick = { newSelectedIndex, message -> - amplitudeTracker.track( - type = CLICK, - name = "send_choice", - properties = mapOf( - "index" to newSelectedIndex + 1, - "message" to message, - ), - ) - scope.launch { - selectedIndex = newSelectedIndex - isPokeEnabled = false - bottomSheetState.hide() - viewModel.poke(message) - showSnackBar(Poke) - snackBarHostState.showSnackbar( - message = "", - duration = Short, - ) - }.invokeOnCompletion { - isBottomSheetVisible(false) - } - }, - onIconClick = { - isAnonymous = !isAnonymous - amplitudeTracker.track( - type = CLICK, - name = "anonymity", - properties = mapOf("isAnonymous" to isAnonymous), - ) - if (isAnonymous.not()) scope.launch { - showSnackBar(Anonymous) - snackBarHostState.showSnackbar( - message = "", - duration = Short, - ) - } - }, - isAnonymous = isAnonymous, - )*/ - }, - ) { - FortuneDetailScreen( - date = date, - onFortuneAmuletClick = { - amplitudeTracker.track( - type = CLICK, - name = "get_charmcard", - ) - onFortuneAmuletClick() - }, - onProfileClick = { userId -> - context.startActivity( - Intent(Intent.ACTION_VIEW, Uri.parse("https://playground.sopt.org/members/${userId}")) - ) - }, - onPokeClick = { - amplitudeTracker.track( - type = CLICK, - name = "randomepeople", - ) - scope.launch { - bottomSheetState.show() - }.invokeOnCompletion { - isBottomSheetVisible(true) - } - }, - onErrorDialogCheckClick = viewModel::updateUi, - uiState = uiState, - isEnabled = isPokeEnabled, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt deleted file mode 100644 index 78b9dcc29..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailScreen.kt +++ /dev/null @@ -1,151 +0,0 @@ -/* - * MIT License - * Copyright 2023-2026 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width -import androidx.compose.material3.CircularProgressIndicator -import androidx.compose.material3.MaterialTheme.colorScheme -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.Center -import androidx.compose.ui.Alignment.Companion.CenterHorizontally -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.component.dialog.NetworkErrorDialog -import org.sopt.official.feature.fortune.component.FortuneButton -import org.sopt.official.feature.fortune.feature.fortuneDetail.component.TodayFortuneDashboard -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo -import timber.log.Timber - -@Composable -internal fun FortuneDetailScreen( - date: String, - isEnabled: Boolean, - onFortuneAmuletClick: () -> Unit, - onPokeClick: (userId: Long) -> Unit, - onProfileClick: (userId: Long) -> Unit, - onErrorDialogCheckClick: () -> Unit, - modifier: Modifier = Modifier, - uiState: FortuneDetailUiState = Loading, -) { - Column( - horizontalAlignment = CenterHorizontally, - modifier = modifier - .fillMaxSize() - .padding(horizontal = 20.dp), - ) { - Spacer(modifier = Modifier.height(height = 16.dp)) - - if (uiState is Success) { - TodayFortuneDashboard( - date = date, - todaySentence = uiState.todaySentence.content, - name = uiState.todaySentence.userName, - ) - /*Spacer(modifier = Modifier.height(height = 20.dp)) - PokeRecommendationDashboard( - profile = uiState.userInfo.profile, - name = uiState.userInfo.userName, - isEnabled = isEnabled, - userDescription = uiState.userInfo.userDescription, - onPokeClick = { onPokeClick(uiState.userInfo.userId) }, - onProfileClick = { onProfileClick(uiState.userInfo.userId) }, - )*/ - Spacer(modifier = Modifier.weight(weight = 1f)) - FortuneButton( - title = "오늘의 부적 받기", - onClick = onFortuneAmuletClick, - ) - Spacer(modifier = Modifier.height(height = 14.dp)) - } else { - Box( - contentAlignment = Center, - modifier = Modifier - .fillMaxSize() - .background(color = colors.background.copy(alpha = 0.55f)), - ) { - when (uiState) { - is Error -> NetworkErrorDialog( - onConfirm = { - onErrorDialogCheckClick() - Timber.e(uiState.errorMessage) - } - ) - - is Loading -> CircularProgressIndicator( - modifier = Modifier.width(width = 32.dp), - color = colorScheme.secondary, - trackColor = colorScheme.surfaceVariant, - strokeWidth = 4.dp, - ) - - else -> Unit - } - } - } - } -} - -@Preview -@Composable -private fun FortuneDetailScreenPreview() { - SoptTheme { - FortuneDetailScreen( - date = "2024-09-09", - onFortuneAmuletClick = {}, - isEnabled = true, - uiState = Success( - todaySentence = TodaySentence( - userName = "이현우", - content = "사과해요나한테사과해요나한테사과해요나한테" - ), - userInfo = UserInfo( - userId = 0L, - profile = "", - userName = "동민", - generation = 111, - part = "기획 파트" - ) - ), - onPokeClick = { }, - onProfileClick = { }, - onErrorDialogCheckClick = { }, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt deleted file mode 100644 index 28df479c0..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/FortuneDetailViewModel.kt +++ /dev/null @@ -1,122 +0,0 @@ -/* - * MIT License - * Copyright 2023-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail - -import androidx.lifecycle.ViewModel -import androidx.lifecycle.viewModelScope -import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.async -import kotlinx.coroutines.awaitAll -import kotlinx.coroutines.coroutineScope -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.update -import kotlinx.coroutines.launch -import org.sopt.official.domain.fortune.usecase.GetTodayFortuneUseCase -import org.sopt.official.domain.poke.repository.PokeRepository -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Error -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Loading -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.TodaySentence -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.FortuneDetailUiState.Success.UserInfo -import javax.inject.Inject - -@HiltViewModel -internal class FortuneDetailViewModel @Inject constructor( - private val getTodayFortuneUseCase: GetTodayFortuneUseCase, - private val pokeRepository: PokeRepository, -) : ViewModel() { - private val _uiState: MutableStateFlow = MutableStateFlow(Loading) - val uiState: StateFlow get() = _uiState.asStateFlow() - private var isAnonymous: Boolean = false - // private var userId = DEFAULT_ID - - private var dummyUser = UserInfo( - userId = 0L, - profile = "", - userName = "동민", - generation = 111, - part = "기획 파트" - ) - - init { - updateUi() - } - - fun updateUi() { - viewModelScope.launch { - runCatching { - coroutineScope { - awaitAll(async { getTodayFortuneUseCase() } /*async { pokeRepository.getOnboardingPokeUserList(size = 1) }*/) - } - }.onSuccess { result -> - val todayFortune = result[0] - /*val pokeUser = result[1] as GetOnboardingPokeUserListResponse - val user = pokeUser.data?.randomInfoList?.get(0)?.userInfoList?.get(0) ?: throw IllegalArgumentException()*/ - - _uiState.update { - Success( - todaySentence = TodaySentence( - userName = todayFortune.userName, - content = todayFortune.title, - ), userInfo = UserInfo( - /*userId = user.userId.toLong(), - profile = user.profileImage, - userName = user.name, - generation = user.generation, - part = user.part,*/ - - userId = dummyUser.userId, - profile = dummyUser.profile, - userName = dummyUser.userName, - generation = dummyUser.generation, - part = dummyUser.part - ) - ) - }/*.also { - userId = user.userId - }*/ - }.onFailure { error -> - _uiState.update { Error(error) } - } - } - } - - fun poke(message: String) { - viewModelScope.launch { - runCatching { - pokeRepository.pokeUser( - userId = dummyUser.userId.toInt(), /*userId = userId,*/ isAnonymous = isAnonymous, message = message - ) - }.onSuccess { - _uiState.update { uiState.value as Success } - }.onFailure { error -> - _uiState.update { Error(error) } - } - } - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt deleted file mode 100644 index 094364484..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/FortuneDetailBox.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.Center -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme.colors - -@Composable -internal fun TodayFortuneBox( - content: @Composable () -> Unit, - modifier: Modifier = Modifier, -) { - Box( - contentAlignment = Center, - modifier = modifier - .fillMaxWidth() - .background( - color = colors.onSurface900, - shape = RoundedCornerShape(size = 12.dp), - ), - ) { - content() - } -} - -@Preview(showBackground = true) -@Composable -private fun TodayFortuneBoxPreview() { - TodayFortuneBox( - content = { Text(text = "123") }, - modifier = Modifier.background(color = Color.White), - ) -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt deleted file mode 100644 index 6c5dff463..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageBottomSheet.kt +++ /dev/null @@ -1,128 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.Image -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Arrangement.SpaceBetween -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.itemsIndexed -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.CenterVertically -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import kotlinx.collections.immutable.persistentListOf -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography -import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_off -import org.sopt.official.feature.fortune.R.drawable.ic_checkbox_on - -@Composable -internal fun PokeMessageBottomSheetScreen( - isAnonymous: Boolean, - selectedIndex: Int, - onItemClick: (selectedIndex: Int, message: String) -> Unit, - onIconClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Column( - modifier = modifier - .fillMaxWidth() - .padding(horizontal = 20.dp) - .padding( - top = 24.dp, - bottom = 12.dp, - ), - ) { - Row( - verticalAlignment = CenterVertically, - horizontalArrangement = SpaceBetween, - modifier = Modifier.fillMaxWidth(), - ) { - Text( - text = "함께 보낼 메시지를 선택해주세요", - style = typography.heading20B, - color = colors.onSurface30, - ) - Spacer(modifier = Modifier.weight(weight = 1f)) - Image( - imageVector = if (isAnonymous) ImageVector.vectorResource(id = ic_checkbox_on) - else ImageVector.vectorResource(id = ic_checkbox_off), - contentDescription = "익명 체크박스", - modifier = Modifier.clickable { onIconClick() }, - ) - Spacer(modifier = Modifier.width(width = 8.dp)) - Text( - text = "익명", - style = typography.title16SB, - color = colors.onSurface10, - ) - } - Spacer(modifier = Modifier.height(height = 12.dp)) - LazyColumn(contentPadding = PaddingValues(vertical = 4.dp)) { - val messages = persistentListOf( - "안녕하세요? I AM 35기에요", - "친해지고 싶어서 DM 드려요 ^^~", - "이야기 해보고 싶었어요!!", - "모각작 하실래요?", - "콕 \uD83D\uDC48", - ) - - itemsIndexed(messages) { index, message -> - PokeMessageItem( - message = message, - isSelected = index == selectedIndex, - onItemClick = { onItemClick(index, message) }, - ) - } - } - } -} - -@Preview -@Composable -private fun PokeMessageBottomSheetScreenPreview() { - SoptTheme { - PokeMessageBottomSheetScreen( - isAnonymous = true, - selectedIndex = 0, - onItemClick = { _, _ -> }, - onIconClick = { }, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt deleted file mode 100644 index cce3fe0ef..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeMessageItem.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography - -@Composable -internal fun PokeMessageItem( - message: String, - isSelected: Boolean, - onItemClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Box( - modifier = modifier - .fillMaxWidth() - .background( - color = if (isSelected) colors.onSurface700 else colors.onSurface800, - shape = RoundedCornerShape(size = 6.dp), - ) - .clickable( - indication = null, - interactionSource = null, - ) { onItemClick() }, - ) { - Text( - text = message, - style = typography.body16M, - color = colors.onSurface10, - modifier = Modifier.padding( - vertical = 14.dp, - horizontal = 8.dp, - ), - ) - } -} - -@Preview(showBackground = true) -@Composable -private fun PokeMessageItemPreview() { - SoptTheme { - PokeMessageItem( - message = "123", - isSelected = true, - onItemClick = { }, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt deleted file mode 100644 index b0ddebbb8..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationDashboard.kt +++ /dev/null @@ -1,144 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.background -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Icon -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.Center -import androidx.compose.ui.Alignment.Companion.CenterVertically -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.text.style.TextOverflow.Companion.Ellipsis -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography -import org.sopt.official.feature.fortune.R.drawable.ic_poke - -@Composable -internal fun PokeRecommendationDashboard( - profile: String, - name: String, - userDescription: String, - isEnabled: Boolean, - onPokeClick: () -> Unit, - onProfileClick: () -> Unit, - modifier: Modifier = Modifier, -) { - TodayFortuneBox(content = { - Column( - modifier = modifier - .fillMaxWidth() - .padding(all = 20.dp), - ) { - Text( - text = "콕 찌르기", - style = typography.body14R, - color = colors.onSurface100, - ) - Text( - text = "행운이 2배가 될 솝트인을 찔러보세요", - style = typography.title18SB, - color = colors.onSurface30, - ) - Spacer(modifier = Modifier.height(height = 28.dp)) - Row( - verticalAlignment = CenterVertically, - modifier = Modifier.fillMaxWidth(), - ) { - PokeRecommendationUserProfileImage( - profile = profile, - modifier = Modifier.size(size = 72.dp) - .clip(shape = RoundedCornerShape(size = 100.dp)) - .clickable { onProfileClick() }, - ) - Spacer(modifier = Modifier.width(width = 8.dp)) - Column( - modifier = Modifier - .weight(weight = 1f) - .padding(end = 30.dp), - ) { - Text( - text = name, - style = typography.body18M, - overflow = Ellipsis, - maxLines = 1, - color = colors.onSurface30, - ) - Text( - text = userDescription, - style = typography.label12SB, - color = colors.onSurface300, - ) - } - Box( - contentAlignment = Center, - modifier = Modifier - .size(size = 44.dp) - .background( - color = if (isEnabled) colors.onSurface10 else colors.onSurface700, - shape = RoundedCornerShape(size = 18.dp), - ).clickable { if (isEnabled) onPokeClick() }, - ) { - Icon( - imageVector = ImageVector.vectorResource(id = ic_poke), - contentDescription = "콕 찌르기", - ) - } - } - } - }) -} - -@Preview -@Composable -private fun PokeRecommendationDashboardPreview() { - SoptTheme { - PokeRecommendationDashboard( - profile = "123", - name = "이현우이현우이현우이현우이현우", - isEnabled = true, - onPokeClick = { }, - onProfileClick = { }, - userDescription = "1100기 iOS", - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt deleted file mode 100644 index 3a4e9402f..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeRecommendationUserProfileImage.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.Image -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.layout.ContentScale.Companion.Crop -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.tooling.preview.Preview -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.component.UrlImage -import org.sopt.official.feature.fortune.R.drawable.ic_empty_profile - -@Composable -internal fun PokeRecommendationUserProfileImage( - profile: String, - modifier: Modifier = Modifier, -) { - when (profile.isEmpty()) { - true -> { - Image( - imageVector = ImageVector.vectorResource(id = ic_empty_profile), - contentDescription = "profileImageEmpty", - modifier = modifier, - ) - } - - false -> { - UrlImage( - url = profile, - contentDescription = "profileImage", - contentScale = Crop, - modifier = modifier, - ) - } - } -} - -@Preview -@Composable -private fun PokeRecommendationUserProfileImagePreview() { - SoptTheme { - PokeRecommendationUserProfileImage(profile = "") - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt deleted file mode 100644 index 5b7b01a45..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/PokeSnackBar.kt +++ /dev/null @@ -1,91 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.annotation.DrawableRes -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material.Icon -import androidx.compose.material.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.CenterVertically -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.Color.Companion.Unspecified -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography -import org.sopt.official.feature.fortune.R.drawable.ic_alert - -@Composable -internal fun PokeSnackBar( - @DrawableRes icon: Int, - title: String, - modifier: Modifier = Modifier, -) { - Row( - verticalAlignment = CenterVertically, - modifier = modifier - .fillMaxWidth() - .padding(horizontal = 16.dp) - .background( - color = colors.onSurface10, - shape = RoundedCornerShape(size = 18.dp), - ) - ) { - Spacer(modifier = Modifier.width(width = 16.dp)) - Icon( - imageVector = ImageVector.vectorResource(id = icon), - tint = Unspecified, - contentDescription = null, - ) - Spacer(modifier = Modifier.width(width = 8.dp)) - Text( - text = title, - style = typography.title14SB, - color = colors.onSurface900, - modifier = Modifier.padding(vertical = 16.dp), - ) - } -} - -@Preview -@Composable -private fun PokeSnackBarPreview() { - SoptTheme { - PokeSnackBar( - icon = ic_alert, - title = "익명 해제 시, 상대방이 나를 알 수 있어요.", - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt deleted file mode 100644 index 579040d97..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneDashboard.kt +++ /dev/null @@ -1,90 +0,0 @@ -/* - * MIT License - * Copyright 2023-2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import androidx.compose.foundation.Image -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.height -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment.Companion.CenterHorizontally -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography -import org.sopt.official.feature.fortune.R.drawable.img_fortune_title_small - -@Composable -internal fun TodayFortuneDashboard( - date: String, - todaySentence: String, - name: String, - modifier: Modifier = Modifier, -) { - TodayFortuneBox( - content = { - Column( - horizontalAlignment = CenterHorizontally, - modifier = modifier, - ) { - Spacer(modifier = Modifier.height(height = 32.dp)) - Image( - imageVector = ImageVector.vectorResource(id = img_fortune_title_small), - contentDescription = "오늘의 솝마디", - ) - Spacer(modifier = Modifier.height(height = 10.dp)) - Text( - text = date, - style = typography.title18SB, - color = colors.onSurface100, - ) - Spacer(modifier = Modifier.height(height = 20.dp)) - TodayFortuneText( - todaySentence = todaySentence, - name = name, - ) - Spacer(modifier = Modifier.height(height = 36.dp)) - } - } - ) -} - - -@Preview(showBackground = true) -@Composable -private fun TodayFortuneDashboardPreview() { - SoptTheme { - TodayFortuneDashboard( - date = "2024-09-09", - todaySentence = "예상치 못한 칭찬을 받게 되겠솝", - name = "김세훈", - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt deleted file mode 100644 index 8e3a0fdbc..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/component/TodayFortuneText.kt +++ /dev/null @@ -1,125 +0,0 @@ -/* - * MIT License - * Copyright 2023-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.component - -import android.graphics.Paint -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.remember -import androidx.compose.ui.Alignment.Companion.CenterHorizontally -import androidx.compose.ui.Modifier -import androidx.compose.ui.platform.LocalConfiguration -import androidx.compose.ui.platform.LocalDensity -import androidx.compose.ui.semantics.contentDescription -import androidx.compose.ui.semantics.semantics -import androidx.compose.ui.text.style.LineBreak.Companion.Simple -import androidx.compose.ui.text.style.TextAlign.Companion.Center -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.designsystem.SoptTheme.colors -import org.sopt.official.designsystem.SoptTheme.typography - -@Composable -internal fun TodayFortuneText( - todaySentence: String, - name: String, - modifier: Modifier = Modifier, -) { - val currentDensity = LocalDensity.current - val currentConfiguration = LocalConfiguration.current - val textPaint = remember { Paint().apply { textSize = with(currentDensity) { 24.sp.toPx() } } } - val screenWidth = remember { with(currentDensity) { (currentConfiguration.screenWidthDp.dp - (88.dp * 2)).toPx() } } - val formattedSentence = remember { todaySentence.toLineBreakingSentence(textPaint, screenWidth) } - - Column( - horizontalAlignment = CenterHorizontally, - modifier = modifier - .fillMaxWidth() - .padding(horizontal = 68.dp) - .semantics { contentDescription = "todaySentence" }, - ) { - Text( - text = "${name}님,", - style = typography.title24SB, - color = colors.onSurface30, - maxLines = 1, - textAlign = Center, - ) - Spacer(modifier = Modifier.height(height = 6.dp)) - Text( - text = formattedSentence, - style = typography.title24SB.copy( - lineBreak = Simple, - ), - color = colors.onSurface30, - maxLines = 4, - textAlign = Center, - softWrap = true, - ) - } -} - -private fun String.toLineBreakingSentence(textPaint: Paint, screenWidth: Float): String { - var resultSentence = "" - var sentenceLineWidth = 0f - val words = split(" ") - val spaceWidth = textPaint.measureText(" ") - - words.forEach { word -> - val wordWidth = textPaint.measureText(word) - - when (sentenceLineWidth + wordWidth + spaceWidth > screenWidth) { - true -> { - resultSentence += "\n$word" - sentenceLineWidth = wordWidth - } - - false -> { - resultSentence = if (resultSentence.isBlank()) word else "$resultSentence $word" - sentenceLineWidth += wordWidth + spaceWidth - } - } - } - - return resultSentence -} - -@Preview -@Composable -private fun TodayFortuneTextPreview() { - SoptTheme { - TodayFortuneText( - todaySentence = "저 근데 진짜 발 딛는 것도 처음이라 좀 수치스러울 것 같은데 옆에서 카공하다", - name = "김세훈", - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt deleted file mode 100644 index 66bf3286e..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/FortuneDetailUiState.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.model - -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.Stable - -@Stable -internal sealed interface FortuneDetailUiState { - - @Immutable - data class Success( - val todaySentence: TodaySentence, - val userInfo: UserInfo, - ) : FortuneDetailUiState { - - @Immutable - data class TodaySentence( - val userName: String, - val content: String, - ) - - @Immutable - data class UserInfo( - val userId: Long, - val profile: String, - val userName: String, - val generation: Int, - val part: String, - ) { - val userDescription = "${generation}기 $part" - } - } - - @Immutable - data object Loading : FortuneDetailUiState - - @Immutable - data class Error(val errorMessage: Throwable) : FortuneDetailUiState -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/SnackBarUiState.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/SnackBarUiState.kt deleted file mode 100644 index a6eff7f66..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/model/SnackBarUiState.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.model - -import androidx.compose.runtime.Immutable -import androidx.compose.runtime.Stable - -@Stable -sealed interface SnackBarUiState { - - @Immutable - data object Anonymous : SnackBarUiState - - @Immutable - data object Poke : SnackBarUiState -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt deleted file mode 100644 index e7b96a5cb..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/fortuneDetail/navigation/FortuneDetailNavGraph.kt +++ /dev/null @@ -1,54 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.fortuneDetail.navigation - -import androidx.compose.material3.SnackbarHostState -import androidx.navigation.NavGraphBuilder -import androidx.navigation.compose.composable -import androidx.navigation.toRoute -import kotlinx.serialization.Serializable -import org.sopt.official.feature.fortune.feature.fortuneDetail.FortuneDetailRoute -import org.sopt.official.feature.fortune.feature.fortuneDetail.model.SnackBarUiState - -@Serializable -data class FortuneDetail(val date: String) - -fun NavGraphBuilder.fortuneDetailNavGraph( - navigateToFortuneAmulet: () -> Unit, - snackBarHostState: SnackbarHostState, - isBottomSheetVisible: (isVisible: Boolean) -> Unit, - showSnackBar: (case: SnackBarUiState) -> Unit, -) { - composable { backStackEntry -> - val items = backStackEntry.toRoute() - FortuneDetailRoute( - date = items.date, - onFortuneAmuletClick = navigateToFortuneAmulet, - isBottomSheetVisible = isBottomSheetVisible, - snackBarHostState = snackBarHostState, - showSnackBar = showSnackBar, - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt deleted file mode 100644 index e0a4a2db1..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/HomeScreen.kt +++ /dev/null @@ -1,153 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.home - -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.padding -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.runtime.saveable.rememberSaveable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.analytics.EventType -import org.sopt.official.analytics.compose.LocalTracker -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.fortune.R -import org.sopt.official.feature.fortune.component.FortuneButton -import java.time.LocalDate -import java.time.format.DateTimeFormatter -import java.time.format.TextStyle -import java.util.Locale - -@Composable -internal fun HomeRoute( - onFortuneDetailClick: (String) -> Unit, -) { - val date = rememberSaveable { getToday() } - val amplitudeTracker = LocalTracker.current.also { - it.track( - type = EventType.VIEW, - name = "soptmadi_title", - ) - } - - HomeScreen( - date = date, - onFortuneDetailClick = { - onFortuneDetailClick(date) - amplitudeTracker.track( - type = EventType.CLICK, - name = "check_todaysoptmadi", - ) - } - ) -} - -@Composable -private fun HomeScreen( - date: String, - onFortuneDetailClick: () -> Unit = {}, -) { - Column( - modifier = Modifier - .fillMaxSize() - .padding(horizontal = 20.dp) - .background(SoptTheme.colors.background), - horizontalAlignment = Alignment.CenterHorizontally - ) { - Spacer(modifier = Modifier.height(12.dp)) - - Text( - text = date, - style = SoptTheme.typography.body16M, - color = SoptTheme.colors.onBackground, - ) - - Spacer(modifier = Modifier.height(2.dp)) - - Text( - text = "오늘의 운세가 도착했어요!", - style = SoptTheme.typography.heading18B, - color = SoptTheme.colors.onBackground, - ) - - Spacer(modifier = Modifier.height(8.dp)) - - Image( - imageVector = ImageVector.vectorResource(id = R.drawable.img_fortune_title_large), - contentDescription = null, - modifier = Modifier.padding(horizontal = 25.dp) - ) - - Spacer(modifier = Modifier.height(10.dp)) - - Image( - imageVector = ImageVector.vectorResource(id = R.drawable.img_fortune_three_cards), - contentDescription = null, - modifier = Modifier - .padding(horizontal = 6.dp) - ) - - Spacer(modifier = Modifier.weight(1f)) - - FortuneButton( - title = "오늘의 운세 확인하기", - onClick = onFortuneDetailClick, - ) - - Spacer(modifier = Modifier.height(36.dp)) - } -} - -fun getToday(): String { - val today = LocalDate.now() - - val monthDay = today.format(DateTimeFormatter.ofPattern("M월 d일")) - val dayOfWeek = today.dayOfWeek.getDisplayName( - TextStyle.FULL, - Locale.KOREAN - ) - - return "$monthDay $dayOfWeek" -} - -@Preview -@Composable -fun HomeScreenPreview() { - SoptTheme { - HomeScreen( - date = getToday() - ) - } -} diff --git a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt b/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt deleted file mode 100644 index 165d27da2..000000000 --- a/feature/fortune/src/main/java/org/sopt/official/feature/fortune/feature/home/navigation/HomeNavGraph.kt +++ /dev/null @@ -1,43 +0,0 @@ -/* - * MIT License - * Copyright 2024 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune.feature.home.navigation - -import androidx.navigation.NavGraphBuilder -import androidx.navigation.compose.composable -import kotlinx.serialization.Serializable -import org.sopt.official.feature.fortune.feature.home.HomeRoute - -@Serializable -data object Home - -fun NavGraphBuilder.homeNavGraph( - navigateToFortuneDetail: (String) -> Unit, -) { - composable { - HomeRoute( - onFortuneDetailClick = navigateToFortuneDetail - ) - } -} diff --git a/feature/fortune/src/main/res/drawable/ic_alert.xml b/feature/fortune/src/main/res/drawable/ic_alert.xml deleted file mode 100644 index 6f06619a5..000000000 --- a/feature/fortune/src/main/res/drawable/ic_alert.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - diff --git a/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml b/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml deleted file mode 100644 index 19107480e..000000000 --- a/feature/fortune/src/main/res/drawable/ic_checkbox_off.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - diff --git a/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml b/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml deleted file mode 100644 index 945b394d4..000000000 --- a/feature/fortune/src/main/res/drawable/ic_checkbox_on.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - diff --git a/feature/fortune/src/main/res/drawable/ic_empty_profile.xml b/feature/fortune/src/main/res/drawable/ic_empty_profile.xml deleted file mode 100644 index dc7ca751a..000000000 --- a/feature/fortune/src/main/res/drawable/ic_empty_profile.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - diff --git a/feature/fortune/src/main/res/drawable/ic_poke.xml b/feature/fortune/src/main/res/drawable/ic_poke.xml deleted file mode 100644 index 67f8c375d..000000000 --- a/feature/fortune/src/main/res/drawable/ic_poke.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/feature/fortune/src/main/res/drawable/ic_poke_check.xml b/feature/fortune/src/main/res/drawable/ic_poke_check.xml deleted file mode 100644 index 711da8388..000000000 --- a/feature/fortune/src/main/res/drawable/ic_poke_check.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - diff --git a/feature/fortune/src/main/res/drawable/img_fortune_three_cards.xml b/feature/fortune/src/main/res/drawable/img_fortune_three_cards.xml deleted file mode 100644 index 4d780cbae..000000000 --- a/feature/fortune/src/main/res/drawable/img_fortune_three_cards.xml +++ /dev/null @@ -1,919 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/fortune/src/main/res/drawable/img_fortune_title_large.xml b/feature/fortune/src/main/res/drawable/img_fortune_title_large.xml deleted file mode 100644 index 4b4509586..000000000 --- a/feature/fortune/src/main/res/drawable/img_fortune_title_large.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/fortune/src/main/res/drawable/img_fortune_title_small.xml b/feature/fortune/src/main/res/drawable/img_fortune_title_small.xml deleted file mode 100644 index f480a391b..000000000 --- a/feature/fortune/src/main/res/drawable/img_fortune_title_small.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/feature/fortune/src/test/java/org/sopt/official/feature/fortune/ExampleUnitTest.kt b/feature/fortune/src/test/java/org/sopt/official/feature/fortune/ExampleUnitTest.kt deleted file mode 100644 index 5b7b424e6..000000000 --- a/feature/fortune/src/test/java/org/sopt/official/feature/fortune/ExampleUnitTest.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.fortune - -import org.junit.Assert.assertEquals -import org.junit.Test - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} diff --git a/feature/home/src/main/java/org/sopt/official/feature/home/HomeAnalytics.kt b/feature/home/src/main/java/org/sopt/official/feature/home/HomeAnalytics.kt index 651f43fca..4824bd2a9 100644 --- a/feature/home/src/main/java/org/sopt/official/feature/home/HomeAnalytics.kt +++ b/feature/home/src/main/java/org/sopt/official/feature/home/HomeAnalytics.kt @@ -40,7 +40,6 @@ enum class HomeAnalyticsEvent( CLICK_PLAYGROUND_PROJECT(EventType.CLICK, "playground_project"), CLICK_PLAYGROUND_COFFEE_CHAT(EventType.CLICK, "playground_coffee_chat"), CLICK_PLAYGROUND_COMMUNITY(EventType.CLICK, "playground_community"), - CLICK_TODAYSOPTMADI(EventType.CLICK, "todaysoptmadi"), CLICK_SOPTLETTER_MENU(EventType.CLICK, "soptletter_menu"), CLICK_HOTBOARD(EventType.CLICK, "hotboard"), CLICK_HOMEPAGE(EventType.CLICK, "homepage"), diff --git a/feature/home/src/main/java/org/sopt/official/feature/home/HomeRoute.kt b/feature/home/src/main/java/org/sopt/official/feature/home/HomeRoute.kt index 398e99d18..9173c75b7 100644 --- a/feature/home/src/main/java/org/sopt/official/feature/home/HomeRoute.kt +++ b/feature/home/src/main/java/org/sopt/official/feature/home/HomeRoute.kt @@ -24,9 +24,11 @@ */ package org.sopt.official.feature.home +import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth @@ -35,6 +37,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.CircleShape import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect @@ -43,6 +46,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.res.vectorResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.Lifecycle @@ -53,12 +58,13 @@ import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import org.sopt.official.analytics.Tracker import org.sopt.official.analytics.compose.LocalTracker -import org.sopt.official.analytics.track import org.sopt.official.analytics.trackViewType +import org.sopt.official.common.util.noRippleClickable import org.sopt.official.common.util.ui.dropShadow import org.sopt.official.designsystem.GrayAlpha700 import org.sopt.official.designsystem.SoptTheme.colors import org.sopt.official.designsystem.SoptTheme.typography +import org.sopt.official.designsystem.White import org.sopt.official.designsystem.component.dialog.NetworkErrorDialog import org.sopt.official.designsystem.component.indicator.LoadingIndicator import org.sopt.official.feature.home.component.HomeEnjoySoptServicesBlock @@ -252,14 +258,25 @@ private fun HomeScreenForMember( Spacer(modifier = Modifier.height(height = 12.dp)) - Text( - text = "SOPT Playground", - style = typography.title14SB, - color = colors.onSurface400, + Row( modifier = Modifier .fillMaxWidth() - .padding(horizontal = 20.dp) - ) + .noRippleClickable(onClick = homeShortcutNavigation::navigateToPlaygroundHome) + .padding(horizontal = 20.dp), + horizontalArrangement = Arrangement.spacedBy(8.dp) + ) { + Text( + text = "SOPT Playground", + style = typography.title14SB, + color = White, + ) + + Icon( + imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_right), + contentDescription = null, + tint = White + ) + } Spacer(modifier = Modifier.height(height = 12.dp)) diff --git a/feature/home/src/main/java/org/sopt/official/feature/home/NewHomeViewModel.kt b/feature/home/src/main/java/org/sopt/official/feature/home/NewHomeViewModel.kt index 58082eb7d..04c41b175 100644 --- a/feature/home/src/main/java/org/sopt/official/feature/home/NewHomeViewModel.kt +++ b/feature/home/src/main/java/org/sopt/official/feature/home/NewHomeViewModel.kt @@ -104,6 +104,7 @@ internal class NewHomeViewModel @Inject constructor( val appServiceResult = appServiceDeferred.await() appServiceResult.onSuccess { result -> + Timber.d("[AppjamMode] API 응답 isAppjamMode=${result.isAppjamMode} -> UserStorage에 저장") userStorage.saveIsAppjamMode(result.isAppjamMode) viewModelState.update { it.copy(appServices = result.appServices) } } diff --git a/feature/home/src/main/java/org/sopt/official/feature/home/model/HomeUiState.kt b/feature/home/src/main/java/org/sopt/official/feature/home/model/HomeUiState.kt index 0acada57e..80c62042e 100644 --- a/feature/home/src/main/java/org/sopt/official/feature/home/model/HomeUiState.kt +++ b/feature/home/src/main/java/org/sopt/official/feature/home/model/HomeUiState.kt @@ -32,7 +32,6 @@ import kotlinx.collections.immutable.persistentListOf import kotlinx.collections.immutable.toPersistentList import org.sopt.official.feature.home.R.drawable.img_poke import org.sopt.official.feature.home.R.drawable.img_soptamp -import org.sopt.official.feature.home.R.drawable.img_soptmadi import org.sopt.official.feature.home.model.Schedule.EVENT @Stable diff --git a/feature/home/src/main/java/org/sopt/official/feature/home/navigation/HomeNavigation.kt b/feature/home/src/main/java/org/sopt/official/feature/home/navigation/HomeNavigation.kt index 2dc619789..285591959 100644 --- a/feature/home/src/main/java/org/sopt/official/feature/home/navigation/HomeNavigation.kt +++ b/feature/home/src/main/java/org/sopt/official/feature/home/navigation/HomeNavigation.kt @@ -31,6 +31,7 @@ sealed interface HomeNavigation { @Stable interface HomeShortcutNavigation : HomeNavigation { + fun navigateToPlaygroundHome() fun navigateToPlaygroundCommunity() fun navigateToPlaygroundGroup() fun navigateToPlaygroundMember() diff --git a/feature/home/src/main/res/drawable/img_soptmadi.png b/feature/home/src/main/res/drawable/img_soptmadi.png deleted file mode 100644 index 3d17c6ac5..000000000 Binary files a/feature/home/src/main/res/drawable/img_soptmadi.png and /dev/null differ diff --git a/feature/main/src/main/java/org/sopt/official/feature/main/MainActivity.kt b/feature/main/src/main/java/org/sopt/official/feature/main/MainActivity.kt index 69b579688..5ac15e5ff 100644 --- a/feature/main/src/main/java/org/sopt/official/feature/main/MainActivity.kt +++ b/feature/main/src/main/java/org/sopt/official/feature/main/MainActivity.kt @@ -26,7 +26,9 @@ package org.sopt.official.feature.main import android.content.Context import android.content.Intent +import android.graphics.Color import android.os.Bundle +import androidx.activity.SystemBarStyle import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge import androidx.appcompat.app.AppCompatActivity @@ -66,7 +68,11 @@ class MainActivity : AppCompatActivity() { intentState = intent val startArgs = intent.getSerializableExtra(ARGS) as? StartArgs - enableEdgeToEdge() + enableEdgeToEdge( + statusBarStyle = SystemBarStyle.dark( + scrim = Color.TRANSPARENT, + ), + ) setContent { SoptTheme { ProvideTracker(tracker) { diff --git a/feature/main/src/main/java/org/sopt/official/feature/main/MainScreen.kt b/feature/main/src/main/java/org/sopt/official/feature/main/MainScreen.kt index 025e45352..fab08b604 100644 --- a/feature/main/src/main/java/org/sopt/official/feature/main/MainScreen.kt +++ b/feature/main/src/main/java/org/sopt/official/feature/main/MainScreen.kt @@ -184,7 +184,6 @@ fun MainScreen( val shouldNavigatePokeFriendList = remember(intentState) { val intent = intentState intent?.getBooleanExtra("isPokeFriendList", false) == true - intent?.hasExtra("friendType") == true } LaunchedEffect( @@ -203,7 +202,7 @@ fun MainScreen( if (shouldNavigateToAppjamtamp()) { navigator.navigateAndClear(MainTab.Appjamtamp, userStatus) - activity?.intent?.putExtra("isSoptampDeepLink", false) + activity?.intent?.putExtra("isAppjamtampDeepLink", false) } if (shouldNavigateToMyPage) { @@ -270,6 +269,7 @@ fun MainScreen( putExtra(INTENT_URL, url) } + override fun navigateToPlaygroundHome() = context.startActivity(getIntent(PlaygroundWebLink.OFFICIAL_HOMEPAGE)) override fun navigateToPlaygroundCommunity() = context.startActivity(getIntent(PlaygroundWebLink.COMMUNITY)) override fun navigateToPlaygroundGroup() = context.startActivity(getIntent(PlaygroundWebLink.GROUP_STUDY)) override fun navigateToPlaygroundMember() = context.startActivity(getIntent(PlaygroundWebLink.MEMBER)) @@ -399,11 +399,6 @@ fun MainScreen( } } }, - navigateToFortune = { - context.startActivity( - applicationNavigator.getFortuneActivityIntent() - ) - }, navigateUp = navigator::navigateUp ) } diff --git a/feature/notification/src/main/java/org/sopt/official/feature/notification/detail/NotificationDetailActivity.kt b/feature/notification/src/main/java/org/sopt/official/feature/notification/detail/NotificationDetailActivity.kt index 1de6e417b..2b5e3822b 100644 --- a/feature/notification/src/main/java/org/sopt/official/feature/notification/detail/NotificationDetailActivity.kt +++ b/feature/notification/src/main/java/org/sopt/official/feature/notification/detail/NotificationDetailActivity.kt @@ -47,13 +47,9 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.Scaffold -import androidx.compose.material3.SnackbarHost -import androidx.compose.material3.SnackbarHostState import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults import androidx.compose.runtime.getValue -import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.vector.ImageVector @@ -63,14 +59,10 @@ import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import dagger.hilt.android.AndroidEntryPoint import dagger.hilt.android.EntryPointAccessors -import kotlinx.coroutines.launch import org.sopt.official.common.context.appContext import org.sopt.official.common.navigator.NavigatorEntryPoint -import org.sopt.official.common.navigator.SOPTLOG_FORTUNE import org.sopt.official.designsystem.SoptTheme import org.sopt.official.feature.notification.R -import org.sopt.official.feature.notification.detail.component.ErrorSnackBar -import java.time.LocalDate private val navigator by lazy { EntryPointAccessors.fromApplication( @@ -90,18 +82,6 @@ class NotificationDetailActivity : AppCompatActivity() { val notification by viewModel.notificationDetail.collectAsStateWithLifecycle() val context = LocalContext.current - val snackBarHostState = remember { SnackbarHostState() } - val coroutineScope = rememberCoroutineScope() - val onShowErrorSnackBar: (String?) -> Unit = { text -> - coroutineScope.launch { - snackBarHostState.currentSnackbarData?.dismiss() - - snackBarHostState.showSnackbar( - message = text ?: "오류가 발생했어요. 다시 시도해주세요.", - ) - } - } - SoptTheme { Scaffold( modifier = Modifier @@ -172,20 +152,12 @@ class NotificationDetailActivity : AppCompatActivity() { onClick = { val link = notification?.webLink ?: notification?.deepLink - when { - link == SOPTLOG_FORTUNE && !isToday(notification?.createdAt?.split("T")?.get(0)) -> { - onShowErrorSnackBar("앗, 오늘의 솝마디만 볼 수 있어요.") - } - - else -> { - context.startActivity( - navigator.getSchemeActivityIntent( - notificationId = notification?.notificationId.orEmpty(), - link = link.orEmpty() - ) - ) - } - } + context.startActivity( + navigator.getSchemeActivityIntent( + notificationId = notification?.notificationId.orEmpty(), + link = link.orEmpty() + ) + ) }, colors = ButtonDefaults.buttonColors( containerColor = SoptTheme.colors.primary, @@ -206,14 +178,6 @@ class NotificationDetailActivity : AppCompatActivity() { } } } - - SnackbarHost( - hostState = snackBarHostState, - modifier = Modifier - .padding(top = 16.dp) - ) { - ErrorSnackBar(message = it.visuals.message) - } } } } @@ -221,8 +185,6 @@ class NotificationDetailActivity : AppCompatActivity() { private fun isValidLinks(deepLink: String?, webLink: String?): Boolean = !deepLink.isNullOrBlank() || !webLink.isNullOrBlank() - private fun isToday(date: String?): Boolean = LocalDate.now().toString() == date - override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) val notificationId = intent.getStringExtra("notificationId").orEmpty() diff --git a/feature/poke/src/main/java/org/sopt/official/feature/poke/bridge/PokeEntryRoute.kt b/feature/poke/src/main/java/org/sopt/official/feature/poke/bridge/PokeEntryRoute.kt index 7e538dca6..4074369a4 100644 --- a/feature/poke/src/main/java/org/sopt/official/feature/poke/bridge/PokeEntryRoute.kt +++ b/feature/poke/src/main/java/org/sopt/official/feature/poke/bridge/PokeEntryRoute.kt @@ -40,6 +40,7 @@ import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.navigation.NavController import org.sopt.official.feature.poke.main.PokeScreen +import org.sopt.official.feature.poke.navigation.navigateToPokeFriendList import org.sopt.official.feature.poke.navigation.navigateToPokeNotification import org.sopt.official.feature.poke.onboarding.OnboardingScreen import org.sopt.official.model.UserStatus @@ -90,6 +91,9 @@ fun PokeEntryRoute( navigateToPokeNotification = { navController.navigateToPokeNotification(userStatus.name) }, + navigateToPokeFriendList = { + navController.navigateToPokeFriendList(initialFriendType = null) + }, ) } } diff --git a/feature/poke/src/main/java/org/sopt/official/feature/poke/friend/summary/FriendListSummaryScreen.kt b/feature/poke/src/main/java/org/sopt/official/feature/poke/friend/summary/FriendListSummaryScreen.kt index c443b208a..6778f59c5 100644 --- a/feature/poke/src/main/java/org/sopt/official/feature/poke/friend/summary/FriendListSummaryScreen.kt +++ b/feature/poke/src/main/java/org/sopt/official/feature/poke/friend/summary/FriendListSummaryScreen.kt @@ -83,6 +83,7 @@ import org.sopt.official.model.UserStatus fun FriendListSummaryScreen( paddingValues: PaddingValues, userStatus: UserStatus, + navigateUp: () -> Unit, viewModel: FriendListSummaryViewModel = hiltViewModel() ) { val context = LocalContext.current @@ -271,7 +272,8 @@ fun FriendListSummaryScreen( ) { binding = this if (includeFriendListBlockNewFriend.recyclerView.adapter == null) { - includeAppBar.textViewTitle.text = root.context.getString(R.string.poke_title) + includeAppBar.textViewTitle.text = root.context.getString(R.string.my_friend_title) + includeAppBar.toolbar.setOnClickListener { navigateUp() } swipeRefreshLayout.setOnRefreshListener { viewModel.getFriendListSummary() diff --git a/feature/poke/src/main/java/org/sopt/official/feature/poke/main/PokeScreen.kt b/feature/poke/src/main/java/org/sopt/official/feature/poke/main/PokeScreen.kt index b4e9791b4..621dadb3b 100644 --- a/feature/poke/src/main/java/org/sopt/official/feature/poke/main/PokeScreen.kt +++ b/feature/poke/src/main/java/org/sopt/official/feature/poke/main/PokeScreen.kt @@ -59,7 +59,6 @@ import org.sopt.official.domain.poke.type.PokeMessageType import org.sopt.official.feature.poke.R import org.sopt.official.feature.poke.UiState import org.sopt.official.feature.poke.databinding.ActivityPokeMainBinding -import org.sopt.official.feature.poke.friend.summary.FriendListSummaryActivity import org.sopt.official.feature.poke.message.MessageListBottomSheetFragment import org.sopt.official.feature.poke.user.PokeUserListClickListener import org.sopt.official.feature.poke.util.addOnAnimationEndListener @@ -78,6 +77,7 @@ fun PokeScreen( paddingValues: PaddingValues, userStatus: UserStatus, navigateToPokeNotification: (String) -> Unit, + navigateToPokeFriendList: () -> Unit, viewModel: PokeMainViewModel = hiltViewModel() ) { val context = LocalContext.current @@ -289,12 +289,7 @@ fun PokeScreen( } imgNextPokeMyFriend.setOnClickListener { - context.startActivity( - FriendListSummaryActivity.getIntent( - context, - FriendListSummaryActivity.StartArgs(userStatus.name), - ), - ) + navigateToPokeFriendList() } scrollviewPokeMain.viewTreeObserver.addOnScrollChangedListener { diff --git a/feature/poke/src/main/java/org/sopt/official/feature/poke/navigation/PokeNavGraph.kt b/feature/poke/src/main/java/org/sopt/official/feature/poke/navigation/PokeNavGraph.kt index 8f25dea24..5ced292d5 100644 --- a/feature/poke/src/main/java/org/sopt/official/feature/poke/navigation/PokeNavGraph.kt +++ b/feature/poke/src/main/java/org/sopt/official/feature/poke/navigation/PokeNavGraph.kt @@ -60,6 +60,9 @@ fun NavGraphBuilder.pokeNavGraph( userStatus = userStatus, navigateToPokeNotification = { navController.navigate(PokeNotification(userStatus.name)) + }, + navigateToPokeFriendList = { + navController.navigateToPokeFriendList(initialFriendType = null) } ) } @@ -96,6 +99,7 @@ fun NavGraphBuilder.pokeNavGraph( FriendListSummaryScreen( paddingValues = paddingValues, userStatus = userStatus, + navigateUp = navController::navigateUp, ) } } diff --git a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogScreen.kt b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogScreen.kt index 65f4b9387..5e2af4f8d 100644 --- a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogScreen.kt +++ b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogScreen.kt @@ -52,7 +52,6 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import kotlinx.collections.immutable.toImmutableList -import org.sopt.official.analytics.EventType import org.sopt.official.analytics.compose.LocalTracker import org.sopt.official.analytics.trackViewType import org.sopt.official.common.util.throttledNoRippleClickable @@ -61,7 +60,6 @@ import org.sopt.official.designsystem.component.dialog.NetworkErrorDialog import org.sopt.official.designsystem.component.indicator.LoadingIndicator import org.sopt.official.domain.soptlog.model.SoptLogInfo import org.sopt.official.feature.soptlog.component.SoptLogSection -import org.sopt.official.feature.soptlog.component.TodayFortuneBanner import org.sopt.official.feature.soptlog.model.MySoptLogItemType import org.sopt.official.feature.soptlog.model.SoptLogCategory import org.sopt.official.feature.soptlog.navigation.SoptLogNavigation @@ -73,7 +71,6 @@ import org.sopt.official.model.toViewType internal fun SoptLogRoute( soptLogNavigation: SoptLogNavigation, userStatus: UserStatus, - navigateToFortune: () -> Unit = {}, navigateUp: () -> Unit = {}, viewModel: SoptLogViewModel = hiltViewModel() ) { @@ -102,9 +99,6 @@ internal fun SoptLogRoute( val soptLogState by viewModel.soptLogInfo.collectAsStateWithLifecycle() val soptLogInfo = soptLogState.soptLogInfo - val isAppjamJoined by viewModel.isAppjamJoined.collectAsStateWithLifecycle() - val isAppjamMode by viewModel.isAppjamMode.collectAsStateWithLifecycle() - val todayFortuneText by viewModel.todayFortuneText.collectAsStateWithLifecycle("") val tracker = LocalTracker.current val viewType = userStatus.toViewType() @@ -121,18 +115,9 @@ internal fun SoptLogRoute( else -> { with(receiver = soptLogState.soptLogInfo) { SoptlogScreen( - isAppjamMode = isAppjamMode, - isAppjamJoined = isAppjamJoined, + isAppjamJoined = isAppjamParticipant, soptLogInfo = soptLogInfo, - todayFortuneText = todayFortuneText, onNavigationClick = viewModel::onNavigationClick, - navigateToFortune = { - navigateToFortune() - tracker.track( - name = "at36_soptlog_soptmadi", - type = EventType.CLICK - ) - }, navigateUp = navigateUp ) } @@ -143,13 +128,10 @@ internal fun SoptLogRoute( @OptIn(ExperimentalMaterial3Api::class) @Composable private fun SoptlogScreen( - isAppjamMode: Boolean, isAppjamJoined: Boolean, soptLogInfo: SoptLogInfo, - todayFortuneText: String, onNavigationClick: (url: String) -> Unit, modifier: Modifier = Modifier, - navigateToFortune: () -> Unit = {}, navigateUp: () -> Unit = {} ) { val scrollState = rememberScrollState() @@ -196,7 +178,7 @@ private fun SoptlogScreen( Spacer(modifier = Modifier.height(36.dp)) SoptlogContents { - val showSoptampSection = if (isAppjamMode) isAppjamJoined else soptLogInfo.isActive + val showSoptampSection = soptLogInfo.isActive || isAppjamJoined if (showSoptampSection) { SoptLogSection( title = "솝탬프 로그", @@ -224,12 +206,6 @@ private fun SoptlogScreen( } ) - Spacer(modifier = Modifier.height(38.dp)) - - TodayFortuneBanner( - title = todayFortuneText, - onClick = navigateToFortune - ) } Spacer(modifier = Modifier.height(36.dp)) @@ -265,8 +241,6 @@ private fun PreviewSoptlogScreen() { SoptTheme { val soptLogInfo = SoptLogInfo( isActive = true, - isFortuneChecked = false, - todayFortuneText = "오늘의 운세", soptampCount = 0, viewCount = 216, myClapCount = 209, @@ -283,10 +257,8 @@ private fun PreviewSoptlogScreen() { } SoptlogScreen( - isAppjamMode = false, isAppjamJoined = false, soptLogInfo = soptLogInfo, - todayFortuneText = "오늘의 운세", onNavigationClick = { url -> dummyAppServiceNavigation.navigateToDeepLink(url) } diff --git a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogViewModel.kt b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogViewModel.kt index 8ff678d42..d4b0692f4 100644 --- a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogViewModel.kt +++ b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/SoptLogViewModel.kt @@ -29,18 +29,14 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject -import kotlinx.coroutines.async +import kotlinx.coroutines.Job import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow -import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.receiveAsFlow -import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch -import org.sopt.official.domain.appjamtamp.repository.AppjamtampRepository import org.sopt.official.domain.poke.entity.ApiResult import org.sopt.official.domain.poke.entity.CheckNewInPoke import org.sopt.official.domain.poke.usecase.CheckNewInPokeUseCase @@ -48,37 +44,41 @@ import org.sopt.official.domain.soptlog.repository.SoptLogRepository import org.sopt.official.feature.soptlog.navigation.SoptLogUrl import org.sopt.official.feature.soptlog.state.SoptLogNavigationEvent import org.sopt.official.feature.soptlog.state.SoptLogState -import org.sopt.official.localstorage.source.UserStorage import timber.log.Timber @HiltViewModel class SoptLogViewModel @Inject constructor( private val soptLogRepository: SoptLogRepository, - private val appjamtampRepository: AppjamtampRepository, private val checkNewInPokeUseCase: CheckNewInPokeUseCase, - private val userStorage: UserStorage, ) : ViewModel() { private val _soptLogInfo = MutableStateFlow(SoptLogState()) val soptLogInfo: StateFlow get() = _soptLogInfo.asStateFlow() - val todayFortuneText = _soptLogInfo.map { it.soptLogInfo.todayFortuneText } - - private val _isAppjamJoined = MutableStateFlow(false) - val isAppjamJoined: StateFlow - get() = _isAppjamJoined.asStateFlow() - - val isAppjamMode: StateFlow = userStorage.isAppjamMode - .stateIn(viewModelScope, SharingStarted.Eagerly, false) - private val _navigationEvent = Channel() val navigationEvent = _navigationEvent.receiveAsFlow() + private var loadSoptLogInfoJob: Job? = null + fun loadSoptLogInfo() { - if (isAppjamMode.value) { - loadSoptLogWithAppjamInfo() - } else { - loadSoptLogInfoOnly() + loadSoptLogInfoJob?.cancel() + loadSoptLogInfoJob = viewModelScope.launch { + _soptLogInfo.update { it.copy(isLoading = true) } + + soptLogRepository.getSoptLogInfo() + .onSuccess { info -> + Timber.d( + "[AppjamMode] soptLog.isActive=${info.isActive}, " + + "isAppjamMode=${info.isAppjamMode}, isAppjamParticipant=${info.isAppjamParticipant}" + ) + _soptLogInfo.update { + it.copy(soptLogInfo = info, isLoading = false, isError = false) + } + } + .onFailure { error -> + Timber.e(error) + _soptLogInfo.update { it.copy(isLoading = false, isError = true) } + } } } @@ -86,7 +86,8 @@ class SoptLogViewModel @Inject constructor( when (SoptLogUrl.from(url)) { SoptLogUrl.POKE, SoptLogUrl.POKE_FRIEND_SUMMARY -> handlePokeNavigation(url) SoptLogUrl.SOPTAMP -> { - val deepLinkUrl = if (isAppjamMode.value) "appjamtamp" else "soptamp" + val isAppjamMode = _soptLogInfo.value.soptLogInfo.isAppjamMode + val deepLinkUrl = if (isAppjamMode) "appjamtamp" else "soptamp" viewModelScope.launch { _navigationEvent.send(SoptLogNavigationEvent.NavigateToDeepLink(deepLinkUrl)) } @@ -123,52 +124,6 @@ class SoptLogViewModel @Inject constructor( } } - private fun loadSoptLogWithAppjamInfo() { - viewModelScope.launch { - _soptLogInfo.update { it.copy(isLoading = true) } - - val soptLogDeferred = async { soptLogRepository.getSoptLogInfo() } - val appjamInfoDeferred = async { appjamtampRepository.getMyAppjamInfo() } - - val soptLogResult = soptLogDeferred.await() - val appjamResult = appjamInfoDeferred.await() - - if (soptLogResult.isSuccess && appjamResult.isSuccess) { - _isAppjamJoined.value = appjamResult.getOrThrow().isAppjamJoined - _soptLogInfo.update { - it.copy( - soptLogInfo = soptLogResult.getOrThrow(), - isLoading = false, - isError = false - ) - } - } else { - val error = soptLogResult.exceptionOrNull() - ?: appjamResult.exceptionOrNull() - ?: Exception("Unknown error") - Timber.e(error) - _soptLogInfo.update { it.copy(isLoading = false, isError = true) } - } - } - } - - private fun loadSoptLogInfoOnly() { - viewModelScope.launch { - _soptLogInfo.update { it.copy(isLoading = true) } - - soptLogRepository.getSoptLogInfo() - .onSuccess { info -> - _soptLogInfo.update { - it.copy(soptLogInfo = info, isLoading = false, isError = false) - } - } - .onFailure { error -> - Timber.e(error) - _soptLogInfo.update { it.copy(isLoading = false, isError = true) } - } - } - } - suspend fun fetchIsNewPoke(): Result { val apiResult: ApiResult<*> = checkNewInPokeUseCase() diff --git a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/component/TodayFortuneBanner.kt b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/component/TodayFortuneBanner.kt deleted file mode 100644 index ee2df88f3..000000000 --- a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/component/TodayFortuneBanner.kt +++ /dev/null @@ -1,101 +0,0 @@ -/* - * MIT License - * Copyright 2024-2025 SOPT - Shout Our Passion Together - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ -package org.sopt.official.feature.soptlog.component - -import androidx.compose.foundation.Image -import androidx.compose.foundation.background -import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.Spacer -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.graphics.vector.ImageVector -import androidx.compose.ui.res.vectorResource -import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.unit.dp -import org.sopt.official.designsystem.SoptTheme -import org.sopt.official.feature.soptlog.R - -@Composable -internal fun TodayFortuneBanner( - title: String, - onClick: () -> Unit, - modifier: Modifier = Modifier, -) { - Row( - modifier = modifier - .fillMaxWidth() - .clip(shape = RoundedCornerShape(12.dp)) - .background(color = SoptTheme.colors.onSurface900) - .padding(top = 12.dp, bottom = 12.dp, start = 12.dp, end = 14.dp) - .clickable(onClick = onClick), - verticalAlignment = Alignment.CenterVertically - ) { - Image( - imageVector = ImageVector.vectorResource(id = R.drawable.img_fortune_title), - modifier = Modifier.size(60.dp), - contentDescription = null - ) - - Spacer(modifier = Modifier.width(14.dp)) - - Column { - Text( - text = title, - style = SoptTheme.typography.heading18B, - color = SoptTheme.colors.surface, - maxLines = 1, - overflow = TextOverflow.Ellipsis - ) - - Text( - text = "바로 확인하기 >", - style = SoptTheme.typography.label12SB, - color = SoptTheme.colors.onSurface200 - ) - } - } -} - -@Preview(showBackground = true) -@Composable -private fun TodayFortuneBannerPreview() { - SoptTheme { - TodayFortuneBanner( - title = "차은우님, 잊지 말아야 할 말을 듣게 될것 같아요오오오?", - onClick = {} - ) - } -} diff --git a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/navigation/SoptlogNavigator.kt b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/navigation/SoptlogNavigator.kt index 3ecc834f1..4be4525af 100644 --- a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/navigation/SoptlogNavigator.kt +++ b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/navigation/SoptlogNavigator.kt @@ -43,14 +43,12 @@ fun NavController.navigateToSoptLog(navOptions: NavOptions) { fun NavGraphBuilder.soptLogNavGraph( userStatus: UserStatus, soptLogNavigation: SoptLogNavigation, - navigateToFortune: () -> Unit, navigateUp: () -> Unit ) { composable { SoptLogRoute( userStatus = userStatus, soptLogNavigation = soptLogNavigation, - navigateToFortune = navigateToFortune, navigateUp = navigateUp ) } diff --git a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/state/SoptLogState.kt b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/state/SoptLogState.kt index 43d987ede..9152bbcad 100644 --- a/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/state/SoptLogState.kt +++ b/feature/soptlog/src/main/java/org/sopt/official/feature/soptlog/state/SoptLogState.kt @@ -29,8 +29,6 @@ import org.sopt.official.domain.soptlog.model.SoptLogInfo data class SoptLogState( val soptLogInfo: SoptLogInfo = SoptLogInfo( isActive = false, - isFortuneChecked = false, - todayFortuneText = "", soptampCount = 0, viewCount = 0, myClapCount = 0, diff --git a/feature/soptlog/src/main/res/drawable/img_fortune_title.xml b/feature/soptlog/src/main/res/drawable/img_fortune_title.xml deleted file mode 100644 index 869fe732f..000000000 --- a/feature/soptlog/src/main/res/drawable/img_fortune_title.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/settings.gradle.kts b/settings.gradle.kts index 425714d62..457ec02de 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -36,7 +36,6 @@ include( ":core:localstorage", ":data:auth", - ":data:fortune", ":data:home", ":data:user", ":data:mypage", @@ -49,7 +48,6 @@ include( ":data:sopletter", ":domain:auth", - ":domain:fortune", ":domain:home", ":domain:user", ":domain:mypage", @@ -62,7 +60,6 @@ include( ":domain:sopletter", ":feature:auth", - ":feature:fortune", ":feature:home", ":feature:mypage", ":feature:notification",