diff --git a/app/src/main/java/gallery/memories/mapper/Response.kt b/app/src/main/java/gallery/memories/mapper/Response.kt new file mode 100644 index 00000000..7ae3695b --- /dev/null +++ b/app/src/main/java/gallery/memories/mapper/Response.kt @@ -0,0 +1,11 @@ +package gallery.memories.mapper + +import org.json.JSONObject + +class Response { + companion object { + val OK get(): JSONObject { + return JSONObject().put("message", "ok") + } + } +} \ No newline at end of file diff --git a/app/src/main/java/gallery/memories/service/DbService.kt b/app/src/main/java/gallery/memories/service/DbService.kt index 5b5d800d..099b4a24 100644 --- a/app/src/main/java/gallery/memories/service/DbService.kt +++ b/app/src/main/java/gallery/memories/service/DbService.kt @@ -9,9 +9,9 @@ import gallery.memories.mapper.Day import gallery.memories.mapper.Photo import gallery.memories.mapper.SystemImage -class DbService(val context: Context) : SQLiteOpenHelper(context, "memories", null, 42) { +class DbService(val context: Context) : SQLiteOpenHelper(context, "memories", null, 45) { companion object { - val MEMORIES = "images" + val MEMORIES = "memories" } override fun onCreate(db: SQLiteDatabase) { diff --git a/app/src/main/java/gallery/memories/service/TimelineQuery.kt b/app/src/main/java/gallery/memories/service/TimelineQuery.kt index c3c1cdfa..9afb4bb6 100644 --- a/app/src/main/java/gallery/memories/service/TimelineQuery.kt +++ b/app/src/main/java/gallery/memories/service/TimelineQuery.kt @@ -16,6 +16,7 @@ import androidx.media3.common.util.UnstableApi import gallery.memories.MainActivity import gallery.memories.R import gallery.memories.mapper.Fields +import gallery.memories.mapper.Response import gallery.memories.mapper.SystemImage import org.json.JSONArray import org.json.JSONException @@ -39,12 +40,6 @@ import java.util.concurrent.CountDownLatch var videoObserver: ContentObserver? = null var refreshPending: Boolean = false - companion object { - val okResponse get(): JSONObject { - return JSONObject().put("message", "ok") - } - } - init { // Register intent launcher for callback deleteIntentLauncher = mCtx.registerForActivityResult(ActivityResultContracts.StartIntentSenderForResult()) { result: ActivityResult? -> @@ -178,12 +173,12 @@ import java.util.concurrent.CountDownLatch try { // Get list of file IDs val photos = mDbService.getPhotosByAUIDs(auids) - if (photos.isEmpty()) return okResponse + if (photos.isEmpty()) return Response.OK val fileIds = photos.map { it.localId } // List of URIs val uris = SystemImage.getByIds(mCtx, fileIds).map { it.uri } - if (uris.isEmpty()) return okResponse + if (uris.isEmpty()) return Response.OK // Delete file with media store if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { @@ -216,7 +211,7 @@ import java.util.concurrent.CountDownLatch synchronized(this) { deleting = false } } - return okResponse + return Response.OK } private fun syncDb(startTime: Long): Int {