Commit graph

170 commits

Author SHA1 Message Date
bmarty
23c1112dcf Sync Strings from Localazy 2026-04-13 00:48:40 +00:00
Jorge Martin Espinosa
f1708f6366
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
8e46e68630
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]
2b04c4bfc0
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
25c723c35a Sync Strings from Localazy 2026-02-23 00:39:49 +00:00
Benoit Marty
c901772145 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
b91e3cfb84 Do some cleanup in VectorUnifiedPushMessagingReceiverBindings 2025-12-22 14:17:19 +01:00
Benoit Marty
4aadbed0b1 Fix test issue: "java.security.KeyStoreException: AndroidKeyStore not found" 2025-12-19 09:27:11 +01:00
ElementBot
ad881c303a
Sync Strings from Localazy (#5904)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-12-15 23:51:19 +01:00
S1m
c4dd960e0d
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
1d7d00e4bb Improve code readability and documentation. 2025-11-14 15:10:24 +01:00
Benoit Marty
dbb9bb1338 Update KDoc 2025-11-14 14:23:29 +01:00
Benoit Marty
f1e12c1c1c Do not attempt to restore the pusher after 2 removal in a short time. 2025-11-13 23:15:00 +01:00
Benoit Marty
358731def3 Update comment 2025-11-13 18:06:27 +01:00
Benoit Marty
c453d2adac Add unit test on DefaultUnifiedPushRemovedGatewayHandler 2025-11-13 15:34:33 +01:00
Benoit Marty
f9c0b9e8bb 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
6b7e8f72f5 Improve logs 2025-11-13 12:26:46 +01:00
Benoit Marty
e706e5fa0e Unregister the pusher when the topic is deleted (unregistered) 2025-11-13 12:26:35 +01:00
Benoit Marty
eb31505dc7 Copyright: Add Element Creations Ltd. copyright 2025-11-10 11:05:05 +01:00
Benoit Marty
f86431e663 Copyright: Add final period 2025-11-10 10:13:41 +01:00
Benoit Marty
c4e0370f41 Copyright: run command uv run license-editor --repository ../element-x-android 2025-11-10 10:09:26 +01:00
Benoit Marty
afdfe28ef4 Remove dependency on AppNavigationStateService from DefaultUnifiedPushCurrentUserPushConfigProvider 2025-10-23 15:37:31 +02:00
Benoit Marty
263e761907 Remove @Inject, not necessary anymore when class is annotated with @ContributesBinding 2025-10-22 18:52:37 +02:00
Benoit Marty
df48ed5a2d 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
b01de9efa7 Fix tests. 2025-10-16 18:16:48 +02:00
Benoit Marty
7c437761c4 Move Json provider from Network module to AppModule to reuse it. 2025-10-16 16:37:08 +02:00
Benoit Marty
a02b2283af
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
7ce4b47203 Improve current push provider test: give info about the distributor. 2025-10-07 15:17:59 +02:00
Benoit Marty
9436ea55a3 Fix API break in tests. 2025-10-06 22:39:33 +02:00
Benoit Marty
8d5078904a Introduce runAndTestState extension on NotificationTroubleshootTest 2025-09-23 09:46:21 +02:00
Benoit Marty
a83fc2aa1d Add default value for Failure.hasQuickFix 2025-09-23 09:13:45 +02:00
Benoit Marty
fa14e4c106 Add notification troubleshoot test about blocked users. 2025-09-23 08:59:40 +02:00
Benoit Marty
a575019760 Use DependencyHandlerScope.testCommonDependencies() 2025-09-16 14:38:31 +02:00
bmarty
8027ce9dca Sync Strings from Localazy 2025-09-05 07:44:19 +00:00
Jorge Martín
e8328858ab Fixes after rebase 2025-09-04 16:49:21 +02:00
Jorge Martín
6a05e1b911 Improve the fix for push notifications and MessagingReceiver being unknown to the DI 2025-09-04 16:49:21 +02:00
Jorge Martín
badd8aa8a1 Fix push notification bindings 2025-09-04 16:49:21 +02:00
Jorge Martín
de8de61b2e Remove dagger and anvil dependencies, try to simplify gradle build scripts a bit 2025-09-04 16:49:21 +02:00
Jorge Martín
4ab62a6a38 Redo DI gradle setup code 2025-09-04 16:49:20 +02:00
Jorge Martín
29a97fc0d9 Fix lint issues and restore commented out code 2025-09-04 16:49:18 +02:00
Jorge Martín
b76a71ebf5 Start migrating Anvil KSP to Metro 2025-09-04 16:48:34 +02:00
bmarty
284241a4ec Sync Strings from Localazy 2025-06-30 00:33:54 +00:00
Benoit Marty
624bf7bc49 Create a loggerTag val. 2025-06-11 14:54:46 +02:00
ElementBot
520c1293b6
Sync Strings from Localazy (#4842)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-06-11 14:13:33 +02:00
Benoit Marty
5f191d9f9c
Fix coroutine scope (#4820)
* 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.
2025-06-04 15:33:51 +00:00
Jorge Martin Espinosa
efdc10e60a
Add catchingExceptions method to replace runCatching (#4797)
- Add `runCatchingExceptions` and `mapCatchingExceptions` to replace `runCatching` and `mapCatching`.
- Make `tryOrNull { ... }` catch only exceptions too.
- Apply the changes to the whole project.
- Add new Rust fakes for tests to handle the code that's now unblocked - previously it just threw an `UnsatisfiedLinkError` which we ignored.
- Add a new `detekt-rules` project with a `RunCatchingRule` to prevent `runCatching` and `mapCatching` usages.
2025-06-04 09:02:26 +02:00
ElementBot
e8f29a38bf
Sync Strings (#4775) 2025-05-30 08:47:39 +00:00
Benoit Marty
61075c7a9b
Update UnifiedPush library (#4358)
* Upgrade `com.github.UnifiedPush:android-connector` from 2.4.0 to 3.0.4

* Do not use jitpack to get the unified push library

* implementation is ok

* Exclude com.google.crypto.tink to fix a compilation issue

* Fix tests.

* Update log.

* Revert "Exclude com.google.crypto.tink to fix a compilation issue"

This reverts commit f431ebe3b78a06282e0ee74c9f428702d463df45.

* Fix compilation issue after rebase.

* Exclude com.google.crypto.tink again.

* Try version 3.0.8

* Use latest version 3.0.9

* Replace tink exclusion with dependency resolution

---------

Co-authored-by: Jorge Martín <jorgem@element.io>
2025-05-26 14:56:54 +02:00
ElementBot
34e88f30ae
Sync Strings (#4739)
* Sync Strings from Localazy

* Sync strings again

---------

Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
Co-authored-by: Benoit Marty <benoit@matrix.org>
2025-05-19 08:17:02 +00:00
ElementBot
bfa05ece67
Sync Strings from Localazy (#4677)
Co-authored-by: bmarty <3940906+bmarty@users.noreply.github.com>
2025-05-05 12:11:22 +02:00