mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
commit
3579d68ad0
@ -18,7 +18,7 @@ VALID_PACKAGE = set(list(VALID_SERVER.values()))
|
||||
VALID_CLOUD_SERVER = {
|
||||
'CN-Official': 'com.miHoYo.cloudgames.hkrpg',
|
||||
}
|
||||
VALID_CLOUD_PACKAGE = set(list(VALID_SERVER.values()))
|
||||
VALID_CLOUD_PACKAGE = set(list(VALID_CLOUD_SERVER.values()))
|
||||
|
||||
|
||||
def set_lang(lang_: str):
|
||||
|
@ -242,6 +242,17 @@ class Uiautomator2(Connection):
|
||||
hierarchy = etree.fromstring(content.encode('utf-8'))
|
||||
return hierarchy
|
||||
|
||||
def uninstall_uiautomator2(self):
|
||||
logger.info('Removing uiautomator2')
|
||||
for file in [
|
||||
'app-uiautomator.apk',
|
||||
'app-uiautomator-test.apk',
|
||||
'minitouch',
|
||||
'minitouch.so',
|
||||
'atx-agent',
|
||||
]:
|
||||
self.adb_shell(["rm", f"/data/local/tmp/{file}"])
|
||||
|
||||
@retry
|
||||
def resolution_uiautomator2(self, cal_rotation=True) -> t.Tuple[int, int]:
|
||||
"""
|
||||
|
@ -1,3 +1,4 @@
|
||||
import os
|
||||
import random
|
||||
import re
|
||||
import socket
|
||||
@ -5,6 +6,7 @@ import time
|
||||
import typing as t
|
||||
|
||||
import uiautomator2 as u2
|
||||
import uiautomator2cache
|
||||
from adbutils import AdbTimeout
|
||||
from lxml import etree
|
||||
|
||||
@ -51,6 +53,25 @@ from module.logger import logger
|
||||
RETRY_TRIES = 5
|
||||
RETRY_DELAY = 3
|
||||
|
||||
# Patch uiautomator2 appdir
|
||||
u2.init.appdir = os.path.dirname(uiautomator2cache.__file__)
|
||||
|
||||
# Patch uiautomator2 logger
|
||||
u2_logger = u2.logger
|
||||
u2_logger.debug = logger.info
|
||||
u2_logger.info = logger.info
|
||||
u2_logger.warning = logger.warning
|
||||
u2_logger.error = logger.error
|
||||
u2_logger.critical = logger.critical
|
||||
|
||||
|
||||
def setup_logger(*args, **kwargs):
|
||||
return u2_logger
|
||||
|
||||
|
||||
u2.setup_logger = setup_logger
|
||||
u2.init.setup_logger = setup_logger
|
||||
|
||||
|
||||
def is_port_using(port_num):
|
||||
""" if port is using by others, return True. else return False """
|
||||
|
4
module/notify/__init__.py
Normal file
4
module/notify/__init__.py
Normal file
@ -0,0 +1,4 @@
|
||||
def handle_notify(*args, **kwargs):
|
||||
# Lazy import onepush
|
||||
from module.notify.notify import handle_notify
|
||||
return handle_notify(*args, **kwargs)
|
Loading…
Reference in New Issue
Block a user