aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
diff options
context:
space:
mode:
authorHarsh Shandilya <msfjarvis@gmail.com>2019-10-02 18:04:18 +0530
committerGitHub <noreply@github.com>2019-10-02 18:04:18 +0530
commitf1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e (patch)
tree2afb98c921714ccefcd22f35a7340584d1bfba53 /app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
parent9a1a54a6fcfa6fd6cf142f2af9804375255d14cf (diff)
downloadHardenedPass-f1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e.tar.gz
HardenedPass-f1f59dc1ed26c2351dc31e55902ff8e4b5a6ed0e.zip
Add Spotless to regulate codestyle (#550)
* Add Spotless to regulate codestyle * treewide: Run spotless * Add spotlessCheck to CI test Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
Diffstat (limited to 'app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt44
1 files changed, 23 insertions, 21 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
index 4ab90e96..e155bdd3 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.kt
@@ -29,7 +29,7 @@ import java.io.File
/**
* Creates a new git operation
*
- * @param fileDir the git working tree directory
+ * @param fileDir the git working tree directory
* @param callingActivity the calling activity
*/
abstract class GitOperation(fileDir: File, internal val callingActivity: Activity) {
@@ -54,8 +54,8 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
/**
* Sets the authentication using ssh-key scheme
*
- * @param sshKey the ssh-key file
- * @param username the username
+ * @param sshKey the ssh-key file
+ * @param username the username
* @param passphrase the passphrase
* @return the current object
*/
@@ -87,14 +87,16 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
* Executes the GitCommand in an async task after creating the authentication
*
* @param connectionMode the server-connection mode
- * @param username the username
- * @param sshKey the ssh-key file to use in ssh-key connection mode
- * @param identity the api identity to use for auth in OpenKeychain connection mode
+ * @param username the username
+ * @param sshKey the ssh-key file to use in ssh-key connection mode
+ * @param identity the api identity to use for auth in OpenKeychain connection mode
*/
- fun executeAfterAuthentication(connectionMode: String,
- username: String,
- sshKey: File?,
- identity: SshApiSessionFactory.ApiIdentity?) {
+ fun executeAfterAuthentication(
+ connectionMode: String,
+ username: String,
+ sshKey: File?,
+ identity: SshApiSessionFactory.ApiIdentity?
+ ) {
executeAfterAuthentication(connectionMode, username, sshKey, identity, false)
}
@@ -102,16 +104,18 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
* Executes the GitCommand in an async task after creating the authentication
*
* @param connectionMode the server-connection mode
- * @param username the username
- * @param sshKey the ssh-key file to use in ssh-key connection mode
- * @param identity the api identity to use for auth in OpenKeychain connection mode
- * @param showError show the passphrase edit text in red
+ * @param username the username
+ * @param sshKey the ssh-key file to use in ssh-key connection mode
+ * @param identity the api identity to use for auth in OpenKeychain connection mode
+ * @param showError show the passphrase edit text in red
*/
- private fun executeAfterAuthentication(connectionMode: String,
- username: String,
- sshKey: File?,
- identity: SshApiSessionFactory.ApiIdentity?,
- showError: Boolean) {
+ private fun executeAfterAuthentication(
+ connectionMode: String,
+ username: String,
+ sshKey: File?,
+ identity: SshApiSessionFactory.ApiIdentity?,
+ showError: Boolean
+ ) {
if (connectionMode.equals("ssh-key", ignoreCase = true)) {
if (sshKey == null || !sshKey.exists()) {
MaterialAlertDialogBuilder(callingActivity)
@@ -199,7 +203,6 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
.setPositiveButton("Ok") { _, _ -> callingActivity.finish() }
.show()
}
-
}
} else if (connectionMode.equals("OpenKeychain", ignoreCase = true)) {
setAuthentication(username, identity).execute()
@@ -216,7 +219,6 @@ abstract class GitOperation(fileDir: File, internal val callingActivity: Activit
.setPositiveButton(callingActivity.resources.getString(R.string.dialog_ok)) { _, _ ->
// authenticate using the user/pwd and then execute the command
setAuthentication(username, password.text.toString()).execute()
-
}
.setNegativeButton(callingActivity.resources.getString(R.string.dialog_cancel)) { _, _ ->
callingActivity.finish()