This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 712
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfixes: GitHub auto-backup & other reported bugs (#2521)
* Update the GitHub Backups tutorial video to the one by KLAUS * Fix an UI bug in the "GitHub Backups" card in Settings * Remove the "Request a feature" in GitHub feature * Make the Activity edge-to-edge * Fix the ItemStatisticScreen * Migrate GitHub PAT from `EncryptedSharedPrefs` to regular `DataStore` * Refactor and make the backups every 12 hours * Bump version to "4.4.1" (141) * Fix the PR template
- Loading branch information
1 parent
99afd8e
commit e8bf5a6
Showing
26 changed files
with
193 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ class GitHubClient @Inject constructor( | |
credentials: GitHubCredentials, | ||
path: String, | ||
content: String, | ||
isAutomatic: Boolean = false, | ||
commitMsg: String, | ||
): Either<String, Unit> = either { | ||
val repoUrl = repoUrl(credentials, path) | ||
val sha = getExistingFile(credentials, repoUrl)?.sha | ||
|
@@ -61,25 +61,25 @@ class GitHubClient @Inject constructor( | |
|
||
val requestBody = GitHubFileContent( | ||
content = encodedContent, | ||
message = if (isAutomatic) { | ||
"Automatic Ivy Wallet data backup" | ||
} else { | ||
"Manual Ivy Wallet data backup" | ||
}, | ||
message = commitMsg, | ||
committer = Committer( | ||
name = "Ivy Wallet", | ||
email = "[email protected]" | ||
), | ||
sha = sha, | ||
) | ||
|
||
val response = httpClient.get().put(repoUrl) { | ||
headers { | ||
githubToken(credentials) | ||
contentType(ContentType.Application.Json) | ||
acceptsUtf16() | ||
val response = try { | ||
httpClient.get().put(repoUrl) { | ||
headers { | ||
githubToken(credentials) | ||
contentType(ContentType.Application.Json) | ||
acceptsUtf16() | ||
} | ||
setBody(requestBody) | ||
} | ||
setBody(requestBody) | ||
} catch (e: Exception) { | ||
return Either.Left("HttpException: ${e.message}") | ||
} | ||
ensure(response.status.isSuccess()) { | ||
when (response.status.value) { | ||
|
@@ -88,7 +88,6 @@ class GitHubClient @Inject constructor( | |
else -> "Unsuccessful response: '${response.status}' $response." | ||
} | ||
} | ||
return Either.Right(Unit) | ||
} | ||
|
||
suspend fun readFileContent( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 0 additions & 29 deletions
29
app/src/main/java/com/ivy/wallet/io/network/service/GithubService.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.ivy.wallet.migrations | ||
|
||
interface Migration { | ||
val key: String | ||
|
||
suspend fun migrate() | ||
} |
Oops, something went wrong.