chore(frontend): cleanup legacy code and improve localization consistency
- Removed deprecated `NotificationCard` component due to dependency on an outdated presentation layer. - Translated comments and documentation to German for improved localization across `core.auth`, `ping-feature`, and `network`. - Standardized comment formatting, improved doc clarity, and ensured consistent API documentation in all modules.
This commit is contained in:
+2
-1
@@ -10,7 +10,8 @@ import io.ktor.client.call.body
|
||||
import io.ktor.client.request.get
|
||||
|
||||
/**
|
||||
* PingApi implementation that uses a provided HttpClient (e.g., DI-provided "apiClient").
|
||||
* PingApi-Implementierung, die einen bereitgestellten HttpClient verwendet (z. B. den per Dependency Injection
|
||||
* bereitgestellten "apiClient").
|
||||
*/
|
||||
class PingApiKoinClient(private val client: HttpClient) : PingApi {
|
||||
|
||||
|
||||
+10
-7
@@ -5,21 +5,24 @@ import at.mocode.frontend.core.sync.SyncableRepository
|
||||
import at.mocode.ping.api.PingEvent
|
||||
import app.cash.sqldelight.async.coroutines.awaitAsOneOrNull
|
||||
|
||||
// ARCH-BLUEPRINT: This repository implements the generic SyncableRepository
|
||||
// for a specific entity, bridging the gap between the sync core and the local database.
|
||||
/**
|
||||
** ARCH-BLUEPRINT: Dieses Repository implementiert das generische Syncable Repository
|
||||
** für eine bestimmte Entität und überbrückt so die Lücke zwischen dem Sync-Core und der
|
||||
** lokalen Datenbank.
|
||||
*/
|
||||
class PingEventRepositoryImpl(
|
||||
private val db: AppDatabase
|
||||
) : SyncableRepository<PingEvent> {
|
||||
|
||||
// The `since` parameter for our sync is the ID of the last event, not a timestamp.
|
||||
// Der `since`-Parameter für unsere Synchronisierung ist die ID des letzten Ereignisses, kein Zeitstempel.
|
||||
override suspend fun getLatestSince(): String? {
|
||||
println("PingEventRepositoryImpl: getLatestSince called - using corrected async implementation")
|
||||
// FIX: Use .awaitAsOneOrNull() for async drivers instead of the blocking .executeAsOneOrNull()
|
||||
return db.appDatabaseQueries.selectLatestPingEventId().awaitAsOneOrNull()
|
||||
println("PingEventRepositoryImpl: getLatestSince called - using corrected async implementation")
|
||||
// FIX: Verwenden Sie .awaitAsOneOrNull() für asynchrone Treiber anstelle des blockierenden .executeAsOneOrNull().
|
||||
return db.appDatabaseQueries.selectLatestPingEventId().awaitAsOneOrNull()
|
||||
}
|
||||
|
||||
override suspend fun upsert(items: List<PingEvent>) {
|
||||
// Always perform bulk operations within a transaction.
|
||||
// Führen Sie Massenoperationen immer innerhalb einer Transaktion durch.
|
||||
db.transaction {
|
||||
items.forEach { event ->
|
||||
db.appDatabaseQueries.upsertPingEvent(
|
||||
|
||||
+4
-5
@@ -11,19 +11,18 @@ import org.koin.core.qualifier.named
|
||||
import org.koin.dsl.module
|
||||
|
||||
/**
|
||||
* Consolidated Koin module for the Ping Feature (Clean Architecture).
|
||||
* Replaces the old 'clients.pingfeature' module.
|
||||
* Konsolidiertes Koin-Modul für die Ping-Funktion (Clean Architecture).
|
||||
*/
|
||||
val pingFeatureModule = module {
|
||||
// 1. API Client (Data Layer)
|
||||
// Uses the shared authenticated 'apiClient' from Core Network
|
||||
// Verwendet den gemeinsam genutzten, authentifizierten „apiClient“ aus dem Kernnetzwerk.
|
||||
single<PingApi> { PingApiKoinClient(get(named("apiClient"))) }
|
||||
|
||||
// 2. Repository (Data Layer)
|
||||
single { PingEventRepositoryImpl(get<AppDatabase>()) }
|
||||
|
||||
// 3. Domain Service (Domain Layer)
|
||||
// Wraps SyncManager and Repository to decouple ViewModel from SyncManager implementation details
|
||||
// Wraps SyncManager und Repository, um ViewModel von den Implementierungsdetails von SyncManager zu entkoppeln.
|
||||
single<PingSyncService> {
|
||||
PingSyncServiceImpl(
|
||||
syncManager = get(),
|
||||
@@ -32,7 +31,7 @@ val pingFeatureModule = module {
|
||||
}
|
||||
|
||||
// 4. ViewModel (Presentation Layer)
|
||||
// Injects API and Domain Service
|
||||
// Injects API und Domain Service
|
||||
factory {
|
||||
PingViewModel(
|
||||
apiClient = get(),
|
||||
|
||||
+2
-2
@@ -5,14 +5,14 @@ import at.mocode.frontend.core.sync.SyncableRepository
|
||||
import at.mocode.ping.api.PingEvent
|
||||
|
||||
/**
|
||||
* Interface for the Ping Sync Service to allow easier testing and decoupling.
|
||||
* Interface für den Ping-Sync-Dienst zur einfacheren Prüfung und Entkopplung.
|
||||
*/
|
||||
interface PingSyncService {
|
||||
suspend fun syncPings()
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of PingSyncService using the generic SyncManager.
|
||||
* Implementierung des PingSyncService unter Verwendung des generischen SyncManager.
|
||||
*/
|
||||
class PingSyncServiceImpl(
|
||||
private val syncManager: SyncManager,
|
||||
|
||||
-2
@@ -19,8 +19,6 @@ import at.mocode.frontend.core.designsystem.components.DashboardCard
|
||||
import at.mocode.frontend.core.designsystem.components.DenseButton
|
||||
import at.mocode.frontend.core.designsystem.theme.Dimens
|
||||
|
||||
// --- Refactored PingScreen using Design System ---
|
||||
|
||||
@Composable
|
||||
fun PingScreen(
|
||||
viewModel: PingViewModel,
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import kotlin.test.assertEquals
|
||||
|
||||
class PingApiKoinClientTest {
|
||||
|
||||
// Helper to create a testable client using the new DI-friendly implementation
|
||||
// Hilfe zur Erstellung eines testbaren Clients mithilfe der neuen DI-freundlichen Implementierung
|
||||
private fun createTestClient(mockEngine: MockEngine): PingApiKoinClient {
|
||||
val client = HttpClient(mockEngine) {
|
||||
install(ContentNegotiation) {
|
||||
|
||||
Reference in New Issue
Block a user