diff --git a/hara-ddiclient-api/src/main/kotlin/org/eclipse/hara/ddiclient/api/MessageListener.kt b/hara-ddiclient-api/src/main/kotlin/org/eclipse/hara/ddiclient/api/MessageListener.kt index d6013ab..7437cb2 100644 --- a/hara-ddiclient-api/src/main/kotlin/org/eclipse/hara/ddiclient/api/MessageListener.kt +++ b/hara-ddiclient-api/src/main/kotlin/org/eclipse/hara/ddiclient/api/MessageListener.kt @@ -59,15 +59,13 @@ interface MessageListener { /** * Client is waiting for the authorization to start downloading - * @property forcedDownload: if true, immediate download is requested from server */ - class WaitingDownloadAuthorization(val forcedDownload:Boolean) : State("Waiting authorization to start download") + object WaitingDownloadAuthorization : State("Waiting authorization to start download") /** * Client is waiting for the authorization to start updating - * @property forcedUpdate: if true, immediate update is requested from server */ - class WaitingUpdateAuthorization(val forcedUpdate:Boolean) : State("Waiting authorization to start update") + object WaitingUpdateAuthorization : State("Waiting authorization to start update") /** * Client is waiting for new requests from server diff --git a/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/DownloadManager.kt b/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/DownloadManager.kt index 85989f3..2495590 100644 --- a/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/DownloadManager.kt +++ b/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/DownloadManager.kt @@ -93,8 +93,7 @@ private constructor(scope: ActorScope) : AbstractActor(scope) { waitingAuthJob?.cancel() waitingAuthJob = launch { softRequest.onAuthorizationReceive(onWaitForAuthorization = { - notificationManager.send(MessageListener.Message.State - .WaitingDownloadAuthorization(false)) + notificationManager.send(MessageListener.Message.State.WaitingDownloadAuthorization) }, onGrantAuthorization = { channel.send(Message.DownloadGranted) }) diff --git a/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/UpdateManager.kt b/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/UpdateManager.kt index a7b248a..3ee2187 100644 --- a/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/UpdateManager.kt +++ b/src/main/kotlin/org/eclipse/hara/ddiclient/api/actors/UpdateManager.kt @@ -103,14 +103,13 @@ private constructor(scope: ActorScope) : AbstractActor(scope) { return "Start updating the device" } - private suspend fun attemptUpdateDevice(state: State): String { + private fun attemptUpdateDevice(state: State): String { become(waitingUpdateAuthorization(state)) waitingAuthJob = launch { softRequest.onAuthorizationReceive( onWaitForAuthorization = { notificationManager.send( - MessageListener.Message.State.WaitingUpdateAuthorization( - state.isUpdateForced)) + MessageListener.Message.State.WaitingUpdateAuthorization) }, onGrantAuthorization = { channel.send(Message.UpdateGranted) })