* Create `PushHandlingWakeLock` to start a foreground service:
When receiving a push and scheduling the notification fetching, several problems can happen:
1. Some async operation is waiting for a timeout and it takes way longer than that to finish (i.e. timeout of 10s but it took 30s to advance).
2. The same, but when starting new coroutines. I've seen the time between scheduling a coroutine and it running sometimes take up to 1 minute.
3. Notification fetching can be scheduled immediately, but it can take a while to actually run because the OS understands the app is now in Doze.
Having a wakelock that runs as soon as the push handling starts fixes these: it continues the previous wakelock held by either Firebase or the UnifiedPush distributor.
* Acquire the wakelock as soon as we received the pushes in both receivers
* Also release the wakelock ahead of time if possible
* Add `isNetworkBlocked` and `isInAirGappedEnvironment` to `NetworkMonitor`.
* Improve the DI of `SyncPendingNotificationsRequestBuilder` to simplify its usage.
* Only update `isInAirGappedEnvironment` in `DefaultNetworkManager` if the current build is an enterprise one.
* Add network constraints to `DefaultSyncPendingNotificationsRequestBuilder` based on the air-gapped status.
* Add a feature flag to disable the new check, in case it doesn't work as expected.
* Add `NetworkMonitor.isNetworkBlocked()`, use it to check if Doze prevented us from loading notifications
* Only check if network is blocked after checking if we have a network available, otherwise it's always `true`
* Extract `NetworkBlockedChecker` to handle deprecations more carefully
* Inject the session scope instead of the application scope where it's possible.
* Create AppCoroutineScope annotation to let developers explicitly choose the appropriate CoroutineScope when injecting one.
* Create `SyncOrchestrator` to centralise the sync start/stop flow through the whole app: the decision is based on several inputs: sync state, network available, app in foreground, app in call, app needing to sync an event for a notification.
* Make network monitor return network connectivity status, not internet connectivity
* Don't stop the `SyncService` when network connection is lost, let it fail instead. This prevents an issue when using the offline mode of the SDK, which made the wrong UI states to be shown when the `SyncState` is `Idle` (that is, after the service being manually stopped).
* Rename `NetworkStatus.Online/Offline` to `Connected/Disconnected` so they're not easily mistaken with internet connectivity instead
2 replace all actions have been performed:
- "SPDX-License-Identifier: AGPL-3.0-only" to "SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial"
- "Please see LICENSE in the repository root for full details." to "Please see LICENSE files in the repository root for full details."