From a96a457add325b1b3924e641bf5f7b411836afad Mon Sep 17 00:00:00 2001 From: Sneha Datta Date: Sun, 15 Sep 2024 19:07:28 +0530 Subject: [PATCH] Remove fun ensureTimestampIsInMilliseconds in TextViewBindingAdapters --- .../app/databinding/TextViewBindingAdapters.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/databinding/TextViewBindingAdapters.java b/app/src/main/java/org/oppia/android/app/databinding/TextViewBindingAdapters.java index e4584d7cad1..284e1332b2d 100644 --- a/app/src/main/java/org/oppia/android/app/databinding/TextViewBindingAdapters.java +++ b/app/src/main/java/org/oppia/android/app/databinding/TextViewBindingAdapters.java @@ -68,15 +68,14 @@ public static void setDrawableEndCompat( } private static String getTimeAgo(View view, long lastVisitedTimestamp) { - long timeStampMillis = ensureTimestampIsInMilliseconds(lastVisitedTimestamp); long currentTimeMillis = getOppiaClock(view).getCurrentTimeMs(); AppLanguageResourceHandler resourceHandler = getResourceHandler(view); - if (timeStampMillis > currentTimeMillis || timeStampMillis <= 0) { + if (lastVisitedTimestamp > currentTimeMillis || lastVisitedTimestamp <= 0) { return resourceHandler.getStringInLocale(R.string.last_logged_in_recently); } - long timeDifferenceMillis = currentTimeMillis - timeStampMillis; + long timeDifferenceMillis = currentTimeMillis - lastVisitedTimestamp; if (timeDifferenceMillis < (int) TimeUnit.MINUTES.toMillis(1)) { return resourceHandler.getStringInLocale(R.string.just_now); @@ -112,15 +111,6 @@ private static String getPluralString( ); } - private static long ensureTimestampIsInMilliseconds(long lastVisitedTimestamp) { - // TODO(#3842): Investigate & remove this check. - if (lastVisitedTimestamp < 1000000000000L) { - // If timestamp is given in seconds, convert that to milliseconds. - return TimeUnit.SECONDS.toMillis(lastVisitedTimestamp); - } - return lastVisitedTimestamp; - } - private static AppLanguageResourceHandler getResourceHandler(View view) { AppLanguageActivityInjectorProvider provider = (AppLanguageActivityInjectorProvider) getAttachedActivity(view);