From dac701bb3572f27593d445b580cc833204bd7439 Mon Sep 17 00:00:00 2001 From: KaiserBh Date: Tue, 14 Nov 2023 00:30:22 +1100 Subject: [PATCH] refactor: use relativeTimeSpanString Instead of manually formatting, use the relativeTimeSpanString function. --- .../more/settings/screen/SettingsDataScreen.kt | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt index 307586055..987c7f509 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsDataScreen.kt @@ -493,11 +493,6 @@ private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference. val context = LocalContext.current val syncIntervalPref = syncPreferences.syncInterval() val lastSync by syncPreferences.syncLastSync().collectAsState() - val formattedLastSync = DateUtils.getRelativeTimeSpanString( - lastSync.toEpochMilli(), - System.currentTimeMillis(), - DateUtils.MINUTE_IN_MILLIS, - ) return Preference.PreferenceGroup( title = stringResource(R.string.pref_sync_service_category), @@ -521,7 +516,7 @@ private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference. true }, ), - Preference.PreferenceItem.InfoPreference(stringResource(R.string.last_synchronization, formattedLastSync)), + Preference.PreferenceItem.InfoPreference(stringResource(R.string.last_synchronization, relativeTimeSpanString(lastSync.toEpochMilli()))), ), ) }