Commit Graph

215 Commits

Author SHA1 Message Date
Jorge Martin Espinosa
13bbd24df1 Fix wakelock not stopping early when notifications are disabled (#6424)
If notifications for a device are disabled when there is no connection with the HS, the push registration will still exist, so the device can still receive push notifications.

In that cases, we were running into an issue where the wakelock for push notifications was started immediately after receiving a push but was never stopped and it ran for 3 minutes until its timeout, keeping the device awake for no reason.

This patch changes `DefaultPushHandler` so if we don't need the wakelock it returns `false` and we can stop the wakelock early.
2026-03-23 18:07:25 +01:00
Jorge Martin Espinosa
96e2f882a2 Add a foreground service with a wakelock for fetching push notifications (#6321)
* 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
2026-03-17 14:24:26 +01:00
renovate[bot]
7c97ec1155 Update metro to v0.11.2 (#6270)
* Update metro to v0.11.2

* Bind push tests to the right scope .Add a comment so we don't forget to do it for future ones.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jorge Martín <jorgem@element.io>
2026-03-03 13:39:43 +01:00
bmarty
6c81e88689 Sync Strings from Localazy 2026-02-23 00:39:49 +00:00
Benoit Marty
657a610f53 Metro 0.10.0: Classes annotated with ContributesIntoSet do not need to be annotated with Inject. 2026-01-20 10:13:39 +01:00
Jorge Martín
3a6e82a7f0 Do some cleanup in VectorUnifiedPushMessagingReceiverBindings 2025-12-22 14:17:19 +01:00
Benoit Marty
bd46ce9775 Fix test issue: "java.security.KeyStoreException: AndroidKeyStore not found" 2025-12-19 09:27:11 +01:00
ElementBot
6880cf518c Sync Strings from Localazy (#5904)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-12-15 23:51:19 +01:00
Benoit Marty
72b3decf4c Detekt: enable rule exceptions.SwallowedException and fix existing issue. 2025-12-05 09:45:23 +01:00
S1m
3cbdc97cdd Fix push gateway with some push provider (Sunup/autopush) (#5741)
* Add more HTTP response code returning NoMatrixGateway

Fix Push notifications with Mozilla's autopush that returns 406

* Update gateway resolver tests to match new known errors
2025-11-17 13:34:35 +01:00
Benoit Marty
2789c8614d Improve code readability and documentation. 2025-11-14 15:10:24 +01:00
Benoit Marty
828092c87a Update KDoc 2025-11-14 14:23:29 +01:00
Benoit Marty
ced5af18d0 Do not attempt to restore the pusher after 2 removal in a short time. 2025-11-13 23:15:00 +01:00
Benoit Marty
0a7e6629d3 Update comment 2025-11-13 18:06:27 +01:00
Benoit Marty
eff4766693 Add unit test on DefaultUnifiedPushRemovedGatewayHandler 2025-11-13 15:34:33 +01:00
Benoit Marty
2b4d80df01 UnifiedPush: emit error when registration fails.
Note that I did not manage to have the method `onRegistrationFailed` invoked. If the network is not available for instance, unregistering the previous pusher will fail first.
2025-11-13 14:56:20 +01:00
Benoit Marty
823a35231d Improve logs 2025-11-13 12:26:46 +01:00
Benoit Marty
5864c055d5 Unregister the pusher when the topic is deleted (unregistered) 2025-11-13 12:26:35 +01:00
Benoit Marty
1292da2a72 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty
b748fcc631 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
0a0224b586 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Benoit Marty
44b5ad48f1 Remove dependency on AppNavigationStateService from DefaultUnifiedPushCurrentUserPushConfigProvider 2025-10-23 15:37:31 +02:00
Benoit Marty
826cacf209 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
241a968d66 Introduce JsonProvider.
It will ensure that classes are using the correct Json instances in the unit tests.
2025-10-20 09:40:42 +02:00
Benoit Marty
ff205042ec Fix tests. 2025-10-16 18:16:48 +02:00
Benoit Marty
276c707e42 Move Json provider from Network module to AppModule to reuse it. 2025-10-16 16:37:08 +02:00
Benoit Marty
46f5b4959f Merge pull request #5443 from element-hq/renovate/org.unifiedpush.android-connector-3.x
fix(deps): update dependency org.unifiedpush.android:connector to v3.1.0
2025-10-10 17:52:33 +02:00
Benoit Marty
146c5d4adc Need to be a compose library for Distributor to be considered stable. 2025-10-09 18:22:37 +02:00
Benoit Marty
6fb194f3dd Improve current push provider test: give info about the distributor. 2025-10-07 15:17:59 +02:00
Benoit Marty
261688da12 Fix API break in tests. 2025-10-06 22:39:33 +02:00
ElementBot
c6d4a367d3 Sync Strings from Localazy (#5427)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-09-29 15:10:21 +00:00
Benoit Marty
194340b19c Introduce runAndTestState extension on NotificationTroubleshootTest 2025-09-23 09:46:21 +02:00
Benoit Marty
054e0564f8 Add default value for Failure.hasQuickFix 2025-09-23 09:13:45 +02:00
Benoit Marty
c4d7d42141 Add notification troubleshoot test about blocked users. 2025-09-23 08:59:40 +02:00
Benoit Marty
b9df8f969a Make PushData.clientSecret mandatory.
Also do not restore the last session as a fallback, it can lead to error in a multi account context, or even when a ghost pusher send a Push.
2025-09-19 08:57:23 +02:00
Benoit Marty
629fc552e5 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
bmarty
676d7f6c8f Sync Strings from Localazy 2025-09-05 07:44:19 +00:00
Jorge Martín
8f09fd62d9 Fixes after rebase 2025-09-04 16:49:21 +02:00
Jorge Martín
36bca71a46 Improve the fix for push notifications and MessagingReceiver being unknown to the DI 2025-09-04 16:49:21 +02:00
Jorge Martín
298fda8bcf Fix push notification bindings 2025-09-04 16:49:21 +02:00
Jorge Martín
dca1c5b516 Remove dagger and anvil dependencies, try to simplify gradle build scripts a bit 2025-09-04 16:49:21 +02:00
Jorge Martín
e06bacbff3 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín
fc3153bd26 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín
92a4b8b66b Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
Benoit Marty
a00623e490 Cleanup tests. 2025-09-01 15:03:41 +02:00
Benoit Marty
5f223f3c89 Refactor: Move InMemorySessionStore to test module
- Delete `libraries/session-storage/impl-memory` module
- Move `InMemorySessionStore.kt` to `libraries/session-storage/test`
2025-09-01 14:47:42 +02:00
ganfra
880f1e0134 deps (firebase) : bom >= 34.0.0 doesn't have ktx module anymore 2025-07-22 18:23:42 +02:00
bmarty
2e8f8ec057 Sync Strings from Localazy 2025-06-30 00:33:54 +00:00
Benoit Marty
a55a493060 Create a loggerTag val. 2025-06-11 14:54:46 +02:00
ElementBot
f32495ee58 Sync Strings from Localazy (#4842)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-06-11 14:13:33 +02:00