Make EditAccount show a spinner until ready

Instead of crashing if userInfo is not yet available.

statusMessage is removed for now from UserUpdated events,
and the users model items will have a "loading" property.
This commit is contained in:
miruka
2019-07-21 07:14:16 -04:00
parent 71f78feec6
commit 853bb350b4
13 changed files with 53 additions and 62 deletions

View File

@@ -3,7 +3,7 @@
import asyncio
import random
from typing import Dict, Optional, Set, Tuple
from typing import Any, Dict, Optional, Set, Tuple
from .app import App
from .events import users
@@ -18,6 +18,7 @@ class Backend:
from . import config_files
self.saved_accounts = config_files.Accounts(self)
self.ui_settings = config_files.UISettings(self)
self.ui_state = config_files.UIState(self)
self.clients: Dict[str, MatrixClient] = {}
@@ -92,7 +93,14 @@ class Backend:
# General functions
async def load_settings(self) -> Tuple[Dict[str, Any], ...]:
return (await self.ui_settings.read(), await self.ui_state.read())
async def request_user_update_event(self, user_id: str) -> None:
if not self.clients:
return
client = self.clients.get(
user_id,
random.choice(tuple(self.clients.values()))