Reload member device list when they change
This commit is contained in:
parent
8771ae2aae
commit
963b022f3d
1
TODO.md
1
TODO.md
|
@ -1,6 +1,5 @@
|
||||||
# TODO
|
# TODO
|
||||||
|
|
||||||
- reload devices when needed
|
|
||||||
- get devices for members with no shared E2E room?
|
- get devices for members with no shared E2E room?
|
||||||
- keyboard controls
|
- keyboard controls
|
||||||
- remove useless Base imports in Base components
|
- remove useless Base imports in Base components
|
||||||
|
|
|
@ -12,6 +12,7 @@ import nio
|
||||||
|
|
||||||
from .html_markdown import HTML_PROCESSOR
|
from .html_markdown import HTML_PROCESSOR
|
||||||
from .models.items import TypeSpecifier
|
from .models.items import TypeSpecifier
|
||||||
|
from .pyotherside_events import DevicesUpdated
|
||||||
from .utils import classes_defined_in, plain2html
|
from .utils import classes_defined_in, plain2html
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
@ -123,6 +124,8 @@ class NioCallbacks:
|
||||||
else:
|
else:
|
||||||
await self.client.register_nio_room(room)
|
await self.client.register_nio_room(room)
|
||||||
|
|
||||||
|
DevicesUpdated(self.user_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Room events, invite events and misc events callbacks
|
# Room events, invite events and misc events callbacks
|
||||||
|
|
|
@ -90,3 +90,10 @@ class ModelItemDeleted(ModelEvent):
|
||||||
@dataclass
|
@dataclass
|
||||||
class ModelCleared(ModelEvent):
|
class ModelCleared(ModelEvent):
|
||||||
"""Indicate that a `Backend` `Model` was cleared."""
|
"""Indicate that a `Backend` `Model` was cleared."""
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class DevicesUpdated(PyOtherSideEvent):
|
||||||
|
"""Indicate changes in devices for us or users we share a room with."""
|
||||||
|
|
||||||
|
our_user_id: str = field()
|
||||||
|
|
|
@ -132,4 +132,13 @@ HListView {
|
||||||
Component.onCompleted: loadDevices()
|
Component.onCompleted: loadDevices()
|
||||||
|
|
||||||
Keys.onEscapePressed: stackView.pop()
|
Keys.onEscapePressed: stackView.pop()
|
||||||
|
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: py.eventHandlers
|
||||||
|
|
||||||
|
function onDeviceUpdateSignal(forAccount) {
|
||||||
|
if (forAccount === profile.userId) profile.loadDevices()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@ import ".."
|
||||||
import "../.."
|
import "../.."
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
|
signal deviceUpdateSignal(string forAccount)
|
||||||
|
|
||||||
|
|
||||||
function onExitRequested(exitCode) {
|
function onExitRequested(exitCode) {
|
||||||
Qt.exit(exitCode)
|
Qt.exit(exitCode)
|
||||||
}
|
}
|
||||||
|
@ -82,4 +85,9 @@ QtObject {
|
||||||
// print("clear", syncId)
|
// print("clear", syncId)
|
||||||
ModelStore.get(syncId).clear()
|
ModelStore.get(syncId).clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function onDevicesUpdated(forAccount) {
|
||||||
|
deviceUpdateSignal(forAccount)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user