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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mobile
android
xx Messenger Android
Commits
fa1a0629
Commit
fa1a0629
authored
2 years ago
by
Kamal Bramwell
Browse files
Options
Downloads
Patches
Plain Diff
Wrap return values in Result<>
parent
1028aab3
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/CrustDataSource.kt
+10
-5
10 additions, 5 deletions
...io/xxlabs/messenger/backup/cloud/crust/CrustDataSource.kt
with
10 additions
and
5 deletions
app/src/main/java/io/xxlabs/messenger/backup/cloud/crust/CrustDataSource.kt
+
10
−
5
View file @
fa1a0629
...
...
@@ -4,7 +4,7 @@ import bindings.Bindings
import
bindings.UserDiscovery
interface
CrustDataSource
{
suspend
fun
uploadBackup
(
path
:
String
):
ByteArray
suspend
fun
uploadBackup
(
path
:
String
):
Result
<
ByteArray
>
suspend
fun
recoverBackup
(
username
:
String
):
Result
<
ByteArray
>
}
...
...
@@ -14,10 +14,15 @@ class BindingsCrustMediator(
)
:
CrustDataSource
{
override
suspend
fun
uploadBackup
(
path
:
String
):
ByteArray
{
return
udManager
?.
let
{
Bindings
.
uploadBackup
(
path
,
udManager
,
receptionRsaPrivateKey
)
}
?:
byteArrayOf
()
override
suspend
fun
uploadBackup
(
path
:
String
):
Result
<
ByteArray
>
{
return
try
{
udManager
?.
let
{
val
uploadSuccessReport
=
Bindings
.
uploadBackup
(
path
,
udManager
,
receptionRsaPrivateKey
)
Result
.
success
(
uploadSuccessReport
)
}
?:
Result
.
failure
(
Exception
(
"Failed to run backup. UserDiscovery not initialized."
))
}
catch
(
e
:
Exception
)
{
Result
.
failure
(
e
)
}
}
override
suspend
fun
recoverBackup
(
username
:
String
):
Result
<
ByteArray
>
{
...
...
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