-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdialogs.go
32 lines (26 loc) · 835 Bytes
/
dialogs.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
package main
import "github.com/ttacon/libphonenumber"
func getTextFromDialog(fun, obj, signal string) string {
win.Root().Call(fun)
p := win.Root().ObjectByName(obj)
ch := make(chan string)
p.On(signal, func(text string) {
ch <- text
})
text := <-ch
return text
}
func getStoragePassword() string {
return getTextFromDialog("getStoragePassword", "passwordPage", "passwordEntered")
}
func getPhoneNumber() string {
n := getTextFromDialog("getPhoneNumber", "signInPage", "numberEntered")
num, _ := libphonenumber.Parse(n, "")
c := libphonenumber.GetRegionCodeForCountryCode(int(num.GetCountryCode()))
s := libphonenumber.GetNationalSignificantNumber(num)
f := formatE164(s, c)
return f
}
func getVerificationCode() string {
return getTextFromDialog("getVerificationCode", "codeVerificationPage", "codeEntered")
}