aboutsummaryrefslogtreecommitdiff
path: root/matrix/matrix.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2020-04-19 18:06:45 +0300
committerTulir Asokan <tulir@maunium.net>2020-04-19 18:06:49 +0300
commita66b02ae8b65db97ee51adccd34cd6c173f22b8d (patch)
treea1ec45bc7be7eb797d7b9ca0dc4b98d0d1bde188 /matrix/matrix.go
parent6a907354e21469a83c51f50bc4dd520ffe8915d6 (diff)
Add progress bar for first sync
Diffstat (limited to 'matrix/matrix.go')
-rw-r--r--matrix/matrix.go16
1 files changed, 15 insertions, 1 deletions
diff --git a/matrix/matrix.go b/matrix/matrix.go
index 0a4c2e0..39f980d 100644
--- a/matrix/matrix.go
+++ b/matrix/matrix.go
@@ -300,6 +300,13 @@ func init() {
gob.Register(&config.UserPreferences{})
}
+type StubSyncingModal struct{}
+func (s StubSyncingModal) SetIndeterminate() {}
+func (s StubSyncingModal) SetMessage(s2 string) {}
+func (s StubSyncingModal) SetSteps(i int) {}
+func (s StubSyncingModal) Step() {}
+func (s StubSyncingModal) Close() {}
+
// OnLogin initializes the syncer and updates the room list.
func (c *Container) OnLogin() {
c.ui.OnLogin()
@@ -307,7 +314,7 @@ func (c *Container) OnLogin() {
c.client.Store = c.config
debug.Print("Initializing syncer")
- c.syncer = NewGomuksSyncer(c.config)
+ c.syncer = NewGomuksSyncer(c.config.Rooms)
c.syncer.OnEventType(event.EventMessage, c.HandleMessage)
c.syncer.OnEventType(event.EventEncrypted, c.HandleMessage)
c.syncer.OnEventType(event.EventSticker, c.HandleMessage)
@@ -324,6 +331,13 @@ func (c *Container) OnLogin() {
c.syncer.OnEventType(event.AccountDataPushRules, c.HandlePushRules)
c.syncer.OnEventType(event.AccountDataRoomTags, c.HandleTag)
c.syncer.OnEventType(AccountDataGomuksPreferences, c.HandlePreferences)
+ c.syncer.Progress = c.ui.MainView().OpenSyncingModal()
+ c.syncer.Progress.SetMessage("Waiting for /sync response from server")
+ c.syncer.Progress.SetIndeterminate()
+ c.syncer.FirstDoneCallback = func() {
+ c.syncer.Progress.Close()
+ c.syncer.Progress = StubSyncingModal{}
+ }
c.syncer.InitDoneCallback = func() {
debug.Print("Initial sync done")
c.config.AuthCache.InitialSyncDone = true