SDK-2524: Fix achievement notification

This commit is contained in:
Romuald Bierbasz
2019-02-13 10:22:36 +01:00
parent 3e34edf5e7
commit 4cec6c09b2
2 changed files with 12 additions and 5 deletions

View File

@@ -207,8 +207,12 @@ class Plugin():
params = {"owned_game" : game}
self._notification_client.notify("owned_game_updated", params)
def unlock_achievement(self, achievement):
self._notification_client.notify("achievement_unlocked", achievement)
def unlock_achievement(self, game_id, achievement):
params = {
"game_id": game_id,
"achievement": achievement
}
self._notification_client.notify("achievement_unlocked", params)
def update_local_game_status(self, local_game):
params = {"local_game" : local_game}

View File

@@ -70,7 +70,7 @@ def test_unlock_achievement(plugin, write):
achievement = Achievement("lvl20", 1548422395)
async def couritine():
plugin.unlock_achievement(achievement)
plugin.unlock_achievement("14", achievement)
asyncio.run(couritine())
response = json.loads(write.call_args[0][0])
@@ -79,7 +79,10 @@ def test_unlock_achievement(plugin, write):
"jsonrpc": "2.0",
"method": "achievement_unlocked",
"params": {
"achievement_id": "lvl20",
"unlock_time": 1548422395
"game_id": "14",
"achievement": {
"achievement_id": "lvl20",
"unlock_time": 1548422395
}
}
}