Skip to content

Commit

Permalink
dont create date instance for release mode
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Feb 10, 2025
1 parent 5e07003 commit 576ad72
Showing 1 changed file with 22 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class GallerySearchTask(
private val storageManager: FileDataStorageManager
) {
private val photoFragmentWeakReference = WeakReference(photoFragment)
private val tag = "GallerySearchTask"

@Suppress("DEPRECATION", "MagicNumber")
fun execute(endDate: Long, limit: Int) {
Expand All @@ -54,25 +55,17 @@ class GallerySearchTask(
this
}

val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)

Log_OC.d(
this,
(
"Start gallery search since " +
dateFormat.format(Date(endDate * 1000L)) +
" with limit: " +
limit
)
)
logGallerySearch(endDate, limit)

val result = searchRemoteOperation.execute(user, context)

if (!result.isSuccess) {
Log_OC.d(tag, "GallerySearchTask failed")
return@launch
}

if (result.resultData !is ArrayList<RemoteFile>) {
Log_OC.d(tag, "GallerySearchTask data type is not ArrayList<RemoteFile>")
return@launch
}

Expand All @@ -87,6 +80,24 @@ class GallerySearchTask(
}
}

private fun logGallerySearch(endDate: Long, limit: Int) {
if (!BuildConfig.DEBUG) {
return
}

val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US)

Log_OC.d(
this,
(
"Start gallery search since " +
dateFormat.format(Date(endDate * 1000L)) +
" with limit: " +
limit
)
)
}

@Suppress("MagicNumber")
private fun findLastTimestamp(remoteFiles: ArrayList<RemoteFile>): Long {
val lastPosition = remoteFiles.size - 1
Expand Down

0 comments on commit 576ad72

Please sign in to comment.