Commit Graph
4 Commits
Author SHA1 Message Date
Mateusz Szklarek 38c46c165d Refactor: Replace nonisolated(unsafe) Calendar with @TaskLocal
The `DateEnvironment.calendar` property was previously marked with `nonisolated(unsafe)`,
which disables crucial compiler safety checks for a mutable global variable.
This pattern is unsafe and can lead to data races and unpredictable behavior in
concurrent environments.

This commit replaces `nonisolated(unsafe)` with the modern `@TaskLocal`
property wrapper available in Swift 6.1. This provides a much safer API
for managing context-specific data.

The key benefits of this change are:
- **Thread Safety:** `@TaskLocal` is inherently safe. The property is read-only by default, and modifications are confined to the specific task's scope.
- **Scoped Modifications:** Changes to the calendar are made via the `withValue` function, which guarantees that the modification only applies within a local scope and does not leak, preventing global state pollution.
- **Improved Clarity:** The API now clearly expresses its intent. Consumers must explicitly create a local scope to use a different calendar, making the code more predictable and easier to reason about.
2025-07-16 16:35:40 +02:00
Maciej Gomółka 99cd15fce7 Display lock screen over the app 2025-04-10 15:24:21 +00:00
Maciej Gomółka b2f1fe26f8 Precache emails 2025-01-31 16:13:04 +01:00
Mateusz Szklarek 1d793acf5b Rename ProtonTesting module to InboxTesting 2024-10-29 12:42:21 +01:00