Skip to content

Commit

Permalink
Restart pogo once PD service is started after having stopped it
Browse files Browse the repository at this point in the history
  • Loading branch information
Grennith committed Dec 24, 2023
1 parent c67aa9f commit 7b4e48e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions mapadroid/ocr/screenPath.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ async def __handle_screentype(self, screentype: ScreenType,
BurnType.MAINTENANCE)
elif screentype == ScreenType.POGO:
screentype = await self.__check_pogo_screen_ban_or_loading(screentype, y_offset=y_offset)
if screentype == ScreenType.WELCOME:
screentype = await self.__handle_welcome_screen()
elif screentype == ScreenType.QUEST:
logger.warning("Already on quest screen")
# TODO: consider closing quest window?
Expand Down Expand Up @@ -420,9 +422,14 @@ async def __handle_google_login(self, screentype) -> ScreenType:
await asyncio.sleep(120)
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value false'")
await asyncio.sleep(5)
await asyncio.sleep(2)
await self._communicator.passthrough(
"su -c 'am start-foreground-service -n com.mad.pogodroid/.services.HookReceiverService'")
await asyncio.sleep(5)
await self._communicator.stop_app("com.nianticlabs.pokemongo")
await asyncio.sleep(10)
await self._communicator.start_app("com.nianticlabs.pokemongo")
await asyncio.sleep(120)
else:
screentype = ScreenType.ERROR
return screentype
Expand Down Expand Up @@ -521,9 +528,14 @@ async def __handle_ptc_login(self) -> ScreenType:
# Start pogodroid service again to make sure we are running PD properly here
await self._communicator.passthrough(
"su -c 'am broadcast -a com.mad.pogodroid.SET_INTENTIONAL_STOP -c android.intent.category.DEFAULT -n com.mad.pogodroid/.IntentionalStopSetterReceiver --ez value false'")
await asyncio.sleep(5)
await asyncio.sleep(2)
await self._communicator.passthrough(
"su -c 'am start-foreground-service -n com.mad.pogodroid/.services.HookReceiverService'")
await asyncio.sleep(5)
await self._communicator.stop_app("com.nianticlabs.pokemongo")
await asyncio.sleep(10)
await self._communicator.start_app("com.nianticlabs.pokemongo")
await asyncio.sleep(120)
return ScreenType.PTC
else:
logger.error("Log in [accept] button not found?")
Expand Down

0 comments on commit 7b4e48e

Please sign in to comment.