Fix: Wait cloud remain reduce

This commit is contained in:
LmeSzinc 2024-05-30 21:41:19 +08:00
parent b3b06e4b79
commit 732efa25ed

View File

@ -443,7 +443,37 @@ class LoginAndroidCloud(ModuleBase):
continue continue
# Update remain # Update remain
if self.config.stored.CloudRemainSeasonPass:
self._cloud_get_remain() self._cloud_get_remain()
else:
# Wait cloud remain reduce
# Value wasn't updated that fast at the time re-entering XPath.START_GAME
skip_first = True
timeout = Timer(2, count=4).start()
prev = [
self.config.stored.CloudRemainSeasonPass.value,
self.config.stored.CloudRemainPaid.value,
self.config.stored.CloudRemainFree.value,
]
with self.config.multi_set():
while 1:
if skip_first:
skip_first = False
else:
self.device.dump_hierarchy()
# End
if timeout.reached():
logger.warning('Wait cloud remain reduce timeout')
break
self._cloud_get_remain()
current = [
self.config.stored.CloudRemainSeasonPass.value,
self.config.stored.CloudRemainPaid.value,
self.config.stored.CloudRemainFree.value,
]
if current != prev:
break
def cloud_keep_alive(self): def cloud_keep_alive(self):
""" """