Remote connection
This commit is contained in:
@@ -6,14 +6,17 @@ import { Store } from '@ngrx/store';
|
||||
import { DatabaseService } from './core/services/database.service';
|
||||
import { ServerDirectoryService } from './core/services/server-directory.service';
|
||||
import { TimeSyncService } from './core/services/time-sync.service';
|
||||
import { VoiceSessionService } from './core/services/voice-session.service';
|
||||
import { ServersRailComponent } from './features/servers/servers-rail.component';
|
||||
import { TitleBarComponent } from './features/shell/title-bar.component';
|
||||
import { FloatingVoiceControlsComponent } from './features/voice/floating-voice-controls.component';
|
||||
import * as UsersActions from './store/users/users.actions';
|
||||
import * as RoomsActions from './store/rooms/rooms.actions';
|
||||
import { selectCurrentRoom } from './store/rooms/rooms.selectors';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [CommonModule, RouterOutlet, ServersRailComponent, TitleBarComponent],
|
||||
imports: [CommonModule, RouterOutlet, ServersRailComponent, TitleBarComponent, FloatingVoiceControlsComponent],
|
||||
templateUrl: './app.html',
|
||||
styleUrl: './app.scss',
|
||||
})
|
||||
@@ -23,6 +26,9 @@ export class App implements OnInit {
|
||||
private router = inject(Router);
|
||||
private servers = inject(ServerDirectoryService);
|
||||
private timeSync = inject(TimeSyncService);
|
||||
private voiceSession = inject(VoiceSessionService);
|
||||
|
||||
currentRoom = this.store.selectSignal(selectCurrentRoom);
|
||||
|
||||
async ngOnInit(): Promise<void> {
|
||||
// Initialize database
|
||||
@@ -56,12 +62,20 @@ export class App implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
// Persist last visited on navigation
|
||||
// Persist last visited on navigation and track voice session navigation
|
||||
this.router.events.subscribe((evt) => {
|
||||
if (evt instanceof NavigationEnd) {
|
||||
const url = evt.urlAfterRedirects || evt.url;
|
||||
// Store room route or search
|
||||
localStorage.setItem('metoyou_lastVisitedRoute', url);
|
||||
|
||||
// Check if user navigated away from voice-connected server
|
||||
// Extract roomId from URL if on a room route
|
||||
const roomMatch = url.match(/\/room\/([^/]+)/);
|
||||
const currentRoomId = roomMatch ? roomMatch[1] : null;
|
||||
|
||||
// Update voice session service with current server context
|
||||
this.voiceSession.checkCurrentRoute(currentRoomId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user