Compare commits
No commits in common. "9d58ea0ae7a99e139953de9b064a6055515b4831" and "be5bdc625beae85c10760bf95bba8fa47752ab2b" have entirely different histories.
9d58ea0ae7
...
be5bdc625b
@ -48,7 +48,7 @@ func (c *Client) BatteryLevel() (uint8, error) {
|
|||||||
func (c *Client) WatchBatteryLevel() (<-chan uint8, func(), error) {
|
func (c *Client) WatchBatteryLevel() (<-chan uint8, func(), error) {
|
||||||
c.battLevelCh = make(chan types.Response, 2)
|
c.battLevelCh = make(chan types.Response, 2)
|
||||||
err := c.requestNoRes(types.Request{
|
err := c.requestNoRes(types.Request{
|
||||||
Type: types.ReqTypeWatchBattLevel,
|
Type: types.ReqTypeBattLevel,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"image/color"
|
"image/color"
|
||||||
|
"net"
|
||||||
|
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/theme"
|
"fyne.io/fyne/v2/theme"
|
||||||
"go.arsenm.dev/itd/api"
|
"go.arsenm.dev/itd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func infoTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
func infoTab(parent fyne.Window) *fyne.Container {
|
||||||
infoLayout := container.NewVBox(
|
infoLayout := container.NewVBox(
|
||||||
// Add rectangle for a bit of padding
|
// Add rectangle for a bit of padding
|
||||||
canvas.NewRectangle(color.Transparent),
|
canvas.NewRectangle(color.Transparent),
|
||||||
@ -20,50 +25,20 @@ func infoTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
// Create label for heart rate
|
// Create label for heart rate
|
||||||
heartRateLbl := newText("0 BPM", 24)
|
heartRateLbl := newText("0 BPM", 24)
|
||||||
// Creae container to store heart rate section
|
// Creae container to store heart rate section
|
||||||
heartRateSect := container.NewVBox(
|
heartRate := container.NewVBox(
|
||||||
newText("Heart Rate", 12),
|
newText("Heart Rate", 12),
|
||||||
heartRateLbl,
|
heartRateLbl,
|
||||||
canvas.NewLine(theme.ShadowColor()),
|
canvas.NewLine(theme.ShadowColor()),
|
||||||
)
|
)
|
||||||
infoLayout.Add(heartRateSect)
|
infoLayout.Add(heartRate)
|
||||||
|
|
||||||
heartRateCh, cancel, err := client.WatchHeartRate()
|
// Watch for heart rate updates
|
||||||
if err != nil {
|
go watch(types.ReqTypeWatchHeartRate, func(data interface{}) {
|
||||||
guiErr(err, "Error getting heart rate channel", true, parent)
|
// Change text of heart rate label
|
||||||
}
|
heartRateLbl.Text = fmt.Sprintf("%d BPM", int(data.(float64)))
|
||||||
onClose = append(onClose, cancel)
|
// Refresh label
|
||||||
go func() {
|
heartRateLbl.Refresh()
|
||||||
for heartRate := range heartRateCh {
|
}, parent)
|
||||||
// Change text of heart rate label
|
|
||||||
heartRateLbl.Text = fmt.Sprintf("%d BPM", heartRate)
|
|
||||||
// Refresh label
|
|
||||||
heartRateLbl.Refresh()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Create label for heart rate
|
|
||||||
stepCountLbl := newText("0 Steps", 24)
|
|
||||||
// Creae container to store heart rate section
|
|
||||||
stepCountSect := container.NewVBox(
|
|
||||||
newText("Step Count", 12),
|
|
||||||
stepCountLbl,
|
|
||||||
canvas.NewLine(theme.ShadowColor()),
|
|
||||||
)
|
|
||||||
infoLayout.Add(stepCountSect)
|
|
||||||
|
|
||||||
stepCountCh, cancel, err := client.WatchStepCount()
|
|
||||||
if err != nil {
|
|
||||||
guiErr(err, "Error getting step count channel", true, parent)
|
|
||||||
}
|
|
||||||
onClose = append(onClose, cancel)
|
|
||||||
go func() {
|
|
||||||
for stepCount := range stepCountCh {
|
|
||||||
// Change text of heart rate label
|
|
||||||
stepCountLbl.Text = fmt.Sprintf("%d Steps", stepCount)
|
|
||||||
// Refresh label
|
|
||||||
stepCountLbl.Refresh()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
// Create label for battery level
|
// Create label for battery level
|
||||||
battLevelLbl := newText("0%", 24)
|
battLevelLbl := newText("0%", 24)
|
||||||
@ -75,40 +50,32 @@ func infoTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
)
|
)
|
||||||
infoLayout.Add(battLevel)
|
infoLayout.Add(battLevel)
|
||||||
|
|
||||||
battLevelCh, cancel, err := client.WatchBatteryLevel()
|
// Watch for changes in battery level
|
||||||
if err != nil {
|
go watch(types.ReqTypeWatchBattLevel, func(data interface{}) {
|
||||||
guiErr(err, "Error getting battery level channel", true, parent)
|
battLevelLbl.Text = fmt.Sprintf("%d%%", int(data.(float64)))
|
||||||
}
|
battLevelLbl.Refresh()
|
||||||
onClose = append(onClose, cancel)
|
}, parent)
|
||||||
go func() {
|
|
||||||
for battLevel := range battLevelCh {
|
|
||||||
// Change text of battery level label
|
|
||||||
battLevelLbl.Text = fmt.Sprintf("%d%%", battLevel)
|
|
||||||
// Refresh label
|
|
||||||
battLevelLbl.Refresh()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
fwVerString, err := client.Version()
|
fwVerString, err := get(types.ReqTypeFwVersion)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
guiErr(err, "Error getting firmware string", true, parent)
|
guiErr(err, "Error getting firmware string", true, parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fwVer := container.NewVBox(
|
fwVer := container.NewVBox(
|
||||||
newText("Firmware Version", 12),
|
newText("Firmware Version", 12),
|
||||||
newText(fwVerString, 24),
|
newText(fwVerString.(string), 24),
|
||||||
canvas.NewLine(theme.ShadowColor()),
|
canvas.NewLine(theme.ShadowColor()),
|
||||||
)
|
)
|
||||||
infoLayout.Add(fwVer)
|
infoLayout.Add(fwVer)
|
||||||
|
|
||||||
btAddrString, err := client.Address()
|
btAddrString, err := get(types.ReqTypeBtAddress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
btAddr := container.NewVBox(
|
btAddr := container.NewVBox(
|
||||||
newText("Bluetooth Address", 12),
|
newText("Bluetooth Address", 12),
|
||||||
newText(btAddrString, 24),
|
newText(btAddrString.(string), 24),
|
||||||
canvas.NewLine(theme.ShadowColor()),
|
canvas.NewLine(theme.ShadowColor()),
|
||||||
)
|
)
|
||||||
infoLayout.Add(btAddr)
|
infoLayout.Add(btAddr)
|
||||||
@ -116,6 +83,65 @@ func infoTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
return infoLayout
|
return infoLayout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func watch(req int, onRecv func(data interface{}), parent fyne.Window) error {
|
||||||
|
conn, err := net.Dial("unix", SockPath)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
err = json.NewEncoder(conn).Encode(types.Request{
|
||||||
|
Type: req,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
scanner := bufio.NewScanner(conn)
|
||||||
|
for scanner.Scan() {
|
||||||
|
res, err := getResp(scanner.Bytes())
|
||||||
|
if err != nil {
|
||||||
|
guiErr(err, "Error getting response from connection", false, parent)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
onRecv(res.Value)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func get(req int) (interface{}, error) {
|
||||||
|
conn, err := net.Dial("unix", SockPath)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
err = json.NewEncoder(conn).Encode(types.Request{
|
||||||
|
Type: req,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
line, _, err := bufio.NewReader(conn).ReadLine()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
res, err := getResp(line)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return res.Value, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func getResp(line []byte) (*types.Response, error) {
|
||||||
|
var res types.Response
|
||||||
|
err := json.Unmarshal(line, &res)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if res.Error {
|
||||||
|
return nil, errors.New(res.Message)
|
||||||
|
}
|
||||||
|
return &res, nil
|
||||||
|
}
|
||||||
|
|
||||||
func newText(t string, size float32) *canvas.Text {
|
func newText(t string, size float32) *canvas.Text {
|
||||||
text := canvas.NewText(t, theme.ForegroundColor())
|
text := canvas.NewText(t, theme.ForegroundColor())
|
||||||
text.TextSize = size
|
text.TextSize = size
|
||||||
|
@ -1,38 +1,31 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net"
|
||||||
|
|
||||||
"fyne.io/fyne/v2/app"
|
"fyne.io/fyne/v2/app"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"go.arsenm.dev/itd/api"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var onClose []func()
|
var SockPath = "/tmp/itd/socket"
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Create new app
|
// Create new app
|
||||||
a := app.New()
|
a := app.New()
|
||||||
// Create new window with title "itgui"
|
// Create new window with title "itgui"
|
||||||
window := a.NewWindow("itgui")
|
window := a.NewWindow("itgui")
|
||||||
window.SetOnClosed(func() {
|
|
||||||
for _, closeFn := range onClose {
|
|
||||||
closeFn()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
client, err := api.New(api.DefaultAddr)
|
_, err := net.Dial("unix", SockPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
guiErr(err, "Error connecting to itd", true, window)
|
guiErr(err, "Error dialing itd socket", true, window)
|
||||||
}
|
}
|
||||||
onClose = append(onClose, func() {
|
|
||||||
client.Close()
|
|
||||||
})
|
|
||||||
|
|
||||||
// Create new app tabs container
|
// Create new app tabs container
|
||||||
tabs := container.NewAppTabs(
|
tabs := container.NewAppTabs(
|
||||||
container.NewTabItem("Info", infoTab(window, client)),
|
container.NewTabItem("Info", infoTab(window)),
|
||||||
container.NewTabItem("Notify", notifyTab(window, client)),
|
container.NewTabItem("Notify", notifyTab(window)),
|
||||||
container.NewTabItem("Set Time", timeTab(window, client)),
|
container.NewTabItem("Set Time", timeTab(window)),
|
||||||
container.NewTabItem("Upgrade", upgradeTab(window, client)),
|
container.NewTabItem("Upgrade", upgradeTab(window)),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set tabs as window content
|
// Set tabs as window content
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"go.arsenm.dev/itd/api"
|
"go.arsenm.dev/itd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func notifyTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
func notifyTab(parent fyne.Window) *fyne.Container {
|
||||||
// Create new entry for notification title
|
// Create new entry for notification title
|
||||||
titleEntry := widget.NewEntry()
|
titleEntry := widget.NewEntry()
|
||||||
titleEntry.SetPlaceHolder("Title")
|
titleEntry.SetPlaceHolder("Title")
|
||||||
@ -19,11 +22,20 @@ func notifyTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
|
|
||||||
// Create new button to send notification
|
// Create new button to send notification
|
||||||
sendBtn := widget.NewButton("Send", func() {
|
sendBtn := widget.NewButton("Send", func() {
|
||||||
err := client.Notify(titleEntry.Text, bodyEntry.Text)
|
// Dial itd UNIX socket
|
||||||
|
conn, err := net.Dial("unix", SockPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
guiErr(err, "Error sending notification", false, parent)
|
guiErr(err, "Error dialing socket", false, parent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// Encode notify request on connection
|
||||||
|
json.NewEncoder(conn).Encode(types.Request{
|
||||||
|
Type: types.ReqTypeNotify,
|
||||||
|
Data: types.ReqDataNotify{
|
||||||
|
Title: titleEntry.Text,
|
||||||
|
Body: bodyEntry.Text,
|
||||||
|
},
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Return new container containing all elements
|
// Return new container containing all elements
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"net"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"go.arsenm.dev/itd/api"
|
"go.arsenm.dev/itd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func timeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
func timeTab(parent fyne.Window) *fyne.Container {
|
||||||
// Create new entry for time string
|
// Create new entry for time string
|
||||||
timeEntry := widget.NewEntry()
|
timeEntry := widget.NewEntry()
|
||||||
// Set text to current time formatter properly
|
// Set text to current time formatter properly
|
||||||
@ -19,7 +21,7 @@ func timeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
// Create button to set current time
|
// Create button to set current time
|
||||||
currentBtn := widget.NewButton("Set Current", func() {
|
currentBtn := widget.NewButton("Set Current", func() {
|
||||||
timeEntry.SetText(time.Now().Format(time.RFC1123))
|
timeEntry.SetText(time.Now().Format(time.RFC1123))
|
||||||
setTime(client, true)
|
setTime(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Create button to set time inside entry
|
// Create button to set time inside entry
|
||||||
@ -31,7 +33,7 @@ func timeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Set time to parsed time
|
// Set time to parsed time
|
||||||
setTime(client, false, parsedTime)
|
setTime(false, parsedTime)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Return new container with all elements centered
|
// Return new container with all elements centered
|
||||||
@ -46,13 +48,30 @@ func timeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
|
|
||||||
// setTime sets the first element in the variadic parameter
|
// setTime sets the first element in the variadic parameter
|
||||||
// if current is false, otherwise, it sets the current time.
|
// if current is false, otherwise, it sets the current time.
|
||||||
func setTime(client *api.Client, current bool, t ...time.Time) error {
|
func setTime(current bool, t ...time.Time) error {
|
||||||
var err error
|
// Dial UNIX socket
|
||||||
if current {
|
conn, err := net.Dial("unix", SockPath)
|
||||||
err = client.SetTimeNow()
|
if err != nil {
|
||||||
} else {
|
return err
|
||||||
err = client.SetTime(t[0])
|
|
||||||
}
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
var data string
|
||||||
|
// If current is true, use the string "now"
|
||||||
|
// otherwise, use the formatted time from the
|
||||||
|
// first element in the variadic parameter.
|
||||||
|
// "now" is more accurate than formatting
|
||||||
|
// current time as only seconds are preserved
|
||||||
|
// in that case.
|
||||||
|
if current {
|
||||||
|
data = "now"
|
||||||
|
} else {
|
||||||
|
data = t[0].Format(time.RFC3339)
|
||||||
|
}
|
||||||
|
// Encode SetTime request with above data
|
||||||
|
err = json.NewEncoder(conn).Encode(types.Request{
|
||||||
|
Type: types.ReqTypeSetTime,
|
||||||
|
Data: data,
|
||||||
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
@ -10,11 +13,11 @@ import (
|
|||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/storage"
|
"fyne.io/fyne/v2/storage"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"go.arsenm.dev/itd/api"
|
"github.com/mitchellh/mapstructure"
|
||||||
"go.arsenm.dev/itd/internal/types"
|
"go.arsenm.dev/itd/internal/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
func upgradeTab(parent fyne.Window) *fyne.Container {
|
||||||
var (
|
var (
|
||||||
archivePath string
|
archivePath string
|
||||||
firmwarePath string
|
firmwarePath string
|
||||||
@ -114,7 +117,7 @@ func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
// Resize modal to 300x100
|
// Resize modal to 300x100
|
||||||
progressDlg.Resize(fyne.NewSize(300, 100))
|
progressDlg.Resize(fyne.NewSize(300, 100))
|
||||||
|
|
||||||
var fwUpgType api.UpgradeType
|
var fwUpgType int
|
||||||
var files []string
|
var files []string
|
||||||
// Get appropriate upgrade type and file paths
|
// Get appropriate upgrade type and file paths
|
||||||
switch upgradeTypeSelect.Selected {
|
switch upgradeTypeSelect.Selected {
|
||||||
@ -126,18 +129,48 @@ func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
files = append(files, initPktPath, firmwarePath)
|
files = append(files, initPktPath, firmwarePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
progress, err := client.FirmwareUpgrade(fwUpgType, files...)
|
// Dial itd UNIX socket
|
||||||
|
conn, err := net.Dial("unix", SockPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
guiErr(err, "Error initiating DFU", false, parent)
|
guiErr(err, "Error dialing socket", false, parent)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer conn.Close()
|
||||||
|
|
||||||
|
// Encode firmware upgrade request to connection
|
||||||
|
json.NewEncoder(conn).Encode(types.Request{
|
||||||
|
Type: types.ReqTypeFwUpgrade,
|
||||||
|
Data: types.ReqDataFwUpgrade{
|
||||||
|
Type: fwUpgType,
|
||||||
|
Files: files,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Show progress dialog
|
// Show progress dialog
|
||||||
progressDlg.Show()
|
progressDlg.Show()
|
||||||
// Hide progress dialog after completion
|
// Hide progress dialog after completion
|
||||||
defer progressDlg.Hide()
|
defer progressDlg.Hide()
|
||||||
|
|
||||||
for event := range progress {
|
scanner := bufio.NewScanner(conn)
|
||||||
|
for scanner.Scan() {
|
||||||
|
var res types.Response
|
||||||
|
// Decode scanned line into response struct
|
||||||
|
err = json.Unmarshal(scanner.Bytes(), &res)
|
||||||
|
if err != nil {
|
||||||
|
guiErr(err, "Error decoding response", false, parent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if res.Error {
|
||||||
|
guiErr(err, "Error returned in response", false, parent)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var event types.DFUProgress
|
||||||
|
// Decode response data into progress struct
|
||||||
|
err = mapstructure.Decode(res.Value, &event)
|
||||||
|
if err != nil {
|
||||||
|
guiErr(err, "Error decoding response value", false, parent)
|
||||||
|
return
|
||||||
|
}
|
||||||
// Set label text to received / total B
|
// Set label text to received / total B
|
||||||
progressLbl.SetText(fmt.Sprintf("%d / %d B", event.Received, event.Total))
|
progressLbl.SetText(fmt.Sprintf("%d / %d B", event.Received, event.Total))
|
||||||
// Set progress bar values
|
// Set progress bar values
|
||||||
@ -146,7 +179,7 @@ func upgradeTab(parent fyne.Window, client *api.Client) *fyne.Container {
|
|||||||
// Refresh progress bar
|
// Refresh progress bar
|
||||||
progressBar.Refresh()
|
progressBar.Refresh()
|
||||||
// If transfer finished, break
|
// If transfer finished, break
|
||||||
if event.Sent == event.Total {
|
if event.Received == event.Total {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user