-
Notifications
You must be signed in to change notification settings - Fork 1
/
connect.go
51 lines (42 loc) · 989 Bytes
/
connect.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"gioui.org/layout"
"gioui.org/widget/material"
"github.com/katzenpost/katzenpost/catshadow"
)
type connectingPage struct {
result chan interface{}
}
func (p *connectingPage) Layout(gtx layout.Context) layout.Dimensions {
bg := Background{
Color: th.Bg,
Inset: layout.Inset{},
}
return bg.Layout(gtx, func(gtx C) D { return layout.Center.Layout(gtx, material.Caption(th, "Stand by... connecting").Layout) })
}
func (p *connectingPage) Start(stop <-chan struct{}) {
}
type connectError struct {
err error
}
type connectSuccess struct {
client *catshadow.Client
}
func (p *connectingPage) Event(gtx layout.Context) interface{} {
select {
case r := <-p.result:
switch r := r.(type) {
case error:
return connectError{err: r}
case *catshadow.Client:
return connectSuccess{client: r}
}
default:
}
return nil
}
func newConnectingPage(result chan interface{}) *connectingPage {
p := new(connectingPage)
p.result = result
return p
}