- Adjusted configuration for reset after swipes to 10 seconds and added action to go back. - Updated flow control to skip back action if a recent reset was triggered within 5 seconds. - Implemented a mechanism to enable back navigation when consecutive misses reach a threshold. - Added GUI options to enable or disable back navigation on misses, ensuring consistency with user settings. - Introduced new diagnostic tools for runtime flag checks and screenshot diagnostics. - Created PowerShell scripts for restoring Start Menu shortcuts and performing system health checks. - Added tests for swipe operations and back navigation to validate new logic.
42 lines
1.5 KiB
Python
42 lines
1.5 KiB
Python
from douyin.core.douyin_fudai import fudai_analyse
|
|
from douyin.handlers import douyin_swipe_ops
|
|
|
|
class DummyOp:
|
|
def swipe(self, device_id, sx, sy, ex, ey, duration_ms):
|
|
# minimal output
|
|
print(f"swipe: device={device_id} from=({sx},{sy}) to=({ex},{ey}) dur={duration_ms}")
|
|
def click_back(self, device_id=None):
|
|
print(f"click_back called, device={device_id}")
|
|
|
|
|
|
def main():
|
|
a = fudai_analyse()
|
|
a.operation = DummyOp()
|
|
a.device_id = "DUMMY"
|
|
# use config default of 10 to simulate ten swipes
|
|
a.fudai_exit_after_misses = int(getattr(a, 'fudai_exit_after_misses', 10) or 10)
|
|
print('fudai_exit_after_misses =', a.fudai_exit_after_misses)
|
|
# ensure counter starts at 0
|
|
a._consecutive_no_fudai_count = 0
|
|
|
|
for i in range(1, 11):
|
|
print(f"\n-- swipe #{i} --")
|
|
douyin_swipe_ops.swipe_up_switch_live(a)
|
|
# simulate not finding fudai -> increment counter
|
|
a._consecutive_no_fudai_count = int(getattr(a, '_consecutive_no_fudai_count', 0)) + 1
|
|
print('consecutive_no_fudai_count =', a._consecutive_no_fudai_count)
|
|
if a._consecutive_no_fudai_count >= a.fudai_exit_after_misses:
|
|
print('threshold reached, invoking back')
|
|
try:
|
|
a.operation.click_back(a.device_id)
|
|
except Exception:
|
|
print('click_back failed')
|
|
# reset counter as real logic would
|
|
a._consecutive_no_fudai_count = 0
|
|
break
|
|
else:
|
|
print('\nNo back triggered after 10 swipes')
|
|
|
|
if __name__ == '__main__':
|
|
main()
|