Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
## 🤖 Android
- Android Studio : Android Studio Koala | 2024.1.1
- JDK : 17
- minSDK : 23
- minSDK : 28
- targetSDK : 35

## 🐚 Convertion
Expand Down
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ android {
// S21: API 33
defaultConfig {
applicationId = "com.eatssu.android"
minSdk = 23
minSdk = 28
targetSdk = 35
versionCode = 35
versionName = "2.1.15"
Expand Down Expand Up @@ -52,8 +52,8 @@ android {
buildConfigField("String", "NAVER_MAPS_CLIENT_ID", "\"$naverMapsClientID\"")
manifestPlaceholders["NAVER_MAPS_CLIENT_ID"] = naverMapsClientID

isShrinkResources = false
isMinifyEnabled = false
isShrinkResources = true
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}

Expand Down
23 changes: 23 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,26 @@
# https://developers.kakao.com/docs/latest/en/getting-started/sdk-android#configure-for-shrinking-and-obfuscation-(optional)
-keep class com.kakao.sdk.**.model.* { <fields>; }
-keep class * extends com.google.gson.TypeAdapter

# https://firebase.google.com/docs/database/android/start?hl=ko
-keepattributes Signature

-keep class com.eatssu.android.data.dto.** {
*;
}
-keep class com.eatssu.android.data.enums.** {
*;
}

# https://github.com/square/okhttp/pull/6792
-dontwarn org.bouncycastle.jsse.**
-dontwarn org.conscrypt.*
-dontwarn org.openjsse.**

# refrofit2 (with r8 full mode)
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
-if interface * { @retrofit2.http.* public *** *(...); }
-keep,allowoptimization,allowshrinking,allowobfuscation class <3>
-keep,allowobfuscation,allowshrinking class retrofit2.Response
25 changes: 10 additions & 15 deletions app/src/main/java/com/eatssu/android/alarm/NotificationReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import com.eatssu.android.R
import com.eatssu.android.presentation.login.IntroActivity
Expand All @@ -16,7 +14,6 @@ import java.time.LocalDateTime

class NotificationReceiver : BroadcastReceiver() {

@RequiresApi(Build.VERSION_CODES.O)
override fun onReceive(context: Context, intent: Intent) {
// 현재 요일이 평일인 경우에만 알림을 발송
val currentDay = LocalDateTime.now().dayOfWeek
Expand All @@ -29,19 +26,17 @@ class NotificationReceiver : BroadcastReceiver() {
val notificationManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val channel = NotificationChannel(
CHANNEL_ID,
"점심시간 전 알림",
NotificationManager.IMPORTANCE_HIGH // 중요도를 높게 설정
).apply {
description = "점심시간 전, 푸시알림을 발송합니다."
enableLights(true)
enableVibration(true) // 진동도 활성화
lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC // 잠금 화면에서도 표시
}
notificationManager.createNotificationChannel(channel)
val channel = NotificationChannel(
CHANNEL_ID,
"점심시간 전 알림",
NotificationManager.IMPORTANCE_HIGH // 중요도를 높게 설정
).apply {
description = "점심시간 전, 푸시알림을 발송합니다."
enableLights(true)
enableVibration(true) // 진동도 활성화
lockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC // 잠금 화면에서도 표시
}
notificationManager.createNotificationChannel(channel)


val intent = Intent(context, IntroActivity::class.java).apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import android.os.SystemClock
import android.view.MenuItem
import android.view.View.GONE
import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
Expand Down Expand Up @@ -40,7 +39,6 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
private val mainViewModel: MainViewModel by viewModels()
private val myPageViewModel: MyPageViewModel by viewModels()

@RequiresApi(Build.VERSION_CODES.O)
@SuppressLint("SuspiciousIndentation")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.eatssu.android.presentation.cafeteria

import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import androidx.annotation.RequiresApi
import androidx.fragment.app.activityViewModels
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
Expand Down Expand Up @@ -38,7 +36,6 @@ class CafeteriaFragment : BaseFragment<FragmentCafeteriaBinding>(), OnItemListen
return FragmentCafeteriaBinding.inflate(layoutInflater)
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand Down Expand Up @@ -84,7 +81,6 @@ class CafeteriaFragment : BaseFragment<FragmentCafeteriaBinding>(), OnItemListen
monthYearText = binding.monthYearTV
}

@RequiresApi(Build.VERSION_CODES.O)
private fun setWeekView() {
monthYearText?.text = CalendarUtil.selectedDate?.let { monthYearFromDate(it) }
val days = CalendarUtil.selectedDate?.let { daysInWeekArray(it) }
Expand All @@ -95,7 +91,6 @@ class CafeteriaFragment : BaseFragment<FragmentCafeteriaBinding>(), OnItemListen
calendarRecyclerView?.adapter = calendarAdapter
}

@RequiresApi(Build.VERSION_CODES.O)
fun setCalendarWeekClickListener() {
binding.btnPreviousWeek.setOnClickListener {
CalendarUtil.selectedDate = CalendarUtil.selectedDate.minusWeeks(1)
Expand All @@ -110,7 +105,6 @@ class CafeteriaFragment : BaseFragment<FragmentCafeteriaBinding>(), OnItemListen
}
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onItemClick(position: Int, date: LocalDate) {
CalendarUtil.selectedDate = date
mainViewModel.setData(date)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.eatssu.android.presentation.cafeteria

import android.os.Build
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.viewpager2.adapter.FragmentStateAdapter
Expand Down Expand Up @@ -35,7 +33,6 @@ class CafeteriaViewPagerAdapter(fragmentActivity: FragmentActivity) :
}

// 4. 디폴트로 노출할 Fragment의 위치를 설정
@RequiresApi(Build.VERSION_CODES.O)
fun getDefaultFragmentPosition(): Int {
// 여기에서 디폴트로 노출할 Fragment의 위치를 반환해줍니다.
// 예를 들어, 첫 번째 Fragment를 디폴트로 설정하려면 0을 반환합니다.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.eatssu.android.presentation.cafeteria.calendar

import android.os.Build
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.eatssu.android.R
Expand Down Expand Up @@ -34,7 +32,6 @@ internal class CalendarAdapter(
}


@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: CalendarViewHolder, position: Int) {
val date = days[position]
holder.dayOfMonth.text = date.dayOfMonth.toString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.eatssu.android.presentation.cafeteria.menu

import android.os.Build
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
Expand Down Expand Up @@ -69,7 +67,6 @@ class MenuFragment : Fragment() {
return binding.root
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand All @@ -82,7 +79,6 @@ class MenuFragment : Fragment() {
observeViewModel()
}

@RequiresApi(Build.VERSION_CODES.O)
fun observeViewModel() {
mainViewModel.getData().observe(viewLifecycleOwner) { dataReceived ->

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.eatssu.android.presentation.cafeteria.review.write.menu

import android.content.Intent
import android.os.Build
import android.os.Bundle
import androidx.activity.viewModels
import androidx.annotation.RequiresApi
import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.LinearLayoutManager
import com.eatssu.android.databinding.ActivityReviewWriteMenuBinding
Expand All @@ -24,7 +22,6 @@ class ReviewWriteMenuActivity :

private lateinit var variableMenuPickAdapter: VariableMenuPickAdapter

@RequiresApi(Build.VERSION_CODES.O)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
toolbarTitle.text = "리뷰 남기기" // 툴바 제목 설정
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import android.os.Bundle
import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AlertDialog
import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels
Expand All @@ -20,8 +19,8 @@ import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import com.eatssu.android.R
import com.eatssu.android.databinding.FragmentMyPageBinding
import com.eatssu.android.presentation.base.BaseFragment
import com.eatssu.android.presentation.MainViewModel
import com.eatssu.android.presentation.base.BaseFragment
import com.eatssu.android.presentation.login.LoginActivity
import com.eatssu.android.presentation.mypage.myreview.MyReviewListActivity
import com.eatssu.android.presentation.mypage.terms.WebViewActivity
Expand All @@ -43,7 +42,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
return FragmentMyPageBinding.inflate(layoutInflater)
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

Expand All @@ -52,7 +50,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
setOnClickListener()
}

@RequiresApi(Build.VERSION_CODES.O)
private fun setupObservers() {
viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.STARTED) {
Expand All @@ -73,7 +70,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun handleAlarmSwitchChange(isChecked: Boolean) {
val nowDatetime = LocalDateTime.now()
val formattedDate = nowDatetime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"))
Expand All @@ -91,7 +87,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun setOnClickListener() {
binding.llMyInfo.setOnClickListener {
startActivity(Intent(requireContext(), UserInfoActivity::class.java))
Expand Down Expand Up @@ -137,7 +132,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun showNotificationPermissionDialog() {
AlertDialog.Builder(requireContext())
.setTitle("알림 권한 필요")
Expand Down Expand Up @@ -182,7 +176,6 @@ class MyPageFragment : BaseFragment<FragmentMyPageBinding>() {
}
}

@RequiresApi(Build.VERSION_CODES.O)
private fun openAppNotificationSettings(context: Context) {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
package com.eatssu.android.presentation.util

import android.os.Build
import androidx.annotation.RequiresApi
import java.text.SimpleDateFormat
import java.time.DayOfWeek
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.Calendar
import java.util.Date
import java.util.Locale


object CalendarUtil {
lateinit var selectedDate: LocalDate

@RequiresApi(Build.VERSION_CODES.O)
fun monthYearFromDate(date: LocalDate): String {
val formatter = DateTimeFormatter.ofPattern("yyyy.MM")
return date.format(formatter)
}

@RequiresApi(Build.VERSION_CODES.O)
fun daysInWeekArray(selectedDate: LocalDate): ArrayList<LocalDate> {
val days = ArrayList<LocalDate>()
var current = sundayForDate(selectedDate)
Expand All @@ -32,7 +27,6 @@ object CalendarUtil {
return days
}

@RequiresApi(Build.VERSION_CODES.O)
private fun sundayForDate(current: LocalDate): LocalDate? {
var current = current
val oneWeekAgo = current.minusWeeks(1)
Expand All @@ -50,15 +44,8 @@ object CalendarUtil {
}

fun getNextDayDate(): String {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val nextDay = LocalDate.now().plusDays(1)
val formatter = DateTimeFormatter.ofPattern("yyyyMMdd", Locale.getDefault())
nextDay.format(formatter)
} else {
val calendar = Calendar.getInstance()
calendar.add(Calendar.DAY_OF_MONTH, 1)
val formatter = SimpleDateFormat("yyyyMMdd", Locale.getDefault())
formatter.format(calendar.time)
}
val nextDay = LocalDate.now().plusDays(1)
val formatter = DateTimeFormatter.ofPattern("yyyyMMdd", Locale.getDefault())
return nextDay.format(formatter)
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package com.eatssu.android.presentation.widget

import android.content.Context
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.glance.GlanceId
import androidx.glance.appwidget.GlanceAppWidgetManager
import androidx.glance.appwidget.state.updateAppWidgetState
Expand Down Expand Up @@ -32,7 +30,6 @@ class MealWorker @AssistedInject constructor(
companion object {
private val uniqueWorkName = MealWorker::class.java.simpleName

@RequiresApi(Build.VERSION_CODES.O)
fun enqueue(context: Context) {
val manager = WorkManager.getInstance(context)
val requestBuilder = PeriodicWorkRequestBuilder<MealWorker>(
Expand All @@ -48,7 +45,6 @@ class MealWorker @AssistedInject constructor(
}
}

@RequiresApi(Build.VERSION_CODES.O)
override suspend fun doWork(): Result {
val manager = GlanceAppWidgetManager(context)
val glanceIds = manager.getGlanceIds(MealWidget::class.java)
Expand Down
Loading