mirror of
https://github.com/SableClient/Sable.git
synced 2026-12-05 16:22:26 -08:00
Merge pull request #219 from 7w1/split-read-and-typing
split read and typing indicators
This commit is contained in:
16 files changed
+60
-45
No files matched your search
@@ -2,4 +2,4 @@
|
||||
sable: minor
|
||||
---
|
||||
|
||||
# Add setting to enable picture-in-picture in element-call
|
||||
Add setting to enable picture-in-picture in element-call
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
sable: patch
|
||||
---
|
||||
|
||||
Split typing and read status settings, allowing toggling off one and not the other.
|
||||
@@ -93,7 +93,7 @@ type RoomNavItemMenuProps = {
|
||||
const RoomNavItemMenu = forwardRef<HTMLDivElement, RoomNavItemMenuProps>(
|
||||
({ room, requestClose, notificationMode }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const unread = useRoomUnread(room.roomId, roomToUnreadAtom);
|
||||
const powerLevels = usePowerLevels(room);
|
||||
const creators = useRoomCreators(room);
|
||||
@@ -106,7 +106,7 @@ const RoomNavItemMenu = forwardRef<HTMLDivElement, RoomNavItemMenuProps>(
|
||||
const [invitePrompt, setInvitePrompt] = useState(false);
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
markAsRead(mx, room.roomId, hideActivity);
|
||||
markAsRead(mx, room.roomId, hideReads);
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export function Room() {
|
||||
|
||||
const [isDrawer] = useSetting(settingsAtom, 'isPeopleDrawer');
|
||||
const [isWidgetDrawerOpen] = useSetting(settingsAtom, 'isWidgetDrawer');
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const screenSize = useScreenSizeContext();
|
||||
const powerLevels = usePowerLevels(room);
|
||||
const members = useRoomMembers(mx, room.roomId);
|
||||
@@ -36,10 +36,10 @@ export function Room() {
|
||||
useCallback(
|
||||
(evt) => {
|
||||
if (isKeyHotkey('escape', evt)) {
|
||||
markAsRead(mx, room.roomId, hideActivity);
|
||||
markAsRead(mx, room.roomId, hideReads);
|
||||
}
|
||||
},
|
||||
[mx, room.roomId, hideActivity]
|
||||
[mx, room.roomId, hideReads]
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -560,7 +560,7 @@ export function RoomTimeline({
|
||||
}: RoomTimelineProps) {
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const [messageLayout] = useSetting(settingsAtom, 'messageLayout');
|
||||
const [messageSpacing] = useSetting(settingsAtom, 'messageSpacing');
|
||||
const [hideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents');
|
||||
@@ -754,7 +754,7 @@ export function RoomTimeline({
|
||||
// Check if the document is in focus (user is actively viewing the app),
|
||||
// and either there are no unread messages or the latest message is from the current user.
|
||||
// If either condition is met, trigger the markAsRead function to send a read receipt.
|
||||
requestAnimationFrame(() => markAsRead(mx, mEvt.getRoomId()!, hideActivity));
|
||||
requestAnimationFrame(() => markAsRead(mx, mEvt.getRoomId()!, hideReads));
|
||||
}
|
||||
|
||||
if (!document.hasFocus() && !unreadInfo) {
|
||||
@@ -780,7 +780,7 @@ export function RoomTimeline({
|
||||
setUnreadInfo(getRoomUnreadInfo(room));
|
||||
}
|
||||
},
|
||||
[mx, room, unreadInfo, hideActivity]
|
||||
[mx, room, unreadInfo, hideReads]
|
||||
)
|
||||
);
|
||||
|
||||
@@ -884,15 +884,15 @@ export function RoomTimeline({
|
||||
const tryAutoMarkAsRead = useCallback(() => {
|
||||
const readUptoEventId = readUptoEventIdRef.current;
|
||||
if (!readUptoEventId) {
|
||||
requestAnimationFrame(() => markAsRead(mx, room.roomId, hideActivity));
|
||||
requestAnimationFrame(() => markAsRead(mx, room.roomId, hideReads));
|
||||
return;
|
||||
}
|
||||
const evtTimeline = getEventTimeline(room, readUptoEventId);
|
||||
const latestTimeline = evtTimeline && getFirstLinkedTimeline(evtTimeline, Direction.Forward);
|
||||
if (latestTimeline === room.getLiveTimeline()) {
|
||||
requestAnimationFrame(() => markAsRead(mx, room.roomId, hideActivity));
|
||||
requestAnimationFrame(() => markAsRead(mx, room.roomId, hideReads));
|
||||
}
|
||||
}, [mx, room, hideActivity]);
|
||||
}, [mx, room, hideReads]);
|
||||
|
||||
const debounceSetAtBottom = useDebounce(
|
||||
useCallback((entry: IntersectionObserverEntry) => {
|
||||
@@ -1119,7 +1119,7 @@ export function RoomTimeline({
|
||||
};
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
markAsRead(mx, room.roomId, hideActivity);
|
||||
markAsRead(mx, room.roomId, hideReads);
|
||||
};
|
||||
|
||||
const handleOpenReply: MouseEventHandler = useCallback(
|
||||
@@ -1363,7 +1363,7 @@ export function RoomTimeline({
|
||||
/>
|
||||
)
|
||||
}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
memberPowerTag={getMemberPowerTag(senderId)}
|
||||
hour24Clock={hour24Clock}
|
||||
@@ -1450,7 +1450,7 @@ export function RoomTimeline({
|
||||
/>
|
||||
)
|
||||
}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
memberPowerTag={getMemberPowerTag(mEvent.getSender() ?? '')}
|
||||
hour24Clock={hour24Clock}
|
||||
@@ -1572,7 +1572,7 @@ export function RoomTimeline({
|
||||
/>
|
||||
)
|
||||
}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
memberPowerTag={getMemberPowerTag(mEvent.getSender() ?? '')}
|
||||
hour24Clock={hour24Clock}
|
||||
@@ -1624,7 +1624,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
@@ -1667,7 +1667,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
@@ -1711,7 +1711,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
@@ -1755,7 +1755,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
@@ -1801,7 +1801,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
@@ -1852,7 +1852,7 @@ export function RoomTimeline({
|
||||
highlight={highlighted}
|
||||
messageSpacing={messageSpacing}
|
||||
canDelete={canRedact || mEvent.getSender() === mx.getUserId()}
|
||||
hideReadReceipts={hideActivity}
|
||||
hideReadReceipts={hideReads}
|
||||
showDeveloperTools={showDeveloperTools}
|
||||
>
|
||||
<EventContent
|
||||
|
||||
@@ -69,7 +69,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||
const roomInputRef = useRef<HTMLDivElement>(null);
|
||||
const roomViewRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const screenSize = useScreenSizeContext();
|
||||
|
||||
const { roomId } = room;
|
||||
@@ -184,7 +184,7 @@ export function RoomView({ room, eventId }: { room: Room; eventId?: string }) {
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
{hideActivity ? <RoomViewFollowingPlaceholder /> : <RoomViewFollowing room={room} />}
|
||||
{hideReads ? <RoomViewFollowingPlaceholder /> : <RoomViewFollowing room={room} />}
|
||||
</Box>
|
||||
</SwipeableChatWrapper>
|
||||
</Page>
|
||||
|
||||
@@ -106,7 +106,7 @@ type RoomMenuProps = {
|
||||
};
|
||||
const RoomMenu = forwardRef<HTMLDivElement, RoomMenuProps>(({ room, requestClose }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const unread = useRoomUnread(room.roomId, roomToUnreadAtom);
|
||||
const powerLevels = usePowerLevelsContext();
|
||||
const creators = useRoomCreators(room);
|
||||
@@ -123,7 +123,7 @@ const RoomMenu = forwardRef<HTMLDivElement, RoomMenuProps>(({ room, requestClose
|
||||
const [directInvitePrompt, setDirectInvitePrompt] = useState(false);
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
markAsRead(mx, room.roomId, hideActivity);
|
||||
markAsRead(mx, room.roomId, hideReads);
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -404,6 +404,7 @@ function Editor({ isMobile }: { isMobile: boolean }) {
|
||||
const [enterForNewline, setEnterForNewline] = useSetting(settingsAtom, 'enterForNewline');
|
||||
const [isMarkdown, setIsMarkdown] = useSetting(settingsAtom, 'isMarkdown');
|
||||
const [hideActivity, setHideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads, setHideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
@@ -435,11 +436,18 @@ function Editor({ isMobile }: { isMobile: boolean }) {
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Hide Typing & Read Receipts"
|
||||
description="Turn off both typing status and read receipts to keep your activity private."
|
||||
title="Hide Typing Indicators"
|
||||
description="Turn off typing status."
|
||||
after={<Switch variant="Primary" value={hideActivity} onChange={setHideActivity} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Hide Read Receipts"
|
||||
description="Turn off read receipts."
|
||||
after={<Switch variant="Primary" value={hideReads} onChange={setHideReads} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -58,13 +58,13 @@ type DirectMenuProps = {
|
||||
};
|
||||
const DirectMenu = forwardRef<HTMLDivElement, DirectMenuProps>(({ requestClose }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const orphanRooms = useDirectRooms();
|
||||
const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom);
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
if (!unread) return;
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity));
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -69,13 +69,13 @@ type HomeMenuProps = {
|
||||
};
|
||||
const HomeMenu = forwardRef<HTMLDivElement, HomeMenuProps>(({ requestClose }, ref) => {
|
||||
const orphanRooms = useHomeRooms();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom);
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
if (!unread) return;
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity));
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ type RoomNotificationsGroupProps = {
|
||||
notifications: INotification[];
|
||||
mediaAutoLoad?: boolean;
|
||||
urlPreview?: boolean;
|
||||
hideActivity: boolean;
|
||||
hideReads: boolean;
|
||||
onOpen: (roomId: string, eventId: string) => void;
|
||||
legacyUsernameColor?: boolean;
|
||||
hour24Clock: boolean;
|
||||
@@ -218,7 +218,7 @@ function RoomNotificationsGroupComp({
|
||||
notifications,
|
||||
mediaAutoLoad,
|
||||
urlPreview,
|
||||
hideActivity,
|
||||
hideReads,
|
||||
onOpen,
|
||||
legacyUsernameColor,
|
||||
hour24Clock,
|
||||
@@ -414,7 +414,7 @@ function RoomNotificationsGroupComp({
|
||||
onOpen(room.roomId, eventId);
|
||||
};
|
||||
const handleMarkAsRead = () => {
|
||||
markAsRead(mx, room.roomId, hideActivity);
|
||||
markAsRead(mx, room.roomId, hideReads);
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -565,7 +565,7 @@ const FAST_REFRESH_MS = 2500;
|
||||
|
||||
export function Notifications() {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const [mediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
|
||||
const [urlPreview] = useSetting(settingsAtom, 'urlPreview');
|
||||
const [legacyUsernameColor] = useSetting(settingsAtom, 'legacyUsernameColor');
|
||||
@@ -720,7 +720,7 @@ export function Notifications() {
|
||||
notifications={group.notifications}
|
||||
mediaAutoLoad={mediaAutoLoad}
|
||||
urlPreview={urlPreview}
|
||||
hideActivity={hideActivity}
|
||||
hideReads={hideReads}
|
||||
onOpen={navigateRoom}
|
||||
legacyUsernameColor={
|
||||
legacyUsernameColor || mDirects.has(groupRoom.roomId)
|
||||
|
||||
@@ -31,13 +31,13 @@ type DirectMenuProps = {
|
||||
};
|
||||
const DirectMenu = forwardRef<HTMLDivElement, DirectMenuProps>(({ requestClose }, ref) => {
|
||||
const orphanRooms = useDirectRooms();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom);
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
if (!unread) return;
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity));
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -32,13 +32,13 @@ type HomeMenuProps = {
|
||||
};
|
||||
const HomeMenu = forwardRef<HTMLDivElement, HomeMenuProps>(({ requestClose }, ref) => {
|
||||
const orphanRooms = useHomeRooms();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const unread = useRoomsUnread(orphanRooms, roomToUnreadAtom);
|
||||
const mx = useMatrixClient();
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
if (!unread) return;
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideActivity));
|
||||
orphanRooms.forEach((rId) => markAsRead(mx, rId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ type SpaceMenuProps = {
|
||||
const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
|
||||
({ room, requestClose, onUnpin }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const roomToParents = useAtomValue(roomToParentsAtom);
|
||||
const powerLevels = usePowerLevels(room);
|
||||
const creators = useRoomCreators(room);
|
||||
@@ -121,7 +121,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(
|
||||
const unread = useRoomsUnread(allChild, roomToUnreadAtom);
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideActivity));
|
||||
allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ type SpaceMenuProps = {
|
||||
};
|
||||
const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(({ room, requestClose }, ref) => {
|
||||
const mx = useMatrixClient();
|
||||
const [hideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const [developerTools] = useSetting(settingsAtom, 'developerTools');
|
||||
const roomToParents = useAtomValue(roomToParentsAtom);
|
||||
const powerLevels = usePowerLevels(room);
|
||||
@@ -101,7 +101,7 @@ const SpaceMenu = forwardRef<HTMLDivElement, SpaceMenuProps>(({ room, requestClo
|
||||
const unread = useRoomsUnread(allChild, roomToUnreadAtom);
|
||||
|
||||
const handleMarkAsRead = () => {
|
||||
allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideActivity));
|
||||
allChild.forEach((childRoomId) => markAsRead(mx, childRoomId, hideReads));
|
||||
requestClose();
|
||||
};
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ export interface Settings {
|
||||
showUnreadCounts: boolean;
|
||||
badgeCountDMsOnly: boolean;
|
||||
showPingCounts: boolean;
|
||||
hideReads: boolean;
|
||||
}
|
||||
|
||||
const defaultSettings: Settings = {
|
||||
@@ -142,6 +143,7 @@ const defaultSettings: Settings = {
|
||||
showUnreadCounts: true,
|
||||
badgeCountDMsOnly: false,
|
||||
showPingCounts: true,
|
||||
hideReads: false,
|
||||
};
|
||||
|
||||
export const getSettings = () => {
|
||||
|
||||
Reference in new issue
Block a user