You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log.d(TAG, "getTrialState: Returning NOT_YET_STARTED_AWAITING_INTERNET (no end time, awaiting internet, not confirmed expired)")
105
+
// Fall 1: Die Test-Endzeit wurde noch nicht per Internetzeit festgelegt.
106
+
if (trialUtcEndTime ==null) {
107
+
returnif (isAwaitingFirstInternetTime) {
108
+
Log.d(TAG, "getTrialState: No trialUtcEndTime set, and awaiting first internet time. Returning NOT_YET_STARTED_AWAITING_INTERNET.")
109
109
TrialState.NOT_YET_STARTED_AWAITING_INTERNET
110
110
} else {
111
-
//This path means either trial has started (endTime exists) or it's not awaiting first internet,
112
-
//but we don't have current time to check. Or, endTime is null but we are not awaiting (inconsistent state).
113
-
Log.d(TAG, "getTrialState: Returning INTERNET_UNAVAILABLE_CANNOT_VERIFY (end time might exist or not awaiting, but no current time, not confirmed expired)")
111
+
//Inkonsistenter Zustand: Sollte nicht passieren, wenn startTrialIfNecessaryWithInternetTime korrekt funktioniert.
112
+
//Bedeutet, KEY_TRIAL_AWAITING_FIRST_INTERNET_TIME ist false, aber es gibt keine Endzeit.
113
+
Log.e(TAG, "getTrialState: Inconsistent state - trialUtcEndTime is null, but KEY_TRIAL_AWAITING_FIRST_INTERNET_TIME is false. Returning INTERNET_UNAVAILABLE_CANNOT_VERIFY.")
114
114
TrialState.INTERNET_UNAVAILABLE_CANNOT_VERIFY
115
115
}
116
116
}
117
117
118
-
// currentUtcTimeMs is NOT null from this point onwards
119
-
Log.d(TAG, "getTrialState: currentUtcTimeMs is $currentUtcTimeMs. Evaluating state based on time.")
// This is an inconsistent state: trial supposedly started (not awaiting), but no end time.
130
-
// This might happen if saveTrialUtcEndTime failed or was cleared erroneously.
131
-
Log.e(TAG, "CRITICAL INCONSISTENCY: Trial marked as started (not awaiting internet), but no trial end time found. Check save/load logic. Returning INTERNET_UNAVAILABLE_CANNOT_VERIFY.")
132
-
// Cannot confirm active or expired without an end time.
Log.d(TAG, "getTrialState: Trial ACTIVE (confirmed by available internet time). Returning ACTIVE_INTERNET_TIME_CONFIRMED.")
128
+
returnTrialState.ACTIVE_INTERNET_TIME_CONFIRMED
146
129
}
147
-
else-> {
148
-
// Fallback for any unhandled scenarios, though ideally all paths should be covered.
149
-
Log.e(TAG, "Unhandled case in getTrialState. isAwaiting: $isAwaitingFirstInternetTime, endTime: $trialUtcEndTime, currentTime: $currentUtcTimeMs. Defaulting to NOT_YET_STARTED_AWAITING_INTERNET.")
150
-
TrialState.NOT_YET_STARTED_AWAITING_INTERNET
130
+
} else {
131
+
// Fall 3: Internetzeit ist NICHT verfügbar. Prüfung auf Ablauf nur mit lokaler UTC-Zeit.
132
+
if (currentLocalUtcTimeMs >= trialUtcEndTime) {
133
+
Log.i(TAG, "getTrialState: Trial EXPIRED (based on local UTC time, no internet time). LocalUTCTime: $currentLocalUtcTimeMs, EndTime: $trialUtcEndTime. Setting KEY_TRIAL_CONFIRMED_EXPIRED=true.")
0 commit comments