Skip to content

Commit 97908b1

Browse files
committed
feat: Remove serial LocalStorage
1 parent 7e5b477 commit 97908b1

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
run: |
2424
python -m pip install --upgrade pip
2525
pip install setuptools wheel twine poetry
26+
poetry lock --no-update
2627
poetry install
2728
2829
- name: Get the version from the tag

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ aiofiles = "^23.1.0"
1818
uiautomator2 = "^3.0.0"
1919
facebook-wda = "^1.0.5"
2020
tidevice = "^0.12.10"
21-
hmdriver2 = "^1.2.10"
21+
hmdriver2 = "^1.3.0"
2222

2323
[tool.poetry.extras]
2424

uiviewer/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def global_exception_handler(request: Request, exc: Exception):
3636
def http_exception_handler(request: Request, exc: HTTPException):
3737
return JSONResponse(
3838
status_code=exc.status_code,
39-
content=ApiResponse(success=False, message=exc.detail).dict(),
39+
content=ApiResponse(success=False, message=exc.detail).dict()
4040
)
4141

4242

uiviewer/_device.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
import abc
4+
import traceback
45
import tempfile
56
from typing import List, Dict, Union, Tuple, Optional
67
from functools import cached_property # python3.8+
@@ -14,6 +15,7 @@
1415
from hmdriver2 import hdc
1516
from fastapi import HTTPException
1617

18+
from uiviewer._logger import logger
1719
from uiviewer._utils import file2base64, image2base64
1820
from uiviewer._models import Platform, BaseHierarchy
1921
from uiviewer.parser import android_hierarchy, ios_hierarchy, harmony_hierarchy
@@ -159,6 +161,7 @@ def get_device(platform: str, serial: str, wda_url: str, max_depth: int) -> Unio
159161
def init_device(platform: str, serial: str, wda_url: str, max_depth: int):
160162

161163
if serial not in list_serials(platform):
164+
logger.error(f"Device<{serial}> not found")
162165
raise HTTPException(status_code=500, detail=f"Device<{serial}> not found")
163166

164167
try:
@@ -168,6 +171,7 @@ def init_device(platform: str, serial: str, wda_url: str, max_depth: int):
168171
if isinstance(device, IosDevice):
169172
return device._check_wda_health()
170173
except Exception as e:
174+
logger.error(traceback.format_exc())
171175
raise HTTPException(status_code=500, detail=str(e))
172176

173177
return True

uiviewer/static/js/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ new Vue({
88
return {
99
version: "",
1010
platform: getFromLocalStorage('platform', 'harmony'),
11-
serial: getFromLocalStorage('serial', ''),
11+
serial: "",
1212
devices: [],
1313
isConnected: false,
1414
isConnecting: false,
@@ -61,9 +61,6 @@ new Vue({
6161
platform(newVal) {
6262
saveToLocalStorage('platform', newVal);
6363
},
64-
serial(newVal) {
65-
saveToLocalStorage('serial', newVal);
66-
},
6764
wdaUrl(newVal) {
6865
saveToLocalStorage('wdaUrl', newVal);
6966
},
@@ -404,10 +401,10 @@ new Vue({
404401
return isFieldMatch || isLabelMatch;
405402
},
406403
getTreeLabel(node) {
407-
const { _type="", resourceId, lable, text, id } = node;
404+
const { _type="", resourceId="", label="", text="", id="" } = node;
408405
const labelMap = {
409406
android: resourceId || text,
410-
ios: lable,
407+
ios: label,
411408
harmony: text || id
412409
};
413410
return `${_type} - ${labelMap[this.platform] || ''}`;

0 commit comments

Comments
 (0)