refactor: rename files

This commit is contained in:
lilong.129
2025-02-06 19:53:47 +08:00
parent 0e5eb8b303
commit 5707715d19
10 changed files with 51 additions and 50 deletions
+11 -10
View File
@@ -13,12 +13,13 @@ import (
)
type stubIOSDriver struct {
*wdaDriver
DriverClient
bightInsightPrefix string
serverPrefix string
timeout time.Duration
Driver
*wdaDriver
device *IOSDevice
device *IOSDevice
}
func newStubIOSDriver(bightInsightAddr, serverAddr string, dev *IOSDevice, readTimeout ...time.Duration) (*stubIOSDriver, error) {
@@ -31,7 +32,7 @@ func newStubIOSDriver(bightInsightAddr, serverAddr string, dev *IOSDevice, readT
driver.bightInsightPrefix = bightInsightAddr
driver.serverPrefix = serverAddr
driver.timeout = timeout
driver.Driver.client = &http.Client{
driver.DriverClient.client = &http.Client{
Timeout: time.Second * 10, // 设置超时时间为 10 秒
}
return driver, nil
@@ -450,7 +451,7 @@ func (s *stubIOSDriver) GetDriverResults() []*DriverResult {
}
func (s *stubIOSDriver) Source(srcOpt ...SourceOption) (string, error) {
resp, err := s.Driver.Request(http.MethodGet, fmt.Sprintf("%s/source?format=json&onlyWeb=false", s.bightInsightPrefix), []byte{})
resp, err := s.DriverClient.Request(http.MethodGet, fmt.Sprintf("%s/source?format=json&onlyWeb=false", s.bightInsightPrefix), []byte{})
if err != nil {
return "", err
}
@@ -472,7 +473,7 @@ func (s *stubIOSDriver) LoginNoneUI(packageName, phoneNumber string, captcha, pa
if err != nil {
return info, err
}
resp, err := s.Driver.Request(http.MethodPost, fmt.Sprintf("%s/host/login/account/", s.serverPrefix), bsJSON)
resp, err := s.DriverClient.Request(http.MethodPost, fmt.Sprintf("%s/host/login/account/", s.serverPrefix), bsJSON)
if err != nil {
return info, err
}
@@ -496,7 +497,7 @@ func (s *stubIOSDriver) LoginNoneUI(packageName, phoneNumber string, captcha, pa
}
func (s *stubIOSDriver) LogoutNoneUI(packageName string) error {
resp, err := s.Driver.Request(http.MethodGet, fmt.Sprintf("%s/host/loginout/", s.serverPrefix), []byte{})
resp, err := s.DriverClient.Request(http.MethodGet, fmt.Sprintf("%s/host/loginout/", s.serverPrefix), []byte{})
if err != nil {
return err
}
@@ -515,12 +516,12 @@ func (s *stubIOSDriver) LogoutNoneUI(packageName string) error {
}
func (s *stubIOSDriver) TearDown() error {
s.Driver.client.CloseIdleConnections()
s.DriverClient.client.CloseIdleConnections()
return nil
}
func (s *stubIOSDriver) getLoginAppInfo(packageName string) (info AppLoginInfo, err error) {
resp, err := s.Driver.Request(http.MethodGet, fmt.Sprintf("%s/host/app/info/", s.serverPrefix), []byte{})
resp, err := s.DriverClient.Request(http.MethodGet, fmt.Sprintf("%s/host/app/info/", s.serverPrefix), []byte{})
if err != nil {
return info, err
}
@@ -542,5 +543,5 @@ func (s *stubIOSDriver) getLoginAppInfo(packageName string) (info AppLoginInfo,
}
func (s *stubIOSDriver) GetSession() *DriverSession {
return &s.Driver.session
return &s.DriverClient.session
}