Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
xx Messenger Android
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
android
xx Messenger Android
Commits
7b8dcaea
Commit
7b8dcaea
authored
Dec 2, 2022
by
Kamal Bramwell
Browse files
Options
Downloads
Patches
Plain Diff
Create CrustBackupData, a BackupSnapshot implementation
parent
749372bd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/io/xxlabs/messenger/backup/cloud/crust/Crust.kt
+14
-1
14 additions, 1 deletion
...main/java/io/xxlabs/messenger/backup/cloud/crust/Crust.kt
with
14 additions
and
1 deletion
app/src/main/java/io/xxlabs/messenger/backup/cloud/crust/Crust.kt
+
14
−
1
View file @
7b8dcaea
...
...
@@ -7,6 +7,7 @@ import io.xxlabs.messenger.backup.cloud.CloudStorage
import
io.xxlabs.messenger.backup.data.backup.BackupPreferencesRepository
import
io.xxlabs.messenger.backup.data.restore.RestoreEnvironment
import
io.xxlabs.messenger.backup.model.BackupLocation
import
io.xxlabs.messenger.backup.model.BackupSnapshot
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.launch
import
kotlinx.coroutines.withContext
...
...
@@ -49,8 +50,10 @@ class Crust private constructor(
}
private
suspend
fun
fetchData
()
{
cachedBackupData
=
crustApi
.
recoverBackup
(
""
).
getOrNull
()
?.
let
{
cachedBackupData
=
crustApi
.
recoverBackup
(
preferences
.
name
).
getOrNull
()
?.
let
{
AccountArchive
(
it
)
}
?.
also
{
updateLastBackup
(
CrustBackupData
.
from
(
it
))
}
}
...
...
@@ -90,3 +93,13 @@ class Crust private constructor(
):
Crust
=
instance
?:
Crust
(
backupService
,
preferences
,
crustApi
)
}
}
private
class
CrustBackupData
(
override
val
sizeBytes
:
Long
,
override
val
date
:
Long
=
System
.
currentTimeMillis
()
)
:
BackupSnapshot
{
companion
object
Factory
{
fun
from
(
backupData
:
AccountArchive
)
=
CrustBackupData
(
backupData
.
data
.
size
.
toLong
())
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment