Refactor
parent
a612b02dfa
commit
0eee69bacb
|
@ -5,6 +5,7 @@ import android.net.Uri
|
|||
import android.util.Base64
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import gallery.memories.MainActivity
|
||||
import gallery.memories.R
|
||||
import io.github.g00fy2.versioncompare.Version
|
||||
|
@ -16,6 +17,7 @@ import okhttp3.Response
|
|||
import org.json.JSONObject
|
||||
import java.net.SocketTimeoutException
|
||||
|
||||
@UnstableApi
|
||||
class AccountService(private val mCtx: MainActivity) {
|
||||
companion object {
|
||||
val TAG = AccountService::class.java.simpleName
|
||||
|
@ -140,9 +142,10 @@ class AccountService(private val mCtx: MainActivity) {
|
|||
}
|
||||
|
||||
fun checkCredentialsAndVersion() {
|
||||
memoriesUrl.let { base ->
|
||||
if (memoriesUrl == null) return
|
||||
|
||||
val request = Request.Builder()
|
||||
.url(base + "api/describe")
|
||||
.url(memoriesUrl + "api/describe")
|
||||
.get()
|
||||
.header("Authorization", authHeader ?: "")
|
||||
.build()
|
||||
|
@ -188,7 +191,6 @@ class AccountService(private val mCtx: MainActivity) {
|
|||
return toast(mCtx.getString(R.string.err_no_ver))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun loggedOut() {
|
||||
toast(mCtx.getString(R.string.err_logged_out))
|
||||
|
|
|
@ -26,7 +26,8 @@ import java.io.IOException
|
|||
import java.time.Instant
|
||||
import java.util.concurrent.CountDownLatch
|
||||
|
||||
@UnstableApi class TimelineQuery(private val mCtx: MainActivity) {
|
||||
@UnstableApi
|
||||
class TimelineQuery(private val mCtx: MainActivity) {
|
||||
private val TAG = TimelineQuery::class.java.simpleName
|
||||
private val mConfigService = ConfigService(mCtx)
|
||||
|
||||
|
@ -228,7 +229,7 @@ import java.util.concurrent.CountDownLatch
|
|||
}
|
||||
|
||||
// Delete from database
|
||||
mPhotoDao.deleteFileIds(sysImgs.map { it.fileId})
|
||||
mPhotoDao.deleteFileIds(sysImgs.map { it.fileId })
|
||||
} finally {
|
||||
synchronized(this) { deleting = false }
|
||||
}
|
||||
|
@ -254,13 +255,25 @@ import java.util.concurrent.CountDownLatch
|
|||
var updates = 0
|
||||
|
||||
// Iterate all images from system store
|
||||
for (image in SystemImage.cursor(mCtx, SystemImage.IMAGE_URI, selection, selectionArgs, null)) {
|
||||
for (image in SystemImage.cursor(
|
||||
mCtx,
|
||||
SystemImage.IMAGE_URI,
|
||||
selection,
|
||||
selectionArgs,
|
||||
null
|
||||
)) {
|
||||
insertItemDb(image)
|
||||
updates++
|
||||
}
|
||||
|
||||
// Iterate all videos from system store
|
||||
for (video in SystemImage.cursor(mCtx, SystemImage.VIDEO_URI, selection, selectionArgs, null)) {
|
||||
for (video in SystemImage.cursor(
|
||||
mCtx,
|
||||
SystemImage.VIDEO_URI,
|
||||
selection,
|
||||
selectionArgs,
|
||||
null
|
||||
)) {
|
||||
insertItemDb(video)
|
||||
updates++
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue