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
499 changes: 499 additions & 0 deletions core/data/schemas/zed.rainxch.core.data.local.db.AppDatabase/4.json

Large diffs are not rendered by default.

504 changes: 504 additions & 0 deletions core/data/schemas/zed.rainxch.core.data.local.db.AppDatabase/5.json

Large diffs are not rendered by default.

528 changes: 528 additions & 0 deletions core/data/schemas/zed.rainxch.core.data.local.db.AppDatabase/6.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import zed.rainxch.core.data.local.db.migrations.MIGRATION_1_2
import zed.rainxch.core.data.local.db.migrations.MIGRATION_2_3
import zed.rainxch.core.data.local.db.migrations.MIGRATION_3_4
import zed.rainxch.core.data.local.db.migrations.MIGRATION_4_5
import zed.rainxch.core.data.local.db.migrations.MIGRATION_5_6

fun initDatabase(context: Context): AppDatabase {
val appContext = context.applicationContext
Expand All @@ -21,5 +22,6 @@ fun initDatabase(context: Context): AppDatabase {
MIGRATION_2_3,
MIGRATION_3_4,
MIGRATION_4_5,
MIGRATION_5_6,
).build()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package zed.rainxch.core.data.local.db.migrations

import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase

val MIGRATION_5_6 =
object : Migration(5, 6) {
override fun migrate(db: SupportSQLiteDatabase) {
db.execSQL(
"""
CREATE TABLE IF NOT EXISTS seen_repos (
repoId INTEGER NOT NULL PRIMARY KEY,
seenAt INTEGER NOT NULL
)
""".trimIndent(),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import zed.rainxch.core.data.local.db.AppDatabase
import zed.rainxch.core.data.local.db.dao.CacheDao
import zed.rainxch.core.data.local.db.dao.FavoriteRepoDao
import zed.rainxch.core.data.local.db.dao.InstalledAppDao
import zed.rainxch.core.data.local.db.dao.SeenRepoDao
import zed.rainxch.core.data.local.db.dao.StarredRepoDao
import zed.rainxch.core.data.local.db.dao.UpdateHistoryDao
import zed.rainxch.core.data.logging.KermitLogger
Expand All @@ -26,6 +27,7 @@ import zed.rainxch.core.data.repository.FavouritesRepositoryImpl
import zed.rainxch.core.data.repository.InstalledAppsRepositoryImpl
import zed.rainxch.core.data.repository.ProxyRepositoryImpl
import zed.rainxch.core.data.repository.RateLimitRepositoryImpl
import zed.rainxch.core.data.repository.SeenReposRepositoryImpl
import zed.rainxch.core.data.repository.StarredRepositoryImpl
import zed.rainxch.core.data.repository.TweaksRepositoryImpl
import zed.rainxch.core.domain.getPlatform
Expand All @@ -37,6 +39,7 @@ import zed.rainxch.core.domain.repository.FavouritesRepository
import zed.rainxch.core.domain.repository.InstalledAppsRepository
import zed.rainxch.core.domain.repository.ProxyRepository
import zed.rainxch.core.domain.repository.RateLimitRepository
import zed.rainxch.core.domain.repository.SeenReposRepository
import zed.rainxch.core.domain.repository.StarredRepository
import zed.rainxch.core.domain.repository.TweaksRepository
import zed.rainxch.core.domain.use_cases.SyncInstalledAppsUseCase
Expand Down Expand Up @@ -94,6 +97,12 @@ val coreModule =
)
}

single<SeenReposRepository> {
SeenReposRepositoryImpl(
seenRepoDao = get(),
)
}

single<ProxyRepository> {
ProxyRepositoryImpl(
preferences = get(),
Expand Down Expand Up @@ -203,4 +212,8 @@ val databaseModule =
single<CacheDao> {
get<AppDatabase>().cacheDao
}

single<SeenRepoDao> {
get<AppDatabase>().seenRepoDao
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import androidx.room.RoomDatabase
import zed.rainxch.core.data.local.db.dao.CacheDao
import zed.rainxch.core.data.local.db.dao.FavoriteRepoDao
import zed.rainxch.core.data.local.db.dao.InstalledAppDao
import zed.rainxch.core.data.local.db.dao.SeenRepoDao
import zed.rainxch.core.data.local.db.dao.StarredRepoDao
import zed.rainxch.core.data.local.db.dao.UpdateHistoryDao
import zed.rainxch.core.data.local.db.entities.CacheEntryEntity
import zed.rainxch.core.data.local.db.entities.FavoriteRepoEntity
import zed.rainxch.core.data.local.db.entities.InstalledAppEntity
import zed.rainxch.core.data.local.db.entities.SeenRepoEntity
import zed.rainxch.core.data.local.db.entities.StarredRepositoryEntity
import zed.rainxch.core.data.local.db.entities.UpdateHistoryEntity

Expand All @@ -20,8 +22,9 @@ import zed.rainxch.core.data.local.db.entities.UpdateHistoryEntity
UpdateHistoryEntity::class,
StarredRepositoryEntity::class,
CacheEntryEntity::class,
SeenRepoEntity::class,
],
version = 5,
version = 6,
exportSchema = true,
)
abstract class AppDatabase : RoomDatabase() {
Expand All @@ -30,4 +33,5 @@ abstract class AppDatabase : RoomDatabase() {
abstract val updateHistoryDao: UpdateHistoryDao
abstract val starredReposDao: StarredRepoDao
abstract val cacheDao: CacheDao
abstract val seenRepoDao: SeenRepoDao
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package zed.rainxch.core.data.local.db.dao

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import kotlinx.coroutines.flow.Flow
import zed.rainxch.core.data.local.db.entities.SeenRepoEntity

@Dao
interface SeenRepoDao {
@Query("SELECT repoId FROM seen_repos")
fun getAllSeenRepoIds(): Flow<List<Long>>

@Insert(onConflict = OnConflictStrategy.IGNORE)
suspend fun insert(entity: SeenRepoEntity)

@Query("DELETE FROM seen_repos")
suspend fun clearAll()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package zed.rainxch.core.data.local.db.entities

import androidx.room.Entity
import androidx.room.PrimaryKey

@Entity(tableName = "seen_repos")
data class SeenRepoEntity(
@PrimaryKey
val repoId: Long,
val seenAt: Long,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package zed.rainxch.core.data.repository

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import zed.rainxch.core.data.local.db.dao.SeenRepoDao
import zed.rainxch.core.data.local.db.entities.SeenRepoEntity
import zed.rainxch.core.domain.repository.SeenReposRepository

class SeenReposRepositoryImpl(
private val seenRepoDao: SeenRepoDao,
) : SeenReposRepository {
override fun getAllSeenRepoIds(): Flow<Set<Long>> =
seenRepoDao.getAllSeenRepoIds().map { it.toSet() }

override suspend fun markAsSeen(repoId: Long) {
seenRepoDao.insert(
SeenRepoEntity(
repoId = repoId,
seenAt = System.currentTimeMillis(),
),
)
}

override suspend fun clearAll() {
seenRepoDao.clearAll()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class TweaksRepositoryImpl(
private val UPDATE_CHECK_INTERVAL_KEY = longPreferencesKey("update_check_interval_hours")
private val INCLUDE_PRE_RELEASES_KEY = booleanPreferencesKey("include_pre_releases")
private val LIQUID_GLASS_ENABLED_KEY = booleanPreferencesKey("liquid_glass_enabled")
private val HIDE_SEEN_ENABLED_KEY = booleanPreferencesKey("hide_seen_enabled")

override fun getThemeColor(): Flow<AppTheme> =
preferences.data.map { prefs ->
Expand Down Expand Up @@ -144,6 +145,17 @@ class TweaksRepositoryImpl(
}
}

override fun getHideSeenEnabled(): Flow<Boolean> =
preferences.data.map { prefs ->
prefs[HIDE_SEEN_ENABLED_KEY] ?: false
}

override suspend fun setHideSeenEnabled(enabled: Boolean) {
preferences.edit { prefs ->
prefs[HIDE_SEEN_ENABLED_KEY] = enabled
}
}

companion object {
const val DEFAULT_UPDATE_CHECK_INTERVAL_HOURS = 6L
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package zed.rainxch.core.domain.repository

import kotlinx.coroutines.flow.Flow

interface SeenReposRepository {
fun getAllSeenRepoIds(): Flow<Set<Long>>

suspend fun markAsSeen(repoId: Long)

suspend fun clearAll()
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,8 @@ interface TweaksRepository {
fun getLiquidGlassEnabled(): Flow<Boolean>

suspend fun setLiquidGlassEnabled(enabled: Boolean)

fun getHideSeenEnabled(): Flow<Boolean>

suspend fun setHideSeenEnabled(enabled: Boolean)
}
Original file line number Diff line number Diff line change
Expand Up @@ -585,4 +585,11 @@
<string name="update_signing_key_mismatch">عدم تطابق مفتاح التوقيع: تم توقيع التحديث بواسطة مطور مختلف. تم حظر التحديث.</string>
<string name="liquid_glass_option_title">تأثير الزجاج السائل</string>
<string name="liquid_glass_option_description">تحسين الواجهة بمظهر زجاجي ناعم</string>

<string name="hide_seen_title">إخفاء المستودعات المشاهَدة</string>
<string name="hide_seen_description">إخفاء المستودعات التي شاهدتها بالفعل من خلاصات الاكتشاف</string>
<string name="clear_seen_history">مسح سجل المشاهدة</string>
<string name="clear_seen_history_description">إعادة تعيين جميع المستودعات المشاهَدة لتظهر مجدداً في الخلاصات</string>
<string name="seen_history_cleared">تم مسح سجل المشاهدة</string>
<string name="seen_badge">تمت المشاهدة</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,11 @@
<string name="update_signing_key_mismatch">সাইনিং কী অমিল: আপডেটটি একজন ভিন্ন ডেভেলপার দ্বারা সাইন করা হয়েছে। আপডেট ব্লক করা হয়েছে।</string>
<string name="liquid_glass_option_title">লিকুইড গ্লাস ইফেক্ট</string>
<string name="liquid_glass_option_description">একটি মসৃণ কাচের মতো চেহারা দিয়ে ইন্টারফেস উন্নত করুন</string>

<string name="hide_seen_title">দেখা রিপোজিটরি লুকান</string>
<string name="hide_seen_description">আপনি ইতিমধ্যে দেখেছেন এমন রিপোজিটরি আবিষ্কার ফিড থেকে লুকান</string>
<string name="clear_seen_history">দেখার ইতিহাস মুছুন</string>
<string name="clear_seen_history_description">সমস্ত দেখা রিপোজিটরি রিসেট করুন যাতে সেগুলো ফিডে আবার দেখা যায়</string>
<string name="seen_history_cleared">দেখার ইতিহাস মুছে ফেলা হয়েছে</string>
<string name="seen_badge">দেখা হয়েছে</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -545,4 +545,11 @@
<string name="update_signing_key_mismatch">Clave de firma no coincide: la actualización fue firmada por un desarrollador diferente. Actualización bloqueada.</string>
<string name="liquid_glass_option_title">Efecto de cristal líquido</string>
<string name="liquid_glass_option_description">Mejora la interfaz con una apariencia suave tipo cristal</string>

<string name="hide_seen_title">Ocultar repositorios vistos</string>
<string name="hide_seen_description">Ocultar repositorios que ya has visto de las fuentes de descubrimiento</string>
<string name="clear_seen_history">Borrar historial de vistos</string>
<string name="clear_seen_history_description">Restablecer todos los repositorios vistos para que aparezcan de nuevo en las fuentes</string>
<string name="seen_history_cleared">Historial de vistos borrado</string>
<string name="seen_badge">Visto</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,11 @@
<string name="update_signing_key_mismatch">Incompatibilité de clé de signature : la mise à jour a été signée par un développeur différent. Mise à jour bloquée.</string>
<string name="liquid_glass_option_title">Effet verre liquide</string>
<string name="liquid_glass_option_description">Améliorez l\'interface avec une apparence vitreuse et fluide</string>

<string name="hide_seen_title">Masquer les dépôts consultés</string>
<string name="hide_seen_description">Masquer les dépôts que vous avez déjà consultés des flux de découverte</string>
<string name="clear_seen_history">Effacer l\'historique des consultations</string>
<string name="clear_seen_history_description">Réinitialiser tous les dépôts consultés pour qu\'ils réapparaissent dans les flux</string>
<string name="seen_history_cleared">Historique des consultations effacé</string>
<string name="seen_badge">Consulté</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,11 @@
<string name="update_signing_key_mismatch">साइनिंग कुंजी मेल नहीं खाती: अपडेट किसी अन्य डेवलपर द्वारा साइन किया गया था। अपडेट ब्लॉक किया गया।</string>
<string name="liquid_glass_option_title">लिक्विड ग्लास इफ़ेक्ट</string>
<string name="liquid_glass_option_description">एक चिकने काँच जैसे रूप से इंटरफ़ेस को बेहतर बनाएं</string>

<string name="hide_seen_title">देखे गए रिपॉजिटरी छुपाएँ</string>
<string name="hide_seen_description">पहले से देखे गए रिपॉजिटरी को डिस्कवरी फ़ीड से छुपाएँ</string>
<string name="clear_seen_history">देखने का इतिहास साफ़ करें</string>
<string name="clear_seen_history_description">सभी देखे गए रिपॉजिटरी रीसेट करें ताकि वे फ़ीड में फिर से दिखें</string>
<string name="seen_history_cleared">देखने का इतिहास साफ़ किया गया</string>
<string name="seen_badge">देखा गया</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -584,4 +584,11 @@
<string name="update_signing_key_mismatch">Chiave di firma non corrispondente: l\'aggiornamento è stato firmato da uno sviluppatore diverso. Aggiornamento bloccato.</string>
<string name="liquid_glass_option_title">Effetto vetro liquido</string>
<string name="liquid_glass_option_description">Migliora l\'interfaccia con un aspetto liscio simile al vetro</string>

<string name="hide_seen_title">Nascondi repository visualizzati</string>
<string name="hide_seen_description">Nascondi i repository già visualizzati dai feed di scoperta</string>
<string name="clear_seen_history">Cancella cronologia visualizzazioni</string>
<string name="clear_seen_history_description">Reimposta tutti i repository visualizzati in modo che ricompaiano nei feed</string>
<string name="seen_history_cleared">Cronologia visualizzazioni cancellata</string>
<string name="seen_badge">Visualizzato</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,11 @@
<string name="update_signing_key_mismatch">署名キーの不一致: 更新は別の開発者によって署名されています。更新がブロックされました。</string>
<string name="liquid_glass_option_title">リキッドグラスエフェクト</string>
<string name="liquid_glass_option_description">滑らかなガラスのような外観でインターフェースを向上させます</string>

<string name="hide_seen_title">閲覧済みリポジトリを非表示</string>
<string name="hide_seen_description">すでに閲覧したリポジトリをディスカバリーフィードから非表示にします</string>
<string name="clear_seen_history">閲覧履歴をクリア</string>
<string name="clear_seen_history_description">すべての閲覧済みリポジトリをリセットしてフィードに再表示します</string>
<string name="seen_history_cleared">閲覧履歴をクリアしました</string>
<string name="seen_badge">閲覧済み</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -581,4 +581,11 @@
<string name="update_signing_key_mismatch">서명 키 불일치: 업데이트가 다른 개발자에 의해 서명되었습니다. 업데이트가 차단되었습니다.</string>
<string name="liquid_glass_option_title">리퀴드 글라스 효과</string>
<string name="liquid_glass_option_description">매끄러운 유리 같은 외관으로 인터페이스를 향상시킵니다</string>

<string name="hide_seen_title">본 저장소 숨기기</string>
<string name="hide_seen_description">이미 본 저장소를 디스커버리 피드에서 숨깁니다</string>
<string name="clear_seen_history">조회 기록 삭제</string>
<string name="clear_seen_history_description">모든 조회 기록을 초기화하여 피드에 다시 표시합니다</string>
<string name="seen_history_cleared">조회 기록이 삭제되었습니다</string>
<string name="seen_badge">확인함</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -548,4 +548,11 @@
<string name="update_signing_key_mismatch">Niezgodność klucza podpisu: aktualizacja została podpisana przez innego programistę. Aktualizacja zablokowana.</string>
<string name="liquid_glass_option_title">Efekt płynnego szkła</string>
<string name="liquid_glass_option_description">Ulepsz interfejs o gładki, szklany wygląd</string>

<string name="hide_seen_title">Ukryj przeglądane repozytoria</string>
<string name="hide_seen_description">Ukryj repozytoria, które już przeglądałeś, z kanałów odkrywania</string>
<string name="clear_seen_history">Wyczyść historię przeglądania</string>
<string name="clear_seen_history_description">Zresetuj wszystkie przeglądane repozytoria, aby ponownie pojawiły się w kanałach</string>
<string name="seen_history_cleared">Historia przeglądania wyczyszczona</string>
<string name="seen_badge">Przeglądane</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -548,4 +548,11 @@
<string name="update_signing_key_mismatch">Несоответствие ключа подписи: обновление подписано другим разработчиком. Обновление заблокировано.</string>
<string name="liquid_glass_option_title">Эффект жидкого стекла</string>
<string name="liquid_glass_option_description">Улучшите интерфейс с помощью гладкого стеклянного оформления</string>

<string name="hide_seen_title">Скрыть просмотренные репозитории</string>
<string name="hide_seen_description">Скрыть уже просмотренные репозитории из лент обнаружения</string>
<string name="clear_seen_history">Очистить историю просмотров</string>
<string name="clear_seen_history_description">Сбросить все просмотренные репозитории, чтобы они снова появились в лентах</string>
<string name="seen_history_cleared">История просмотров очищена</string>
<string name="seen_badge">Просмотрено</string>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -582,4 +582,11 @@
<string name="update_signing_key_mismatch">İmza anahtarı uyumsuzluğu: güncelleme farklı bir geliştirici tarafından imzalanmış. Güncelleme engellendi.</string>
<string name="liquid_glass_option_title">Sıvı Cam Efekti</string>
<string name="liquid_glass_option_description">Arayüzü pürüzsüz cam benzeri bir görünümle geliştirin</string>

<string name="hide_seen_title">Görülen depoları gizle</string>
<string name="hide_seen_description">Zaten görüntülediğiniz depoları keşif akışlarından gizleyin</string>
<string name="clear_seen_history">Görüntüleme geçmişini temizle</string>
<string name="clear_seen_history_description">Tüm görüntülenen depoları sıfırlayarak akışlarda tekrar görünmelerini sağlayın</string>
<string name="seen_history_cleared">Görüntüleme geçmişi temizlendi</string>
<string name="seen_badge">Görüntülendi</string>
</resources>
Loading