cli: Make UI struct singleton
This commit is contained in:
parent
d37d40def4
commit
a22de02531
|
@ -35,11 +35,10 @@ func main() {
|
|||
client := &Client{
|
||||
Backend: rpc.NewRicochetCoreClient(conn),
|
||||
}
|
||||
ui := &UI{
|
||||
Ui = UI{
|
||||
Input: input,
|
||||
Client: client,
|
||||
}
|
||||
client.Ui = ui
|
||||
|
||||
fmt.Print("Connecting to backend...\n")
|
||||
|
||||
|
@ -49,9 +48,9 @@ func main() {
|
|||
os.Exit(1)
|
||||
}
|
||||
client.Block()
|
||||
ui.PrintStatus()
|
||||
Ui.PrintStatus()
|
||||
client.Unblock()
|
||||
}()
|
||||
|
||||
ui.CommandLoop()
|
||||
Ui.CommandLoop()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
|
||||
type Client struct {
|
||||
Backend ricochet.RicochetCoreClient
|
||||
Ui *UI
|
||||
|
||||
ServerStatus ricochet.ServerStatusReply
|
||||
Identity ricochet.Identity
|
||||
|
@ -227,8 +226,8 @@ func (c *Client) onContactEvent(event *ricochet.ContactEvent) {
|
|||
|
||||
contact, _ := c.Contacts.Deleted(data)
|
||||
|
||||
if c.Ui.CurrentContact == contact {
|
||||
c.Ui.SetCurrentContact(nil)
|
||||
if Ui.CurrentContact == contact {
|
||||
Ui.SetCurrentContact(nil)
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue