Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
openjdk64-11.0.11
openjdk64-17.0.7
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,19 @@ import androidx.compose.ui.window.Dialog
import androidx.hilt.navigation.compose.hiltViewModel
import com.yogeshpaliyal.common.constants.ScannerType
import com.yogeshpaliyal.common.utils.TOTPHelper
import com.yogeshpaliyal.keypass.R
import com.yogeshpaliyal.keypass.ui.detail.components.BottomBar
import com.yogeshpaliyal.keypass.ui.detail.components.Fields
import com.yogeshpaliyal.keypass.ui.redux.actions.CopyToClipboard
import com.yogeshpaliyal.keypass.ui.redux.actions.GoBackAction
import com.yogeshpaliyal.keypass.ui.redux.actions.NavigationAction
import com.yogeshpaliyal.keypass.ui.redux.actions.ToastAction
import com.yogeshpaliyal.keypass.ui.redux.states.PasswordGeneratorState
import org.reduxkotlin.compose.rememberDispatcher
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStream
import java.net.MalformedURLException
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
Expand Down Expand Up @@ -80,7 +83,13 @@ fun AccountDetailPage(
}
ScannerType.Secret -> {
it.scannedText ?: return@rememberLauncherForActivityResult
val totp = TOTPHelper(it.scannedText)
var totp: TOTPHelper? = null
try {
totp = TOTPHelper(it.scannedText)
} catch (e: MalformedURLException) {
dispatchAction(ToastAction(R.string.invalid_secret_key))
return@rememberLauncherForActivityResult
}
var newAccountModel = accountModel.copy(secret = totp.secret)

if (newAccountModel.title.isNullOrEmpty()) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,6 @@
<string name="keepass_backup">KeePass Backup</string>
<string name="keepass_backup_desc">Choose KeePass CSV file to import</string>
<string name="generate_qr_code">Export</string>
<string name="invalid_secret_key">Invalid secret key format</string>

</resources>
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,6 @@ android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false

kotlin.mpp.androidGradlePluginCompatibility.nowarn=true