mirror of
https://github.com/carey314/mio-plugin-worker.git
synced 2026-08-10 07:04:32 +00:00
Three things squashed into one commit since they're all release-prep:
1. Bump CFBundleVersion 2 → 3, CFBundleShortVersionString 0.2.0 →
0.3.0, WorkerPlugin.version & ExpandedView footer string to match.
Aligns with the 5-feature v0.3.0 ship.
2. fix(water): lastWaterReminderHr was an Int hour (0-23) so a
yesterday-fired 17:00 blocked today's 17:00 reminder. Now stores
"yyyy-MM-dd HH" composite key so dedupe is scoped per-day.
3. Holidays.swift: 2026 entry table re-calibrated per typical
State Council 调休 pattern. Notable changes:
- 春节 starts on 除夕 02-16 (not 初一 02-17) per 2024 policy
- 中秋 + 国庆 merged into 10-day 09-25 ~ 10-04 window (since
2026 中秋 09-25 is 6 days before 国庆 10-01)
- 劳动节 renamed from "五一" for clarity
Disclaimer still in header: verify against 国务院 announcement
when published, edit + re-release if 调休 differs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
965 B
Swift
39 lines
965 B
Swift
//
|
|
// WorkerPlugin.swift
|
|
// Mio Island plugin: 摸鱼侠
|
|
//
|
|
// Principal class. Module = WorkerPlugin, Class = WorkerPlugin →
|
|
// NSPrincipalClass = "WorkerPlugin.WorkerPlugin".
|
|
//
|
|
|
|
import AppKit
|
|
import SwiftUI
|
|
|
|
final class WorkerPlugin: NSObject, MioPlugin {
|
|
var id: String { "worker" }
|
|
var name: String { "摸鱼侠" }
|
|
var icon: String { "fish.fill" }
|
|
var version: String { "0.3.0" }
|
|
|
|
func activate() {
|
|
WorkerDebugLog.write("plugin activate")
|
|
Task { @MainActor in
|
|
WorkerStore.shared.start()
|
|
WorkerNotificationCenter.shared.requestAuthorizationIfNeeded()
|
|
}
|
|
}
|
|
|
|
func deactivate() {
|
|
WorkerDebugLog.write("plugin deactivate")
|
|
Task { @MainActor in
|
|
WorkerStore.shared.stop()
|
|
}
|
|
}
|
|
|
|
func makeView() -> NSView {
|
|
let view = NSHostingView(rootView: ExpandedView())
|
|
view.autoresizingMask = [.width, .height]
|
|
return view
|
|
}
|
|
}
|