Skip to content

Commit

Permalink
fix: get more values by session
Browse files Browse the repository at this point in the history
> #26
  • Loading branch information
electricbubble committed Apr 22, 2022
1 parent 81af541 commit c92932c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions device.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,19 @@ func (d *device) GetValue(domain, key string) (v interface{}, err error) {
if _, err = d.lockdownService(); err != nil {
return nil, err
}
return d.lockdown.GetValue(domain, key)
if d.lockdown.pairRecord == nil {
if err = d.lockdown.handshake(); err != nil {
return nil, err
}
}
if err = d.lockdown.startSession(d.lockdown.pairRecord); err != nil {
return nil, err
}
if v, err = d.lockdown.GetValue(domain, key); err != nil {
return nil, err
}
err = d.lockdown.stopSession()
return
}

func (d *device) Pair() (pairRecord *PairRecord, err error) {
Expand Down Expand Up @@ -730,7 +742,7 @@ func (d *device) XCTest(bundleID string, opts ...XCTestOption) (out <-chan strin
if _err := d.AppKill(pid); _err != nil {
debugLog(fmt.Sprintf("xctest kill: %d", pid))
}
//time.Sleep(time.Second)
// time.Sleep(time.Second)
close(_out)
return
}()
Expand Down
5 changes: 4 additions & 1 deletion lockdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func Test_lockdown_QueryType(t *testing.T) {
func Test_lockdown_GetValue(t *testing.T) {
setupLockdownSrv(t)

v, err := lockdownSrv.GetValue("", "")
// v, err := dev.GetValue("com.apple.mobile.iTunes", "")
// v, err := dev.GetValue("com.apple.mobile.internal", "")
v, err := dev.GetValue("com.apple.mobile.battery", "")

// v, err := lockdownSrv.GetValue("", "ProductVersion")
// v, err := lockdownSrv.GetValue("", "DeviceName")
// v, err := lockdownSrv.GetValue("com.apple.mobile.iTunes", "")
Expand Down

0 comments on commit c92932c

Please sign in to comment.