added notifications
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
@close="showInviteModal = false" @room-changed="handleRoomChanged" />
|
||||
|
||||
<RoomDetailsModal v-if="showDetailsModal && isSocketConnected" :roomUuid="props.uuid"
|
||||
:roomName="currentRoom?.name || 'Unknown room'" :isGlobal="currentRoom?.global || false" :ownerUuid="currentRoom?.owner_uuid || ''"
|
||||
@close="showDetailsModal = false" @room-changed="handleRoomChanged" />
|
||||
:roomName="currentRoom?.name || 'Unknown room'" :isGlobal="currentRoom?.global || false"
|
||||
:ownerUuid="currentRoom?.owner_uuid || ''" @close="showDetailsModal = false"
|
||||
@room-changed="handleRoomChanged" />
|
||||
|
||||
<div v-if="uuid === 'none'" class="no-room">
|
||||
<div class="empty-state">
|
||||
@@ -66,6 +67,7 @@ import WebSocket from '@tauri-apps/plugin-websocket';
|
||||
import { getAuthData } from "../store.ts";
|
||||
import { fetchRoomInfo } from "../api/rooms.ts";
|
||||
import { useFluent } from 'fluent-vue';
|
||||
import { sendNotification } from '@tauri-apps/plugin-notification';
|
||||
|
||||
const { $t } = useFluent();
|
||||
|
||||
@@ -194,6 +196,12 @@ async function connectGlobalWebSocket() {
|
||||
} else {
|
||||
// Notifications for other rooms
|
||||
emit('notification', data.room_uuid);
|
||||
|
||||
sendNotification({
|
||||
title: $t('notifications-message-title', { messageType: data.message_type, senderUsername: data.sender }),
|
||||
body: data.content,
|
||||
// channelId: 'messages',
|
||||
});
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
||||
@@ -123,3 +123,6 @@ shared-updating = Updating
|
||||
shared-delete = Delete
|
||||
shared-leave = Leave
|
||||
shared-confirm = Confirm
|
||||
|
||||
## Notifications
|
||||
notifications-message-title = New {$messageType} message from {$senderUsername}
|
||||
|
||||
@@ -121,3 +121,6 @@ shared-updating = Mise à jour...
|
||||
shared-delete = Supprimer
|
||||
shared-leave = Quitter
|
||||
shared-confirm = Confirmer
|
||||
|
||||
## Notifications
|
||||
notifications-message-title = Nouveau message {$messageType} de {$senderUsername}
|
||||
|
||||
26
src/main.ts
26
src/main.ts
@@ -3,6 +3,12 @@ import router from './router.ts'
|
||||
import App from './App.vue'
|
||||
import { validateToken, initTheme } from './store.ts'
|
||||
import { fluent, setLanguage } from './i18n'
|
||||
// import {
|
||||
// createChannel,
|
||||
// Importance,
|
||||
// Visibility,
|
||||
// } from '@tauri-apps/plugin-notification';
|
||||
|
||||
|
||||
import './base.css'
|
||||
import { getLocalePreference } from './store.ts'
|
||||
@@ -25,14 +31,26 @@ async function init() {
|
||||
setLanguage(osLocale);
|
||||
}
|
||||
|
||||
// await createChannel({
|
||||
// id: 'messages',
|
||||
// name: 'Messages',
|
||||
// description: 'Notifications for new messages',
|
||||
// importance: Importance.High,
|
||||
// visibility: Visibility.Private,
|
||||
// lights: true,
|
||||
// lightColor: '#ff0000',
|
||||
// vibration: true,
|
||||
// sound: 'notification_sound',
|
||||
// });
|
||||
|
||||
app.mount('#app')
|
||||
}
|
||||
|
||||
init()
|
||||
|
||||
// export const API = 'http://127.0.0.1:8080'
|
||||
export const API = 'http://127.0.0.1:8080'
|
||||
// export const API = 'http://192.168.1.183:8080'
|
||||
export const API = 'https://alatreon.org/frangipane'
|
||||
// export const API_WS = 'ws://127.0.0.1:8080/ws'
|
||||
// export const API = 'https://alatreon.org/frangipane'
|
||||
export const API_WS = 'ws://127.0.0.1:8080/ws'
|
||||
// export const API_WS = 'ws://192.168.1.183:8080/ws'
|
||||
export const API_WS = 'wss://alatreon.org/frangipane/ws'
|
||||
// export const API_WS = 'wss://alatreon.org/frangipane/ws'
|
||||
|
||||
Reference in New Issue
Block a user