aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/com
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2020-11-01 22:51:02 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2020-11-01 22:51:02 +0530
commitcff8d41c91a73371f7eb65b08730fa548ce510a4 (patch)
treec35846b7c5b89f1e16b976993f9b2ca54d697482 /app/src/main/java/com
parent18b6e93bb5b3fb95ce1076ecc232db109523e635 (diff)
build: compile against SDK 30 and resolve deprecations
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app/src/main/java/com')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt6
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitConfigActivity.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt3
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt7
5 files changed, 15 insertions, 7 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt b/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt
index 268698e7..3ad6346d 100644
--- a/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt
@@ -7,6 +7,7 @@ package com.zeapo.pwdstore
import android.content.Intent
import android.os.Bundle
import android.os.Handler
+import android.os.Looper
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.edit
import com.zeapo.pwdstore.crypto.DecryptActivity
@@ -51,7 +52,7 @@ class LaunchActivity : AppCompatActivity() {
Intent(this, PasswordStore::class.java)
startActivity(intentToStart)
- Handler().postDelayed({ finish() }, if (noAuth) 0L else 500L)
+ Handler(Looper.getMainLooper()).postDelayed({ finish() }, if (noAuth) 0L else 500L)
}
companion object {
diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt b/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
index 6b6c2032..17c18998 100644
--- a/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/crypto/BasePgpActivity.kt
@@ -45,12 +45,12 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
/**
* Full path to the repository
*/
- val repoPath: String by lazy(LazyThreadSafetyMode.NONE) { intent.getStringExtra("REPO_PATH") }
+ val repoPath by lazy(LazyThreadSafetyMode.NONE) { intent.getStringExtra("REPO_PATH")!! }
/**
* Full path to the password file being worked on
*/
- val fullPath: String by lazy(LazyThreadSafetyMode.NONE) { intent.getStringExtra("FILE_PATH") }
+ val fullPath by lazy(LazyThreadSafetyMode.NONE) { intent.getStringExtra("FILE_PATH")!! }
/**
* Name of the password file
@@ -186,7 +186,7 @@ open class BasePgpActivity : AppCompatActivity(), OpenPgpServiceConnection.OnBou
*/
fun getUserInteractionRequestIntent(result: Intent): IntentSender {
i { "RESULT_CODE_USER_INTERACTION_REQUIRED" }
- return (result.getParcelableExtra(OpenPgpApi.RESULT_INTENT) as PendingIntent).intentSender
+ return result.getParcelableExtra<PendingIntent>(OpenPgpApi.RESULT_INTENT)!!.intentSender
}
/**
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitConfigActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitConfigActivity.kt
index 752a6b7a..8c6c7d59 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitConfigActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitConfigActivity.kt
@@ -7,6 +7,7 @@ package com.zeapo.pwdstore.git
import android.content.Intent
import android.os.Bundle
import android.os.Handler
+import android.os.Looper
import android.util.Patterns
import android.view.MenuItem
import androidx.core.os.postDelayed
@@ -55,7 +56,7 @@ class GitConfigActivity : BaseGitActivity() {
GitSettings.authorEmail = email
GitSettings.authorName = name
Snackbar.make(binding.root, getString(R.string.git_server_config_save_success), Snackbar.LENGTH_SHORT).show()
- Handler().postDelayed(500) { finish() }
+ Handler(Looper.getMainLooper()).postDelayed(500) { finish() }
}
}
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt b/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
index 235af58b..af6540a4 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/GitServerConfigActivity.kt
@@ -8,6 +8,7 @@ import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.os.Handler
+import android.os.Looper
import android.view.MenuItem
import android.view.View
import androidx.core.os.postDelayed
@@ -144,7 +145,7 @@ class GitServerConfigActivity : BaseGitActivity() {
PasswordRepository.initialize()
if (!isClone) {
Snackbar.make(binding.root, getString(R.string.git_server_config_save_success), Snackbar.LENGTH_SHORT).show()
- Handler().postDelayed(500) { finish() }
+ Handler(Looper.getMainLooper()).postDelayed(500) { finish() }
} else {
cloneRepository()
}
diff --git a/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt b/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt
index 5e6cfb1b..52297133 100644
--- a/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt
+++ b/app/src/main/java/com/zeapo/pwdstore/git/sshj/SshKey.kt
@@ -262,7 +262,12 @@ object SshKey {
apply(algorithm.applyToSpec)
if (requireAuthentication) {
setUserAuthenticationRequired(true)
- setUserAuthenticationValidityDurationSeconds(30)
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
+ setUserAuthenticationParameters(30, KeyProperties.AUTH_DEVICE_CREDENTIAL)
+ } else {
+ @Suppress("DEPRECATION")
+ setUserAuthenticationValidityDurationSeconds(30)
+ }
}
build()
}