1.4 KiB
1.4 KiB
Sub2API Monitor
Android home-screen widget prototype for monitoring Sub2API usage and service status.
Current Scope
- Native Android app in Kotlin.
- Jetpack Compose configuration screen.
- Jetpack Glance home-screen widget.
- Local configuration with DataStore.
- Mock Sub2API monitoring data.
- Manual widget refresh action.
- WorkManager refresh scheduling boundary.
- Last successful snapshot is preserved when refresh fails.
Configuration
The app lets the user enter:
- Sub2API base URL.
- Admin key.
- Automatic refresh interval in minutes.
The admin key is stored locally through DataStore and is not rendered in the widget.
Widget States
- Missing configuration: shows
请先配置 Sub2API. - Configured with data: shows dashboard metrics, recent calls, model TOP4, and lifetime totals.
- Refresh failure: stores the error while keeping the last successful snapshot visible.
Replacing Mock Data
The first real integration should replace MockSub2ApiRepository with a network-backed implementation of Sub2ApiRepository. Keep the widget and Compose UI consuming Sub2ApiSnapshot so the rendering layer does not need structural changes.
Build
Open this folder in Android Studio or run:
.\gradlew :app:assembleDebug
This workspace currently does not include a Gradle wrapper jar. If Android Studio is used, let it sync the Gradle project and generate/use its configured Gradle installation.