@poolse/react-native 2.26.0 → 2.28.0

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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useUser, useMe, useConversations, formatCallLogPreview, useAttachmentUpload, useConversation, useMembers, usePresence, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, usePoolse, useVoiceRoom, useCalls, useCallRoom } from '@poolse/react';
1
+ import { useUser, useMe, useConversations, formatCallLogPreview, useAttachmentUpload, useConversation, useMembers, usePresence, receiptsOf, useMessages, useTyping, useRealtimeStatus, isMessageVisibleTo, computeGroupPosition, canEditOwnMessage, formatDayLabel, callLogDisplayFor, useLiveCall, sameDay, useReactions, useThread, useAttachmentUrl, usePoolse, useVoiceRoom, useCalls, useCallRoom } from '@poolse/react';
2
2
  import { createContext, forwardRef, useRef, useState, useImperativeHandle, useEffect, useMemo, useCallback, useContext, createElement } from 'react';
3
3
  import { StyleSheet, View, Pressable, TextInput, Text, useWindowDimensions, Animated, Easing, PanResponder, Image, Keyboard, Platform, ScrollView, ActivityIndicator, FlatList, AppState, KeyboardAvoidingView, Modal, Linking, StatusBar } from 'react-native';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
@@ -1461,8 +1461,8 @@ var styles7 = StyleSheet.create({
1461
1461
  });
1462
1462
  function LiveCallBanner({ call, inCall, onJoin }) {
1463
1463
  const theme = usePoolseTheme();
1464
- const what = call.media === "video" ? "Video call in progress" : "Voice call in progress";
1465
- const who = inCall > 0 ? `${inCall} on the call` : "Ringing";
1464
+ const what = call.kind === "room" ? call.media === "video" ? "Video room" : "Voice room" : call.media === "video" ? "Video call in progress" : "Voice call in progress";
1465
+ const who = inCall > 0 ? `${inCall} ${call.kind === "room" ? "in the room" : "on the call"}` : call.kind === "room" ? "Starting" : "Ringing";
1466
1466
  return /* @__PURE__ */ jsxs(
1467
1467
  View,
1468
1468
  {
@@ -4237,6 +4237,8 @@ function ConversationView({
4237
4237
  const theme = usePoolseTheme();
4238
4238
  const { me } = useMe();
4239
4239
  const meId = me?.id ?? null;
4240
+ const receiptsVisible = receiptsOf(me).visible;
4241
+ const showReadState = readReceipts && receiptsVisible;
4240
4242
  const {
4241
4243
  messages,
4242
4244
  loading,
@@ -4315,9 +4317,15 @@ function ConversationView({
4315
4317
  const custom = renderMessage(msg, meId);
4316
4318
  if (custom !== null && custom !== void 0) return custom;
4317
4319
  }
4318
- const readState = readReceipts && meId !== null && msg.sender_id === meId ? readStateForMessage(msg, members, meId, sequenceByMessageId) : void 0;
4320
+ const readState = showReadState && meId !== null && msg.sender_id === meId ? readStateForMessage(msg, members, meId, sequenceByMessageId) : void 0;
4319
4321
  const isSelf = meId !== null && msg.sender_id === meId;
4320
- const canEdit = isSelf && !msg.deleted_at && (readState ?? "sent") === "sent";
4322
+ const canEdit = canEditOwnMessage({
4323
+ isSelf,
4324
+ deleted: !!msg.deleted_at,
4325
+ receiptsVisible,
4326
+ readState,
4327
+ insertedAt: msg.inserted_at
4328
+ });
4321
4329
  const groupPosition = groupPositionById.get(msg.id) ?? "standalone";
4322
4330
  return /* @__PURE__ */ jsx(
4323
4331
  MessageRow,
@@ -4351,6 +4359,8 @@ function ConversationView({
4351
4359
  renderMessage,
4352
4360
  meId,
4353
4361
  readReceipts,
4362
+ showReadState,
4363
+ receiptsVisible,
4354
4364
  members,
4355
4365
  reactions,
4356
4366
  attachments,