mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-15 15:02:49 +01:00
refactor: use relativeTimeSpanString
Instead of manually formatting, use the relativeTimeSpanString function.
This commit is contained in:
parent
67b93bb177
commit
dac701bb35
@ -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()))),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user