당직근무 0.16.1 (웹 2026-12-01.2): 날짜가 바뀌면 지난달 달력에 머물지 않고 이번 달로 넘어감
This commit is contained in:
1 parent
e678b8520b
commit
3060246e9f
18 files changed
+187
-36
No files matched your search
@@ -1,3 +1,10 @@
|
||||
# 0.16.1 · 웹 2026-12-01.2 · 2026년 12월 1일
|
||||
|
||||
- 앱을 열어 둔 채 날짜가 바뀌거나 며칠 만에 다시 열어도 달력이 지난달에 머물지 않습니다. 보던 달이 그 전 오늘의 달이었으면 이번 달로 넘어가고 고른 날도 오늘로 옮깁니다. 12월 1일인데 11월 달력의 회색 칸에 오늘이 보이던 문제입니다.
|
||||
- 달력 위젯은 지난달에 옮겨 둔 달을 버리고 이번 달을 보입니다. 이번 달로 다시 돌아오면 옮긴 기록을 지워 다음 달이 되면 따라갑니다.
|
||||
- 웹 달력도 열어 둔 채 자정이 지나면 같은 방식으로 이번 달로 넘어갑니다.
|
||||
- 직접 다른 달로 옮겨 둔 화면과 직접 고른 날짜는 그대로 둡니다.
|
||||
|
||||
# 0.16.0 · 웹 2026-12-01.1 · 2026년 12월 1일
|
||||
|
||||
- 관리자 페이지에 **공지** 메뉴를 따로 만들었습니다. 한 화면에서 공지 띠를 켜고 끄며 공지사항 글을 쓰고 고치고 고정합니다.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# 당직근무
|
||||
|
||||
제작자 블리어 (이창현) · 미리보기 0.16.0 · Android 8.0 이상
|
||||
제작자 블리어 (이창현) · 미리보기 0.16.1 · Android 8.0 이상
|
||||
|
||||
당직과 교대근무를 달력으로 확인하고 홈 화면에 계속 놓아두는 앱입니다. 본인의 근무표는 로그인 없이 사용할 수 있습니다. 서버가 잠시 멈춰도 기기에 저장한 근무와 일정 및 기념일은 그대로 사용합니다.
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@ android {
|
||||
applicationId = "kr.co.itosm.dutycalendar"
|
||||
minSdk = 26
|
||||
targetSdk = 36
|
||||
versionCode = 34
|
||||
versionName = "0.16.0"
|
||||
versionCode = 35
|
||||
versionName = "0.16.1"
|
||||
testInstrumentationRunner = "kr.co.itosm.dutycalendar.StorageSyncCheck"
|
||||
}
|
||||
buildTypes {
|
||||
|
||||
@@ -184,7 +184,7 @@ object WidgetAppearanceCheck {
|
||||
ScheduleStore.saveDisplay(app,current.dutyAsWeekday,current.showLunar,current.offAsHoliday,start,fromSync=true)
|
||||
for(dimensions in listOf(kind.width to kind.height,320 to 440)) {
|
||||
val (width,height)=dimensions
|
||||
positions.edit().putString("month_99004","2026-08").commit()
|
||||
positions.edit().putString("month_99004","2026-08").putString("monthBase_99004",java.time.YearMonth.now().toString()).commit()
|
||||
WidgetStyle.save(app,99004,WidgetStyle(monthFit=true,scale=scale,transparency=50))
|
||||
val options=Bundle().apply {
|
||||
putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,width);putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,width)
|
||||
@@ -235,15 +235,25 @@ object WidgetAppearanceCheck {
|
||||
for(kind in WidgetKind.entries) {
|
||||
val id=manager.getAppWidgetIds(kind.component(app)).firstOrNull()?:continue
|
||||
WidgetStyle.save(app,id,WidgetStyle(monthFit=true))
|
||||
positions.edit().putString("month_$id","2026-12").putInt("offset_$id",14).commit()
|
||||
val now=java.time.YearMonth.now()
|
||||
positions.edit().putString("month_$id",now.plusMonths(3).toString()).putString("monthBase_$id",now.toString()).putInt("offset_$id",14).commit()
|
||||
val receiver=kind.receiver.getDeclaredConstructor().newInstance()
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.NEXT).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(positions.getString("month_$id",null)=="2027-01")
|
||||
check(positions.getString("month_$id",null)==now.plusMonths(4).toString()&&positions.getString("monthBase_$id",null)==now.toString())
|
||||
check(positions.getInt("offset_$id",0)==14)
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.PREVIOUS).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(positions.getString("month_$id",null)=="2026-12")
|
||||
check(positions.getString("month_$id",null)==now.plusMonths(3).toString())
|
||||
// 지금 달로 돌아오면 저장을 지워 다음 달이 되면 위젯도 따라간다.
|
||||
positions.edit().putString("month_$id",now.plusMonths(1).toString()).commit()
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.PREVIOUS).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(!positions.contains("month_$id")&&!positions.contains("monthBase_$id")&&DutyWidget.selectedMonth(app,id)==now){"지금 달로 돌아온 위젯 저장"}
|
||||
// 지난달에 옮겨 둔 달은 버리고 지금 달을 보인다(2026-12-01: 12월 1일인데 11월 달력이 보이던 문제).
|
||||
positions.edit().putString("month_$id",now.minusMonths(1).toString()).putString("monthBase_$id",now.minusMonths(1).toString()).commit()
|
||||
check(DutyWidget.selectedMonth(app,id)==now){"지난달에 옮겨 둔 위젯 달"}
|
||||
positions.edit().putString("month_$id",now.minusMonths(1).toString()).remove("monthBase_$id").commit()
|
||||
check(DutyWidget.selectedMonth(app,id)==now){"옛 버전이 저장한 위젯 달"}
|
||||
receiver.onReceive(app,android.content.Intent(DutyWidget.TODAY).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,id))
|
||||
check(!positions.contains("month_$id")&&!positions.contains("offset_$id"))
|
||||
check(!positions.contains("month_$id")&&!positions.contains("monthBase_$id")&&!positions.contains("offset_$id"))
|
||||
WidgetStyle.save(app,id,WidgetStyle())
|
||||
}
|
||||
// 실제 홈 화면에 배치된 새 종류는 자신의 날짜 범위만 이동하고 오늘로 돌아와야 한다.
|
||||
@@ -260,7 +270,7 @@ object WidgetAppearanceCheck {
|
||||
}
|
||||
failure?.let{throw it}
|
||||
success=true
|
||||
message="근무 순서 이름 세 가지 표시와 줄마다 표시 및 옛 일반근무 이름 무시와 일반근무 글자 숨기기 확인. 네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 날짜 옆 + 없음과 연차 빨강·반차 파랑 숫자 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인."
|
||||
message="근무 순서 이름 세 가지 표시와 줄마다 표시 및 옛 일반근무 이름 무시와 일반근무 글자 숨기기 확인. 네 종류의 기본 배치와 한 달 전체 선택 확인. 월·일 시작과 80·100·120% 및 최소·확장 크기에서 42칸과 모든 날짜 및 마지막 주의 글자 높이와 생략 없음 확인. 날짜 옆 + 없음과 연차 빨강·반차 파랑 숫자 확인. 월 이동과 연말 넘김 및 오늘 복귀와 개별 저장 및 구버전 설정 보존 확인. 지난달에 옮겨 둔 위젯 달은 지금 달로 돌아옴 확인."
|
||||
} catch(error:Throwable) {message=error.stackTraceToString()}
|
||||
finally {
|
||||
val scheduleRestore=schedulePrefs.edit()
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import java.time.LocalDate
|
||||
import java.time.YearMonth
|
||||
|
||||
/**
|
||||
* 날짜가 바뀐 뒤 앱 첫 화면과 달력 위젯이 지난달에 머물지 않게 한다.
|
||||
* (2026-12-01 사용자 지적: 12월 1일인데 11월 달력의 회색 칸에 오늘이 표시됐다.)
|
||||
*
|
||||
* 앱 첫 화면: 보던 달과 고른 날이 그 전 '오늘'이었으면 새 오늘로 옮긴다. 사용자가 일부러 옮겨 둔 다른 달과 날짜는 그대로 둔다.
|
||||
* 달력 위젯: 달을 옮긴 때의 달(base)과 지금 달이 다르면 옮겨 둔 달을 버리고 지금 달을 보인다.
|
||||
*/
|
||||
object DayRollover {
|
||||
data class View(val month: YearMonth, val selected: LocalDate, val shownDay: LocalDate)
|
||||
|
||||
fun follow(view: View, today: LocalDate): View {
|
||||
if (today == view.shownDay) return view
|
||||
val month = if (view.month == YearMonth.from(view.shownDay)) YearMonth.from(today) else view.month
|
||||
val selected = if (view.selected == view.shownDay) today else view.selected
|
||||
return View(month, selected, today)
|
||||
}
|
||||
|
||||
/** 위젯에 저장한 달. 저장한 달이 없거나 읽지 못하거나 옮긴 때의 달이 지금 달과 다르면 지금 달이다. */
|
||||
fun widgetMonth(stored: String?, base: String?, now: YearMonth): YearMonth {
|
||||
val month = stored?.let { runCatching { YearMonth.parse(it) }.getOrNull() } ?: return now
|
||||
val from = base?.let { runCatching { YearMonth.parse(it) }.getOrNull() } ?: return now
|
||||
return if (from == now) month else now
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
override fun onAppWidgetOptionsChanged(context: Context, manager: AppWidgetManager, id: Int, options: Bundle) { update(context, manager, id) }
|
||||
override fun onDeleted(context: Context, ids: IntArray) {
|
||||
val editor = context.getSharedPreferences("widget", Context.MODE_PRIVATE).edit()
|
||||
ids.forEach { editor.remove("month_$it");editor.remove("offset_$it") }
|
||||
ids.forEach { editor.remove("month_$it");editor.remove("monthBase_$it");editor.remove("offset_$it") }
|
||||
editor.apply()
|
||||
context.getSharedPreferences("widget_style",0).edit().apply { ids.forEach { remove("style_$it") } }.apply()
|
||||
}
|
||||
@@ -47,8 +47,14 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
val kind=WidgetKind.of(context,id)
|
||||
val prefs = context.getSharedPreferences("widget", Context.MODE_PRIVATE)
|
||||
val editor = prefs.edit()
|
||||
if (action == TODAY) { editor.remove("month_$id");editor.remove("offset_$id") }
|
||||
else if(kind==WidgetKind.MONTH||WidgetStyle.load(context,id).monthFit)editor.putString("month_$id", selectedMonth(context, id).plusMonths(if (action == NEXT) 1 else -1).toString())
|
||||
if (action == TODAY) { editor.remove("month_$id");editor.remove("monthBase_$id");editor.remove("offset_$id") }
|
||||
else if(kind==WidgetKind.MONTH||WidgetStyle.load(context,id).monthFit) {
|
||||
// 옮긴 때의 달(monthBase)을 같이 둔다. 지금 달로 돌아오면 저장을 지워 다음 달이 되면 따라가게 한다.
|
||||
val now=YearMonth.now()
|
||||
val next=selectedMonth(context, id).plusMonths(if (action == NEXT) 1 else -1)
|
||||
if(next==now){editor.remove("month_$id");editor.remove("monthBase_$id")}
|
||||
else{editor.putString("month_$id", next.toString());editor.putString("monthBase_$id", now.toString())}
|
||||
}
|
||||
else {
|
||||
val step=if(kind==WidgetKind.WIDE)14 else 7
|
||||
editor.putInt("offset_$id",(prefs.getInt("offset_$id",0)+(if(action==NEXT)step else -step)).coerceIn(-36500,36500))
|
||||
@@ -76,10 +82,11 @@ open class DutyWidget : AppWidgetProvider() {
|
||||
R.id.day_28, R.id.day_29, R.id.day_30, R.id.day_31, R.id.day_32, R.id.day_33, R.id.day_34,
|
||||
R.id.day_35, R.id.day_36, R.id.day_37, R.id.day_38, R.id.day_39, R.id.day_40, R.id.day_41
|
||||
)
|
||||
// 저장된 월을 읽지 못해도 위젯을 비워 두지 않는다. 현재 달로 복구해 정상적인 표시를 유지한다.
|
||||
internal fun selectedMonth(context: Context, id: Int): YearMonth = runCatching {
|
||||
YearMonth.parse(context.getSharedPreferences("widget", Context.MODE_PRIVATE).getString("month_$id", YearMonth.now().toString()))
|
||||
}.getOrDefault(YearMonth.now())
|
||||
// 저장된 월을 읽지 못하거나 옮긴 때의 달이 지났으면 지금 달을 보인다(DayRollover.widgetMonth).
|
||||
internal fun selectedMonth(context: Context, id: Int): YearMonth {
|
||||
val prefs=context.getSharedPreferences("widget", Context.MODE_PRIVATE)
|
||||
return DayRollover.widgetMonth(prefs.getString("month_$id", null), prefs.getString("monthBase_$id", null), YearMonth.now())
|
||||
}
|
||||
|
||||
fun updateAll(context: Context) {
|
||||
val manager = AppWidgetManager.getInstance(context)
|
||||
|
||||
@@ -24,6 +24,12 @@ import java.util.Locale
|
||||
class MainActivity : Activity() {
|
||||
private var month = YearMonth.now()
|
||||
private var selectedDate = LocalDate.now()
|
||||
// 이 화면이 '오늘'로 삼은 날. 날짜가 바뀌면 DayRollover로 달과 고른 날을 새 오늘로 옮긴다.
|
||||
private var shownDay = LocalDate.now()
|
||||
private var watchingDay = false
|
||||
private val dayWatcher = object : android.content.BroadcastReceiver() {
|
||||
override fun onReceive(context: android.content.Context, intent: android.content.Intent) { if (followToday()) render() }
|
||||
}
|
||||
private val planner by lazy { PlannerDialogs(this) { render() } }
|
||||
private val peopleEditor by lazy { PeopleDialogs(this) { render() } }
|
||||
private val anniversaries by lazy { AnniversaryDialogs(this) { render() } }
|
||||
@@ -66,6 +72,7 @@ class MainActivity : Activity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
savedInstanceState?.getString("month")?.let { month = YearMonth.parse(it) }
|
||||
savedInstanceState?.getString("selectedDate")?.let { selectedDate = LocalDate.parse(it) }
|
||||
savedInstanceState?.getString("shownDay")?.let { shownDay = LocalDate.parse(it) }
|
||||
PlannerStore.migrate(this)
|
||||
if(savedInstanceState==null) receiveNavigation(intent)
|
||||
}
|
||||
@@ -80,9 +87,10 @@ class MainActivity : Activity() {
|
||||
setIntent(incoming);receiveNavigation(incoming)
|
||||
}
|
||||
override fun onDestroy() { WidgetStyleDialog.dismiss(this);super.onDestroy() }
|
||||
override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState); outState.putString("month", month.toString()); outState.putString("selectedDate", selectedDate.toString()) }
|
||||
override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState); outState.putString("month", month.toString()); outState.putString("selectedDate", selectedDate.toString()); outState.putString("shownDay", shownDay.toString()) }
|
||||
override fun onResume() {
|
||||
super.onResume(); render(); DutyWidget.updateAll(this); Reminders.reschedule(this)
|
||||
super.onResume(); followToday(); render(); DutyWidget.updateAll(this); Reminders.reschedule(this)
|
||||
watchDay(true)
|
||||
CalendarMirror.request(this)
|
||||
Holidays.schedule(this)
|
||||
val holidayRevision=Holidays.revision(this)
|
||||
@@ -91,7 +99,26 @@ class MainActivity : Activity() {
|
||||
SyncClient.foreground(this) { runOnUiThread { if (!isFinishing && !isDestroyed) render() } }
|
||||
UpdateChecker.check(this, fresh = true)
|
||||
}
|
||||
override fun onPause() { SyncClient.background(); super.onPause() }
|
||||
override fun onPause() { watchDay(false); SyncClient.background(); super.onPause() }
|
||||
/** 날짜가 바뀌었으면 true. 보던 달과 고른 날이 그 전 오늘이었으면 새 오늘로 옮긴다. */
|
||||
private fun followToday(): Boolean {
|
||||
val today = LocalDate.now()
|
||||
if (today == shownDay) return false
|
||||
val next = DayRollover.follow(DayRollover.View(month, selectedDate, shownDay), today)
|
||||
month = next.month; selectedDate = next.selected; shownDay = next.shownDay
|
||||
return true
|
||||
}
|
||||
// 화면을 켜 둔 채 자정을 넘기거나 시간대·시계를 바꿔도 달력이 지난날에 머물지 않게 한다. 화면이 보일 때만 듣는다.
|
||||
private fun watchDay(on: Boolean) {
|
||||
if (on == watchingDay) return
|
||||
watchingDay = on
|
||||
if (!on) { runCatching { unregisterReceiver(dayWatcher) }; return }
|
||||
val filter = android.content.IntentFilter().apply {
|
||||
addAction(android.content.Intent.ACTION_TIME_TICK); addAction(android.content.Intent.ACTION_DATE_CHANGED)
|
||||
addAction(android.content.Intent.ACTION_TIME_CHANGED); addAction(android.content.Intent.ACTION_TIMEZONE_CHANGED)
|
||||
}
|
||||
if (android.os.Build.VERSION.SDK_INT >= 33) registerReceiver(dayWatcher, filter, RECEIVER_NOT_EXPORTED) else registerReceiver(dayWatcher, filter)
|
||||
}
|
||||
override fun onWindowFocusChanged(hasFocus: Boolean) {
|
||||
super.onWindowFocusChanged(hasFocus)
|
||||
// 첫 실행에서는 onResume보다 창 표시가 늦을 수 있다. 저장된 새 버전도 창이 준비된 뒤 안내한다.
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package kr.co.itosm.dutycalendar
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import java.time.LocalDate
|
||||
import java.time.YearMonth
|
||||
|
||||
class DayRolloverTest {
|
||||
private val nov30 = LocalDate.of(2026, 11, 30)
|
||||
private val dec1 = LocalDate.of(2026, 12, 1)
|
||||
|
||||
@Test
|
||||
fun monthAndSelectedDayFollowNewToday() {
|
||||
val after = DayRollover.follow(DayRollover.View(YearMonth.of(2026, 11), nov30, nov30), dec1)
|
||||
assertEquals(DayRollover.View(YearMonth.of(2026, 12), dec1, dec1), after)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun openedLongAgoStillMovesToThisMonth() {
|
||||
val nov26 = LocalDate.of(2026, 11, 26)
|
||||
val after = DayRollover.follow(DayRollover.View(YearMonth.of(2026, 11), nov26, nov26), dec1)
|
||||
assertEquals(YearMonth.of(2026, 12), after.month)
|
||||
assertEquals(dec1, after.selected)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun movedMonthAndPickedDayStay() {
|
||||
val picked = LocalDate.of(2027, 1, 15)
|
||||
val after = DayRollover.follow(DayRollover.View(YearMonth.of(2027, 1), picked, nov30), dec1)
|
||||
assertEquals(YearMonth.of(2027, 1), after.month)
|
||||
assertEquals(picked, after.selected)
|
||||
assertEquals(dec1, after.shownDay)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun sameDayChangesNothing() {
|
||||
val view = DayRollover.View(YearMonth.of(2026, 10), LocalDate.of(2026, 10, 3), dec1)
|
||||
assertEquals(view, DayRollover.follow(view, dec1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun widgetMonthDropsOldNavigation() {
|
||||
val dec = YearMonth.of(2026, 12)
|
||||
assertEquals(dec, DayRollover.widgetMonth(null, null, dec))
|
||||
assertEquals(dec, DayRollover.widgetMonth("2026-11", null, dec))
|
||||
assertEquals(dec, DayRollover.widgetMonth("2026-11", "2026-11", dec))
|
||||
assertEquals(dec, DayRollover.widgetMonth("2027-02", "2026-11", dec))
|
||||
assertEquals(YearMonth.of(2027, 2), DayRollover.widgetMonth("2027-02", "2026-12", dec))
|
||||
assertEquals(dec, DayRollover.widgetMonth("망가진 값", "2026-12", dec))
|
||||
}
|
||||
}
|
||||
@@ -123,3 +123,11 @@ ANNUAL_LEAVE와 MONTHLY_LEAVE 및 VACATION과 OFFICIAL_LEAVE 및 FAMILY_LEAVE를
|
||||
공지 띠는 홈페이지 설정의 `noticeOn`·`noticeTone`·`noticeText`다. 서버 `site_admin.notice`가 켜진 공지의 글과 종류(info·warn)를 만들고 `GET /calendar/api/version`의 `notice`로 준다. 꺼져 있거나 글이 없으면 `text`가 빈 글자다. 웹 홈페이지는 지금처럼 `GET /calendar/api/site`로 그린다.
|
||||
|
||||
앱은 첫 화면을 열 때마다 하는 버전 확인(`UpdateChecker`) 응답에서 `notice`를 읽어 `Notice`로 정리하고 `site_notice` 기기 설정에 둔다. 바뀌었을 때만 첫 화면을 다시 그린다. 응답에 `notice`가 없으면(예전 서버) 보관한 공지를 그대로 둔다. 회원 인증값이나 개인 자료는 보내지 않는다.
|
||||
|
||||
## 날짜 넘김 · 0.16.1
|
||||
|
||||
앱 첫 화면은 보던 달(`month`)과 고른 날(`selectedDate`) 및 그 화면이 오늘로 삼은 날(`shownDay`)을 함께 둔다. 화면이 다시 보일 때와 화면이 보이는 동안의 시간 알림(1분마다·날짜·시각·시간대 변경)에서 날짜가 바뀌었으면 `DayRollover.follow`로 보던 달이 그 전 오늘의 달일 때만 이번 달로 옮기고 고른 날이 그 전 오늘일 때만 오늘로 옮긴다. 화면 상태를 복원할 때도 `shownDay`를 함께 저장한다.
|
||||
|
||||
달력 위젯은 달을 옮길 때 옮긴 달(`month_위젯번호`)과 옮긴 때의 달(`monthBase_위젯번호`)을 같이 둔다. 이번 달로 돌아오면 둘 다 지운다. `DayRollover.widgetMonth`는 옮긴 때의 달이 지금 달과 다르거나 없으면(예전 버전 저장) 지금 달을 보인다.
|
||||
|
||||
웹(`app.js`)은 `shownDay`를 두고 30초마다와 화면이 다시 보일 때 같은 규칙으로 옮긴다.
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# 새 버전 배포와 복구
|
||||
|
||||
제작자 블리어 (이창현) · 0.16.0
|
||||
제작자 블리어 (이창현) · 0.16.1
|
||||
|
||||
## 배포 위치
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# 당직근무 설치와 사용법
|
||||
|
||||
제작자 블리어 (이창현) · 0.16.0
|
||||
제작자 블리어 (이창현) · 0.16.1
|
||||
|
||||
## 설치와 처음 설정
|
||||
|
||||
|
||||
+5
-1
@@ -1,6 +1,6 @@
|
||||
# Android Studio로 당직근무 만들기
|
||||
|
||||
제작자 블리어 (이창현) · 0.16.0
|
||||
제작자 블리어 (이창현) · 0.16.1
|
||||
|
||||
## 준비할 환경
|
||||
|
||||
@@ -201,3 +201,7 @@ ANNUAL_LEAVE와 MONTHLY_LEAVE 및 VACATION과 OFFICIAL_LEAVE 및 FAMILY_LEAVE를
|
||||
## 0.16.0 공지 띠
|
||||
|
||||
`Notice.kt`가 서버 공지를 화면용으로 정리한다(줄바꿈·제어 문자는 빈칸, 200자까지, tone이 warn일 때만 주의). `UpdateChecker`는 `api/version` 응답의 `notice`를 `Notice.save`로 보관하고 바뀌면 `MainActivity.render`를 다시 부른다. 첫 화면은 상태 줄 아래와 오늘 카드 위에 홈페이지 공지 띠와 같은 색(안내 #E9EEF5 · 주의 #F8ECE5)으로 그린다. 단위 시험은 `NoticeTest`다.
|
||||
|
||||
## 0.16.1 날짜 넘김
|
||||
|
||||
`DayRollover.kt`가 날짜가 바뀐 뒤의 달과 고른 날 규칙을 맡는다. `MainActivity`는 `onResume`에서 `followToday()`를 부르고 화면이 보이는 동안 `ACTION_TIME_TICK`·`ACTION_DATE_CHANGED`·`ACTION_TIME_CHANGED`·`ACTION_TIMEZONE_CHANGED`를 동적 수신기로 듣는다(API 33 이상은 `RECEIVER_NOT_EXPORTED`). 위젯은 `DutyWidget.selectedMonth`가 `DayRollover.widgetMonth`로 저장한 달을 읽는다. 단위 시험은 `DayRolloverTest`이고 위젯 기기 시험(widgetCheck)은 지난달에 옮겨 둔 달과 예전 버전 저장이 지금 달로 돌아오는지 확인한다.
|
||||
+1
-1
@@ -36,7 +36,7 @@ DATA = Path(os.environ.get("DUTY_DATA", ROOT / "data"))
|
||||
DATA.mkdir(parents=True, exist_ok=True, mode=0o700)
|
||||
ORIGIN = os.environ.get("DUTY_ORIGIN", "https://duty.itosm.co.kr").rstrip("/")
|
||||
PREFIX = "/calendar"
|
||||
SERVER_VERSION = "0.16.0"
|
||||
SERVER_VERSION = "0.16.1"
|
||||
COOKIE = "__Secure-duty_session"
|
||||
pepper_file = DATA / "pairing.key"
|
||||
if not pepper_file.exists():
|
||||
|
||||
+8
-8
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"appVersion": "0.16.0",
|
||||
"appVersionCode": 34,
|
||||
"webVersion": "2026-12-01.1",
|
||||
"apkFile": "duty-calendar-0.16.0.apk",
|
||||
"appVersion": "0.16.1",
|
||||
"appVersionCode": 35,
|
||||
"webVersion": "2026-12-01.2",
|
||||
"apkFile": "duty-calendar-0.16.1.apk",
|
||||
"notes": [
|
||||
"운영진이 켠 공지 띠가 앱 첫 화면 맨 위에도 보입니다. 홈페이지 맨 위와 같은 글입니다.",
|
||||
"앱을 열 때마다 새 공지를 확인하고 연결이 없을 때는 마지막으로 받은 공지를 보여 줍니다.",
|
||||
"날짜가 바뀌면 앱 달력이 지난달에 머물지 않고 이번 달로 넘어갑니다. 12월 1일인데 11월 달력의 회색 칸에 오늘이 보이던 문제를 고쳤습니다.",
|
||||
"달력 위젯도 지난달에 옮겨 둔 달은 이번 달로 돌아옵니다. 직접 다른 달로 옮겨 둔 화면은 그대로 둡니다.",
|
||||
"Play 프로텍트 차단 해제가 확인된 버전은 아닙니다."
|
||||
],
|
||||
"apkBytes": 882130,
|
||||
"apkSha256": "ed53324179b2b96e04e315fc9d6dce1e0149fedae4e1b8c8ee9fef9a088cc7c9"
|
||||
"apkBytes": 884022,
|
||||
"apkSha256": "d83b3d822ffe55507b1022394b14a78ab5d3ef696b908717637eacb558aa757f"
|
||||
}
|
||||
@@ -260,9 +260,11 @@ class SiteAdminTest(unittest.TestCase):
|
||||
state = self.call("api/admin/brand", token=self.admin)[1]
|
||||
self.assertEqual((state["custom"]["source"], state["custom"]["candidate"], state["custom"]["by"]), ("candidate", cid, "관리자시험"))
|
||||
self.assertEqual(self.raw("brand/favicon")[1], "image/png")
|
||||
actions = [row["action"] for row in self.call("api/admin/log?area=site", token=self.admin)[1]["entries"]]
|
||||
# 두 기록은 같은 초에 남을 수 있어 순서는 보지 않는다(2026-11-25 전체 시험에서 한 번 뒤바뀜).
|
||||
self.assertEqual(set(actions[:2]), {"logo", "logo-import"})
|
||||
entries = self.call("api/admin/log?area=site", token=self.admin)[1]["entries"]
|
||||
# 작업 기록은 초 단위로만 정렬돼 앞선 시험(test_07)의 기록과 같은 초면 순서가 섞인다.
|
||||
# 순서 대신 이번 작업의 내용으로 찾는다(2026-11-25·12-01 전체 시험에서 순서 때문에 실패).
|
||||
self.assertTrue(any(row["action"] == "logo-import" and row["detail"].endswith("art.png") for row in entries), entries[:4])
|
||||
self.assertTrue(any(row["action"] == "logo" and cid in row["detail"] for row in entries), entries[:4])
|
||||
self.assertEqual(self.call("api/admin/brand-logo-reset", {}, token=self.admin)[0], 200)
|
||||
status, kind, _ = self.raw("api/admin/brand-candidate/" + cid, token=self.admin)
|
||||
self.assertEqual((status, kind), (200, "image/png"))
|
||||
|
||||
@@ -144,6 +144,12 @@ $('event-delete').onclick=async()=>{if(await confirmAction('이 일정을 삭제
|
||||
$('add').onclick=()=>openEvent();$('day-add').onclick=()=>openEvent();
|
||||
function moveMonth(step){const d=dayDate(month+'-01');d.setUTCMonth(d.getUTCMonth()+step);month=dateKey(d).slice(0,7);render();}
|
||||
$('prev').onclick=()=>moveMonth(-1);$('next').onclick=()=>moveMonth(1);$('today').onclick=()=>{selected=todayKey();month=selected.slice(0,7);render();};
|
||||
// 열어 둔 채 날짜가 바뀌면 보던 달과 고른 날이 그 전 오늘이었을 때 새 오늘로 옮긴다(2026-12-01: 12월 1일인데 11월 달력이 보이던 문제).
|
||||
let shownDay=selected;
|
||||
function followToday(){const today=todayKey();if(today===shownDay)return false;if(month===shownDay.slice(0,7))month=today.slice(0,7);if(selected===shownDay)selected=today;shownDay=today;return true;}
|
||||
setInterval(()=>{if(followToday())render();},30000);
|
||||
document.addEventListener('visibilitychange',()=>{if(!document.hidden&&followToday())render();});
|
||||
window.addEventListener('focus',()=>{if(followToday())render();});
|
||||
function drawRotation(pattern){$('rotation-count').value=pattern.length;$('rotation-days').replaceChildren();pattern.forEach((shift,index)=>{const label=text('label',(index+1)+'일째');const select=document.createElement('select');for(const [value,name] of shiftChoices()){const option=text('option',name);option.value=value;select.append(option);}select.value=shift;label.append(select);$('rotation-days').append(label);});}
|
||||
$('rotation').onclick=()=>{const r=rotation()??{anchor:todayKey(),pattern:['DUTY','OFF']};$('rotation-anchor').value=r.anchor;$('rotation-work-week').value=String(r.workWeek||6);resetPatternMode('rotation');drawRotation(r.pattern);$('rotation-error').textContent='';$('rotation-dialog').showModal();};
|
||||
$('rotation-form').onsubmit=event=>{event.preventDefault();const pattern=[...$('rotation-days').querySelectorAll('select')].map(node=>node.value);if(pattern.length!==Number($('rotation-count').value)){$('rotation-error').textContent='반복 일수를 확인해 주세요.';return;}// 근무 순서 이름은 따로 된 창에서 넣는다. 순서 길이가 그대로면 넣어 둔 이름을 남기고 바뀌면 비운다.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<main>
|
||||
<section id="welcome" class="welcome">
|
||||
<div class="welcome-hero">
|
||||
<div class="welcome-copy"><p class="eyebrow" data-site="heroEyebrow">당직 · 교대근무 · 개인 일정</p><h1 data-site="heroTitle">다음 당직,<br>달력에서 바로.</h1><p class="intro" data-site="heroIntro">내 근무 순서대로 채워지는 달력.<br>휴대폰을 켜면 홈 화면에서 바로 확인하세요.</p><div class="welcome-actions"><a class="download-button" data-site-href="downloadUrl" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12m-5-5 5 5 5-5M5 16v5h14v-5"/></svg><span data-site="downloadLabel">안드로이드 앱 받기</span></a><a class="install-link" href="#install-guide">설치 안내</a></div><p class="download-meta"><a data-site-href="downloadUrl" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47">공식 배포 · 소스 · 제작 매뉴얼</a><br>Android 8.0 이상 · 미리보기 0.16.0</p><div class="welcome-caption"><strong data-site="captionTitle">내 달력은 로그인 없이.</strong><p data-site="captionText">함께 보는 근무표와 소속 공유는 <br>회원 로그인 후 이용할 수 있습니다.</p></div></div>
|
||||
<div class="welcome-copy"><p class="eyebrow" data-site="heroEyebrow">당직 · 교대근무 · 개인 일정</p><h1 data-site="heroTitle">다음 당직,<br>달력에서 바로.</h1><p class="intro" data-site="heroIntro">내 근무 순서대로 채워지는 달력.<br>휴대폰을 켜면 홈 화면에서 바로 확인하세요.</p><div class="welcome-actions"><a class="download-button" data-site-href="downloadUrl" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3v12m-5-5 5 5 5-5M5 16v5h14v-5"/></svg><span data-site="downloadLabel">안드로이드 앱 받기</span></a><a class="install-link" href="#install-guide">설치 안내</a></div><p class="download-meta"><a data-site-href="downloadUrl" href="https://forum.itosm.co.kr/c/web-apps/duty-calendar/47">공식 배포 · 소스 · 제작 매뉴얼</a><br>Android 8.0 이상 · 미리보기 0.16.1</p><div class="welcome-caption"><strong data-site="captionTitle">내 달력은 로그인 없이.</strong><p data-site="captionText">함께 보는 근무표와 소속 공유는 <br>회원 로그인 후 이용할 수 있습니다.</p></div></div>
|
||||
<figure class="calendar-preview" aria-label="3당직근무 화면 예시">
|
||||
<figcaption><span>홈 화면에 두는 나의 근무표</span><span>화면 예시</span></figcaption>
|
||||
<div class="calendar-paper"><div class="paper-heading"><div><span class="paper-year">2026</span><strong>11<span>월</span></strong></div><div class="paper-note"><b>당직근무</b><span>당직 · 비번 · 일반근무</span></div></div><div class="sample-week"><span>일</span><span>월</span><span>화</span><span>수</span><span>목</span><span>금</span><span>토</span></div><div class="sample-grid"><div class="sample-day sun"><span>1</span><em class="off">비번</em></div><div class="sample-day"><span>2</span><em class="regular">일반</em></div><div class="sample-day"><span>3</span><em class="duty">당직</em></div><div class="sample-day"><span>4</span><em class="off">비번</em></div><div class="sample-day"><span>5</span><em class="regular">일반</em></div><div class="sample-day"><span>6</span><em class="duty">당직</em></div><div class="sample-day sat"><span>7</span><em class="off">비번</em></div><div class="sample-day sun"><span>8</span><em class="regular">일반</em></div><div class="sample-day"><span>9</span><em class="duty">당직</em></div><div class="sample-day"><span>10</span><em class="off">비번</em></div><div class="sample-day"><span>11</span><em class="regular">일반</em></div><div class="sample-day"><span>12</span><em class="duty">당직</em></div><div class="sample-day"><span>13</span><em class="off">비번</em></div><div class="sample-day sat"><span>14</span><em class="regular">일반</em></div><div class="sample-day sun"><span>15</span><em class="duty">당직</em></div><div class="sample-day"><span>16</span><em class="off">비번</em></div><div class="sample-day"><span>17</span><em class="regular">일반</em></div><div class="sample-day"><span>18</span><em class="duty">당직</em></div><div class="sample-day"><span>19</span><em class="off">비번</em></div><div class="sample-day"><span>20</span><em class="regular">일반</em></div><div class="sample-day sat picked"><span>21</span><em class="duty">당직</em></div><div class="sample-day sun"><span>22</span><em class="off">비번</em></div><div class="sample-day"><span>23</span><em class="regular">일반</em></div><div class="sample-day"><span>24</span><em class="duty">당직</em></div><div class="sample-day"><span>25</span><em class="off">비번</em></div><div class="sample-day"><span>26</span><em class="regular">일반</em></div><div class="sample-day"><span>27</span><em class="duty">당직</em></div><div class="sample-day sat"><span>28</span><em class="off">비번</em></div><div class="sample-day sun"><span>29</span><em class="regular">일반</em></div><div class="sample-day"><span>30</span><em class="duty">당직</em></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div><div class="sample-day empty-day" aria-hidden="true"></div></div><div class="paper-footer"><span><i></i>선택한 날 · 11월 21일 당직</span><span>3일 반복</span></div></div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
'use strict';
|
||||
const WEB_BUILD = '2026-12-01.1';
|
||||
const WEB_BUILD = '2026-12-01.2';
|
||||
let offeredRelease=null, versionChecking=false;
|
||||
const versionDeferKey='duty-web-update-later';
|
||||
const versionSeenKey='duty-web-update-seen';
|
||||
|
||||
Reference in new issue
Block a user