chore: Linting
All checks were successful
Deploy snapshot builds / deploy-release-snapshot (push) Successful in 17m31s

This commit is contained in:
Kumi 2025-03-26 08:38:33 +01:00
parent 0d2dcb3247
commit 1d243c0d03
3 changed files with 18 additions and 16 deletions

View file

@ -87,7 +87,7 @@ class PasswordExportService : Service() {
val targetPasswordFile = val targetPasswordFile =
targetDirectory.createFile( targetDirectory.createFile(
"application/octet-stream", "application/octet-stream",
requireNotNull(name) { "File name cannot be null" } requireNotNull(name) { "File name cannot be null" },
) )
if (targetPasswordFile?.exists() == true) { if (targetPasswordFile?.exists() == true) {
val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri) val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri)
@ -108,13 +108,13 @@ class PasswordExportService : Service() {
sourceDirectory.listFiles().forEach { file -> sourceDirectory.listFiles().forEach { file ->
if (file.isDirectory) { if (file.isDirectory) {
// Create new directory and recurse // Create new directory and recurse
val newDir = val newDir =
targetDirectory.createDirectory( targetDirectory.createDirectory(
requireNotNull(file.name) { "File name cannot be null when creating directory" } requireNotNull(file.name) { "File name cannot be null when creating directory" }
) )
copyDirToDir( copyDirToDir(
file, file,
requireNotNull(newDir) { "Target directory cannot be null when copying directories" } requireNotNull(newDir) { "Target directory cannot be null when copying directories" },
) )
} else { } else {
copyFileToDir(file, targetDirectory) copyFileToDir(file, targetDirectory)

View file

@ -8,11 +8,11 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.pm.PackageManager.ResolveInfoFlags import android.content.pm.PackageManager.ResolveInfoFlags
import android.net.Uri
import android.os.Build import android.os.Build
import android.provider.Settings import android.provider.Settings
import android.service.autofill.SaveInfo import android.service.autofill.SaveInfo
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.net.toUri
/** /**
* In order to add a new browser, do the following: * In order to add a new browser, do the following:
@ -244,7 +244,7 @@ private fun getBrowserAutofillSupportLevel(
public fun getInstalledBrowsersWithAutofillSupportLevel( public fun getInstalledBrowsersWithAutofillSupportLevel(
context: Context context: Context
): List<Pair<String, BrowserAutofillSupportLevel>> { ): List<Pair<String, BrowserAutofillSupportLevel>> {
val testWebIntent = Intent(Intent.ACTION_VIEW).apply { data = Uri.parse("https://example.org") } val testWebIntent = Intent(Intent.ACTION_VIEW).apply { data = "https://example.org".toUri() }
val installedBrowsers = val installedBrowsers =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
context.packageManager.queryIntentActivities( context.packageManager.queryIntentActivities(

View file

@ -86,9 +86,9 @@ class PGPKeyManagerTest {
// Add key using KeyManager // Add key using KeyManager
keyManager.addKey(secretKey).unwrap() keyManager.addKey(secretKey).unwrap()
// Remove key // Remove key
keyManager.removeKey( keyManager
requireNotNull(tryGetId(secretKey)) { "Failed to get ID from secret key" } .removeKey(requireNotNull(tryGetId(secretKey)) { "Failed to get ID from secret key" })
).unwrap() .unwrap()
// Check that no keys remain // Check that no keys remain
val keys = keyManager.getAllKeys().unwrap() val keys = keyManager.getAllKeys().unwrap()
assertEquals(0, keys.size) assertEquals(0, keys.size)
@ -209,15 +209,17 @@ class PGPKeyManagerTest {
runTest(dispatcher) { runTest(dispatcher) {
val alice = val alice =
PGPKey( PGPKey(
requireNotNull(this::class.java.classLoader.getResource("alice_owner@example_com")) { requireNotNull(this::class.java.classLoader.getResource("alice_owner@example_com")) {
"Resource 'alice_owner@example_com' not found" "Resource 'alice_owner@example_com' not found"
}.readBytes() }
.readBytes()
) )
val bobby = val bobby =
PGPKey( PGPKey(
requireNotNull(this::class.java.classLoader.getResource("bobby_owner@example_com")) { requireNotNull(this::class.java.classLoader.getResource("bobby_owner@example_com")) {
"Resource 'bobby_owner@example_com' not found" "Resource 'bobby_owner@example_com' not found"
}.readBytes() }
.readBytes()
) )
assertTrue(keyManager.addKey(alice).isOk) assertTrue(keyManager.addKey(alice).isOk)
assertTrue(keyManager.addKey(bobby).isOk) assertTrue(keyManager.addKey(bobby).isOk)