@ethora/chat-component-rn 26.7.6 → 26.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/lib/commonjs/assets/icons.js +2 -2
  3. package/lib/commonjs/assets/icons.js.map +1 -1
  4. package/lib/commonjs/components/MainComponents/ChatWrapper.js +2 -0
  5. package/lib/commonjs/components/MainComponents/ChatWrapper.js.map +1 -1
  6. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js +51 -1
  7. package/lib/commonjs/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  8. package/lib/commonjs/context/xmppProvider.js +9 -1
  9. package/lib/commonjs/context/xmppProvider.js.map +1 -1
  10. package/lib/commonjs/helpers/pushPayload.js +71 -0
  11. package/lib/commonjs/helpers/pushPayload.js.map +1 -0
  12. package/lib/commonjs/hooks/usePendingNotification.js +8 -11
  13. package/lib/commonjs/hooks/usePendingNotification.js.map +1 -1
  14. package/lib/commonjs/i18n/strings.js +18 -0
  15. package/lib/commonjs/i18n/strings.js.map +1 -1
  16. package/lib/commonjs/main.js +13 -0
  17. package/lib/commonjs/main.js.map +1 -1
  18. package/lib/commonjs/networking/api-requests/rooms.api.js +13 -0
  19. package/lib/commonjs/networking/api-requests/rooms.api.js.map +1 -1
  20. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  21. package/lib/commonjs/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  22. package/lib/commonjs/networking/xmppClient.js +55 -1
  23. package/lib/commonjs/networking/xmppClient.js.map +1 -1
  24. package/lib/commonjs/services/pushSubscriptionService.js +15 -13
  25. package/lib/commonjs/services/pushSubscriptionService.js.map +1 -1
  26. package/lib/module/assets/icons.js +1 -1
  27. package/lib/module/assets/icons.js.map +1 -1
  28. package/lib/module/components/MainComponents/ChatWrapper.js +2 -0
  29. package/lib/module/components/MainComponents/ChatWrapper.js.map +1 -1
  30. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js +53 -3
  31. package/lib/module/components/Modals/ChatProfileModal/ChatProfileModal.js.map +1 -1
  32. package/lib/module/context/xmppProvider.js +9 -1
  33. package/lib/module/context/xmppProvider.js.map +1 -1
  34. package/lib/module/helpers/pushPayload.js +63 -0
  35. package/lib/module/helpers/pushPayload.js.map +1 -0
  36. package/lib/module/hooks/usePendingNotification.js +8 -11
  37. package/lib/module/hooks/usePendingNotification.js.map +1 -1
  38. package/lib/module/i18n/strings.js +18 -0
  39. package/lib/module/i18n/strings.js.map +1 -1
  40. package/lib/module/main.js +1 -0
  41. package/lib/module/main.js.map +1 -1
  42. package/lib/module/networking/api-requests/rooms.api.js +12 -0
  43. package/lib/module/networking/api-requests/rooms.api.js.map +1 -1
  44. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js +5 -1
  45. package/lib/module/networking/xmpp/subscribeToRoomMessages.xmpp.js.map +1 -1
  46. package/lib/module/networking/xmppClient.js +55 -1
  47. package/lib/module/networking/xmppClient.js.map +1 -1
  48. package/lib/module/services/pushSubscriptionService.js +15 -13
  49. package/lib/module/services/pushSubscriptionService.js.map +1 -1
  50. package/lib/typescript/assets/icons.d.ts +8 -0
  51. package/lib/typescript/assets/icons.d.ts.map +1 -1
  52. package/lib/typescript/components/MainComponents/ChatWrapper.d.ts.map +1 -1
  53. package/lib/typescript/components/Modals/ChatProfileModal/ChatProfileModal.d.ts.map +1 -1
  54. package/lib/typescript/context/xmppProvider.d.ts.map +1 -1
  55. package/lib/typescript/helpers/getAvatarColor.d.ts +1 -1
  56. package/lib/typescript/helpers/pushPayload.d.ts +7 -0
  57. package/lib/typescript/helpers/pushPayload.d.ts.map +1 -0
  58. package/lib/typescript/hooks/usePendingNotification.d.ts.map +1 -1
  59. package/lib/typescript/i18n/strings.d.ts.map +1 -1
  60. package/lib/typescript/main.d.ts +2 -0
  61. package/lib/typescript/main.d.ts.map +1 -1
  62. package/lib/typescript/networking/api-requests/rooms.api.d.ts +1 -0
  63. package/lib/typescript/networking/api-requests/rooms.api.d.ts.map +1 -1
  64. package/lib/typescript/networking/xmpp/subscribeToRoomMessages.xmpp.d.ts.map +1 -1
  65. package/lib/typescript/networking/xmppClient.d.ts +7 -0
  66. package/lib/typescript/networking/xmppClient.d.ts.map +1 -1
  67. package/lib/typescript/services/pushSubscriptionService.d.ts +1 -1
  68. package/lib/typescript/services/pushSubscriptionService.d.ts.map +1 -1
  69. package/lib/typescript/types/models/room.model.d.ts +1 -0
  70. package/lib/typescript/types/models/room.model.d.ts.map +1 -1
  71. package/lib/typescript/types/types.d.ts +2 -0
  72. package/lib/typescript/types/types.d.ts.map +1 -1
  73. package/package.json +1 -1
  74. package/src/assets/icons.tsx +24 -0
  75. package/src/components/MainComponents/ChatWrapper.tsx +3 -0
  76. package/src/components/Modals/ChatProfileModal/ChatProfileModal.tsx +36 -2
  77. package/src/context/xmppProvider.tsx +9 -1
  78. package/src/helpers/pushPayload.ts +62 -0
  79. package/src/hooks/usePendingNotification.ts +5 -11
  80. package/src/i18n/strings.ts +18 -0
  81. package/src/main.ts +3 -0
  82. package/src/networking/api-requests/rooms.api.ts +9 -0
  83. package/src/networking/xmpp/subscribeToRoomMessages.xmpp.ts +12 -1
  84. package/src/networking/xmppClient.ts +58 -1
  85. package/src/services/pushSubscriptionService.ts +18 -13
  86. package/src/types/models/room.model.ts +1 -0
  87. package/src/types/types.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,9 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this pr
