diff --git a/app/src/debug/res/drawable/ic_launcher_foreground.xml b/app/src/debug/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 3fcadb8e8..000000000 --- a/app/src/debug/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/app/src/debug/res/drawable/ic_launcher_foreground_copy.xml b/app/src/debug/res/drawable/ic_launcher_foreground_copy.xml deleted file mode 100644 index 87b516883..000000000 --- a/app/src/debug/res/drawable/ic_launcher_foreground_copy.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - diff --git a/app/src/debug/res/drawable/ic_launcher_foreground_debug.xml b/app/src/debug/res/drawable/ic_launcher_foreground_debug.xml deleted file mode 100644 index f2461472c..000000000 --- a/app/src/debug/res/drawable/ic_launcher_foreground_debug.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/app/src/main/java/org/sopt/official/config/initializer/TimberInitializer.kt b/app/src/main/java/org/sopt/official/config/initializer/TimberInitializer.kt index 362bb2512..e90bdcee9 100644 --- a/app/src/main/java/org/sopt/official/config/initializer/TimberInitializer.kt +++ b/app/src/main/java/org/sopt/official/config/initializer/TimberInitializer.kt @@ -13,7 +13,7 @@ class TimberInitializer : Initializer { } private class SOPTDebugTree : Timber.DebugTree() { - override fun createStackElementTag(element: StackTraceElement): String? { + override fun createStackElementTag(element: StackTraceElement): String { return "SOPT://${element.fileName}:${element.lineNumber}#${element.methodName}" } } diff --git a/app/src/main/java/org/sopt/official/data/service/attendance/MockAttendanceService.kt b/app/src/main/java/org/sopt/official/data/service/attendance/MockAttendanceService.kt deleted file mode 100644 index 8c346dce2..000000000 --- a/app/src/main/java/org/sopt/official/data/service/attendance/MockAttendanceService.kt +++ /dev/null @@ -1,308 +0,0 @@ -package org.sopt.official.data.service.attendance - -import kotlinx.serialization.decodeFromString -import kotlinx.serialization.json.Json -import org.sopt.official.data.model.attendance.* - -class MockAttendanceService : AttendanceService { - override suspend fun getSoptEvent(): BaseAttendanceResponse { - return NOT_EVENT_DAY - } - - override suspend fun getAttendanceHistory(): BaseAttendanceResponse { - return ATTENDANCE_HISTORY - } - - override suspend fun getAttendanceRound(lectureId: Long): BaseAttendanceResponse { - return ATTENDANCE_ROUND_ONE - } - - override suspend fun confirmAttendanceCode(param: RequestAttendanceCode): BaseAttendanceResponse { - return FAIL_ATTENDANCE_BEFORE - } - - companion object { - private const val NOT_EVENT_DAY_JSON_TEXT = """ - { - "success": true, - "message": "세미나가 없는 날입니다", - "data": { - "type": "NO_SESSION", - "location": "", - "name": "", - "startDate": "", - "endDate": "", - "attendances": [] - } - } - """ - private val NOT_EVENT_DAY: BaseAttendanceResponse = - Json.decodeFromString(NOT_EVENT_DAY_JSON_TEXT) - private const val SEMINAR_EVENT_BEFORE_START_JSON_TEXT = """ - { - "success": true, - "message": "세미나 조회 성공", - "data": { - "type": "HAS_ATTENDANCE", - "location": "건국대학교 경영관", - "name": "2차 세미나", - "startDate": "2023-04-06T14:13:51.588149", - "endDate": "2023-04-06T18:13:51.588149", - "attendances": [ - { - "status": "ABSENT" - }, - { - "status": "ABSENT" - } - ] - } - } - """ - private val SEMINAR_EVENT_BEFORE_START: BaseAttendanceResponse = - Json.decodeFromString(SEMINAR_EVENT_BEFORE_START_JSON_TEXT) - private const val SEMINAR_EVENT_AFTER_START_BEFORE_END_JSON_TEXT = """ - { - "success": true, - "message": "세미나 조회 성공", - "data": { - "type": "HAS_ATTENDANCE", - "location": "건국대학교 경영관", - "name": "2차 세미나", - "startDate": "2023-04-06T14:13:51.588149", - "endDate": "2023-04-06T18:13:51.588149", - "attendances": [ - { - "status": "ATTENDANCE", - "attendedAt": "2023-04-06T14:13:51.588149" - }, - { - "status": "ABSENT", - "attendedAt": "2023-04-06T16:12:04" - } - ] - } - } - """ - private val SEMINAR_EVENT_AFTER_START_BEFORE_END: BaseAttendanceResponse = - Json.decodeFromString(SEMINAR_EVENT_AFTER_START_BEFORE_END_JSON_TEXT) - private const val SEMINAR_EVENT_AFTER_END_JSON_TEXT = """ - { - "success": true, - "message": "세미나 조회 성공", - "data": { - "type": "HAS_ATTENDANCE", - "location": "건국대학교 경영관", - "name": "2차 세미나", - "startDate": "2023-04-06T14:13:51.588149", - "endDate": "2023-04-06T18:13:51.588149", - "attendances": [ - { - "status": "ATTENDANCE", - "attendedAt": "2023-04-06T14:13:51.588149" - }, - { - "status": "ATTENDANCE", - "attendedAt": "2023-04-06T16:12:04" - } - ] - } - } - """ - private val SEMINAR_EVENT_AFTER_END: BaseAttendanceResponse = - Json.decodeFromString(SEMINAR_EVENT_AFTER_END_JSON_TEXT) - private const val EVENT_NO_ATTENDANCE_JSON_TEXT = """ - { - "success": true, - "message": "세미나 조회 성공", - "data": { - "id": 1, - "type": "NO_ATTENDANCE", - "location": "건국대학교 경영관", - "name": "1차 행사", - "startDate": "2023-04-06T14:13:51.588149", - "endDate": "2023-04-06T18:13:51.588149", - "message": "행사도 참여하고, 출석점수도 받고, 일석이조!", - "attendances": [] - } - } - """ - private val EVENT_NO_ATTENDANCE: BaseAttendanceResponse = - Json.decodeFromString(EVENT_NO_ATTENDANCE_JSON_TEXT) - - private const val ATTENDANCE_HISTORY_JSON_TEXT = """ - { - "success": true, - "message": "전체 출석정보 조회 성공", - "data": { - "part": "SERVER", - "generation": 32, - "name": "용택", - "score": 1.0, - "total": { - "attendance": 1, - "absent": 1, - "tardy": 1, - "participate": 1 - } - "attendances": [ - { - "attribute": "ETC", - "name": "솝커톤", - "status": "PARTICIPATE", - "date": "5월 16일" - }, - { - "attribute": "SEMINAR", - "name": "서버 2차 세미나", - "status": "ATTENDANCE", - "date": "4월 14일" - }, - { - "attribute": "SEMINAR", - "name": "서버 1차 세미나", - "status": "ABSENT", - "date": "4월 10일" - }, - { - "attribute": "SEMINAR", - "name": "OT", - "status": "TARDY", - "date": "4월 2일" - } - ] - } - } - """ - private val ATTENDANCE_HISTORY: BaseAttendanceResponse = - Json.decodeFromString(ATTENDANCE_HISTORY_JSON_TEXT) - - private const val NO_SECTION_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 오늘 세션이 없습니다.", - "data": null - } - """ - private val NO_SECTION: BaseAttendanceResponse = - Json.decodeFromString(NO_SECTION_JSON_TEXT) - - private const val NO_ATTENDANCE_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 출석 시작 전입니다.", - "data": null - } - """ - private val NO_ATTENDANCE: BaseAttendanceResponse = - Json.decodeFromString(NO_ATTENDANCE_JSON_TEXT) - - private const val NO_TIME_FIRST_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 1차 출석 시작 전입니다.", - "data": null - } - """ - private val NO_TIME_FIRST: BaseAttendanceResponse = - Json.decodeFromString(NO_TIME_FIRST_JSON_TEXT) - - private const val NO_TIME_SECOND_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 2차 출석 시작 전입니다.", - "data": null - } - """ - private val NO_TIME_SECOND: BaseAttendanceResponse = - Json.decodeFromString(NO_TIME_SECOND_JSON_TEXT) - - private const val AFTER_TIME_FIRST_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 1차 출석이 이미 종료되었습니다.", - "data": null - } - """ - private val AFTER_TIME_FIRST: BaseAttendanceResponse = - Json.decodeFromString(AFTER_TIME_FIRST_JSON_TEXT) - - private const val AFTER_TIME_SECOND_JSON_TEXT = """ - { - "success": false, - "message": "[LectureException] : 2차 출석이 이미 종료되었습니다.", - "data": null - } - """ - private val AFTER_TIME_SECOND: BaseAttendanceResponse = - Json.decodeFromString(AFTER_TIME_SECOND_JSON_TEXT) - - private const val ATTENDANCE_ROUND_TWO_JSON_TEXT = """ - { - "success": true, - "message": "출석 차수 조회 성공", - "data": { - "id": 16, - "round": 2 - } - } - """ - private val ATTENDANCE_ROUND_TWO: BaseAttendanceResponse = - Json.decodeFromString(ATTENDANCE_ROUND_TWO_JSON_TEXT) - - private const val ATTENDANCE_ROUND_ONE_JSON_TEXT = """ - { - "success": true, - "message": "출석 차수 조회 성공", - "data": { - "id": 5, - "round": 1 - } - } - """ - private val ATTENDANCE_ROUND_ONE: BaseAttendanceResponse = - Json.decodeFromString(ATTENDANCE_ROUND_ONE_JSON_TEXT) - - private const val SUCCESS_ATTENDNACE_TEXT = """ - { - "success": true, - "message": "출석 성공", - "data": { - "subLectureId": 17 - } - } - """ - private val SUCCESS_ATTENDANCE: BaseAttendanceResponse = - Json.decodeFromString(SUCCESS_ATTENDNACE_TEXT) - - private const val FAIL_ATTENDNACE_WRONG_CODE_TEXT = """ - { - "success": false, - "message": "[LectureException] : 코드가 일치하지 않아요!", - "data": null - } - """ - private val FAIL_ATTENDNACE_WRONG_CODE: BaseAttendanceResponse = - Json.decodeFromString(FAIL_ATTENDNACE_WRONG_CODE_TEXT) - - private const val FAIL_ATTENDANCE_BEFORE_TEXT = """ - { - "success": false, - "message": "[LectureException] : 1차 출석 시작 전입니다", - "data": null - } - """ - private val FAIL_ATTENDANCE_BEFORE: BaseAttendanceResponse = - Json.decodeFromString(FAIL_ATTENDANCE_BEFORE_TEXT) - - private const val FAIL_ATTENDANCE_AFTER_TIME_TEXT = """ - { - "success": false, - "message": "[LectureException] : 1차 출석 시작 전입니다", - "data": null - } - """ - private val FAIL_ATTENDANCE_AFTER_TIME: BaseAttendanceResponse = - Json.decodeFromString(FAIL_ATTENDANCE_AFTER_TIME_TEXT) - } -} \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/designsystem/AlertDialogPositiveNegative.kt b/app/src/main/java/org/sopt/official/designsystem/AlertDialogPositiveNegative.kt index 05fcc315a..6481b9fd6 100644 --- a/app/src/main/java/org/sopt/official/designsystem/AlertDialogPositiveNegative.kt +++ b/app/src/main/java/org/sopt/official/designsystem/AlertDialogPositiveNegative.kt @@ -8,6 +8,7 @@ import androidx.annotation.StringRes import androidx.constraintlayout.widget.ConstraintLayout import org.sopt.official.R import org.sopt.official.databinding.LayoutDialogNegativePositiveBinding +import org.sopt.official.util.drawableOf class AlertDialogPositiveNegative(context: Context) : ConstraintLayout(context) { private val builder: AlertDialog.Builder = AlertDialog.Builder(context) @@ -75,7 +76,7 @@ class AlertDialogPositiveNegative(context: Context) : ConstraintLayout(context) fun show() { dialog?.window?.setBackgroundDrawable( - context.getDrawable(R.drawable.rectangle_radius_10).apply { + context.drawableOf(R.drawable.rectangle_radius_10).apply { this?.setTint(context.getColor(R.color.black_60)) } ) diff --git a/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceButtonType.kt b/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceButtonType.kt index cc877c6ec..9e159285a 100644 --- a/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceButtonType.kt +++ b/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceButtonType.kt @@ -17,7 +17,7 @@ enum class AttendanceButtonType( ERROR(AttendanceRound(-2, ""), listOf()); companion object { - fun of(message: String) = values().find { it.messages.contains(message) }?.attendanceRound + fun of(message: String) = entries.find { it.messages.contains(message) }?.attendanceRound ?: ERROR.attendanceRound } } diff --git a/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceErrorCode.kt b/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceErrorCode.kt index e6f542f40..358a99b26 100644 --- a/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceErrorCode.kt +++ b/app/src/main/java/org/sopt/official/domain/entity/attendance/AttendanceErrorCode.kt @@ -14,6 +14,6 @@ enum class AttendanceErrorCode( ); companion object { - fun of(message: String) = values().find { it.messages.contains(message) }?.attendanceErrorCode + fun of(message: String) = entries.find { it.messages.contains(message) }?.attendanceErrorCode } } diff --git a/app/src/main/java/org/sopt/official/domain/entity/auth/UserStatus.kt b/app/src/main/java/org/sopt/official/domain/entity/auth/UserStatus.kt index ecaf5b78d..0cde79c28 100644 --- a/app/src/main/java/org/sopt/official/domain/entity/auth/UserStatus.kt +++ b/app/src/main/java/org/sopt/official/domain/entity/auth/UserStatus.kt @@ -8,6 +8,6 @@ enum class UserStatus( UNAUTHENTICATED("UNAUTHENTICATED"); companion object { - fun of(value: String) = values().find { it.value == value } ?: throw IllegalArgumentException("Invalid user status: $value") + fun of(value: String) = entries.find { it.value == value } ?: throw IllegalArgumentException("Invalid user status: $value") } } diff --git a/app/src/main/java/org/sopt/official/feature/attendance/AttendanceActivity.kt b/app/src/main/java/org/sopt/official/feature/attendance/AttendanceActivity.kt index a8cc08d0d..72a789d63 100644 --- a/app/src/main/java/org/sopt/official/feature/attendance/AttendanceActivity.kt +++ b/app/src/main/java/org/sopt/official/feature/attendance/AttendanceActivity.kt @@ -7,7 +7,8 @@ import android.os.Bundle import android.text.Spannable import android.text.Spanned import android.text.style.StyleSpan -import android.view.* +import android.view.View +import android.view.ViewGroup import android.view.animation.AnimationUtils import android.widget.TextView import android.widget.Toast @@ -23,10 +24,15 @@ import kotlinx.coroutines.flow.onEach import org.sopt.official.R import org.sopt.official.core.di.toast import org.sopt.official.databinding.ActivityAttendanceBinding -import org.sopt.official.domain.entity.attendance.* +import org.sopt.official.domain.entity.attendance.AttendanceLog +import org.sopt.official.domain.entity.attendance.AttendanceStatus +import org.sopt.official.domain.entity.attendance.AttendanceSummary +import org.sopt.official.domain.entity.attendance.AttendanceUserInfo +import org.sopt.official.domain.entity.attendance.EventType +import org.sopt.official.domain.entity.attendance.SoptEvent import org.sopt.official.feature.attendance.adapter.AttendanceAdapter import org.sopt.official.feature.attendance.model.AttendanceState -import org.sopt.official.feature.attendance.util.dpToPx +import org.sopt.official.util.dp @AndroidEntryPoint class AttendanceActivity : AppCompatActivity() { @@ -90,15 +96,15 @@ class AttendanceActivity : AppCompatActivity() { super.getItemOffsets(outRect, view, parent, state) when (parent.getChildAdapterPosition(view)) { 0 -> { - outRect.set(24.dpToPx(), 32.dpToPx(), 24.dpToPx(), 12.dpToPx()) + outRect.set(24.dp, 32.dp, 24.dp, 12.dp) } attendanceAdapter.itemCount - 1 -> { - outRect.set(24.dpToPx(), 12.dpToPx(), 24.dpToPx(), 32.dpToPx()) + outRect.set(24, 12.dp, 24.dp, 32.dp) } else -> { - outRect.set(24.dpToPx(), 12.dpToPx(), 24.dpToPx(), 12.dpToPx()) + outRect.set(24.dp, 12.dp, 24.dp, 12.dp) } } } @@ -178,7 +184,7 @@ class AttendanceActivity : AppCompatActivity() { textInfoEventPoint.isVisible = (soptEvent.message != "") textInfoEventPoint.text = soptEvent.message val textInfoEventNameLayoutParams = textInfoEventName.layoutParams as ViewGroup.MarginLayoutParams - textInfoEventNameLayoutParams.setMargins(0, 16.dpToPx(), 0, 0) + textInfoEventNameLayoutParams.setMargins(0, 16.dp, 0, 0) textInfoEventName.layoutParams = textInfoEventNameLayoutParams removeAllSpan(textInfoEventName) textInfoEventName.text = "오늘은 ${soptEvent.eventName} 날이에요" @@ -228,7 +234,7 @@ class AttendanceActivity : AppCompatActivity() { textInfoEventPoint.isVisible = (soptEvent.message != "") textInfoEventPoint.text = soptEvent.message val textInfoEventNameLayoutParams = textInfoEventName.layoutParams as ViewGroup.MarginLayoutParams - textInfoEventNameLayoutParams.setMargins(0, 16.dpToPx(), 0, 0) + textInfoEventNameLayoutParams.setMargins(0, 16.dp, 0, 0) textInfoEventName.layoutParams = textInfoEventNameLayoutParams removeAllSpan(textInfoEventName) textInfoEventName.text = "오늘은 ${soptEvent.eventName} 날이에요" diff --git a/app/src/main/java/org/sopt/official/feature/attendance/AttendanceViewModel.kt b/app/src/main/java/org/sopt/official/feature/attendance/AttendanceViewModel.kt index dd8939efc..e91035c83 100644 --- a/app/src/main/java/org/sopt/official/feature/attendance/AttendanceViewModel.kt +++ b/app/src/main/java/org/sopt/official/feature/attendance/AttendanceViewModel.kt @@ -29,11 +29,11 @@ class AttendanceViewModel @Inject constructor( private var _dialogState = MutableStateFlow(DialogState.Show) val dialogState: StateFlow get() = _dialogState - private val _isFirstProgressBarActive = MutableStateFlow(false) + private val _isFirstProgressBarActive = MutableStateFlow(false) val isFirstProgressBarActive get() = _isFirstProgressBarActive - private val _isSecondProgressBarActive = MutableStateFlow(false) + private val _isSecondProgressBarActive = MutableStateFlow(false) val isSecondProgressBarActive get() = _isSecondProgressBarActive - private val _isThirdProgressBarActive = MutableStateFlow(false) + private val _isThirdProgressBarActive = MutableStateFlow(false) val isThirdProgressBarActive get() = _isThirdProgressBarActive private val _isThirdProgressBarAttendance = MutableStateFlow(false) val isThirdProgressBarAttendance get() = _isThirdProgressBarAttendance diff --git a/app/src/main/java/org/sopt/official/feature/attendance/adapter/LogHeaderViewHolder.kt b/app/src/main/java/org/sopt/official/feature/attendance/adapter/LogHeaderViewHolder.kt index 43d746f16..bd634ca14 100644 --- a/app/src/main/java/org/sopt/official/feature/attendance/adapter/LogHeaderViewHolder.kt +++ b/app/src/main/java/org/sopt/official/feature/attendance/adapter/LogHeaderViewHolder.kt @@ -5,7 +5,9 @@ import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import org.sopt.official.databinding.ItemAttendanceHistoryLogHeaderBinding -class LogHeaderViewHolder(private val binding: ItemAttendanceHistoryLogHeaderBinding) : RecyclerView.ViewHolder(binding.root) { +class LogHeaderViewHolder( + binding: ItemAttendanceHistoryLogHeaderBinding +) : RecyclerView.ViewHolder(binding.root) { companion object { fun create(parent: ViewGroup): LogHeaderViewHolder { val binding = ItemAttendanceHistoryLogHeaderBinding.inflate( diff --git a/app/src/main/java/org/sopt/official/feature/attendance/util/NumberExtensions.kt b/app/src/main/java/org/sopt/official/feature/attendance/util/NumberExtensions.kt deleted file mode 100644 index f777f51c1..000000000 --- a/app/src/main/java/org/sopt/official/feature/attendance/util/NumberExtensions.kt +++ /dev/null @@ -1,6 +0,0 @@ -package org.sopt.official.feature.attendance.util - -import android.content.res.Resources - -fun Int.dpToPx(): Int = this * Resources.getSystem().displayMetrics.density.toInt() -fun Int.pxToDp(): Int = (this / Resources.getSystem().displayMetrics.density).toInt() \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/feature/main/MainActivity.kt b/app/src/main/java/org/sopt/official/feature/main/MainActivity.kt index 703d6d62b..2d9a5bdf8 100644 --- a/app/src/main/java/org/sopt/official/feature/main/MainActivity.kt +++ b/app/src/main/java/org/sopt/official/feature/main/MainActivity.kt @@ -239,7 +239,7 @@ class MainActivity : AppCompatActivity() { } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder { - return when (SmallBlockViewType.values()[viewType]) { + return when (SmallBlockViewType.entries[viewType]) { SmallBlockViewType.SMALL_BLOCK -> SmallBlockViewHolder(parent) } } diff --git a/app/src/main/java/org/sopt/official/feature/mypage/MyPageActivity.kt b/app/src/main/java/org/sopt/official/feature/mypage/MyPageActivity.kt index 7ae513a26..c1014d0f0 100644 --- a/app/src/main/java/org/sopt/official/feature/mypage/MyPageActivity.kt +++ b/app/src/main/java/org/sopt/official/feature/mypage/MyPageActivity.kt @@ -6,6 +6,7 @@ import android.net.Uri import android.os.Bundle import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity +import com.jakewharton.processphoenix.ProcessPhoenix import com.jakewharton.rxbinding4.view.clicks import dagger.hilt.android.AndroidEntryPoint import io.reactivex.rxjava3.core.BackpressureStrategy @@ -212,8 +213,7 @@ class MyPageActivity : AppCompatActivity() { val intent = packageManager.getLaunchIntentForPackage(packageName) val componentName = intent?.component val mainIntent = Intent.makeRestartActivityTask(componentName) - startActivity(mainIntent) - System.exit(0) + ProcessPhoenix.triggerRebirth(this, mainIntent) } ) } @@ -234,7 +234,7 @@ class MyPageActivity : AppCompatActivity() { companion object { @JvmStatic - fun getIntent(context: Context, args: MyPageActivity.StartArgs) = Intent(context, MyPageActivity::class.java).apply { + fun getIntent(context: Context, args: StartArgs) = Intent(context, MyPageActivity::class.java).apply { putExtra("args", args) } } diff --git a/app/src/main/java/org/sopt/official/feature/mypage/signOut/SignOutActivity.kt b/app/src/main/java/org/sopt/official/feature/mypage/signOut/SignOutActivity.kt index 819cf0542..445ecc290 100644 --- a/app/src/main/java/org/sopt/official/feature/mypage/signOut/SignOutActivity.kt +++ b/app/src/main/java/org/sopt/official/feature/mypage/signOut/SignOutActivity.kt @@ -5,17 +5,16 @@ import android.content.Intent import android.os.Bundle import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity +import com.jakewharton.processphoenix.ProcessPhoenix import com.jakewharton.rxbinding4.view.clicks import dagger.hilt.android.AndroidEntryPoint import io.reactivex.rxjava3.disposables.CompositeDisposable -import kotlinx.coroutines.flow.filter import org.sopt.official.databinding.ActivitySignOutBinding import org.sopt.official.util.rx.observeOnMain import org.sopt.official.util.rx.subscribeBy import org.sopt.official.util.rx.subscribeOnIo import org.sopt.official.util.ui.throttleUi import org.sopt.official.util.viewBinding -import com.jakewharton.processphoenix.ProcessPhoenix @AndroidEntryPoint class SignOutActivity : AppCompatActivity() { diff --git a/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameActivity.kt b/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameActivity.kt index f00b08983..cadc9905a 100644 --- a/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameActivity.kt +++ b/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameActivity.kt @@ -12,6 +12,7 @@ import io.reactivex.rxjava3.core.BackpressureStrategy import io.reactivex.rxjava3.disposables.CompositeDisposable import org.sopt.official.R import org.sopt.official.databinding.ActivityChangeNickNameBinding +import org.sopt.official.util.drawableOf import org.sopt.official.util.rx.observeOnMain import org.sopt.official.util.rx.subscribeBy import org.sopt.official.util.rx.subscribeOnIo @@ -57,7 +58,7 @@ class ChangeNickNameActivity : AppCompatActivity() { .distinctUntilChanged() .map { val visible = !it - val backgroundColor = this.getDrawable( + val backgroundColor = drawableOf( if (it) { R.drawable.layout_edit_text_background } else { @@ -107,7 +108,8 @@ class ChangeNickNameActivity : AppCompatActivity() { companion object { @JvmStatic - fun getIntent(context: Context) = Intent(context, ChangeNickNameActivity::class.java).apply { - } + fun getIntent(context: Context) = + Intent(context, ChangeNickNameActivity::class.java).apply { + } } } \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameViewModel.kt b/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameViewModel.kt index bd738e288..873726538 100644 --- a/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameViewModel.kt +++ b/app/src/main/java/org/sopt/official/feature/mypage/soptamp/nickName/ChangeNickNameViewModel.kt @@ -40,7 +40,7 @@ class ChangeNickNameViewModel @Inject constructor( } } - fun validateNickName() { + private fun validateNickName() { nickName.first("") .subscribeOnIo() .subscribeBy( diff --git a/app/src/main/java/org/sopt/official/feature/update/UpdateCriteria.kt b/app/src/main/java/org/sopt/official/feature/update/UpdateCriteria.kt index 255a368ae..558d32341 100644 --- a/app/src/main/java/org/sopt/official/feature/update/UpdateCriteria.kt +++ b/app/src/main/java/org/sopt/official/feature/update/UpdateCriteria.kt @@ -11,7 +11,7 @@ enum class UpdateCriteria( companion object { private fun of(priority: Int): UpdateCriteria { - return values().find { it.priority == priority } ?: throw IllegalStateException("Unknown priority: $priority") + return entries.find { it.priority == priority } ?: throw IllegalStateException("Unknown priority: $priority") } private fun UpdateCriteria.stalenessDayOf(type: Int) = if (type == AppUpdateType.IMMEDIATE) { diff --git a/app/src/main/java/org/sopt/official/feature/web/WebUrlConstant.kt b/app/src/main/java/org/sopt/official/feature/web/WebUrlConstant.kt index 927eb40ad..df8c5c44e 100644 --- a/app/src/main/java/org/sopt/official/feature/web/WebUrlConstant.kt +++ b/app/src/main/java/org/sopt/official/feature/web/WebUrlConstant.kt @@ -1,49 +1,35 @@ package org.sopt.official.feature.web object WebUrlConstant { - //region sopt - val SOPT_OFFICIAL_PAGE_URL = toSoptUrl("") val SOPT_REVIEW_URL = toSoptUrl("review") val SOPT_PROJECT_URL = toSoptUrl("project") val SOPT_FAQ_URL = toSoptUrl("FAQ") - //endregion - - //region playground - val PLAYGROUNG_MEMBER_URL = toPlaygroundUrl("members") val PLAYGROUNG_PROJECT_URL = toPlaygroundUrl("projects") val PLAYGROUNG_CREW_URL = toPlaygroundUrl("group") - //endregion - - //region others - - val SOPT_OFFICIAL_YOUTUBE = "https://www.youtube.com/@SOPTMEDIA" - val NOTICE_PRIVATE_INFO = "https://florentine-legend-ffc.notion.site/SOPT-0b378275554d4d65a442310e83c7c988" - val NOTICE_SERVICE_RULE = "https://florentine-legend-ffc.notion.site/SOPT-69e33dccb59543dd91f5f44ed1250881" - - //endregion - - //region base + const val SOPT_OFFICIAL_YOUTUBE = "https://www.youtube.com/@SOPTMEDIA" + const val NOTICE_PRIVATE_INFO = + "https://florentine-legend-ffc.notion.site/SOPT-0b378275554d4d65a442310e83c7c988" + const val NOTICE_SERVICE_RULE = + "https://florentine-legend-ffc.notion.site/SOPT-69e33dccb59543dd91f5f44ed1250881" private const val SOPT_BASE_URL = "https://sopt.org" private const val PLAYGROUNG_BASE_URL = "https://playground.sopt.org" - fun toSoptUrl(url: String): String = + private fun toSoptUrl(url: String): String = if (url.isNotEmpty()) { "$SOPT_BASE_URL/$url" } else { SOPT_BASE_URL } - fun toPlaygroundUrl(url: String): String = + private fun toPlaygroundUrl(url: String): String = if (url.isNotEmpty()) { "$PLAYGROUNG_BASE_URL/$url" } else { PLAYGROUNG_BASE_URL } - - //endregion } \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/util/coroutine/FlowExt.kt b/app/src/main/java/org/sopt/official/util/coroutine/FlowExt.kt deleted file mode 100644 index 5de81dad8..000000000 --- a/app/src/main/java/org/sopt/official/util/coroutine/FlowExt.kt +++ /dev/null @@ -1,32 +0,0 @@ -package org.sopt.official.util.coroutine - -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.* -import org.sopt.official.util.wrapper.NullableWrapper -import org.sopt.official.util.wrapper.asNullableWrapper - -fun Flow>.stateInLazily( - scope: CoroutineScope -) = this.stateIn( - scope, - SharingStarted.Lazily, - NullableWrapper.none() -) - -fun Flow.stateInLazily( - scope: CoroutineScope, - initialValue: ValueType -) = this.stateIn( - scope, - SharingStarted.Lazily, - initialValue -) - -fun Flow.safeStateInLazily( - scope: CoroutineScope, -) = this.map { it.asNullableWrapper() } - .stateIn( - scope, - SharingStarted.Lazily, - NullableWrapper.none() - ) \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/util/lifecycle/AndroidLifecycle.kt b/app/src/main/java/org/sopt/official/util/lifecycle/AndroidLifecycle.kt deleted file mode 100644 index 4c5eecb12..000000000 --- a/app/src/main/java/org/sopt/official/util/lifecycle/AndroidLifecycle.kt +++ /dev/null @@ -1,10 +0,0 @@ -package org.sopt.official.util.lifecycle - -enum class AndroidLifecycle { - CREATE, - START, - RESTART, - RESUME, - PAUSE, - DESTROY, -} \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/util/rx/FlowableExt.kt b/app/src/main/java/org/sopt/official/util/rx/FlowableExt.kt index 4368285d8..297bc2161 100644 --- a/app/src/main/java/org/sopt/official/util/rx/FlowableExt.kt +++ b/app/src/main/java/org/sopt/official/util/rx/FlowableExt.kt @@ -13,6 +13,6 @@ fun Flowable.observeOnMain() = this.observeOn(AndroidSchedulers.mai fun Flowable.subscribeBy( compositeDisposable: CompositeDisposable, onError: (Throwable) -> Unit = { Timber.e(it.message) }, - onComplete: () -> Unit = { Unit }, + onComplete: () -> Unit = { }, onNext: (T) -> Unit ) = compositeDisposable.add(subscribe(onNext, onError, onComplete)) diff --git a/app/src/main/java/org/sopt/official/util/rx/MaybeExt.kt b/app/src/main/java/org/sopt/official/util/rx/MaybeExt.kt deleted file mode 100644 index c6d3f337b..000000000 --- a/app/src/main/java/org/sopt/official/util/rx/MaybeExt.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.official.util.rx - -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers -import io.reactivex.rxjava3.core.Maybe -import io.reactivex.rxjava3.disposables.Disposable -import io.reactivex.rxjava3.schedulers.Schedulers -import timber.log.Timber - -fun Maybe.subscribeOnIo() = this.subscribeOn(Schedulers.io()) - -fun Maybe.observeOnMain() = this.observeOn(AndroidSchedulers.mainThread()) - -fun Maybe.subscribeBy( - onError: (Throwable) -> Unit = { Timber.e(it.message) }, - onComplete: () -> Unit = { Unit }, - onNext: (T) -> Unit -): Disposable = subscribe(onNext, onError, onComplete) \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/util/rx/ObservableExt.kt b/app/src/main/java/org/sopt/official/util/rx/ObservableExt.kt deleted file mode 100644 index c4d2bc493..000000000 --- a/app/src/main/java/org/sopt/official/util/rx/ObservableExt.kt +++ /dev/null @@ -1,17 +0,0 @@ -package org.sopt.official.util.rx - -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers -import io.reactivex.rxjava3.core.Observable -import io.reactivex.rxjava3.disposables.Disposable -import io.reactivex.rxjava3.schedulers.Schedulers -import timber.log.Timber - -fun Observable.subscribeOnIo() = this.subscribeOn(Schedulers.io()) - -fun Observable.observeOnMain() = this.observeOn(AndroidSchedulers.mainThread()) - -fun Observable.subscribeBy( - onError: (Throwable) -> Unit = { Timber.e(it.message) }, - onComplete: () -> Unit = { Unit }, - onNext: (T) -> Unit -): Disposable = subscribe(onNext, onError, onComplete) \ No newline at end of file diff --git a/app/src/main/java/org/sopt/official/util/rx/SingleExt.kt b/app/src/main/java/org/sopt/official/util/rx/SingleExt.kt index edd142a7a..5e56bc51d 100644 --- a/app/src/main/java/org/sopt/official/util/rx/SingleExt.kt +++ b/app/src/main/java/org/sopt/official/util/rx/SingleExt.kt @@ -1,6 +1,5 @@ package org.sopt.official.util.rx -import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers import io.reactivex.rxjava3.core.Single import io.reactivex.rxjava3.disposables.CompositeDisposable import io.reactivex.rxjava3.schedulers.Schedulers @@ -8,8 +7,6 @@ import timber.log.Timber fun Single.subscribeOnIo() = this.subscribeOn(Schedulers.io()) -fun Single.observeOnMain() = this.observeOn(AndroidSchedulers.mainThread()) - fun Single.subscribeBy( compositeDisposable: CompositeDisposable, onError: (Throwable) -> Unit = { Timber.e(it.message) }, diff --git a/app/src/main/java/org/sopt/official/util/wrapper/NullableExt.kt b/app/src/main/java/org/sopt/official/util/wrapper/NullableExt.kt index ff5f2e506..a2996d23f 100644 --- a/app/src/main/java/org/sopt/official/util/wrapper/NullableExt.kt +++ b/app/src/main/java/org/sopt/official/util/wrapper/NullableExt.kt @@ -6,13 +6,6 @@ data class NullableWrapper( fun get(): ValueType? = value fun getOrElse(value: ValueType) = this.get() ?: value - fun getOrThrow(): ValueType = - try { - value as ValueType - } catch (exception: Exception) { - throw TypeCastException() - } - companion object { fun none(): NullableWrapper = NullableWrapper(null) } @@ -22,6 +15,3 @@ fun ValueType?.asNullableWrapper(): NullableWrapper fun NullableWrapper.getOrEmpty(): String = getOrElse("") fun NullableWrapper>.getOrEmpty(): List = getOrElse(emptyList()) - -fun NullableWrapper.getOrFlase(): Boolean = getOrElse(false) -fun NullableWrapper.getOrTrue(): Boolean = getOrElse(true) \ No newline at end of file diff --git a/app/src/main/res/anim/anim_zoom_in_fade_in.xml b/app/src/main/res/anim/anim_zoom_in_fade_in.xml deleted file mode 100644 index 1710fdc9d..000000000 --- a/app/src/main/res/anim/anim_zoom_in_fade_in.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/color/attendance_progress_text.xml b/app/src/main/res/color/attendance_progress_text.xml deleted file mode 100644 index 23ed0fcc0..000000000 --- a/app/src/main/res/color/attendance_progress_text.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_bell.xml b/app/src/main/res/drawable/ic_bell.xml deleted file mode 100644 index 55818878e..000000000 --- a/app/src/main/res/drawable/ic_bell.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_check.xml b/app/src/main/res/drawable/ic_check.xml deleted file mode 100644 index 2cca25856..000000000 --- a/app/src/main/res/drawable/ic_check.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_download.xml b/app/src/main/res/drawable/ic_download.xml deleted file mode 100644 index 159cea556..000000000 --- a/app/src/main/res/drawable/ic_download.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_infomation.xml b/app/src/main/res/drawable/ic_infomation.xml deleted file mode 100644 index f4b4f2cf6..000000000 --- a/app/src/main/res/drawable/ic_infomation.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml deleted file mode 100644 index 07d5da9cb..000000000 --- a/app/src/main/res/drawable/ic_launcher_background.xml +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_launcher_foreground.xml b/app/src/main/res/drawable/ic_launcher_foreground.xml deleted file mode 100644 index 87b516883..000000000 --- a/app/src/main/res/drawable/ic_launcher_foreground.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - diff --git a/app/src/main/res/drawable/ic_left.xml b/app/src/main/res/drawable/ic_left.xml deleted file mode 100644 index 1dfb58db0..000000000 --- a/app/src/main/res/drawable/ic_left.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_new.xml b/app/src/main/res/drawable/ic_new.xml deleted file mode 100644 index 503efd8eb..000000000 --- a/app/src/main/res/drawable/ic_new.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/src/main/res/drawable/ic_notice.xml b/app/src/main/res/drawable/ic_notice.xml deleted file mode 100644 index 13253e56c..000000000 --- a/app/src/main/res/drawable/ic_notice.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_right.xml b/app/src/main/res/drawable/ic_right.xml deleted file mode 100644 index 4c8349f17..000000000 --- a/app/src/main/res/drawable/ic_right.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/ic_search.xml b/app/src/main/res/drawable/ic_search.xml deleted file mode 100644 index 1b003f66d..000000000 --- a/app/src/main/res/drawable/ic_search.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/ic_setting.xml b/app/src/main/res/drawable/ic_setting.xml deleted file mode 100644 index d066e22eb..000000000 --- a/app/src/main/res/drawable/ic_setting.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/app/src/main/res/drawable/rectangle_radius_12.xml b/app/src/main/res/drawable/rectangle_radius_12.xml deleted file mode 100644 index 98eb7c376..000000000 --- a/app/src/main/res/drawable/rectangle_radius_12.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml deleted file mode 100644 index 87d161882..000000000 --- a/app/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/item_main_content_non_member_header.xml b/app/src/main/res/layout/item_main_content_non_member_header.xml deleted file mode 100644 index c810842a6..000000000 --- a/app/src/main/res/layout/item_main_content_non_member_header.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/menu/menu_attendance_overview.xml b/app/src/main/res/menu/menu_attendance_overview.xml deleted file mode 100644 index d96461c5e..000000000 --- a/app/src/main/res/menu/menu_attendance_overview.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index c7575d57d..4714234c1 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -13,7 +13,4 @@ ?attr/colorPrimaryVariant - \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f30ce7b69..70f647011 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -16,9 +16,7 @@ 활동후기 FAQ YOUTUBE - 프로젝트 비회원 - SOPT 회원이 되 다양한 서비스를 즐겨보세요 %1$s 님은\nSOPT와 %2$s개월 째 안녕하세요,\nSOPT에 오신 것을 환영합니다! @@ -30,7 +28,6 @@ SOPT 문의하기 멤버 프로젝트 - 전체 공지 크루 공식홈페이지 비활동 @@ -40,7 +37,6 @@ SOPT를 알차게 즐기고 싶다면? SOPT AMP! - NEW PRODUCT 1차 출석 2차 출석 출석 전 @@ -48,12 +44,6 @@ 지각 결석 - [LectureException] : 오늘 세션이 없습니다. - [LectureException] : 출석 시작 전입니다. - [LectureException] : 1차 출석 시작 전입니다. - [LectureException] : 2차 출석 시작 전입니다. - [LectureException] : 1차 출석이 이미 종료되었습니다. - [LectureException] : 2차 출석이 이미 종료되었습니다. 출석 코드 다섯 자리를 입력해주세요. 코드가 일치하지 않아요! 출석하기 diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index ab92053b5..b4272bb79 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -31,13 +31,5 @@ @style/TextAppearance.SOPT.CaptionMedium - - - \ No newline at end of file diff --git a/feature/soptamp/build.gradle.kts b/feature/soptamp/build.gradle.kts index 086ea5725..642e8704c 100644 --- a/feature/soptamp/build.gradle.kts +++ b/feature/soptamp/build.gradle.kts @@ -1,5 +1,3 @@ -import java.util.Properties - plugins { id("org.sopt.official.feature") alias(libs.plugins.ksp) diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/error/ErrorData.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/error/ErrorData.kt index 514f641cf..0666ee9f8 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/error/ErrorData.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/error/ErrorData.kt @@ -19,5 +19,7 @@ sealed class ErrorData( override val message: String? = null, override val cause: Throwable? = null ) : Exception(message, cause) { - data object NetworkUnavailable : ErrorData() + data object NetworkUnavailable : ErrorData() { + private fun readResolve(): Any = "NetworkUnavailable" + } } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/remote/api/SoptampUserService.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/remote/api/SoptampUserService.kt index 3716c29bd..3830d6626 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/remote/api/SoptampUserService.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/remote/api/SoptampUserService.kt @@ -20,7 +20,6 @@ import org.sopt.official.stamp.data.remote.model.request.UpdateProfileMessageReq import org.sopt.official.stamp.data.remote.model.response.UpdateProfileMessageResponse import org.sopt.official.stamp.data.remote.model.response.UserResponse import retrofit2.http.Body -import retrofit2.http.DELETE import retrofit2.http.GET import retrofit2.http.PATCH import retrofit2.http.POST diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/repository/StampRepositoryImpl.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/repository/StampRepositoryImpl.kt index 43f5cab10..e9a0738b7 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/data/repository/StampRepositoryImpl.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/data/repository/StampRepositoryImpl.kt @@ -27,7 +27,7 @@ import org.sopt.official.stamp.util.ContentUriRequestBody import org.sopt.official.stamp.data.remote.api.StampService import org.sopt.official.stamp.domain.model.Archive import org.sopt.official.stamp.domain.repository.StampRepository -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel import javax.inject.Inject class StampRepositoryImpl @Inject constructor( diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/mission/Stamp.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/mission/Stamp.kt index 6ca367c3a..10b2a2ab5 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/mission/Stamp.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/mission/Stamp.kt @@ -52,7 +52,7 @@ enum class Stamp( val defaultStarColor: Color @Composable get() = SoptTheme.colors.onSurface30 - fun findStampByLevel(level: MissionLevel): Stamp = values().find { + fun findStampByLevel(level: MissionLevel): Stamp = entries.find { it.hasStampLevel(level) } ?: throw IllegalArgumentException("$level 에 해당하는 Stamp 가 없습니다.") } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/toolbar/Toolbar.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/toolbar/Toolbar.kt index c6600b26e..fdc8303a3 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/toolbar/Toolbar.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/toolbar/Toolbar.kt @@ -45,7 +45,7 @@ enum class ToolbarIconType( companion object { @Composable fun getResourceFrom(type: ToolbarIconType) = painterResource( - values().find { it.name == type.name }?.resId + entries.find { it.name == type.name }?.resId ?: throw IllegalArgumentException("There's no icon in this class. Icon: ${type.name}") ) } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/util/NoRippleClickable.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/util/NoRippleClickable.kt index 11ab54769..ea0a99cf6 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/util/NoRippleClickable.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/designsystem/component/util/NoRippleClickable.kt @@ -21,7 +21,10 @@ import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed -inline fun Modifier.noRippleClickable(crossinline onClick: () -> Unit): Modifier = composed { +inline fun Modifier.noRippleClickable( + modifier: Modifier = Modifier, + crossinline onClick: () -> Unit +): Modifier = composed { clickable( indication = null, interactionSource = remember { MutableInteractionSource() } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/MissionLevel.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/MissionLevel.kt index 108130eec..57cdcf08a 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/MissionLevel.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/MissionLevel.kt @@ -28,9 +28,7 @@ class MissionLevel private constructor( other as MissionLevel - if (value != other.value) return false - - return true + return value == other.value } override fun hashCode(): Int { diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/error/Error.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/error/Error.kt index 0b7ed12f9..0c002b4cd 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/error/Error.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/error/Error.kt @@ -19,5 +19,7 @@ sealed class Error( override val message: String? = null, override val cause: Throwable? = null ) : Exception(message, cause) { - data object NetworkUnavailable : Error() + data object NetworkUnavailable : Error() { + private fun readResolve(): Any = "NetworkUnavailable" + } } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/fake/FakeStampRepository.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/fake/FakeStampRepository.kt index 1d8793431..e9463485a 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/fake/FakeStampRepository.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/fake/FakeStampRepository.kt @@ -17,7 +17,7 @@ package org.sopt.official.stamp.domain.fake import org.sopt.official.stamp.domain.model.Archive import org.sopt.official.stamp.domain.repository.StampRepository -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel object FakeStampRepository : StampRepository { private val fakeArchive = Archive( diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/MissionsFilter.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/MissionsFilter.kt index a6ad02b37..13c76f700 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/MissionsFilter.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/MissionsFilter.kt @@ -25,8 +25,8 @@ enum class MissionsFilter( fun hasTitle(title: String) = (title == this.title) companion object { - fun getTitleOfMissionsList(): List = values().map { it.title } - fun findFilterOf(title: String) = values().find { it.hasTitle(title) } + fun getTitleOfMissionsList(): List = entries.map { it.title } + fun findFilterOf(title: String) = entries.find { it.hasTitle(title) } ?: throw IllegalArgumentException("$title 에 해당하는 필터가 없습니다.") } } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/User.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/User.kt deleted file mode 100644 index f70ff47cc..000000000 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/model/User.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2023 SOPT - Shout Our Passion Together - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sopt.official.stamp.domain.model - -data class User( - val userId: Int?, - val message: String?, - val statusCode: Int?, - val profileMessage: String? -) diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/repository/StampRepository.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/repository/StampRepository.kt index aa28fc70e..5e345d5d9 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/repository/StampRepository.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/domain/repository/StampRepository.kt @@ -16,7 +16,7 @@ package org.sopt.official.stamp.domain.repository import org.sopt.official.stamp.domain.model.Archive -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel interface StampRepository { suspend fun completeMission( diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetail.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetail.kt index db2e4b2cb..122628f82 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetail.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetail.kt @@ -64,7 +64,7 @@ import org.sopt.official.stamp.feature.ranking.getLevelBackgroundColor import org.sopt.official.stamp.feature.ranking.getLevelTextColor import org.sopt.official.stamp.feature.ranking.getRankTextColor import org.sopt.official.stamp.util.DefaultPreview -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel @MissionNavGraph @Destination("detail") diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetailViewModel.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetailViewModel.kt index b27fe5420..b2fbf35dd 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetailViewModel.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/MissionDetailViewModel.kt @@ -18,6 +18,7 @@ package org.sopt.official.stamp.feature.mission.detail import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.combine @@ -29,7 +30,7 @@ import kotlinx.coroutines.launch import org.sopt.official.stamp.designsystem.component.toolbar.ToolbarIconType import org.sopt.official.stamp.domain.model.Archive import org.sopt.official.stamp.domain.repository.StampRepository -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel import retrofit2.HttpException import timber.log.Timber import javax.inject.Inject @@ -59,6 +60,7 @@ data class PostUiState( } } +@OptIn(FlowPreview::class) @HiltViewModel class MissionDetailViewModel @Inject constructor( private val repository: StampRepository diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/component/ImageContent.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/component/ImageContent.kt index cd8b79126..3fb6d1b2a 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/component/ImageContent.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/detail/component/ImageContent.kt @@ -38,7 +38,7 @@ import androidx.compose.ui.unit.dp import coil.compose.AsyncImage import org.sopt.official.stamp.designsystem.component.util.noRippleClickable import org.sopt.official.stamp.designsystem.style.SoptTheme -import org.sopt.stamp.feature.mission.model.ImageModel +import org.sopt.official.stamp.feature.mission.model.ImageModel @OptIn(ExperimentalFoundationApi::class) @Composable diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/model/ImageModel.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/model/ImageModel.kt index 1d17eb752..af7ec089a 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/model/ImageModel.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/mission/model/ImageModel.kt @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.sopt.stamp.feature.mission.model +package org.sopt.official.stamp.feature.mission.model import android.net.Uri @@ -28,7 +28,7 @@ sealed interface ImageModel { override val size = uri.size } - object Empty : ImageModel { + data object Empty : ImageModel { override fun isEmpty() = true override val size = 1 } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/onboarding/OnboardingScreen.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/onboarding/OnboardingScreen.kt index adca69bd8..07782a6d8 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/onboarding/OnboardingScreen.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/onboarding/OnboardingScreen.kt @@ -71,7 +71,7 @@ private enum class OnBoardingPageUiModel( fun OnboardingScreen( navigator: DestinationsNavigator ) { - val onboardingPages = OnBoardingPageUiModel.values() + val onboardingPages = OnBoardingPageUiModel.entries.toTypedArray() val pageState = rememberPagerState { onboardingPages.size } SoptTheme { SoptColumn( diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/ranking/model/TopRankerDescriptionBubble.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/ranking/model/TopRankerDescriptionBubble.kt index afb74ec3b..e90e7fff5 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/ranking/model/TopRankerDescriptionBubble.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/ranking/model/TopRankerDescriptionBubble.kt @@ -52,7 +52,7 @@ enum class TopRankerDescriptionBubble( } companion object { - fun findBubbleByRank(rank: Int): TopRankerDescriptionBubble = values().find { it.hasRankOf(rank) } + fun findBubbleByRank(rank: Int): TopRankerDescriptionBubble = entries.find { it.hasRankOf(rank) } ?: throw IllegalStateException("$rank 는 상위 3위에 포함된 랭킹이 아닙니다.") } } diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/SettingScreenViewModel.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/SettingScreenViewModel.kt index f92b84dd7..a65ce4dd0 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/SettingScreenViewModel.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/SettingScreenViewModel.kt @@ -34,7 +34,7 @@ sealed interface SettingUiState { data class Success(val action: SettingScreenAction) : SettingUiState data class Failure(val throwable: Throwable) : SettingUiState data class Dialog(val action: SettingScreenAction) : SettingUiState - object Init : SettingUiState + data object Init : SettingUiState } @HiltViewModel diff --git a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/model/SectionUiModel.kt b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/model/SectionUiModel.kt index 7d3af3f00..4b14abd7a 100644 --- a/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/model/SectionUiModel.kt +++ b/feature/soptamp/src/main/java/org/sopt/official/stamp/feature/setting/model/SectionUiModel.kt @@ -50,5 +50,5 @@ sealed interface SectionUiModel { ) : SectionUiModel @Immutable - object Spacer : SectionUiModel + data object Spacer : SectionUiModel }