Skip to content

feat: Add charging constraint to LorraineConstraints#37

Merged
rteyssandier merged 4 commits into
rteyssandier:mainfrom
dombroks:charging-constraint
Jan 21, 2026
Merged

feat: Add charging constraint to LorraineConstraints#37
rteyssandier merged 4 commits into
rteyssandier:mainfrom
dombroks:charging-constraint

Conversation

@dombroks

@dombroks dombroks commented Jan 14, 2026

Copy link
Copy Markdown
Contributor

This pull request adds support for a new requireCharging constraint to tasks, ensuring they can be configured to run only when the device is charging. The change is implemented across the codebase, including the data model, Android and iOS platform logic, database schema, and documentation. It also introduces the necessary logic to detect charging state on iOS and integrates this new constraint into the constraint-checking pipeline.

Constraint System Enhancements:

  • Added requireCharging property to LorraineConstraints, updated the DSL (LorraineConstraintsDefinition) to support it, and ensured conversions between domain and entity models include this new field. [1] [2]
  • Updated Android mapping to pass requireCharging to WorkManager's Constraints.

iOS Platform Support:

  • Implemented ChargingCheck for iOS, including an observer for battery charging state changes, and integrated it into the iOS constraint checks. [1] [2] [3]

Database and Schema Updates:

  • Added require_charging column to the ConstraintEntity and updated the Room database schema to version 4, including an auto-migration and updated schema JSON. [1] [2] [3] [4]

Documentation:

  • Updated the README.md to mention the new requireCharging constraint option.

@dombroks dombroks marked this pull request as ready for review January 16, 2026 15:13
@rteyssandier rteyssandier added the enhancement New feature or request label Jan 21, 2026
Comment thread lorraine/src/commonMain/kotlin/io/dot/lorraine/db/LorraineDB.kt
@rteyssandier rteyssandier merged commit 8fcd3d7 into rteyssandier:main Jan 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants