From e67ef0ae1474bd5c316be03d08c9bfc2eec27fcd Mon Sep 17 00:00:00 2001 From: electricbubble Date: Thu, 3 Mar 2022 22:53:11 +0800 Subject: [PATCH] fix: should browse until complete by default --- installationproxy.go | 13 ++++++++++--- installationproxy_test.go | 8 ++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/installationproxy.go b/installationproxy.go index a56ab41..4e547b6 100644 --- a/installationproxy.go +++ b/installationproxy.go @@ -47,11 +47,18 @@ func (p *installationProxy) Browse(opts ...InstallationProxyOption) (currentList if err = respPkt.Unmarshal(&reply); err != nil { return nil, err } - if reply.Status != "BrowsingApplications" { - return nil, fmt.Errorf("installation proxy 'Browse' status: %s", reply.Status) - } currentList = reply.CurrentList + + for reply.Status != "Complete" { + if respPkt, err = p.client.ReceivePacket(); err != nil { + return nil, err + } + if err = respPkt.Unmarshal(&reply); err != nil { + return nil, err + } + currentList = append(currentList, reply.CurrentList) + } return } diff --git a/installationproxy_test.go b/installationproxy_test.go index a74891f..c2baedf 100644 --- a/installationproxy_test.go +++ b/installationproxy_test.go @@ -36,8 +36,12 @@ func Test_installationProxy_Browse(t *testing.T) { t.Log(len(currentList)) for _, cl := range currentList { - app := cl.(map[string]interface{}) - t.Log(app) + app, ok := cl.(map[string]interface{}) + if ok { + t.Log(app) + } else { + t.Log(cl) + } } }