From b99995069c1fca07b742ac561a742b6b8b7fcd91 Mon Sep 17 00:00:00 2001 From: rumboalla Date: Wed, 4 Oct 2023 07:25:56 +0200 Subject: [PATCH] Start implementation of GitLabRepository --- .../com/apkupdater/data/gitlab/GitLabApp.kt | 12 +++++++++ .../apkupdater/repository/GitLabRepository.kt | 27 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 app/src/main/kotlin/com/apkupdater/data/gitlab/GitLabApp.kt create mode 100644 app/src/main/kotlin/com/apkupdater/repository/GitLabRepository.kt diff --git a/app/src/main/kotlin/com/apkupdater/data/gitlab/GitLabApp.kt b/app/src/main/kotlin/com/apkupdater/data/gitlab/GitLabApp.kt new file mode 100644 index 00000000..8cce6c20 --- /dev/null +++ b/app/src/main/kotlin/com/apkupdater/data/gitlab/GitLabApp.kt @@ -0,0 +1,12 @@ +package com.apkupdater.data.gitlab + +data class GitLabApp( + val packageName: String, + val user: String, + val repo: String +) + +val GitLabApps = listOf( + GitLabApp("com.aurora.store", "AuroraOSS", "AuroraStore"), + GitLabApp("com.github.axet.bookreader", "axet", "android-book-reader") +) diff --git a/app/src/main/kotlin/com/apkupdater/repository/GitLabRepository.kt b/app/src/main/kotlin/com/apkupdater/repository/GitLabRepository.kt new file mode 100644 index 00000000..ea519933 --- /dev/null +++ b/app/src/main/kotlin/com/apkupdater/repository/GitLabRepository.kt @@ -0,0 +1,27 @@ +package com.apkupdater.repository + +import com.apkupdater.data.gitlab.GitLabApps +import com.apkupdater.data.ui.AppInstalled +import com.apkupdater.prefs.Prefs +import com.apkupdater.service.GitLabService +import kotlinx.coroutines.flow.flow + + +class GitLabRepository( + private val service: GitLabService, + private val prefs: Prefs +) { + + suspend fun updates(apps: List) = flow { + + GitLabApps.forEach { app -> + apps.find { it.packageName == app.packageName }?.let { + //checks.add(checkApp(apps, app.user, app.repo, app.packageName, it.version, app.extra)) + } + } + emit(0) + } + + private suspend fun checkApp() {} + +}