68fed087-9049-446f-bfc5-3f8.../Sources/WorkerPlugin.swift
徐翔宇 959580c55e v0.1.0: initial 摸鱼侠 — Worker Toolkit plugin for MioIsland
Office-survival toolkit. Five tabs in the notch:
- 🍅 番茄钟: 25/5 focus/break with circular ring timer + tally.
- 🪑 久坐: count-up since last break, dock-bounce alert at 45min.
- 💧 喝水: animated cup, daily goal tracking with progress dots.
- 🏃 下班: H:M:S countdown to clock-out hour with gradient bar.
- 🎉 周末: 天/时/分 to next Saturday + rotating 打工语录.

100% local. UNUserNotificationCenter for alerts, dock-bounce
fallback when authorization denied. UserDefaults persistence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-27 20:21:12 +08:00

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.1.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
}
}