feat: connect desktop sessions and streaming
This commit is contained in:
@@ -6,6 +6,7 @@ import threading
|
||||
|
||||
from PySide6.QtCore import QObject, Signal, Slot
|
||||
|
||||
from javis.core.provider_router import ApprovalChoice
|
||||
from javis.security.privacy import PrivacyDecision
|
||||
from javis.ui.chat_controller import DesktopController
|
||||
|
||||
@@ -18,13 +19,13 @@ class ApprovalBridge(QObject):
|
||||
super().__init__()
|
||||
self._lock = threading.Lock()
|
||||
self._event: threading.Event | None = None
|
||||
self._result = False
|
||||
self._result = ApprovalChoice.CANCEL
|
||||
|
||||
def request(self, decision: PrivacyDecision) -> bool:
|
||||
def request(self, decision: PrivacyDecision) -> ApprovalChoice:
|
||||
event = threading.Event()
|
||||
with self._lock:
|
||||
self._event = event
|
||||
self._result = False
|
||||
self._result = ApprovalChoice.CANCEL
|
||||
self.approval_requested.emit(decision)
|
||||
event.wait()
|
||||
with self._lock:
|
||||
@@ -32,15 +33,15 @@ class ApprovalBridge(QObject):
|
||||
self._event = None
|
||||
return result
|
||||
|
||||
def resolve(self, allowed: bool) -> None:
|
||||
def resolve(self, choice: ApprovalChoice) -> None:
|
||||
with self._lock:
|
||||
self._result = allowed
|
||||
self._result = choice
|
||||
event = self._event
|
||||
if event is not None:
|
||||
event.set()
|
||||
|
||||
def cancel_pending(self) -> None:
|
||||
self.resolve(False)
|
||||
self.resolve(ApprovalChoice.CANCEL)
|
||||
|
||||
|
||||
class StreamWorker(QObject):
|
||||
|
||||
Reference in New Issue
Block a user