7
7
 
8
8
  ### Added
9
9
 
10
+ - **Mute / unmute a chat from its profile.** A bell button joins Search, Leave and Report in the chat-profile hero (first in the row, per the design): "Unmuted" with a bell, "Muted" with a crossed bell. It toggles the caller's own membership flag through `PUT` / `DELETE /v1/chats/my/{chatName}/mute` and reads the initial state from `muted` in `/chats/my` (new `IRoom.muted`). The flip is optimistic and rolls back with an error toast if the request fails. This is a stored preference only — the server does not change push delivery by itself yet.
11
+
12
+ - **`handlePushPayload(data)` / `openRoomFromPush(jid)` are exported from the package root.** The host owns the native push side (token, permission, tap listeners) and hands the tapped notification's `data` to `handlePushPayload`: a call push rings, a message push (`data.jid` / `chatJid` / `roomJid`) opens its room — immediately when the room list is loaded, otherwise as soon as it is (`usePendingNotification` is now mounted in `ChatWrapper` and actually opens the room; it used to find it and do nothing). The pending jid is also persisted (with a 5-minute TTL), so a tap handled by a JS context that gets replaced right after (cold-start races) still opens the room on the next mount.
10
13
  - **`config.headerLayout.safeAreaTop`** — the room-list and chat header cards pad their top by the safe-area inset and run under the status bar as one white surface. Hosts used to wrap `<Chat>` in a top-edge `SafeAreaView`, which painted its own white band above the card; on Android the card's elevation drew a hairline seam where the two met. Off by default, so existing hosts keep their layout; when on, drop the host-side top inset.
11
14
 
12
15
  - **Profile header polish (both the chat and the user profile).** The back / "…" row is taller and sits further from the top edge, and its buttons are inset 20 pt so a button's centre line matches the collapsed avatar's — they used to sit closer to the edge than the avatar below them. The glyphs inside the hero's round buttons always paint white now (several SDK icons ignore their `color` prop and paint white regardless, so tinting the rest to the title colour left a mix of black and white in one row); on a light fill the circle darkens instead of the glyph. And on the user profile the "…" menu appears once the header is collapsed, carrying exactly the same actions the hero's buttons do — collapsed, those buttons are off-screen and were unreachable.
@@ -57,6 +60,8 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this pr
57
60
  ### Fixed
58
61
 
59
62
  - **Push notifications never arrived for users who only ever signed in through this SDK.** The `initBeforeLoad` bootstrap in `XmppProvider` re-joined rooms with presence but never sent the MucSub (`urn:xmpp:mucsub:0`) subscription — only the legacy `ChatWrapper` path did, via `initRoomsPresence`. ejabberd decides whom to push for offline messages by MucSub subscriptions, so such users had a registered device token and still got nothing ("no MucSub subscription" server-side). The bootstrap and the reconnect `onOnline` handler now subscribe every room in the store after the presence pass, regardless of how that pass ended; `pushSubscriptionService` still dedupes rooms already subscribed on the device.
63
+ - **MucSub subscriptions are sent in parallel batches and carry unique IQ ids.** The pass used to be strictly sequential (await + 100 ms pause per room, 5 s timeout each), so a user with a few dozen rooms needed minutes and a backgrounded socket died long before the end, leaving most rooms unsubscribed. Ids were `newSubscription:<Date.now()>`, which in a batch made every request resolve on the first reply. A refused subscription now logs the server's condition (`registration-required`, `forbidden`, …) so room-config / affiliation problems are visible instead of silent.
64
+ - **The XMPP stream is closed as soon as the app goes to the background** (`XmppClient.suspend()`), and reopened on foreground (`resume()` → immediate reconnect). Android keeps a backgrounded WebSocket alive for minutes; while it lived, ejabberd still saw the user online and routed new messages into the socket instead of sending a push — so only the very first push after a cold start ever arrived, and nothing after the app had been opened and backgrounded again. The suspend is immediate, not deferred: RN pauses JS timers while an Android app is backgrounded. A reconnect that was in flight when the app got backgrounded closes its fresh socket at once, and `resume()` skips the 3 s `stop()` timeout on the already-closed client. Opt out with `xmppSettings.keepAliveInBackground: true`.
60
65
  - **`allRoomPresences` reported a failure on every bootstrap.** `presenceInRoom` schedules its resolve `delay` ms (2000) after the room's reply and races a 2000 ms timeout that rejected with `undefined` — the timeout won, so a join that had succeeded was logged as `allRoomPresences failed`. The timeout no longer rejects once the reply has been seen.
61
66
 
62
67
  - **The signed-in user's description was thrown away on every login.** `unpackAndTransform` (the shaper `setUser` runs every payload through) hardcoded `description: ''`, so the profile's About section could never show your own bio no matter what the server returned. It now carries `input?.description` through.