From dc3d3911ec1df7a636628c362e51b357e16cd974 Mon Sep 17 00:00:00 2001 From: electricbubble Date: Fri, 20 May 2022 23:28:27 +0800 Subject: [PATCH] fix: get all data correctly > https://github.com/electricbubble/gidevice/issues/27 --- device_test.go | 19 +++++++++++++++++++ installationproxy.go | 5 ++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/device_test.go b/device_test.go index 968e2e5..ac18e95 100644 --- a/device_test.go +++ b/device_test.go @@ -153,3 +153,22 @@ func Test_device_Shutdown(t *testing.T) { setupDevice(t) dev.Shutdown() } + +func Test_device_InstallationProxyBrowse(t *testing.T) { + setupDevice(t) + + list, err := dev.InstallationProxyBrowse( + WithApplicationType(ApplicationTypeUser), + WithReturnAttributes("CFBundleDisplayName", "CFBundleIdentifier", "SequenceNumber", "SequenceNumber"), + ) + // list, err := dev.InstallationProxyBrowse() + if err != nil { + t.Fatal(err) + } + + t.Log(len(list)) + + for _, l := range list { + t.Logf("%#v", l) + } +} diff --git a/installationproxy.go b/installationproxy.go index 4e547b6..80c0070 100644 --- a/installationproxy.go +++ b/installationproxy.go @@ -48,8 +48,6 @@ func (p *installationProxy) Browse(opts ...InstallationProxyOption) (currentList return nil, err } - currentList = reply.CurrentList - for reply.Status != "Complete" { if respPkt, err = p.client.ReceivePacket(); err != nil { return nil, err @@ -57,8 +55,9 @@ func (p *installationProxy) Browse(opts ...InstallationProxyOption) (currentList if err = respPkt.Unmarshal(&reply); err != nil { return nil, err } - currentList = append(currentList, reply.CurrentList) } + + currentList = reply.CurrentList return }