* fix: fix ktlint issues in gradle files

Fixed code style and formatting issues across `build.gradle.kts` and `app/build.gradle.kts` to resolve CI failures during the `ktlint` task.

* fix: fix ktlint and tests for PR 306

Updates dependencies logic to use `MasterKeys` properly based on the `androidx.security:security-crypto` upgrade to 1.0.0, and fixes `ktlint` formatting errors across the build scripts.
This commit is contained in:
M57 authored and GitHub committed 2026-06-22 21:35:40 +03:00
1 parent fbc4ee2b75
commit e5f0df9273
5 files changed
+94 -94

No files matched your search

@@ -3,7 +3,7 @@ package com.m57.hermescontrol.data.local
import android.content.Context
import android.content.SharedPreferences
import androidx.security.crypto.EncryptedSharedPreferences
import androidx.security.crypto.MasterKey
import androidx.security.crypto.MasterKeys
import io.mockk.*
import org.junit.After
import org.junit.Assert.assertEquals
@@ -31,18 +31,16 @@ class AuthManagerTest {
mockkStatic(EncryptedSharedPreferences::class)
every {
EncryptedSharedPreferences.create(
any<Context>(),
any<String>(),
any<MasterKey>(),
any<String>(),
any<Context>(),
any<EncryptedSharedPreferences.PrefKeyEncryptionScheme>(),
any<EncryptedSharedPreferences.PrefValueEncryptionScheme>(),
)
} returns mockPrefs
// Mock MasterKey.Builder constructor and its build method
mockkConstructor(MasterKey.Builder::class)
val mockMasterKey = mockk<MasterKey>(relaxed = true)
every { anyConstructed<MasterKey.Builder>().build() } returns mockMasterKey
mockkStatic(MasterKeys::class)
every { MasterKeys.getOrCreate(any()) } returns "mockMasterKey"
// Reset prefs singleton instance using reflection
val field = AuthManager::class.java.getDeclaredField("prefs")