diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-04 20:06:54 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-04 20:06:54 +0100 |
| commit | d06f64a75c78991da0b74319c83d794117a8126c (patch) | |
| tree | 0fd7581c6b7a8bd7d4011314a3ba33b27d3afd61 | |
| parent | fe082f091d383bac06eccd3357c8f9c8fb4b00f3 (diff) | |
| download | HardenedPass-d06f64a75c78991da0b74319c83d794117a8126c.tar.gz HardenedPass-d06f64a75c78991da0b74319c83d794117a8126c.zip | |
feat(app): show a snackbar after a successful git operation
Pull to sync and sync, pull and push from the list's menu showed nothing on
success. They now show "<operation>: done", as hard reset and garbage
collection do in the git settings.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | TODO.md | 2 | ||||
| -rw-r--r-- | app/src/main/java/app/passwordstore/ui/list/ListDestination.kt | 8 | ||||
| -rw-r--r-- | app/src/main/java/app/passwordstore/ui/list/ListScreen.kt | 2 | ||||
| -rw-r--r-- | app/src/main/java/app/passwordstore/ui/main/MainActivity.kt | 3 |
4 files changed, 9 insertions, 6 deletions
@@ -6,8 +6,6 @@ Open work after 0.2.0. Remove an item in the commit that finishes it. - Icon overhaul: the launcher icon is still Password Store's. Design a HardenedPass icon (adaptive icon, monochrome layer for themed icons) and replace it everywhere it appears. -- Feedback after git operations: pull to sync, pull, push and sync from the menu show nothing - on success. Show a short "done" snackbar, as hard reset and garbage collection do. - Git dialogs to Compose: the git operations' View dialogs (`BaseGitActivity`, `GitOperation`, `CredentialFinder`, `BreakOutOfDetached`, `StoreActions`) and the `snackbar` helper still use Material Components (Views). Moving them lets that dependency go. diff --git a/app/src/main/java/app/passwordstore/ui/list/ListDestination.kt b/app/src/main/java/app/passwordstore/ui/list/ListDestination.kt index a9228484..54a7e66c 100644 --- a/app/src/main/java/app/passwordstore/ui/list/ListDestination.kt +++ b/app/src/main/java/app/passwordstore/ui/list/ListDestination.kt @@ -38,9 +38,11 @@ import app.passwordstore.ui.git.base.BaseGitActivity.GitOp import app.passwordstore.ui.main.MainActivity import app.passwordstore.util.extensions.isInsideRepository import app.passwordstore.util.extensions.sharedPrefs +import app.passwordstore.util.extensions.snackbar import app.passwordstore.util.settings.AuthMode import app.passwordstore.util.settings.PreferenceKeys import app.passwordstore.util.viewmodel.SearchableRepositoryViewModel +import com.github.michaelbull.result.onSuccess import java.io.File import kotlinx.collections.immutable.toImmutableSet import kotlinx.coroutines.launch @@ -115,7 +117,11 @@ fun ListDestination( fun runGit(op: GitOp) { refreshing = true activity.lifecycleScope.launch { - activity.runGit(op) + activity.runGit(op).onSuccess { + activity.snackbar( + message = activity.getString(R.string.git_tool_done, activity.getString(op.label)) + ) + } refreshing = false refresh() } diff --git a/app/src/main/java/app/passwordstore/ui/list/ListScreen.kt b/app/src/main/java/app/passwordstore/ui/list/ListScreen.kt index 720cfc0a..1b359d5b 100644 --- a/app/src/main/java/app/passwordstore/ui/list/ListScreen.kt +++ b/app/src/main/java/app/passwordstore/ui/list/ListScreen.kt @@ -331,7 +331,7 @@ private fun ActionIcon(@DrawableRes icon: Int, @StringRes label: Int, onClick: ( } } -private val GitOp.label: Int +internal val GitOp.label: Int get() = when (this) { GitOp.SYNC -> R.string.git_sync diff --git a/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt b/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt index ce5fb1df..462bdb18 100644 --- a/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt +++ b/app/src/main/java/app/passwordstore/ui/main/MainActivity.kt @@ -228,9 +228,8 @@ class MainActivity : BaseGitActivity() { } /** Runs [op]; failures show the usual git error dialog. */ - suspend fun runGit(op: GitOp) { + suspend fun runGit(op: GitOp): Result<Unit, Throwable> = launchGitOperation(op).onFailure { promptOnErrorHandler(it) } - } /** Runs [op] (a hard reset against [branch]) and returns its outcome; the caller reports it. */ suspend fun gitOperation(op: GitOp, branch: String = ""): Result<Unit, Throwable> { |
