bugfix/system-brightness-not-decreasing - #91
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #91 +/- ##
===========================================
+ Coverage 99.14% 99.21% +0.07%
===========================================
Files 4 4
Lines 117 128 +11
===========================================
+ Hits 116 127 +11
Misses 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This reverts commit ef37344.
|
Fix #53 by adding an option to tweak auto brightness |
…ightness to the platform interface test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
7f66e1c to
7635119
Compare
|
Summary: Good structure and clear method handlers. Main concerns are potential crashes from uninitialized/force-unwrapped state and inconsistent permission flows. Fix those before merging. 🔴 Blocker: uninitialized Delegates.notNull fields
🔴 Blocker: forced activity!! (NPE)
🟡 Suggestion: clamp/validate brightness inputs
🟡 Suggestion: unify permission UX
💭 Nit/cleanup:
Questions:
Nice work on the stream handlers and reflection fallback for maximum brightness. |
…mScreenBrightness and setApplicationScreenBrightness. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
28cb3bc to
74e0361
Compare
|
🔴 Blocker — iOS animation uses Thread.sleep + many BlockOperations File: Why: Sleeping and queuing many BlockOperations can starve threads, be imprecise, and cause UI jank on the main thread. Suggestion:
Example: DispatchQueue.main.async {
UIView.animate(withDuration: 0.3) {
UIScreen.main.brightness = CGFloat(target)
}
}Or use CADisplayLink to step smoothly for custom timing. 🟡 Suggestion — Android brightness sentinel compare File: Why: Comparing to -1.0f is unclear and brittle. Suggestion:
Example: if (brightness != WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE) {
// apply override
}🟡 Suggestion — unify error codes/messages & method-name constants File: Why: Mismatched strings between platform_interface and native code cause runtime errors and fragile tests. Suggestion:
Example (Dart): class ScreenBrightnessPlatform {
static const String methodSetBrightness = 'setScreenBrightness';
static const String errorInvalidValue = 'invalid-argument';
}💭 Nit — copy/paste throw texts & boundary tests File: Why: Some thrown messages reference the wrong context; no tests for out-of-range values. Suggestion:
Example test: expect(() => platform.setScreenBrightness(-0.1), throwsA(isA<PlatformException>()));
expect(await plugin.getScreenBrightness(), inInclusiveRange(0.0, 1.0));If desired, produce small patches for the iOS animation and Android check. |
…ink for smooth main-thread animation Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
No description provided.