fix: 연차/반년 최초 적용 타이밍 문제 수정
- setOverride 후 updateRemainingAnnualLeave()를 먼저 호출하고 updateCalendar() 호출 - 연차 계산이 완료된 후 화면 갱신되도록 순서 변경 Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -187,21 +187,21 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
val prefs = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
val prefs = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE)
|
||||||
currentViewTeam = prefs.getString(KEY_TEAM, "A") ?: "A"
|
currentViewTeam = prefs.getString(KEY_TEAM, "A") ?: "A"
|
||||||
|
|
||||||
updateTideButtonVisibility()
|
updateTideButtonVisibility()
|
||||||
updateCalendar()
|
updateCalendar()
|
||||||
|
|
||||||
// 일원화된 통합 권한 체크 실행 (신뢰도 100% 보장)
|
// 일원화된 통합 권한 체크 실행 (신뢰도 100% 보장)
|
||||||
AlarmPermissionUtil.checkAndRequestAllPermissions(this)
|
AlarmPermissionUtil.checkAndRequestAllPermissions(this)
|
||||||
|
|
||||||
// 설정 변경 시 즉시 반영을 위한 강제 동기화 (30일 스케줄링)
|
// 설정 변경 시 즉시 반영을 위한 강제 동기화 (30일 스케줄링)
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
syncAllAlarms(this@MainActivity)
|
syncAllAlarms(this@MainActivity)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 연차 정보 업데이트
|
// 연차 정보 업데이트
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
@@ -213,16 +213,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.tvAnnualLeave.text = "연차: --"
|
binding.tvAnnualLeave.text = "연차: --"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lifecycleScope.launch {
|
}
|
||||||
val repo = ShiftRepository(this@MainActivity)
|
|
||||||
val annualLeave = repo.getAnnualLeave()
|
|
||||||
annualLeave?.let {
|
|
||||||
binding.tvAnnualLeave.text = "연차: ${String.format("%.1f", it.remainingDays)}"
|
|
||||||
} ?: run {
|
|
||||||
binding.tvAnnualLeave.text = "연차: --"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showMonthYearPicker() {
|
private fun showMonthYearPicker() {
|
||||||
val dialogView = layoutInflater.inflate(R.layout.dialog_month_year_picker, null)
|
val dialogView = layoutInflater.inflate(R.layout.dialog_month_year_picker, null)
|
||||||
@@ -334,15 +325,9 @@ class MainActivity : AppCompatActivity() {
|
|||||||
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.warning_red))
|
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.warning_red))
|
||||||
} else {
|
} else {
|
||||||
binding.todayStatusText.text = "오늘의 근무: $shiftForViewingTeam$teamSuffix"
|
binding.todayStatusText.text = "오늘의 근무: $shiftForViewingTeam$teamSuffix"
|
||||||
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
|
binding.todayStatusText.setTextColor(androidx.core.content.ContextCompat.getColor(this@MainActivity, R.color.text_secondary))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update Annual Leave display
|
|
||||||
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
|
||||||
annualLeave?.let {
|
|
||||||
binding.tvAnnualLeave.text = "연차: ${String.format("%.1f", it.remainingDays)}"
|
|
||||||
} ?: run {
|
|
||||||
binding.tvAnnualLeave.text = "연차: --"
|
|
||||||
// Update Annual Leave display
|
// Update Annual Leave display
|
||||||
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
val annualLeave = withContext(Dispatchers.IO) { repo.getAnnualLeave() }
|
||||||
annualLeave?.let {
|
annualLeave?.let {
|
||||||
@@ -350,7 +335,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
} ?: run {
|
} ?: run {
|
||||||
binding.tvAnnualLeave.text = "연차: --"
|
binding.tvAnnualLeave.text = "연차: --"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
updateOtherTeamsLayout(today, factory, prefs)
|
updateOtherTeamsLayout(today, factory, prefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,10 +636,11 @@ class MainActivity : AppCompatActivity() {
|
|||||||
else -> {
|
else -> {
|
||||||
// New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time
|
// New Types: 월차, 연차, 반월, 반년, 교육 -> Saved as Override with no time
|
||||||
repo.setOverride(date, selected, team, factory)
|
repo.setOverride(date, selected, team, factory)
|
||||||
|
// 연차 계산을 먼저 수행하고 달력 업데이트
|
||||||
|
repo.updateRemainingAnnualLeave()
|
||||||
updateCalendar()
|
updateCalendar()
|
||||||
syncAllAlarms(this)
|
syncAllAlarms(this)
|
||||||
android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show()
|
android.widget.Toast.makeText(this, "${selected}(으)로 기록되었습니다. 알람이 해제됩니다.", android.widget.Toast.LENGTH_SHORT).show()
|
||||||
repo.updateRemainingAnnualLeave()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user