feat: update main chat and system chat UI
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
useState,
|
||||
type PropsWithChildren,
|
||||
} from 'react';
|
||||
import { getSavedNotificationDeviceId } from '../../../app/main/notificationIdentity';
|
||||
import { sendClientNotification } from '../../../app/main/notificationApi';
|
||||
import type {
|
||||
GpsAnchor,
|
||||
@@ -156,10 +157,18 @@ function parseConfig(value: unknown): GpsConfig {
|
||||
}
|
||||
|
||||
function sendGpsPushNotification(event: GpsGeofenceEvent) {
|
||||
const notificationDeviceId = getSavedNotificationDeviceId().trim();
|
||||
const targetClientIds = notificationDeviceId ? [notificationDeviceId] : [];
|
||||
const targetAppOrigin = typeof window !== 'undefined' ? window.location.origin.trim() : '';
|
||||
const targetAppDomain = typeof window !== 'undefined' ? window.location.hostname.trim() : '';
|
||||
|
||||
return sendClientNotification({
|
||||
title: `GPS 거점 ${event.type === 'enter' ? 'In' : 'Out'} 알림`,
|
||||
body: `${event.anchorName} ${event.type === 'enter' ? '진입' : '이탈'} 감지 (${event.distanceMeters}m)`,
|
||||
threadId: 'gps-geofence',
|
||||
targetClientIds,
|
||||
targetAppOrigins: targetAppOrigin ? [targetAppOrigin] : undefined,
|
||||
targetAppDomains: targetAppDomain ? [targetAppDomain] : undefined,
|
||||
data: {
|
||||
category: 'gps-geofence',
|
||||
eventType: event.type,
|
||||
|
||||
@@ -20,6 +20,11 @@ type SearchLayerContextValue = SearchLayerSnapshot & {
|
||||
|
||||
const SearchLayerContext = createContext<SearchLayerContextValue | null>(null);
|
||||
const PREVIEW_APP_SELECTION_ID = 'page:preview:app';
|
||||
const PLAY_APP_SELECTION_PREFIX = 'page:play:app:';
|
||||
|
||||
function isPlayAppSelectionId(selectionId: string) {
|
||||
return selectionId.startsWith(PLAY_APP_SELECTION_PREFIX);
|
||||
}
|
||||
|
||||
function appendSelection(
|
||||
previous: SearchWindowSelection[],
|
||||
@@ -34,6 +39,10 @@ function appendSelection(
|
||||
return [...previous.filter((item) => item.id !== PREVIEW_APP_SELECTION_ID), nextSelection];
|
||||
}
|
||||
|
||||
if (isPlayAppSelectionId(selection.id)) {
|
||||
return [...previous.filter((item) => !isPlayAppSelectionId(item.id)), nextSelection];
|
||||
}
|
||||
|
||||
return [...previous, nextSelection];
|
||||
}
|
||||
|
||||
@@ -101,7 +110,7 @@ export function SearchLayerProvider({ children }: PropsWithChildren) {
|
||||
pushRecentSearchOption(option.id, mode);
|
||||
setRecentOptions(resolveRecentSearchOptions(options, mode));
|
||||
|
||||
if (mode === 'window' || option.id === 'page:preview:app') {
|
||||
if (mode === 'window' || option.id === PREVIEW_APP_SELECTION_ID) {
|
||||
setOpen(false);
|
||||
appendWindowSelection(option);
|
||||
(option.onSelectWindow ?? option.onSelect)();
|
||||
|
||||
Reference in New Issue
Block a user