Добавить предпросмотр DM в push-уведомлениях

This commit is contained in:
AidarKC
2026-11-27 15:52:51 +03:00
parent 91a8bb9c3c
commit 7d3f5db206
17 changed files with 696 additions and 31 deletions
+5
View File
@@ -1,3 +1,4 @@
import { setDmPreviewSession } from './services/dm-preview-settings.js';
import { AuthService } from './services/auth-service.js';
import { getLanguage, setLanguage } from './i18n/index.js';
import { closeDmNotification } from './services/dm-push-notifications.js';
@@ -1102,6 +1103,8 @@ export async function saveEntrySettings(nextSettings) {
language: getLanguage(), // language is device-wide, never profile-owned
};
persistEntrySettings(state.entrySettings);
// A new server must be authorized before the worker may use that session again.
await setDmPreviewSession(null).catch(() => {});
authService.setRemoteAddBlockSessionId(state.entrySettings.remoteAddBlockSessionId);
await authService.reconnect(state.entrySettings.shineServer);
try {
@@ -1170,6 +1173,7 @@ export function authorizeSession({
});
upsertSavedProfileInternal({ login, sessionId, isLocalDemo: localDemo, entrySettings: state.entrySettings });
authService.setActiveSessionContext({ login, sessionId });
void setDmPreviewSession(localDemo ? null : { login, sessionId, serverUrl: authService.serverUrl }).catch(() => {});
state.startHint = '';
if (onSessionAuthorized) {
onSessionAuthorized();
@@ -1281,6 +1285,7 @@ async function tryCloseCurrentSessionOnServer() {
export async function terminateCurrentSession({ infoMessage = '', closeServerSession = false, notifySessionReset = true } = {}) {
const signedOutLogin = String(state.session.login || '').trim();
await setDmPreviewSession(null).catch(() => {});
if (closeServerSession) {
await tryCloseCurrentSessionOnServer();
}