Debian Codegraph @

interface/ui.go

raw symbols SCIP
1 // gomuks - A terminal Matrix client written in Go.
2 // Copyright (C) 2020 Tulir Asokan
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16
17 package ifc
18
19 import (
20 "time"
21
22 "maunium.net/go/gomuks/matrix/muksevt"
23 "maunium.net/go/gomuks/matrix/rooms"
24 "maunium.net/go/mautrix/id"
25 "maunium.net/go/mautrix/pushrules"
26 )
27
28 type UIProvider func(gmx Gomuks) GomuksUI
29
30 type GomuksUI interface {
31 Render()
32 HandleNewPreferences()
33 OnLogin()
34 OnLogout()
35 MainView() MainView
36
37 Init()
38 Start() error
39 Stop()
40 Finish()
41 }
42
43 type SyncingModal interface {
44 SetIndeterminate()
45 SetMessage(string)
46 SetSteps(int)
47 Step()
48 Close()
49 }
50
51 type MainView interface {
52 GetRoom(roomID id.RoomID) RoomView
53 AddRoom(room *rooms.Room)
54 RemoveRoom(room *rooms.Room)
55 SetRooms(rooms *rooms.RoomCache)
56 Bump(room *rooms.Room)
57
58 UpdateTags(room *rooms.Room)
59
60 SetTyping(roomID id.RoomID, users []id.UserID)
61 OpenSyncingModal() SyncingModal
62
63 NotifyMessage(room *rooms.Room, message Message, should pushrules.PushActionArrayShould)
64 }
65
66 type RoomView interface {
67 MxRoom() *rooms.Room
68
69 SetCompletions(completions []string)
70 SetTyping(users []id.UserID)
71 UpdateUserList()
72
73 AddEvent(evt *muksevt.Event) Message
74 AddRedaction(evt *muksevt.Event)
75 AddEdit(evt *muksevt.Event)
76 AddReaction(evt *muksevt.Event, key string)
77 GetEvent(eventID id.EventID) Message
78 AddServiceMessage(message string)
79 }
80
81 type Message interface {
82 ID() id.EventID
83 Time() time.Time
84 NotificationSenderName() string
85 NotificationContent() string
86
87 SetIsHighlight(highlight bool)
88 SetID(id id.EventID)
89 }