Fixed a bug where using only folders would cause album to self-delete

This commit is contained in:
Anthony La committed 2025-04-05 01:07:21 -07:00
1 parent 1d87208dca
commit 9baacea029
2 files changed
+12 -6

No files matched your search

@@ -217,10 +217,11 @@ class HomeWallpaperService: Service() {
settings.setHome && settings.setLock && scheduleSeparately -> {
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
if (wallpaper == null) {
val newWallpapers = if (settings.shuffle) homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.wallpapers.map { it.wallpaperUri }
val newWallpapers = if (settings.shuffle) homeAlbum.totalWallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.totalWallpapers.map { it.wallpaperUri }
wallpaper = newWallpapers.firstOrNull()
if (wallpaper == null) {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(homeAlbum.album)
onDestroy()
return
@@ -308,10 +309,11 @@ class HomeWallpaperService: Service() {
settings.setHome && settings.setLock && !scheduleSeparately -> {
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
if (wallpaper == null) {
val newWallpapers = if (settings.shuffle) homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.wallpapers.map { it.wallpaperUri }
val newWallpapers = if (settings.shuffle) homeAlbum.totalWallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.totalWallpapers.map { it.wallpaperUri }
wallpaper = newWallpapers.firstOrNull()
if (wallpaper == null) {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(homeAlbum.album)
onDestroy()
return
@@ -397,10 +399,11 @@ class HomeWallpaperService: Service() {
settings.setHome -> {
var wallpaper = homeAlbum.album.homeWallpapersInQueue.firstOrNull()
if (wallpaper == null) {
val newWallpapers = if (settings.shuffle) homeAlbum.wallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.wallpapers.map { it.wallpaperUri }
val newWallpapers = if (settings.shuffle) homeAlbum.totalWallpapers.map { it.wallpaperUri }.shuffled()
else homeAlbum.totalWallpapers.map { it.wallpaperUri }
wallpaper = newWallpapers.firstOrNull()
if (wallpaper == null) {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(homeAlbum.album)
onDestroy()
return
@@ -686,6 +689,7 @@ class HomeWallpaperService: Service() {
)
}
else {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(album.album)
}
}
@@ -208,6 +208,7 @@ class LockWallpaperService: Service() {
else lockAlbum.totalWallpapers.map { it.wallpaperUri }
wallpaper = newWallpapers.firstOrNull()
if (wallpaper == null) {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(lockAlbum.album)
onDestroy()
return
@@ -300,6 +301,7 @@ class LockWallpaperService: Service() {
else lockAlbum.totalWallpapers.map { it.wallpaperUri }
wallpaper = newWallpapers.firstOrNull()
if (wallpaper == null) {
Log.d("PaperizeWallpaperChanger", "No wallpaper found")
albumRepository.cascadeDeleteAlbum(lockAlbum.album)
onDestroy()
return