Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26d200e282 | ||
|
|
ce0579b672 | ||
|
|
14389f025f | ||
|
|
0a449cf9a3 | ||
|
|
c5dd6ff4a1 | ||
|
|
da59ffec34 | ||
|
|
9ef46c7c95 | ||
|
|
45805b9093 |
No files matched your search
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"cmake.sourceDirectory": "/Users/mbocquet/PRIVATE Documents/git/code-igox/busylight-buddy/windows"
|
||||||
|
}
|
||||||
@@ -2,20 +2,19 @@
|
|||||||
|
|
||||||
Multiplatform Flutter app to control your DIY [BusyLight](https://code.igox.org/iGoX/busylight) (ESP32 + MicroPython + Microdot).
|
Multiplatform Flutter app to control your DIY [BusyLight](https://code.igox.org/iGoX/busylight) (ESP32 + MicroPython + Microdot).
|
||||||
|
|
||||||
Supports **iOS**, **ipadOS**, **Android**, **macOS**, and **Windows**.
|
Supports **Android**, **macOS**, and **Windows**.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Downloads
|
## Downloads
|
||||||
|
|
||||||
[](https://code.igox.org/iGoX/busylight-buddy/releases/download/v0.0.1/BusyLight-Buddy-Installer.exe)
|
[](https://code.igox.org/iGoX/busylight-buddy/releases/)
|
||||||
[](https://code.igox.org/iGoX/busylight-buddy/releases/download/v0.0.1/org.igox.apps.android.busylight-buddy-release.apk)
|
[](https://code.igox.org/iGoX/busylight-buddy/releases/)
|
||||||
|
[](https://code.igox.org/iGoX/busylight-buddy/releases/)
|
||||||
Or browse all releases on the [Releases page](https://code.igox.org/iGoX/busylight-buddy/releases).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Screenshots (iOS)
|
## Screenshots
|
||||||
|
|
||||||
<img src="doc/screenshots/ios-screenshot-main.png" width="300" alt="BusyLight Companion — main screen" /> <img src="doc/screenshots/ios-screenshot-config.png" width="300" alt="BusyLight Companion — settings" />
|
<img src="doc/screenshots/ios-screenshot-main.png" width="300" alt="BusyLight Companion — main screen" /> <img src="doc/screenshots/ios-screenshot-config.png" width="300" alt="BusyLight Companion — settings" />
|
||||||
|
|
||||||
@@ -39,14 +38,15 @@ Or browse all releases on the [Releases page](https://code.igox.org/iGoX/busylig
|
|||||||
### Brightness
|
### Brightness
|
||||||
- Brightness slider (0–100%)
|
- Brightness slider (0–100%)
|
||||||
|
|
||||||
### Background polling
|
### Live updates
|
||||||
- Automatically pulls status + color from device at a configurable interval
|
- Subscribes to `/ws/status` for live status, color, and brightness updates
|
||||||
|
- Automatically reconnects after a disconnect or device address change
|
||||||
- Silent updates — no loading screen interruption
|
- Silent updates — no loading screen interruption
|
||||||
- Configurable in Settings (default: every 5 seconds, can be disabled)
|
- Initial state comes from the WebSocket; no REST polling is used
|
||||||
|
- Keeps the last received state visible while reconnecting
|
||||||
|
|
||||||
### Settings
|
### Settings
|
||||||
- Device address (hostname or IP, e.g. `http://igox-busylight.local`)
|
- Device address (hostname or IP, e.g. `http://igox-busylight.local`)
|
||||||
- Polling interval slider (Off → 1 min)
|
|
||||||
- Start with session (macOS and Windows only) — launch automatically at login
|
- Start with session (macOS and Windows only) — launch automatically at login
|
||||||
|
|
||||||
### UX & feedback
|
### UX & feedback
|
||||||
@@ -87,10 +87,10 @@ busylight_app/
|
|||||||
│ │ ├── busylight_color.dart # Color model (r/g/b/brightness)
|
│ │ ├── busylight_color.dart # Color model (r/g/b/brightness)
|
||||||
│ │ └── color_preset.dart # Named color preset model
|
│ │ └── color_preset.dart # Named color preset model
|
||||||
│ ├── services/
|
│ ├── services/
|
||||||
│ │ ├── busylight_service.dart # All REST API calls
|
│ │ ├── busylight_service.dart # REST API calls and WebSocket status stream
|
||||||
│ │ └── autostart_service.dart # Start with session (macOS + Windows)
|
│ │ └── autostart_service.dart # Start with session (macOS + Windows)
|
||||||
│ ├── providers/
|
│ ├── providers/
|
||||||
│ │ ├── busylight_provider.dart # Status, color, brightness, polling, config
|
│ │ ├── busylight_provider.dart # Live status, color, brightness, config
|
||||||
│ │ └── presets_provider.dart # Custom color presets (CRUD + persistence)
|
│ │ └── presets_provider.dart # Custom color presets (CRUD + persistence)
|
||||||
│ ├── screens/
|
│ ├── screens/
|
||||||
│ │ ├── home_screen.dart # Main screen
|
│ │ ├── home_screen.dart # Main screen
|
||||||
@@ -107,19 +107,28 @@ busylight_app/
|
|||||||
|
|
||||||
| Endpoint | Method | Description |
|
| Endpoint | Method | Description |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `/api/status` | GET | Get current status |
|
| `/ws/status` | WebSocket | Initial state and live status, color, brightness updates |
|
||||||
| `/api/status/available` | POST/GET | Set available (green) |
|
| `/api/status/available` | POST | Set available (green) |
|
||||||
| `/api/status/away` | POST/GET | Set away (yellow) |
|
| `/api/status/away` | POST | Set away (yellow) |
|
||||||
| `/api/status/busy` | POST/GET | Set busy (red) |
|
| `/api/status/busy` | POST | Set busy (red) |
|
||||||
| `/api/status/on` | POST/GET | Turn on (white) |
|
| `/api/status/on` | POST | Turn on (white) |
|
||||||
| `/api/status/off` | POST/GET | Turn off |
|
| `/api/status/off` | POST | Turn off |
|
||||||
| `/api/color` | GET | Get current color + brightness |
|
|
||||||
| `/api/color` | POST | Set custom color (r, g, b, brightness) |
|
| `/api/color` | POST | Set custom color (r, g, b, brightness) |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Platform setup
|
## Platform setup
|
||||||
|
|
||||||
|
### macOS — build release
|
||||||
|
|
||||||
|
Requires macOS 12.0 or newer.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
flutter build macos
|
||||||
|
```
|
||||||
|
|
||||||
|
The Flutter Xcode build phases use `macos/toolchain/lipo` to work around Xcode 27.1 rejecting Flutter's multi-architecture `-verify_arch` call. It verifies each requested architecture separately and delegates all other operations to the system tool. The app remains universal (Intel and Apple Silicon); no Flutter SDK modifications are needed.
|
||||||
|
|
||||||
### Android — build APK
|
### Android — build APK
|
||||||
|
|
||||||
Two helper scripts are available in the `android/` folder to build and rename the APK in one step — one for macOS/Linux, one for Windows.
|
Two helper scripts are available in the `android/` folder to build and rename the APK in one step — one for macOS/Linux, one for Windows.
|
||||||
|
|||||||
@@ -0,0 +1,666 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<!-- Required meta tags -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
|
||||||
|
html {
|
||||||
|
line-height: 1.15;
|
||||||
|
-ms-text-size-adjust: 100%;
|
||||||
|
-webkit-text-size-adjust: 100%
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
article, aside, footer, header, nav, section {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 2em;
|
||||||
|
margin: .67em 0
|
||||||
|
}
|
||||||
|
|
||||||
|
figcaption, figure, main {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
figure {
|
||||||
|
margin: 1em 40px
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
box-sizing: content-box;
|
||||||
|
height: 0;
|
||||||
|
overflow: visible
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-family: monospace, monospace;
|
||||||
|
font-size: 1em
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
background-color: transparent;
|
||||||
|
-webkit-text-decoration-skip: objects
|
||||||
|
}
|
||||||
|
|
||||||
|
abbr[title] {
|
||||||
|
border-bottom: none;
|
||||||
|
text-decoration: underline;
|
||||||
|
text-decoration: underline dotted
|
||||||
|
}
|
||||||
|
|
||||||
|
b, strong {
|
||||||
|
font-weight: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
b, strong {
|
||||||
|
font-weight: bolder
|
||||||
|
}
|
||||||
|
|
||||||
|
code, kbd, samp {
|
||||||
|
font-family: monospace, monospace;
|
||||||
|
font-size: 1em
|
||||||
|
}
|
||||||
|
|
||||||
|
dfn {
|
||||||
|
font-style: italic
|
||||||
|
}
|
||||||
|
|
||||||
|
mark {
|
||||||
|
background-color: #ff0;
|
||||||
|
color: #000
|
||||||
|
}
|
||||||
|
|
||||||
|
small {
|
||||||
|
font-size: 80%
|
||||||
|
}
|
||||||
|
|
||||||
|
sub, sup {
|
||||||
|
font-size: 75%;
|
||||||
|
line-height: 0;
|
||||||
|
position: relative;
|
||||||
|
vertical-align: baseline
|
||||||
|
}
|
||||||
|
|
||||||
|
sub {
|
||||||
|
bottom: -.25em
|
||||||
|
}
|
||||||
|
|
||||||
|
sup {
|
||||||
|
top: -.5em
|
||||||
|
}
|
||||||
|
|
||||||
|
audio, video {
|
||||||
|
display: inline-block
|
||||||
|
}
|
||||||
|
|
||||||
|
audio:not([controls]) {
|
||||||
|
display: none;
|
||||||
|
height: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
border-style: none
|
||||||
|
}
|
||||||
|
|
||||||
|
svg:not(:root) {
|
||||||
|
overflow: hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input, optgroup, select, textarea {
|
||||||
|
font-family: sans-serif;
|
||||||
|
font-size: 100%;
|
||||||
|
line-height: 1.15;
|
||||||
|
margin: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input {
|
||||||
|
overflow: visible
|
||||||
|
}
|
||||||
|
|
||||||
|
button, select {
|
||||||
|
text-transform: none
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=reset], [type=submit], button, html [type=button] {
|
||||||
|
-webkit-appearance: button
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner, button::-moz-focus-inner {
|
||||||
|
border-style: none;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring, button:-moz-focusring {
|
||||||
|
outline: 1px dotted ButtonText
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
padding: .35em .75em .625em
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: inherit;
|
||||||
|
display: table;
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 0;
|
||||||
|
white-space: normal
|
||||||
|
}
|
||||||
|
|
||||||
|
progress {
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: baseline
|
||||||
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
overflow: auto
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=checkbox], [type=radio] {
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button {
|
||||||
|
height: auto
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=search] {
|
||||||
|
-webkit-appearance: textfield;
|
||||||
|
outline-offset: -2px
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration {
|
||||||
|
-webkit-appearance: none
|
||||||
|
}
|
||||||
|
|
||||||
|
::-webkit-file-upload-button {
|
||||||
|
-webkit-appearance: button;
|
||||||
|
font: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
details, menu {
|
||||||
|
display: block
|
||||||
|
}
|
||||||
|
|
||||||
|
summary {
|
||||||
|
display: list-item
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
display: inline-block
|
||||||
|
}
|
||||||
|
|
||||||
|
template {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
|
[hidden] {
|
||||||
|
display: none
|
||||||
|
}
|
||||||
|
|
||||||
|
/* configuration cache styles */
|
||||||
|
|
||||||
|
.report-wrapper {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.gradle-logo {
|
||||||
|
width: 32px;
|
||||||
|
height: 24px;
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAYCAYAAACbU/80AAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAIKADAAQAAAABAAAAGAAAAAA915G0AAAD5klEQVRIDbVWC0xTZxT+emmhVUEeA1/ROh/tFAFFGK7oJisIKsNVoOwBbJPowEWHzikRxeiMRpwwjDWRBHQLIzOmiRhe22BT40TitiyaMBQFfMEeLMIEaSmk+/+rvd7be4no6Elu7n++c/5zzv845/wyOyG4iGyDgzCdNOPLM9W41n4bnmNUiHo5DNsz0hGsmcV6lbkyAOOWXJjrz4qWp1C4o3z/LqzWL4VcJB1FIHmZHn/f78a6pDcxbeIEfNvQiPwTZbDZBpC24zOEaGfDpTsgtZby6u+QlrubFWUY3nh6AH39/ahr/Bn1jZfxW3ML2js60dtvgbtcQVblj8CZM7A0PBSrol6Ft+c4KZ8iTB1nwN0//8IEP9/hA2i924Gir0/iq8oa/NvbJzLiDKiUSqTE6pGVbEBY4BxnsYAPSnwXTa3tLCZ5BF3dPdAkGNHzoFcwcaRMnC4CeZkZiAgKFE252nITC1Pew9Dj5GNEGgS4Rbb5eZ1Te7UXG6FLX4cV6zeh5kIDaDpSunL9Boyf5nLOpwT4Sx+BxWrFK8QAnTAapPRQwofcj86uLoG59cbVEOzA0NAQNh38Atn5RSjY8rFAmc/I3dyQvOx1PsSNVy7Roa3ajHDePbBYLSLn1MaGd5KFAXy07xAOl59C6elK+I73hIHcbGd6wXs8qkyH8FZcjLOI5X/9/TrOnLsAldJDUu4As1NToFFPe3IEpm/M2HigwCFnU6t4Zw6Ck1JhGRhgcXq5juXloKyqFnlHirmz5CaNcEAv59kSE9wVikcB3O78A/MSU0Fznk/H9+yAetJEnPr+B8RFLsLcGS8ia28+qQuX+WrPNNZOV+Nc6VH4+3iz89g0pEaLzRUiQ3LGDWsM8Qidq2WL0PGKKlgf74ZIeQTAfFJ6a44WIsDXh9OW/dPdY58aawC9KK6kpOgolO7JxViVSuBGXnvxksudZ5F0O5yzGYxMJnBOGaau4fnPU2RNAtCFBKFoa7akczaAptY2iWmjB33+yQa4kZwfjpi2ex3Dyf43vuAljWQ/4Btmei1WPj+q45hF4U+1J4fEizCEvNf0EWHoIW244sfzoN1RipaT2kDfdjfv3MNpojdISjmfIheE8Fnp8WR9vJ2Zr+O+bYUmO+kJ9KnIUtf9bnvY2x9wcqrrvnCJvfL8Tw4V9v9LU7PdKzJaoNdy645AR4ph1JMncZHRKrVvYyYY5kmP8iO1v2T3dk6HDtYmrgJtOnwKnaPFrg8z+BBX7QSgEyOPJfX9Qd9DFs40GgTOHbrBs2ch4bXFuEG2mmFkeD9hpUMk+NMXEe0TNtsg/Ly94DVurEAuxfwHC1WiVbe0U7MAAAAASUVORK5CYII=");
|
||||||
|
background-size: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.header {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
padding-top: 24px;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.learn-more {
|
||||||
|
margin-left: auto;
|
||||||
|
align-self: center;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
padding: 18px 0 24px 0;
|
||||||
|
flex: 1 0 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content ol:first-of-type {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-btn {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-btn.collapsed {
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 192 512"><path d="M166.9 264.5l-117.8 116c-4.7 4.7-12.3 4.7-17 0l-7.1-7.1c-4.7-4.7-4.7-12.3 0-17L127.3 256 25.1 155.6c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0l117.8 116c4.6 4.7 4.6 12.3-.1 17z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree-btn.expanded {
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M119.5 326.9L3.5 209.1c-4.7-4.7-4.7-12.3 0-17l7.1-7.1c4.7-4.7 12.3-4.7 17 0L128 287.3l100.4-102.2c4.7-4.7 12.3-4.7 17 0l7.1 7.1c4.7 4.7 4.7 12.3 0 17L136.5 327c-4.7 4.6-12.3 4.6-17-.1z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||||
|
}
|
||||||
|
|
||||||
|
ul .tree-btn {
|
||||||
|
margin-right: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leaf-icon {
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 512"><path d="M32 256 H224" stroke="%23999999" stroke-width="48" stroke-linecap="round"/></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.invisible-text {
|
||||||
|
user-select: all; /* Allow the text to be selectable */
|
||||||
|
color: transparent; /* Hide the text */
|
||||||
|
text-indent: -9999px; /* Move the text out of view */
|
||||||
|
position: relative;
|
||||||
|
white-space: pre; /* Preserve meaningful whitespace in the invisible text for copying */
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-for-copy {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.enum-icon {
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024"><circle cx="512" cy="512" r="200" /></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.5ex;
|
||||||
|
margin-inline-end: 0.5ex;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.error-icon {
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512"><path d="M193.94 256L296.5 153.44l21.15-21.15c3.12-3.12 3.12-8.19 0-11.31l-22.63-22.63c-3.12-3.12-8.19-3.12-11.31 0L160 222.06 36.29 98.34c-3.12-3.12-8.19-3.12-11.31 0L2.34 120.97c-3.12 3.12-3.12 8.19 0 11.31L126.06 256 2.34 379.71c-3.12 3.12-3.12 8.19 0 11.31l22.63 22.63c3.12 3.12 8.19 3.12 11.31 0L160 289.94 262.56 392.5l21.15 21.15c3.12 3.12 8.19 3.12 11.31 0l22.63-22.63c3.12-3.12 3.12-8.19 0-11.31L193.94 256z" fill="%23FC461E" stroke="%23FC461E"/></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.5ex;
|
||||||
|
margin-inline-end: 0.5ex;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.advice-icon {
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg width="800px" height="800px" viewBox="-4.93 0 122.88 122.88" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="enable-background:new 0 0 113.01 122.88" xml:space="preserve"><g><path d="M44.13,102.06c-1.14,0.03-2.14-0.81-2.3-1.96c-0.17-1.2,0.64-2.31,1.82-2.54c-1.3-7.37-4.85-11.43-8.6-15.72 c-2.92-3.34-5.95-6.81-8.34-11.92c-2.35-5.03-3.64-10.23-3.6-15.63c0.05-5.4,1.42-10.96,4.4-16.71c0.02-0.04,0.04-0.07,0.06-0.11 l0,0c3.91-6.62,9.38-11.04,15.47-13.52c5.11-2.09,10.66-2.8,16.1-2.3c5.42,0.5,10.73,2.2,15.37,4.94 c5.9,3.49,10.75,8.67,13.42,15.21c1.44,3.54,2.42,7.49,2.54,11.82c0.12,4.31-0.62,8.96-2.61,13.88 c-2.66,6.59-6.18,10.68-9.47,14.51c-3.03,3.53-5.85,6.81-7.42,11.84c0.89,0.21,1.59,0.94,1.73,1.9c0.17,1.24-0.7,2.39-1.94,2.56 l-0.77,0.11c-0.14,1.09-0.23,2.26-0.27,3.51l0.25-0.04c1.24-0.17,2.39,0.7,2.56,1.94c0.17,1.24-0.7,2.39-1.94,2.56l-0.78,0.11 c0.01,0.15,0.02,0.3,0.03,0.45l0,0c0.07,0.88,0.08,1.73,0.03,2.54l0.13-0.02c1.25-0.15,2.38,0.74,2.54,1.98 c0.15,1.25-0.74,2.38-1.98,2.54l-1.68,0.21c-1.2,3.11-3.34,5.48-5.87,6.94c-1.74,1.01-3.67,1.59-5.61,1.71 c-1.97,0.12-3.96-0.25-5.78-1.13c-2.08-1.02-3.94-2.71-5.29-5.14c-0.65-0.33-1.13-0.97-1.23-1.75c-0.04-0.31-0.01-0.61,0.07-0.89 c-0.39-1.16-0.68-2.43-0.87-3.83l-0.07,0.01c-1.24,0.17-2.39-0.7-2.56-1.94c-0.17-1.24,0.7-2.39,1.94-2.56l0.54-0.08 C44.19,104.32,44.18,103.16,44.13,102.06L44.13,102.06z M2.18,58.86C1.01,58.89,0.04,57.98,0,56.81c-0.04-1.17,0.88-2.14,2.05-2.18 l8.7-0.3c1.17-0.04,2.14,0.88,2.18,2.05c0.04,1.17-0.88,2.14-2.05,2.18L2.18,58.86L2.18,58.86z M110.68,50.25 c1.16-0.12,2.2,0.73,2.32,1.89c0.12,1.16-0.73,2.2-1.89,2.32l-8.66,0.91c-1.16,0.12-2.2-0.73-2.32-1.89 c-0.12-1.16,0.73-2.2,1.89-2.32L110.68,50.25L110.68,50.25z M94.91,14.78c0.65-0.97,1.96-1.23,2.93-0.58 c0.97,0.65,1.23,1.96,0.58,2.93l-4.84,7.24c-0.65,0.97-1.96,1.23-2.93,0.58c-0.97-0.65-1.23-1.96-0.58-2.93L94.91,14.78 L94.91,14.78z M57.63,2.06c0.03-1.17,1-2.09,2.16-2.06c1.17,0.03,2.09,1,2.06,2.16l-0.22,8.7c-0.03,1.17-1,2.09-2.16,2.06 c-1.17-0.03-2.09-1-2.06-2.16L57.63,2.06L57.63,2.06z M13.88,15.53c-0.86-0.8-0.9-2.14-0.11-2.99c0.8-0.86,2.14-0.9,2.99-0.11 l6.37,5.94c0.86,0.8,0.9,2.14,0.11,2.99c-0.8,0.86-2.14,0.9-2.99,0.11L13.88,15.53L13.88,15.53z M47.88,96.95l18.49-2.63 c1.59-6.7,5.05-10.73,8.8-15.08c3.08-3.58,6.36-7.4,8.76-13.34c1.76-4.35,2.41-8.43,2.31-12.19c-0.1-3.75-0.96-7.21-2.24-10.34 c-2.3-5.63-6.51-10.11-11.65-13.15c-4.11-2.43-8.8-3.94-13.59-4.37c-4.77-0.44-9.64,0.19-14.13,2.02 c-5.26,2.15-9.99,5.97-13.39,11.72c-2.64,5.12-3.86,10.02-3.9,14.73c-0.04,4.74,1.11,9.33,3.2,13.8c2.13,4.56,4.97,7.8,7.69,10.92 C42.47,83.9,46.48,88.49,47.88,96.95L47.88,96.95z M65.62,99.02l-17.27,2.45c0.05,1.1,0.07,2.25,0.05,3.47l17.05-2.42 C65.47,101.29,65.52,100.12,65.62,99.02L65.62,99.02z M48.49,109.52c0.12,0.92,0.3,1.76,0.53,2.54l16.55-2.04 c0.11-0.86,0.13-1.77,0.05-2.74l0,0l0-0.02l-0.01-0.17L48.49,109.52L48.49,109.52z M51.37,116.36c0.64,0.67,1.35,1.19,2.1,1.55 c1.15,0.56,2.42,0.79,3.67,0.72c1.29-0.08,2.57-0.47,3.74-1.15c1.1-0.64,2.09-1.53,2.88-2.65L51.37,116.36L51.37,116.36z"/></g></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.5ex;
|
||||||
|
margin-inline-end: 0.5ex;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning-icon {
|
||||||
|
display: inline-block;
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><path d="M270.2 160h35.5c3.4 0 6.1 2.8 6 6.2l-7.5 196c-.1 3.2-2.8 5.8-6 5.8h-20.5c-3.2 0-5.9-2.5-6-5.8l-7.5-196c-.1-3.4 2.6-6.2 6-6.2zM288 388c-15.5 0-28 12.5-28 28s12.5 28 28 28 28-12.5 28-28-12.5-28-28-28zm281.5 52L329.6 24c-18.4-32-64.7-32-83.2 0L6.5 440c-18.4 31.9 4.6 72 41.6 72H528c36.8 0 60-40 41.5-72zM528 480H48c-12.3 0-20-13.3-13.9-24l240-416c6.1-10.6 21.6-10.7 27.7 0l240 416c6.2 10.6-1.5 24-13.8 24z" fill="%23DEAD22" stroke="%23DEAD22"/></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.3ex;
|
||||||
|
margin-inline-end: 1.1ex;
|
||||||
|
margin-top: -0.1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.documentation-button {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 340c-15.464 0-28 12.536-28 28s12.536 28 28 28 28-12.536 28-28-12.536-28-28-28zm7.67-24h-16c-6.627 0-12-5.373-12-12v-.381c0-70.343 77.44-63.619 77.44-107.408 0-20.016-17.761-40.211-57.44-40.211-29.144 0-44.265 9.649-59.211 28.692-3.908 4.98-11.054 5.995-16.248 2.376l-13.134-9.15c-5.625-3.919-6.86-11.771-2.645-17.177C185.658 133.514 210.842 116 255.67 116c52.32 0 97.44 29.751 97.44 80.211 0 67.414-77.44 63.849-77.44 107.408V304c0 6.627-5.373 12-12 12zM256 40c118.621 0 216 96.075 216 216 0 119.291-96.61 216-216 216-119.244 0-216-96.562-216-216 0-119.203 96.602-216 216-216m0-32C119.043 8 8 119.083 8 256c0 136.997 111.043 248 248 248s248-111.003 248-248C504 119.083 392.957 8 256 8z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.5ex;
|
||||||
|
margin-inline-end: 0.5ex;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.documentation-button::selection {
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.documentation-button:hover {
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copy-button {
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path d="M433.941 193.941l-51.882-51.882A48 48 0 0 0 348.118 128H320V80c0-26.51-21.49-48-48-48h-66.752C198.643 13.377 180.858 0 160 0s-38.643 13.377-45.248 32H48C21.49 32 0 53.49 0 80v288c0 26.51 21.49 48 48 48h80v48c0 26.51 21.49 48 48 48h224c26.51 0 48-21.49 48-48V227.882a48 48 0 0 0-14.059-33.941zm-22.627 22.627a15.888 15.888 0 0 1 4.195 7.432H352v-63.509a15.88 15.88 0 0 1 7.431 4.195l51.883 51.882zM160 30c9.941 0 18 8.059 18 18s-8.059 18-18 18-18-8.059-18-18 8.059-18 18-18zM48 384c-8.822 0-16-7.178-16-16V80c0-8.822 7.178-16 16-16h66.752c6.605 18.623 24.389 32 45.248 32s38.643-13.377 45.248-32H272c8.822 0 16 7.178 16 16v48H176c-26.51 0-48 21.49-48 48v208H48zm352 96H176c-8.822 0-16-7.178-16-16V176c0-8.822 7.178-16 16-16h144v72c0 13.2 10.8 24 24 24h72v208c0 8.822-7.178 16-16 16z" fill="%23999999" stroke="%23999999"/></svg>');
|
||||||
|
background-size: contain;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-inline-start: 0.5ex;
|
||||||
|
margin-top: -0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.groups{
|
||||||
|
display: flex;
|
||||||
|
border-bottom: 1px solid #EDEEEF;
|
||||||
|
flex: 1 0 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uncategorized {
|
||||||
|
display: flex;
|
||||||
|
border-top: 4px solid #EDEEEF;
|
||||||
|
flex: 1 0 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-selector {
|
||||||
|
padding: 0 52px 24px 0;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999999;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-selector__count {
|
||||||
|
margin: 0 8px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background-color: #999;
|
||||||
|
color: #fff;
|
||||||
|
padding: 1px 8px 2px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-selector--active {
|
||||||
|
color: #02303A;
|
||||||
|
cursor: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-selector--active .group-selector__count {
|
||||||
|
background-color: #686868;
|
||||||
|
}
|
||||||
|
|
||||||
|
.group-selector--disabled {
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.accordion-header {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
padding-left: 0.5em;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stacktrace {
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 0.5rem;
|
||||||
|
margin-bottom: 0;
|
||||||
|
min-width: 1000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lato (bold, regular) */
|
||||||
|
@font-face {
|
||||||
|
font-display: swap;
|
||||||
|
font-family: Lato;
|
||||||
|
font-weight: 500;
|
||||||
|
font-style: normal;
|
||||||
|
src: url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff2") format("woff2"),
|
||||||
|
url("https://assets.gradle.com/lato/fonts/lato-semibold/lato-semibold.woff") format("woff");
|
||||||
|
}
|
||||||
|
|
||||||
|
@font-face {
|
||||||
|
font-display: swap;
|
||||||
|
font-family: Lato;
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: normal;
|
||||||
|
src: url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff2") format("woff2"),
|
||||||
|
url("https://assets.gradle.com/lato/fonts/lato-bold/lato-bold.woff") format("woff");
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
font-family: "Lato", "Helvetica Neue", Arial, sans-serif;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
color: #02303A;
|
||||||
|
background-color: #ffffff;
|
||||||
|
-webkit-text-size-adjust: 100%;
|
||||||
|
-ms-text-size-adjust: 100%;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* typography */
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
color: #02303A;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-size: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font-size: 0.9rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
font-size: 1.125rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h4, h5, h6 {
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 code {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul, ol, dl {
|
||||||
|
list-style-position: outside;
|
||||||
|
line-height: 1.6;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0 0 0 20px;
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
li {
|
||||||
|
line-height: 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #1DA2BD;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: all 0.3s ease, visibility 0s;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
color: #35c1e4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* code */
|
||||||
|
code, pre {
|
||||||
|
font-family: Inconsolata, Monaco, "Courier New", monospace;
|
||||||
|
font-style: normal;
|
||||||
|
font-variant-ligatures: normal;
|
||||||
|
font-variant-caps: normal;
|
||||||
|
font-variant-numeric: normal;
|
||||||
|
font-variant-east-asian: normal;
|
||||||
|
font-weight: normal;
|
||||||
|
font-stretch: normal;
|
||||||
|
color: #686868;
|
||||||
|
}
|
||||||
|
|
||||||
|
*:not(pre) > code {
|
||||||
|
letter-spacing: 0;
|
||||||
|
padding: 0.1em 0.5ex;
|
||||||
|
text-rendering: optimizeSpeed;
|
||||||
|
word-spacing: -0.15em;
|
||||||
|
word-wrap: break-word;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
line-height: 1.8;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre code {
|
||||||
|
background-color: transparent;
|
||||||
|
color: inherit;
|
||||||
|
line-height: 1.8;
|
||||||
|
font-size: 100%;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a code {
|
||||||
|
color: #1BA8CB;
|
||||||
|
}
|
||||||
|
|
||||||
|
pre.code, pre.programlisting, pre.screen, pre.tt {
|
||||||
|
background-color: #f7f7f8;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 1em;
|
||||||
|
line-height: 1.45;
|
||||||
|
margin-bottom: 1.25em;
|
||||||
|
overflow-x: auto;
|
||||||
|
padding: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
li em, p em {
|
||||||
|
padding: 0 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
code em, tt em {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
code + .copy-button {
|
||||||
|
margin-inline-start: 0.2ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.java-exception {
|
||||||
|
font-size: 0.75rem;
|
||||||
|
padding-left: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.java-exception ul {
|
||||||
|
margin: 0;
|
||||||
|
line-height: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.java-exception code {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.java-exception-part-toggle {
|
||||||
|
user-select: none;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 2px;
|
||||||
|
padding: 0.1em 0.2em;
|
||||||
|
background: azure;
|
||||||
|
color: #686868;
|
||||||
|
}
|
||||||
|
|
||||||
|
.problem-detail {
|
||||||
|
color: #02303A;
|
||||||
|
font-size: 14px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
<!-- Inconsolata is used as a default monospace font in the report. -->
|
||||||
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inconsolata:400,700" />
|
||||||
|
|
||||||
|
<title>Gradle Configuration Cache</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div id="playground"></div>
|
||||||
|
|
||||||
|
<div class="report" id="report">
|
||||||
|
Loading...
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
function configurationCacheProblems() { return (
|
||||||
|
// begin-report-data
|
||||||
|
{"diagnostics":[{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"This annotation is currently applied to the value parameter only, but in the future it will also be applied to property.\n- To opt in to applying to both value parameter and property, add '-Xannotation-default-target=param-property' to your compiler arguments.\n- To keep applying to the value parameter only, use the '@param:' annotation target.\n\nSee https://youtrack.jetbrains.com/issue/KT-73255 for more details.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/Deeplink.kt","line":13,"column":5,"length":18},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"This annotation is currently applied to the value parameter only, but in the future it will also be applied to property.\n- To opt in to applying to both value parameter and property, add '-Xannotation-default-target=param-property' to your compiler arguments.\n- To keep applying to the value parameter only, use the '@param:' annotation target.\n\nSee https://youtrack.jetbrains.com/issue/KT-73255 for more details.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/Deeplink.kt","line":15,"column":5,"length":18},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"This annotation is currently applied to the value parameter only, but in the future it will also be applied to property.\n- To opt in to applying to both value parameter and property, add '-Xannotation-default-target=param-property' to your compiler arguments.\n- To keep applying to the value parameter only, use the '@param:' annotation target.\n\nSee https://youtrack.jetbrains.com/issue/KT-73255 for more details.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/Deeplink.kt","line":17,"column":5,"length":18},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"This annotation is currently applied to the value parameter only, but in the future it will also be applied to property.\n- To opt in to applying to both value parameter and property, add '-Xannotation-default-target=param-property' to your compiler arguments.\n- To keep applying to the value parameter only, use the '@param:' annotation target.\n\nSee https://youtrack.jetbrains.com/issue/KT-73255 for more details.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/Deeplink.kt","line":19,"column":5,"length":18},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"'interface ApkVariant : Any, BaseVariant, InstallableVariant, AndroidArtifactVariant, InternalBaseVariant' is deprecated. Deprecated in Java.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt","line":11,"column":8,"length":39},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","contextualLabel":"Kotlin compiler warning","problemDetails":"'val properties: (Mutable)Map<String, out Any?>' is deprecated. Deprecated in Java.","locations":[{"path":"/Users/mbocquet/PRIVATE Documents/SDK/flutter/packages/flutter_tools/gradle/src/main/kotlin/FlutterPlugin.kt","line":215,"column":29,"length":10},{"taskPath":":gradle:compileKotlin"}]},{"problemId":[{"name":"kotlin","displayName":"Kotlin"},{"name":"compiler:warning","displayName":"Kotlin Compiler Warning"},{"name":"compiler-warning","displayName":"Kotlin compiler warning"}],"severity":"WARNING","conLine truncated
|
||||||
|
// end-report-data
|
||||||
|
);}
|
||||||
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["configuration-cache-report"]=t():n["configuration-cache-report"]=t()}(globalThis,()=>{return void 0===Math.imul&&(Math.imul=function(n,t){return(4294901760&n)*(65535&t)+(65535&n)*(0|t)|0}),void 0===ArrayBuffer.isView&&(ArrayBuffer.isView=function(n){return null!=n&&null!=n.__proto__&&n.__proto__.__proto__===Int8Array.prototype.__proto__}),void 0===Array.prototype.fill&&Object.defineProperty(Array.prototype,"fill",{value:function(n){if(null==this)throw new TypeError("this is null or not defined");for(var t=Object(this),r=t.length>>>0,i=0|arguments[1],e=i<0?Math.max(r+i,0):Math.min(i,r),u=arguments[2],o=void 0===u?r:0|u,s=o<0?Math.max(r+o,0):Math.min(o,r);e<s;)t[e]=n,e++;return t}}),[Int8Array,Int16Array,Uint16Array,Int32Array,Float32Array,Float64Array].forEach(function(n){void 0===n.prototype.fill&&Object.defineProperty(n.prototype,"fill",{value:Array.prototype.fill})}),void 0===Math.clz32&&(Math.clz32=(n=Math.log,t=Math.LN2,function(r){var i=r>>>0;return 0===i?32:31-(n(i)/t|0)|0})),globalThis["org.gradle.buildtool.internal:configuration-cache-report"]=function(n){"use strict";var t,r,i,e,u,o,s,f,c,a,h,l,_,v,g,d,b,w,p,m,k,y,q,B,C,x,z,P,S,I,j,T,L,E,M,N,A,F,D,O,H,R,$,G,U,K,Q,V,W,Y,Z,J,X,nn,tn,rn,en,un,on,sn,fn,cn,an,hn,ln,_n,vn,gn,dn,bn,wn,pn,mn,kn,yn,qn,Bn,Cn,xn,zn,Pn,Sn,In,jn,Tn,Ln,En,Mn=Math.imul,Nn=ArrayBuffer.isView,An=Math.clz32;function Fn(){}function Dn(){}function On(){}function Hn(n,t,r,i,e,u,o){return t=t===w?", ":t,r=r===w?"":r,i=i===w?"":i,e=e===w?-1:e,u=u===w?"...":u,o=o===w?null:o,function(n,t,r,i,e,u,o,s){r=r===w?", ":r,i=i===w?"":i,e=e===w?"":e,u=u===w?-1:u,o=o===w?"...":o,s=s===w?null:s,t.e(i);var f=0,c=0,a=n.length;n:for(;c<a;){var h=n[c];if(c=c+1|0,(f=f+1|0)>1&&t.e(r),!(u<0||f<=u))break n;Ju(t,h,s)}return u>=0&&f>u&&t.e(o),t.e(e),t}(n,Je(),t,r,i,e,u,o).toString()}function Rn(n,t){if(!(t>=0))throw ye(br("Requested element count "+t+" is less than zero."));return function(n,t){if(!(t>=0))throw ye(br("Requested element count "+t+" is less than zero."));if(0===t)return Cu();if(t>=n.length)return function(n){var t;switch(n.length){case 0:t=Cu();break;case 1:t=Zr(n[0]);break;default:t=Hr(n.slice())}return t}(n);if(1===t)return Zr(n[0]);var r=function(n,t,r){return S.p1(0,r,n.length),n.slice(0,r)}(n,0,t);return Hr(r)}(n,st(n.length-t|0,0))}function $n(n){return n.length-1|0}function Gn(n,t,r,i,e,u,o){return t=t===w?", ":t,r=r===w?"":r,i=i===w?"":i,e=e===w?-1:e,u=u===w?"...":u,o=o===w?null:o,Un(n,Je(),t,r,i,e,u,o).toString()}function Un(n,t,r,i,e,u,o,s){r=r===w?", ":r,i=i===w?"":i,e=e===w?"":e,u=u===w?-1:u,o=o===w?"...":o,s=s===w?null:s,t.e(i);var f=0,c=n.g();n:for(;c.h();){var a=c.i();if((f=f+1|0)>1&&t.e(r),!(u<0||f<=u))break n;Ju(t,a,s)}return u>=0&&f>u&&t.e(o),t.e(e),t}function Kn(n){return new ot(n)}function Qn(n){if(n.j())throw Le("List is empty.");return n.k(0)}function Vn(n,t){var r;if(!(t>=0))throw ye(br("Requested element count "+t+" is less than zero."));if(0===t)return Wn(n);if(Ar(n,wt)){var i=n.l()-t|0;if(i<=0)return Cu();if(1===i)return Zr(function(n){if(Ar(n,bt))return ut(n);var t=n.g();if(!t.h())throw Le("Collection is empty.");for(var r=t.i();t.h();)r=t.i();return r}(n));if(r=gi(i),Ar(n,bt)){if(Ar(n,he)){var e=t,u=n.l();if(e<u)do{var o=e;e=e+1|0,r.f(n.k(o))}while(e<u)}else for(var s=n.m(t);s.h();){var f=s.i();r.f(f)}return r}}else r=vi();for(var c=0,a=n.g();a.h();){var h=a.i();c>=t?r.f(h):c=c+1|0}return xu(r)}function Wn(n){if(Ar(n,wt)){var t;switch(n.l()){case 0:t=Cu();break;case 1:t=Zr(Ar(n,bt)?n.k(0):n.g().i());break;default:t=tt(n)}return t}return xu(rt(n))}function Yn(n){return n.j()?null:n.k(0)}function Zn(n,t){var r=gi(n.l()+1|0);return r.q(n),r.f(t),r}function Jn(n,t){if(Ar(t,wt)){var r=gi(n.l()+t.l()|0);return r.q(n),r.q(t),r}var i=di(n);return ju(i,t),i}function Xn(n){if(Ar(n,wt)){var t;switch(n.l()){case 0:t=Ou();break;case 1:t=Xr(Ar(n,bt)?n.k(0):n.g().i());break;default:t=et(n,(r=n.l(),i=gr(yr(ae)),function(n,t,r){Ni(n,1,r),ae.call(r)}(r,0,i),i))}return t}var r,i;return function(n){switch(n.l()){case 0:return Ou();case 1:return Xr(n.g().i());default:return n}}(et(n,ce()))}function nt(n,t){if(!(t>=0))throw ye(br("Requested element count "+t+" is less than zero."));if(0===t)return Cu();var r=n.l();if(t>=r)return Wn(n);if(1===t)return Zr(ut(n));var i=gi(t);if(Ar(n,he)){var e=r-t|0;if(e<r)do{var u=e;e=e+1|0,i.f(n.k(u))}while(e<r)}else for(var o=n.m(r-t|0);o.h();){var s=o.i();i.f(s)}return i}function tt(n){return di(n)}function rt(n){return Ar(n,wt)?tt(n):et(n,vi())}function it(n,t){if(Ar(n,wt)){if(n.l()<=1)return Wn(n);var r=ni(n),i=Fr(r)?r:zr();return function(n,t){n.length>1&&pi(n,t)}(i,t),Hr(i)}var e=rt(n);return ti(e,t),e}function et(n,t){for(var r=n.g();r.h();){var i=r.i();t.f(i)}return t}function ut(n){if(n.j())throw Le("List is empty.");return n.k(zu(n))}function ot(n){this.r_1=n}functLine truncated
|
||||||
|
//# sourceMappingURL=configuration-cache-report.js.map
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
|
#Fri Oct 16 18:40:11 CEST 2026
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
17b71b5af077e19e826bdd5d84ec2de014cd91fe
|
|
||||||
@@ -9,8 +9,6 @@ import '../services/busylight_service.dart';
|
|||||||
|
|
||||||
const _kHostKey = 'busylight_host';
|
const _kHostKey = 'busylight_host';
|
||||||
const _kDefaultHost = 'http://igox-busylight.local';
|
const _kDefaultHost = 'http://igox-busylight.local';
|
||||||
const _kPollIntervalKey = 'busylight_poll_interval';
|
|
||||||
const _kDefaultPollInterval = 1.0; // seconds
|
|
||||||
|
|
||||||
final sharedPreferencesProvider = FutureProvider<SharedPreferences>(
|
final sharedPreferencesProvider = FutureProvider<SharedPreferences>(
|
||||||
(_) => SharedPreferences.getInstance(),
|
(_) => SharedPreferences.getInstance(),
|
||||||
@@ -21,11 +19,6 @@ final deviceHostProvider = StateProvider<String>((ref) {
|
|||||||
return prefs?.getString(_kHostKey) ?? _kDefaultHost;
|
return prefs?.getString(_kHostKey) ?? _kDefaultHost;
|
||||||
});
|
});
|
||||||
|
|
||||||
final pollIntervalProvider = StateProvider<double>((ref) {
|
|
||||||
final prefs = ref.watch(sharedPreferencesProvider).valueOrNull;
|
|
||||||
return prefs?.getDouble(_kPollIntervalKey) ?? _kDefaultPollInterval.toDouble();
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── Service ──────────────────────────────────────────────────────────────────
|
// ── Service ──────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
final busylightServiceProvider = Provider<BusylightService>((ref) {
|
final busylightServiceProvider = Provider<BusylightService>((ref) {
|
||||||
@@ -33,33 +26,10 @@ final busylightServiceProvider = Provider<BusylightService>((ref) {
|
|||||||
return BusylightService(baseUrl: host);
|
return BusylightService(baseUrl: host);
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Startup snapshot ─────────────────────────────────────────────────────────
|
final busylightSnapshotProvider =
|
||||||
// Loads status + color (which includes brightness) in 2 parallel calls.
|
StateNotifierProvider<LiveStatusNotifier, AsyncValue<BusylightUpdate>>(
|
||||||
// No separate GET /api/brightness needed — the color response already has it.
|
(ref) => LiveStatusNotifier(ref.watch(busylightServiceProvider)),
|
||||||
|
);
|
||||||
class BusylightSnapshot {
|
|
||||||
final BusylightStatus status;
|
|
||||||
final BusylightColor color;
|
|
||||||
|
|
||||||
const BusylightSnapshot({
|
|
||||||
required this.status,
|
|
||||||
required this.color,
|
|
||||||
});
|
|
||||||
|
|
||||||
double get brightness => color.brightness;
|
|
||||||
}
|
|
||||||
|
|
||||||
final busylightSnapshotProvider = FutureProvider<BusylightSnapshot>((ref) async {
|
|
||||||
final service = ref.watch(busylightServiceProvider);
|
|
||||||
final results = await Future.wait([
|
|
||||||
service.getStatus(),
|
|
||||||
service.getColor(),
|
|
||||||
]);
|
|
||||||
return BusylightSnapshot(
|
|
||||||
status: results[0] as BusylightStatus,
|
|
||||||
color: results[1] as BusylightColor,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
// ── State notifiers ──────────────────────────────────────────────────────────
|
// ── State notifiers ──────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -67,25 +37,21 @@ class BusylightStateNotifier extends StateNotifier<AsyncValue<BusylightStatus>>
|
|||||||
BusylightStateNotifier(this._service, BusylightStatus? initial)
|
BusylightStateNotifier(this._service, BusylightStatus? initial)
|
||||||
: super(initial != null
|
: super(initial != null
|
||||||
? AsyncValue.data(initial)
|
? AsyncValue.data(initial)
|
||||||
: const AsyncValue.loading()) {
|
: const AsyncValue.loading());
|
||||||
if (initial == null) refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
final BusylightService _service;
|
final BusylightService _service;
|
||||||
|
int _revision = 0;
|
||||||
Future<void> refresh() async {
|
|
||||||
state = const AsyncValue.loading();
|
|
||||||
state = await AsyncValue.guard(_service.getStatus);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> setStatus(BusylightStatus status) async {
|
Future<void> setStatus(BusylightStatus status) async {
|
||||||
// Keep current value visible during the API call — no loading state
|
// Keep current value visible during the API call — no loading state
|
||||||
|
final revision = ++_revision;
|
||||||
final result = await AsyncValue.guard(() => _service.setStatus(status));
|
final result = await AsyncValue.guard(() => _service.setStatus(status));
|
||||||
state = result;
|
if (mounted && revision == _revision) state = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update state locally without making an API call (e.g. for `colored`)
|
/// Update state locally without making an API call (e.g. for `colored`)
|
||||||
void setLocalStatus(BusylightStatus status) {
|
void setLocalStatus(BusylightStatus status) {
|
||||||
|
_revision++;
|
||||||
state = AsyncValue.data(status);
|
state = AsyncValue.data(status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -120,7 +86,7 @@ final brightnessProvider = StateNotifierProvider<BrightnessNotifier, double>(
|
|||||||
final snapshot = ref.watch(busylightSnapshotProvider).valueOrNull;
|
final snapshot = ref.watch(busylightSnapshotProvider).valueOrNull;
|
||||||
return BrightnessNotifier(
|
return BrightnessNotifier(
|
||||||
ref.watch(busylightServiceProvider),
|
ref.watch(busylightServiceProvider),
|
||||||
snapshot?.brightness ?? 0.3,
|
snapshot?.color.brightness ?? 0.3,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -149,51 +115,47 @@ final colorProvider = StateNotifierProvider<ColorNotifier, BusylightColor>(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// ── Background polling ────────────────────────────────────────────────────────
|
class LiveStatusNotifier extends StateNotifier<AsyncValue<BusylightUpdate>> {
|
||||||
// Periodically pulls status + color from the device and silently updates state.
|
LiveStatusNotifier(
|
||||||
|
this._service, {
|
||||||
class PollingNotifier extends StateNotifier<void> {
|
this.reconnectDelay = const Duration(seconds: 2),
|
||||||
PollingNotifier(this._ref) : super(null) {
|
}) : super(const AsyncValue.loading()) {
|
||||||
_start();
|
_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Ref _ref;
|
final BusylightService _service;
|
||||||
Timer? _timer;
|
final Duration reconnectDelay;
|
||||||
|
Timer? _reconnectTimer;
|
||||||
|
StreamSubscription<BusylightUpdate>? _subscription;
|
||||||
|
|
||||||
void _start() {
|
void _connect() {
|
||||||
final intervalSeconds = _ref.read(pollIntervalProvider);
|
if (!mounted) return;
|
||||||
final intervalMillis = (intervalSeconds * 1000).toInt();
|
_subscription = _service.watchStatus().listen(
|
||||||
_timer?.cancel();
|
(update) {
|
||||||
if (intervalMillis <= 0) return;
|
if (!mounted) return;
|
||||||
_timer = Timer.periodic(Duration(milliseconds: intervalMillis), (_) => _poll());
|
state = AsyncValue.data(update);
|
||||||
|
},
|
||||||
|
onError: _disconnected,
|
||||||
|
onDone: () => _disconnected(
|
||||||
|
const BusylightException('Live status connection closed'),
|
||||||
|
StackTrace.current,
|
||||||
|
),
|
||||||
|
cancelOnError: true,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart() => _start();
|
void _disconnected(Object error, StackTrace stackTrace) {
|
||||||
|
if (!mounted) return;
|
||||||
Future<void> _poll() async {
|
state = AsyncValue<BusylightUpdate>.error(error, stackTrace)
|
||||||
try {
|
.copyWithPrevious(state);
|
||||||
final service = _ref.read(busylightServiceProvider);
|
_reconnectTimer?.cancel();
|
||||||
final results = await Future.wait([
|
_reconnectTimer = Timer(reconnectDelay, _connect);
|
||||||
service.getStatus(),
|
|
||||||
service.getColor(),
|
|
||||||
]);
|
|
||||||
final status = results[0] as BusylightStatus;
|
|
||||||
final color = results[1] as BusylightColor;
|
|
||||||
_ref.read(busylightStatusProvider.notifier).setLocalStatus(status);
|
|
||||||
_ref.read(colorProvider.notifier).silentSet(color);
|
|
||||||
_ref.read(brightnessProvider.notifier).silentSet(color.brightness);
|
|
||||||
} catch (_) {
|
|
||||||
// Silently ignore poll errors — connection issues are shown on manual refresh
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_timer?.cancel();
|
_reconnectTimer?.cancel();
|
||||||
|
_subscription?.cancel();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final pollingProvider = StateNotifierProvider<PollingNotifier, void>(
|
|
||||||
(ref) => PollingNotifier(ref),
|
|
||||||
);
|
|
||||||
@@ -36,9 +36,6 @@ class HomeScreen extends ConsumerWidget {
|
|||||||
final snapshot = ref.watch(busylightSnapshotProvider);
|
final snapshot = ref.watch(busylightSnapshotProvider);
|
||||||
final statusAsync = ref.watch(busylightStatusProvider);
|
final statusAsync = ref.watch(busylightStatusProvider);
|
||||||
|
|
||||||
// Start background polling (no-op if already running)
|
|
||||||
ref.watch(pollingProvider);
|
|
||||||
|
|
||||||
if (!snapshot.hasValue && !snapshot.hasError) {
|
if (!snapshot.hasValue && !snapshot.hasError) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
@@ -65,7 +62,7 @@ class HomeScreen extends ConsumerWidget {
|
|||||||
loading: () => const Center(child: CircularProgressIndicator(color: Colors.amber)),
|
loading: () => const Center(child: CircularProgressIndicator(color: Colors.amber)),
|
||||||
error: (e, _) => _ErrorView(
|
error: (e, _) => _ErrorView(
|
||||||
message: e.toString(),
|
message: e.toString(),
|
||||||
onRetry: () => ref.read(busylightStatusProvider.notifier).refresh(),
|
onRetry: () => ref.invalidate(busylightSnapshotProvider),
|
||||||
),
|
),
|
||||||
data: (_) => const _Body(),
|
data: (_) => const _Body(),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'dart:io';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
@@ -14,14 +13,12 @@ class SettingsScreen extends ConsumerStatefulWidget {
|
|||||||
|
|
||||||
class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
||||||
late TextEditingController _hostController;
|
late TextEditingController _hostController;
|
||||||
late double _pollInterval;
|
|
||||||
bool _startWithSession = false;
|
bool _startWithSession = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_hostController = TextEditingController(text: ref.read(deviceHostProvider));
|
_hostController = TextEditingController(text: ref.read(deviceHostProvider));
|
||||||
_pollInterval = ref.read(pollIntervalProvider);
|
|
||||||
_loadAutostart();
|
_loadAutostart();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,14 +38,11 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||||||
if (host.isEmpty) return;
|
if (host.isEmpty) return;
|
||||||
|
|
||||||
ref.read(deviceHostProvider.notifier).state = host;
|
ref.read(deviceHostProvider.notifier).state = host;
|
||||||
ref.read(pollIntervalProvider.notifier).state = _pollInterval;
|
|
||||||
ref.read(pollingProvider.notifier).restart();
|
|
||||||
|
|
||||||
await AutostartService.setEnabled(_startWithSession);
|
await AutostartService.setEnabled(_startWithSession);
|
||||||
|
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setString('busylight_host', host);
|
await prefs.setString('busylight_host', host);
|
||||||
await prefs.setDouble('busylight_poll_interval', _pollInterval);
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
@@ -58,12 +52,6 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String _intervalLabel(double seconds) {
|
|
||||||
if (seconds == 0.0) return 'Off';
|
|
||||||
if (seconds < 2.0) return '${seconds}s';
|
|
||||||
return '${ (seconds)}s';
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -103,52 +91,6 @@ class _SettingsScreenState extends ConsumerState<SettingsScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
|
|
||||||
// ── Polling interval ────────────────────────────────────────────
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('Status polling',
|
|
||||||
style: TextStyle(color: Colors.grey.shade300, fontSize: 13, fontWeight: FontWeight.w600)),
|
|
||||||
Text(
|
|
||||||
_intervalLabel(_pollInterval),
|
|
||||||
style: const TextStyle(color: Colors.amber, fontSize: 13, fontWeight: FontWeight.w600),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
|
||||||
SliderTheme(
|
|
||||||
data: SliderTheme.of(context).copyWith(
|
|
||||||
activeTrackColor: Colors.amber,
|
|
||||||
thumbColor: Colors.amber,
|
|
||||||
inactiveTrackColor: Colors.grey.shade800,
|
|
||||||
overlayColor: Colors.amber.withOpacity(0.2),
|
|
||||||
),
|
|
||||||
child: Slider(
|
|
||||||
value: _pollInterval,
|
|
||||||
min: 0.0,
|
|
||||||
max: 2.0,
|
|
||||||
divisions: 4,
|
|
||||||
onChanged: (v) => setState(() => _pollInterval = v),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text('Off', style: TextStyle(color: Colors.grey.shade600, fontSize: 11)),
|
|
||||||
Text('0.5s', style: TextStyle(color: Colors.grey.shade600, fontSize: 11)),
|
|
||||||
Text('1s', style: TextStyle(color: Colors.grey.shade600, fontSize: 11)),
|
|
||||||
Text('1.5s', style: TextStyle(color: Colors.grey.shade600, fontSize: 11)),
|
|
||||||
Text('2s', style: TextStyle(color: Colors.grey.shade600, fontSize: 11)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 6),
|
|
||||||
Text(
|
|
||||||
_pollInterval == 0
|
|
||||||
? 'Polling is disabled. Status will only refresh manually.'
|
|
||||||
: 'Status is pulled from the device every $_pollInterval seconds.',
|
|
||||||
style: TextStyle(color: Colors.grey.shade600, fontSize: 12),
|
|
||||||
),
|
|
||||||
|
|
||||||
// ── Start with session (macOS + Windows only) ───────────────────
|
// ── Start with session (macOS + Windows only) ───────────────────
|
||||||
if (AutostartService.isSupported) ...[
|
if (AutostartService.isSupported) ...[
|
||||||
const SizedBox(height: 32),
|
const SizedBox(height: 32),
|
||||||
|
|||||||
@@ -1,8 +1,29 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:web_socket_channel/web_socket_channel.dart';
|
||||||
import '../models/busylight_color.dart';
|
import '../models/busylight_color.dart';
|
||||||
import '../models/busylight_status.dart';
|
import '../models/busylight_status.dart';
|
||||||
|
|
||||||
|
class BusylightUpdate {
|
||||||
|
final BusylightStatus status;
|
||||||
|
final BusylightColor color;
|
||||||
|
|
||||||
|
const BusylightUpdate({required this.status, required this.color});
|
||||||
|
|
||||||
|
factory BusylightUpdate.fromJson(Map<String, dynamic> json) {
|
||||||
|
final color = json['color'] as List<dynamic>;
|
||||||
|
return BusylightUpdate(
|
||||||
|
status: BusylightStatus.fromString(json['status'] as String),
|
||||||
|
color: BusylightColor(
|
||||||
|
r: (color[0] as num).toInt(),
|
||||||
|
g: (color[1] as num).toInt(),
|
||||||
|
b: (color[2] as num).toInt(),
|
||||||
|
brightness: (json['brightness'] as num).toDouble(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class BusylightException implements Exception {
|
class BusylightException implements Exception {
|
||||||
final String message;
|
final String message;
|
||||||
const BusylightException(this.message);
|
const BusylightException(this.message);
|
||||||
@@ -21,6 +42,26 @@ class BusylightService {
|
|||||||
|
|
||||||
Uri _uri(String path) => Uri.parse('$baseUrl$path');
|
Uri _uri(String path) => Uri.parse('$baseUrl$path');
|
||||||
|
|
||||||
|
Stream<BusylightUpdate> watchStatus() async* {
|
||||||
|
final uri = _uri('/ws/status');
|
||||||
|
final channel = WebSocketChannel.connect(
|
||||||
|
uri.replace(scheme: uri.scheme == 'https' ? 'wss' : 'ws'),
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
await channel.ready.timeout(timeout);
|
||||||
|
await for (final message in channel.stream) {
|
||||||
|
final text = message is String
|
||||||
|
? message
|
||||||
|
: utf8.decode(message as List<int>);
|
||||||
|
yield BusylightUpdate.fromJson(
|
||||||
|
jsonDecode(text) as Map<String, dynamic>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
await channel.sink.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Future<Map<String, dynamic>> _get(String path) async {
|
Future<Map<String, dynamic>> _get(String path) async {
|
||||||
try {
|
try {
|
||||||
final res = await http.get(_uri(path)).timeout(timeout);
|
final res = await http.get(_uri(path)).timeout(timeout);
|
||||||
|
|||||||
+7
-1
@@ -1,4 +1,4 @@
|
|||||||
platform :osx, '10.15'
|
platform :osx, '12.0'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
@@ -38,5 +38,11 @@ end
|
|||||||
post_install do |installer|
|
post_install do |installer|
|
||||||
installer.pods_project.targets.each do |target|
|
installer.pods_project.targets.each do |target|
|
||||||
flutter_additional_macos_build_settings(target)
|
flutter_additional_macos_build_settings(target)
|
||||||
|
target.build_configurations.each do |config|
|
||||||
|
deployment_target = config.build_settings['MACOSX_DEPLOYMENT_TARGET'] || '0'
|
||||||
|
if Gem::Version.new(deployment_target) < Gem::Version.new('12.0')
|
||||||
|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '12.0'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
+1
-1
@@ -18,6 +18,6 @@ SPEC CHECKSUMS:
|
|||||||
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
|
FlutterMacOS: d0db08ddef1a9af05a5ec4b724367152bb0500b1
|
||||||
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
shared_preferences_foundation: 7036424c3d8ec98dfe75ff1667cb0cd531ec82bb
|
||||||
|
|
||||||
PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009
|
PODFILE CHECKSUM: f24c7d0ecaa1b6ecc83f74a8e53fc646a281a2d5
|
||||||
|
|
||||||
COCOAPODS: 1.16.2
|
COCOAPODS: 1.16.2
|
||||||
@@ -355,7 +355,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "echo \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
|
shellScript = "export PATH=\"$PROJECT_DIR/toolchain:$PATH\"\necho \"$PRODUCT_NAME.app\" > \"$PROJECT_DIR\"/Flutter/ephemeral/.app_filename && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh embed\n";
|
||||||
};
|
};
|
||||||
33CC111E2044C6BF0003C045 /* ShellScript */ = {
|
33CC111E2044C6BF0003C045 /* ShellScript */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
@@ -375,7 +375,7 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
shellScript = "export PATH=\"$PROJECT_DIR/toolchain:$PATH\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
||||||
};
|
};
|
||||||
7ED5BCFD33FB57073491EF91 /* [CP] Check Pods Manifest.lock */ = {
|
7ED5BCFD33FB57073491EF91 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
@@ -556,7 +556,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
@@ -642,7 +642,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
@@ -692,7 +692,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.15;
|
MACOSX_DEPLOYMENT_TARGET = 12.0;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
|||||||
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
if [ "$#" -gt 3 ] && [ "$2" = "-verify_arch" ]; then
|
||||||
|
binary="$1"
|
||||||
|
shift 2
|
||||||
|
for architecture do
|
||||||
|
/usr/bin/lipo "$binary" -verify_arch "$architecture" || exit "$?"
|
||||||
|
done
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec /usr/bin/lipo "$@"
|
||||||
+1
-1
@@ -798,7 +798,7 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.1"
|
version: "1.0.1"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: web_socket_channel
|
name: web_socket_channel
|
||||||
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
|
sha256: d645757fb0f4773d602444000a8131ff5d48c9e47adfe9772652dd1a4f2d45c8
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
http: ^1.2.0
|
http: ^1.2.0
|
||||||
|
web_socket_channel: ^3.0.3
|
||||||
flutter_riverpod: ^2.5.1
|
flutter_riverpod: ^2.5.1
|
||||||
riverpod_annotation: ^2.3.5
|
riverpod_annotation: ^2.3.5
|
||||||
shared_preferences: ^2.2.3
|
shared_preferences: ^2.2.3
|
||||||
|
|||||||
@@ -0,0 +1,183 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:busylight_buddy/models/busylight_color.dart';
|
||||||
|
import 'package:busylight_buddy/models/busylight_status.dart';
|
||||||
|
import 'package:busylight_buddy/providers/busylight_provider.dart';
|
||||||
|
import 'package:busylight_buddy/services/busylight_service.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
class FakeBusylightService extends BusylightService {
|
||||||
|
FakeBusylightService() : super(baseUrl: 'http://localhost');
|
||||||
|
|
||||||
|
final updates = StreamController<BusylightUpdate>.broadcast();
|
||||||
|
int connections = 0;
|
||||||
|
int statusRequests = 0;
|
||||||
|
int colorRequests = 0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stream<BusylightUpdate> watchStatus() {
|
||||||
|
connections++;
|
||||||
|
return updates.stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<BusylightStatus> getStatus() async {
|
||||||
|
statusRequests++;
|
||||||
|
return BusylightStatus.off;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<BusylightColor> getColor() async {
|
||||||
|
colorRequests++;
|
||||||
|
return BusylightColor.white;
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<BusylightStatus> setStatus(BusylightStatus status) async => status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> waitUntil(bool Function() condition) async {
|
||||||
|
final deadline = DateTime.now().add(const Duration(seconds: 3));
|
||||||
|
while (!condition()) {
|
||||||
|
if (DateTime.now().isAfter(deadline)) fail('Condition was not reached');
|
||||||
|
await Future<void>.delayed(const Duration(milliseconds: 5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const update = BusylightUpdate(
|
||||||
|
status: BusylightStatus.colored,
|
||||||
|
color: BusylightColor(r: 12, g: 34, b: 56, brightness: 0.7),
|
||||||
|
);
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
test('decodes initial and subsequent messages from /ws/status', () async {
|
||||||
|
final server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
|
||||||
|
final sockets = <WebSocket>[];
|
||||||
|
addTearDown(() async {
|
||||||
|
for (final socket in sockets) {
|
||||||
|
await socket.close();
|
||||||
|
}
|
||||||
|
await server.close(force: true);
|
||||||
|
});
|
||||||
|
server.listen((request) async {
|
||||||
|
expect(request.uri.path, '/ws/status');
|
||||||
|
final socket = await WebSocketTransformer.upgrade(request);
|
||||||
|
sockets.add(socket);
|
||||||
|
socket.add(jsonEncode({
|
||||||
|
'status': 'available',
|
||||||
|
'color': [0, 255, 0],
|
||||||
|
'brightness': 0.3,
|
||||||
|
}));
|
||||||
|
socket.add(utf8.encode(jsonEncode({
|
||||||
|
'status': 'colored',
|
||||||
|
'color': [12, 34, 56],
|
||||||
|
'brightness': 0.7,
|
||||||
|
})));
|
||||||
|
await socket.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
final service = BusylightService(
|
||||||
|
baseUrl: 'http://127.0.0.1:${server.port}',
|
||||||
|
);
|
||||||
|
final messages = await service.watchStatus().toList();
|
||||||
|
expect(messages.map((message) => message.status),
|
||||||
|
[BusylightStatus.available, BusylightStatus.colored]);
|
||||||
|
expect(messages.last.color.r, 12);
|
||||||
|
expect(messages.last.color.g, 34);
|
||||||
|
expect(messages.last.color.b, 56);
|
||||||
|
expect(messages.last.color.brightness, 0.7);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('live updates initialize without REST and reconnect after errors',
|
||||||
|
() async {
|
||||||
|
final service = FakeBusylightService();
|
||||||
|
final container = ProviderContainer(overrides: [
|
||||||
|
busylightServiceProvider.overrideWithValue(service),
|
||||||
|
busylightSnapshotProvider.overrideWith((ref) => LiveStatusNotifier(
|
||||||
|
ref.watch(busylightServiceProvider),
|
||||||
|
reconnectDelay: const Duration(milliseconds: 5),
|
||||||
|
)),
|
||||||
|
]);
|
||||||
|
addTearDown(() async {
|
||||||
|
container.dispose();
|
||||||
|
await service.updates.close();
|
||||||
|
});
|
||||||
|
expect(container.read(busylightStatusProvider).isLoading, isTrue);
|
||||||
|
await waitUntil(() => service.updates.hasListener);
|
||||||
|
service.updates.add(update);
|
||||||
|
await waitUntil(() => container.read(brightnessProvider) == 0.7);
|
||||||
|
expect(container.read(busylightStatusProvider).value, update.status);
|
||||||
|
expect(container.read(colorProvider).r, 12);
|
||||||
|
expect(container.read(colorProvider).g, 34);
|
||||||
|
expect(container.read(colorProvider).b, 56);
|
||||||
|
|
||||||
|
service.updates.addError(StateError('Disconnected'));
|
||||||
|
await waitUntil(() => service.connections == 2);
|
||||||
|
service.updates.add(const BusylightUpdate(
|
||||||
|
status: BusylightStatus.busy,
|
||||||
|
color: BusylightColor.red,
|
||||||
|
));
|
||||||
|
await waitUntil(() =>
|
||||||
|
container.read(busylightStatusProvider).value == BusylightStatus.busy);
|
||||||
|
expect(service.statusRequests, 0);
|
||||||
|
expect(service.colorRequests, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('socket closure retains the last state without REST polling', () async {
|
||||||
|
final service = FakeBusylightService();
|
||||||
|
final container = ProviderContainer(overrides: [
|
||||||
|
busylightServiceProvider.overrideWithValue(service),
|
||||||
|
]);
|
||||||
|
addTearDown(container.dispose);
|
||||||
|
container.read(busylightSnapshotProvider);
|
||||||
|
await waitUntil(() => service.updates.hasListener);
|
||||||
|
service.updates.add(update);
|
||||||
|
await waitUntil(() => container.read(brightnessProvider) == 0.7);
|
||||||
|
await service.updates.close();
|
||||||
|
await waitUntil(() => container.read(busylightSnapshotProvider).hasError);
|
||||||
|
expect(container.read(busylightStatusProvider).value, update.status);
|
||||||
|
expect(container.read(brightnessProvider), 0.7);
|
||||||
|
expect(service.statusRequests, 0);
|
||||||
|
expect(service.colorRequests, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('changing the device cancels the old subscription', () async {
|
||||||
|
final first = FakeBusylightService();
|
||||||
|
final second = FakeBusylightService();
|
||||||
|
final container = ProviderContainer(overrides: [
|
||||||
|
deviceHostProvider.overrideWith((ref) => 'first'),
|
||||||
|
busylightServiceProvider.overrideWith((ref) =>
|
||||||
|
ref.watch(deviceHostProvider) == 'first' ? first : second),
|
||||||
|
]);
|
||||||
|
addTearDown(() async {
|
||||||
|
container.dispose();
|
||||||
|
await first.updates.close();
|
||||||
|
await second.updates.close();
|
||||||
|
});
|
||||||
|
final subscription = container.listen(busylightSnapshotProvider, (_, next) {});
|
||||||
|
addTearDown(subscription.close);
|
||||||
|
await waitUntil(() => first.updates.hasListener);
|
||||||
|
container.read(deviceHostProvider.notifier).state = 'second';
|
||||||
|
await waitUntil(() => second.updates.hasListener);
|
||||||
|
expect(first.updates.hasListener, isFalse);
|
||||||
|
second.updates.add(update);
|
||||||
|
await waitUntil(() => container.read(brightnessProvider) == 0.7);
|
||||||
|
container.dispose();
|
||||||
|
expect(second.updates.hasListener, isFalse);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('a stale command response cannot overwrite a pushed status', () async {
|
||||||
|
final notifier = BusylightStateNotifier(
|
||||||
|
FakeBusylightService(),
|
||||||
|
BusylightStatus.off,
|
||||||
|
);
|
||||||
|
addTearDown(notifier.dispose);
|
||||||
|
final command = notifier.setStatus(BusylightStatus.available);
|
||||||
|
notifier.setLocalStatus(BusylightStatus.busy);
|
||||||
|
await command;
|
||||||
|
expect(notifier.state.value, BusylightStatus.busy);
|
||||||
|
});
|
||||||
|
}
|
||||||
+53
-3
@@ -1,14 +1,64 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:busylight_buddy/main.dart';
|
import 'package:busylight_buddy/main.dart';
|
||||||
|
import 'package:busylight_buddy/models/busylight_color.dart';
|
||||||
|
import 'package:busylight_buddy/models/busylight_status.dart';
|
||||||
|
import 'package:busylight_buddy/providers/busylight_provider.dart';
|
||||||
|
import 'package:busylight_buddy/services/busylight_service.dart';
|
||||||
|
import 'package:busylight_buddy/widgets/brightness_slider.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
class _WidgetBusylightService extends BusylightService {
|
||||||
|
_WidgetBusylightService() : super(baseUrl: 'http://localhost');
|
||||||
|
|
||||||
|
final updates = StreamController<BusylightUpdate>();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<BusylightStatus> getStatus() async => BusylightStatus.off;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<BusylightColor> getColor() async => BusylightColor.white;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Stream<BusylightUpdate> watchStatus() => updates.stream;
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('App smoke test — renders without crashing', (WidgetTester tester) async {
|
testWidgets('App renders pushed status and brightness', (WidgetTester tester) async {
|
||||||
|
SharedPreferences.setMockInitialValues({});
|
||||||
|
final service = _WidgetBusylightService();
|
||||||
|
addTearDown(service.updates.close);
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
const ProviderScope(
|
ProviderScope(
|
||||||
child: BusylightApp(),
|
overrides: [
|
||||||
|
busylightServiceProvider.overrideWithValue(service),
|
||||||
|
],
|
||||||
|
child: const BusylightApp(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
expect(find.text('BusyLight'), findsOneWidget);
|
expect(find.text('BusyLight'), findsOneWidget);
|
||||||
|
service.updates.add(const BusylightUpdate(
|
||||||
|
status: BusylightStatus.off,
|
||||||
|
color: BusylightColor.white,
|
||||||
|
));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text('OFF'), findsOneWidget);
|
||||||
|
|
||||||
|
service.updates.add(const BusylightUpdate(
|
||||||
|
status: BusylightStatus.busy,
|
||||||
|
color: BusylightColor(r: 255, g: 0, b: 0, brightness: 0.7),
|
||||||
|
));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.text('BUSY'), findsOneWidget);
|
||||||
|
await tester.scrollUntilVisible(
|
||||||
|
find.byType(BrightnessSlider),
|
||||||
|
300,
|
||||||
|
scrollable: find.byType(Scrollable).first,
|
||||||
|
);
|
||||||
|
expect(tester.widget<BrightnessSlider>(find.byType(BrightnessSlider)).value,
|
||||||
|
0.7);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user