From edc43734a8df2424c2beae645c6eefe4553e2471 Mon Sep 17 00:00:00 2001 From: Jonas Lochmann Date: Mon, 20 Dec 2021 01:00:00 +0100 Subject: [PATCH] Never decrement the lastUsage of a session duration limitation --- .../timelimit/android/sync/actions/dispatch/AppLogicAction.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/timelimit/android/sync/actions/dispatch/AppLogicAction.kt b/app/src/main/java/io/timelimit/android/sync/actions/dispatch/AppLogicAction.kt index 8d33d1c..fcf1637 100644 --- a/app/src/main/java/io/timelimit/android/sync/actions/dispatch/AppLogicAction.kt +++ b/app/src/main/java/io/timelimit/android/sync/actions/dispatch/AppLogicAction.kt @@ -1,5 +1,5 @@ /* - * TimeLimit Copyright 2019 - 2020 Jonas Lochmann + * TimeLimit Copyright 2019 - 2021 Jonas Lochmann * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,7 +117,7 @@ object LocalDatabaseAppLogicActionDispatcher { } oldItem.copy( - lastUsage = if (hasTrustedTimestamp) action.trustedTimestamp else oldItem.lastUsage, + lastUsage = action.trustedTimestamp.coerceAtLeast(oldItem.lastUsage), lastSessionDuration = if (extendSession) oldItem.lastSessionDuration + item.timeToAdd.toLong() else item.timeToAdd.toLong() ) } else SessionDuration(