Skip to content

Commit

Permalink
Fix trash issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ismartcoding committed Jun 27, 2024
1 parent c509a8b commit f891641
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
16 changes: 11 additions & 5 deletions app/src/main/java/com/ismartcoding/plain/helpers/ImageHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,17 @@ object ImageHelper {
return null
}

val formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd HH:mm:ss")
val localDateTime = LocalDateTime.parse(dateTime, formatter)
val javaInstant = ZonedDateTime.of(localDateTime, ZoneOffset.UTC).toInstant()
try {
val formatter = DateTimeFormatter.ofPattern("yyyy:MM:dd HH:mm:ss")
val localDateTime = LocalDateTime.parse(dateTime, formatter)
val javaInstant = ZonedDateTime.of(localDateTime, ZoneOffset.UTC).toInstant()

return Instant.fromEpochMilliseconds(javaInstant.toEpochMilli())
} catch (ex: Exception) {
LogCat.e(ex.toString())
}

return Instant.fromEpochMilliseconds(javaInstant.toEpochMilli())
return null
}

fun getExposureProgramText(exposureProgram: Int): String {
Expand Down Expand Up @@ -283,7 +289,7 @@ object ImageHelper {
ExifInterface.FLAG_FLASH_RETURN_LIGHT_DETECTED -> getString(R.string.flash_return_light_detected)
ExifInterface.FLAG_FLASH_MODE_COMPULSORY_FIRING -> getString(R.string.flash_mode_compulsory_firing)
ExifInterface.FLAG_FLASH_MODE_COMPULSORY_SUPPRESSION -> getString(R.string.flash_mode_compulsory_suppression)
ExifInterface.FLAG_FLASH_MODE_AUTO -> getString(R.string.flash_mode_auto)
ExifInterface.FLAG_FLASH_MODE_AUTO -> getString(R.string.flash_mode_auto)
ExifInterface.FLAG_FLASH_NO_FLASH_FUNCTION -> getString(R.string.flash_no_flash_function)
ExifInterface.FLAG_FLASH_RED_EYE_SUPPORTED -> getString(R.string.flash_red_eye_supported)
else -> ""
Expand Down
15 changes: 8 additions & 7 deletions app/src/main/java/com/ismartcoding/plain/web/SXGraphQL.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ import com.ismartcoding.plain.web.loaders.FileInfoLoader
import com.ismartcoding.plain.web.loaders.TagsLoader
import com.ismartcoding.plain.web.models.AIChat
import com.ismartcoding.plain.web.models.AIChatConfig
import com.ismartcoding.plain.web.models.ActionResult
import com.ismartcoding.plain.web.models.App
import com.ismartcoding.plain.web.models.Audio
import com.ismartcoding.plain.web.models.Call
Expand Down Expand Up @@ -1229,7 +1230,7 @@ class SXGraphQL(val schema: Schema) {
}
mutation("deleteMediaItems") {
resolver { type: DataType, query: String ->
var ids: Set<String>
val ids: Set<String>
val context = MainApp.instance
val hasTrashFeature = AppFeatureType.MEDIA_TRASH.has()
when (type) {
Expand All @@ -1251,13 +1252,13 @@ class SXGraphQL(val schema: Schema) {
else -> {
}
}
true
ActionResult(type, query)
}
}
mutation("trashMediaItems") {
resolver { type: DataType, query: String ->
if (!isRPlus()) {
return@resolver query
return@resolver ActionResult(type, query)
}

var ids = setOf<String>()
Expand Down Expand Up @@ -1286,16 +1287,16 @@ class SXGraphQL(val schema: Schema) {
}
}
TagHelper.deleteTagRelationByKeys(ids, type)
query
ActionResult(type, query)
}
}
mutation("restoreMediaItems") {
resolver { type: DataType, query: String ->
if (!isRPlus()) {
return@resolver query
return@resolver ActionResult(type, query)
}

var ids: Set<String>
val ids: Set<String>
val context = MainApp.instance
when (type) {
DataType.AUDIO -> {
Expand All @@ -1316,7 +1317,7 @@ class SXGraphQL(val schema: Schema) {
else -> {
}
}
query
ActionResult(type, query)
}
}
mutation("moveFile") {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.ismartcoding.plain.web.models

import com.ismartcoding.plain.enums.DataType

data class ActionResult(val type: DataType, val query: String)

0 comments on commit f891641

Please sign in to comment.