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