Skip to content

Commit

Permalink
Do not use random endpoint for recent and similar to prevent duplicat…
Browse files Browse the repository at this point in the history
…e assets

Fix dialogtitle
  • Loading branch information
giejay committed Dec 21, 2024
1 parent 7e8f711 commit 38b68d3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ android {
applicationId "nl.giejay.android.tv.immich"
minSdkVersion 24
targetSdkVersion 35
versionCode 68
versionName "2.1.1"
versionCode 69
versionName "2.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testOptions.unitTests.includeAndroidResources = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ class ApiClient(private val config: ApiClientConfig) {

suspend fun recentAssets(page: Int, pageCount: Int, includeVideos: Boolean): Either<String, List<Asset>> {
val now = LocalDateTime.now()
return apiClient!!.listAssets(page, pageCount, true, "desc",
includeVideos = includeVideos, fromDate = now.minusMonths(PreferenceManager.recentAssetsMonthsBack().toLong()), endDate = now)
return apiClient!!.listAssets(page, pageCount, false, "desc",
includeVideos = includeVideos, fromDate = now.minusMonths(PreferenceManager.recentAssetsMonthsBack().toLong()), endDate = now).map { it.shuffled() }
}

suspend fun similarAssets(page: Int, pageCount: Int,includeVideos: Boolean): Either<String, List<Asset>> {
val now = LocalDateTime.now()
val map: List<Either<String, List<Asset>>> = (0 until PreferenceManager.similarAssetsYearsBack()).toList().map {
apiClient!!.listAssets(page,
pageCount,
true,
false,
"desc",
includeVideos = includeVideos,
fromDate = now.minusDays((PreferenceManager.similarAssetsPeriodDays() / 2).toLong()).minusYears(it.toLong()),
Expand Down
6 changes: 2 additions & 4 deletions app/src/main/res/xml/preferences_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,15 @@
app:useSimpleSummaryProvider="true"
android:entries="@array/similar_assets_period_days"
android:defaultValue="30"
android:entryValues="@array/similar_assets_period_days"
android:dialogTitle="Sort photos by"/>
android:entryValues="@array/similar_assets_period_days"/>

<ListPreference
android:key="recent_assets_months_back"
android:title="Recent photos months back"
android:entries="@array/recent_assets_months_back"
android:defaultValue="5"
app:useSimpleSummaryProvider="true"
android:entryValues="@array/recent_assets_months_back"
android:dialogTitle="Sort photos by"/>
android:entryValues="@array/recent_assets_months_back"/>

</PreferenceCategory>

Expand Down

0 comments on commit 38b68d3

Please sign in to comment.