fluffychat icon indicating copy to clipboard operation
fluffychat copied to clipboard

Notifications doesn't work properly on Android with UnifiedPush

Open parrazam opened this issue 1 year ago • 6 comments

Bug Description

I have 2 accounts registered in FluffyChat, one using the default server matrix.org and another one using a custom server. I'm using Ntfy as notification server.

When I add both accounts in the app, the first one register the device in the Ntfy server. However, the second one doesn't. So I can receive notifications for the first account but not for the second one.

Steps to Reproduce

  1. Log in in the app with an account.
  2. Check that the notification device is registered under Settings -> Notifications -> Devices
  3. Log in with another account from a different server.
  4. Go to Settings -> Notifications -> Devices and no one device was registered.
  5. Send a message to the first account. It will be notified.
  6. Send a message to the second account. It won't be notified :(

Expected Behavior

Each account should register in the unifiedpush server, in order to manage notifications independently.

App Version

1.13.0

Additional Platform Information

Device: OnePlus 8T, OS: Android 13

Additional Context

No response

parrazam avatar Aug 25 '23 18:08 parrazam

This issue is stale because it has been open for 120 days with no activity.

github-actions[bot] avatar Dec 24 '23 02:12 github-actions[bot]

This is stilll broken.

marcan avatar Dec 24 '23 03:12 marcan

Just found this out as I was starting to use FluffyChat for my multiple accounts

Doomsdayrs avatar Jan 16 '24 17:01 Doomsdayrs

I tested this by enabling and disabling notifications for each account. each time I do so for one account, I can receive notifications for that account (DMs only -- notifications for group chats never work) but not the other.

cassandracomar avatar Jan 20 '24 16:01 cassandracomar

Yes this is also happening with the google play version, which I installed in the hope to fix this, but I only get DM-notifications for the first account. (Both are custom servers)

TimSchimansky avatar Feb 19 '24 10:02 TimSchimansky

If you are really desperate, here is how to register a pusher manually by directly calling the matrix API:

First you will need you access token and the url of the matrix api.

Api url is easy, take the domain part of your account name (such as "matrix.org") and look at https://matrix.org/.well-known/matrix/client - if they show m.homeserver -> base_url then that is the API url, if not, then the domain part of your account name is the API url. Matrix.org has api at https://matrix-client.matrix.org. Do this for both of your accounts and let's call them MATRIX_HOST_1 and MATRIX_HOST_2.

To get the access tokens, you can either steal them from a web client by inspecting the Authorization headers (any access token of the particular user account should work). I don't know how to get it from Fluffychat, but we could just do a new login on command line:

(Be extra careful with that access token, and that curl command containing your password. If you don't know how to avoid leaking them, or accidentally storing them in some cache or history, don't proceed.)

curl -XPOST -H "Content-Type: application/json" \
  -d '{"type":"m.login.password","identifier":{"type":"m.id.user","user":"YourUsernameHere"},"password":"YourPasswordHere"}' \
  "${MATRIX_HOST_1}/_matrix/client/v3/login"

Get both access tokens, let's call them ACCESS_TOKEN_1 and ACCESS_TOKEN_2.

Get the pusher settings from the first account (the one where push notifications work):

curl -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${ACCESS_TOKEN_1}" \
  "${MATRIX_HOST_1}/_matrix/client/v3/pushers"

From the response take only the object inside pushers:[...] and add this part: "append":true - this can be done with jq:

curl ..../pushers | jq -rc '.pushers[0]+{append:true}'

Now send the resulting json object to the second account's api, to set the pusher:

curl -XPOST -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${ACCESS_TOKEN_2}" \
  --data '{"app_display_name":"..."... ,"append":true}' \
  "${MATRIX_HOST_2}/_matrix/client/v3/pushers/set"

This will effectively clone the exact same UnifiedPush settings from your first account. Now fluffy should be getting the notifications, however it's not 100% ideal, seems like fluffy will show the username of the first account, but at least the notification is there and clicking it opens the correct room in correct account.

Of course this is super hacky solution, so only do this if you are willing to solve whatever breaks. So far it seems to have worked for me, YMMV.

squatica avatar May 15 '24 08:05 squatica

Yes this is also happening with the google play version, which I installed in the hope to fix this, but I only get DM-notifications for the first account. (Both are custom servers)

Hi, I second this. I've reinstalled using Google Play (because was not working with Ntfy) and still notifications does not work.

I have 2 accounts. Boths with self hosted servers. With Element Notifications does work.

gusarg81 avatar May 16 '24 17:05 gusarg81

It's still actual bug. Android 14, Fluffy 1.22.0 I receive push from first account and dont receive form second account.

Yarrax avatar Oct 14 '24 18:10 Yarrax

It's still actual bug. Android 14, Fluffy 1.22.0 I receive push from first account and dont receive form second account.

Yes, the same is happening to me too currently.

gusarg81 avatar Oct 14 '24 18:10 gusarg81