Skip to content

Commit

Permalink
version 0.29
Browse files Browse the repository at this point in the history
  • Loading branch information
FriendsOfGalaxy committed Oct 1, 2019
1 parent c6e7dad commit 1b44a2a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 32 deletions.
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-r app.txt
invoke==1.2.0
pytest==4.2.0
pytest==5.2.0
pytest-asyncio==0.10.0
pytest-mock==1.10.3
pytest-flakes==4.0.0
Expand Down
16 changes: 7 additions & 9 deletions src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,28 +326,26 @@ async def get_friends(self):
for user_id, user_name in (await self._backend_client.get_friends(self._user_id)).items()
]

@staticmethod
async def _open_uri(uri):
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, partial(webbrowser.open, uri))

async def launch_game(self, game_id):
if is_uri_handler_installed("origin2"):
await OriginPlugin._open_uri("origin2://game/launch?offerIds={}&autoDownload=true".format(game_id))
webbrowser.open("origin2://game/launch?offerIds={}&autoDownload=true".format(game_id))
else:
await OriginPlugin._open_uri("https://www.origin.com/download")
webbrowser.open("https://www.origin.com/download")

async def install_game(self, game_id):
if is_uri_handler_installed("origin2"):
await OriginPlugin._open_uri("origin2://game/download?offerId={}".format(game_id))
webbrowser.open("origin2://game/download?offerId={}".format(game_id))
else:
await OriginPlugin._open_uri("https://www.origin.com/download")
webbrowser.open("https://www.origin.com/download")

if is_windows():
async def uninstall_game(self, game_id):
loop = asyncio.get_running_loop()
await loop.run_in_executor(None, partial(subprocess.run, ["control", "appwiz.cpl"]))

async def shutdown_platform_client(self) -> None:
webbrowser.open("origin://quit")

def _store_cookies(self, cookies):
credentials = {
"cookies": cookies
Expand Down
2 changes: 1 addition & 1 deletion src/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.28"
__version__ = "0.29"
34 changes: 13 additions & 21 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,30 +51,22 @@ def test_integration():
"jsonrpc": "2.0",
"result": {
"platform_name": "origin",
"token": token
"token": token,
"features": {
"ImportOwnedGames",
"ImportAchievements",
"ImportInstalledGames",
"LaunchGame",
"InstallGame",
"ShutdownPlatformClient",
"ImportFriends",
"ImportGameTime",
}
}
}
if platform.system().lower() == "windows":
expected_response["result"]["features"] = {
"ImportOwnedGames",
"ImportAchievements",
"ImportInstalledGames",
"LaunchGame",
"InstallGame",
"UninstallGame",
"ImportFriends",
"ImportGameTime"
}
else:
expected_response["result"]["features"] = {
"ImportOwnedGames",
"ImportAchievements",
"ImportInstalledGames",
"LaunchGame",
"InstallGame",
"ImportFriends",
"ImportGameTime"
}
expected_response["result"]["features"].add("UninstallGame")

assert response == expected_response, "Response differs from expected"

plugin_socket.close()
Expand Down

0 comments on commit 1b44a2a

Please sign in to comment.