Skip to content

Commit ae326d1

Browse files
committed
Merge branch 'main' into flatpak-pr
# Conflicts: # core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopInstaller.kt
2 parents 8e0aa65 + f1b9197 commit ae326d1

44 files changed

Lines changed: 2183 additions & 1108 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

core/data/src/androidMain/kotlin/zed/rainxch/core/data/services/AndroidInstaller.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import co.touchlab.kermit.Logger
1212
import zed.rainxch.core.domain.model.AssetArchitectureMatcher
1313
import zed.rainxch.core.domain.model.GithubAsset
1414
import zed.rainxch.core.domain.model.SystemArchitecture
15+
import zed.rainxch.core.domain.system.InstallOutcome
1516
import zed.rainxch.core.domain.system.Installer
1617
import zed.rainxch.core.domain.system.InstallerInfoExtractor
1718
import java.io.File
@@ -134,7 +135,7 @@ class AndroidInstaller(
134135
override suspend fun install(
135136
filePath: String,
136137
extOrMime: String,
137-
) {
138+
): InstallOutcome {
138139
val file = File(filePath)
139140
if (!file.exists()) {
140141
throw IllegalStateException("APK file not found: $filePath")
@@ -158,6 +159,8 @@ class AndroidInstaller(
158159
} else {
159160
throw IllegalStateException("No installer available on this device")
160161
}
162+
163+
return InstallOutcome.DELEGATED_TO_SYSTEM
161164
}
162165

163166
override fun uninstall(packageName: String) {

core/data/src/androidMain/kotlin/zed/rainxch/core/data/services/shizuku/ShizukuInstallerWrapper.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import zed.rainxch.core.domain.model.GithubAsset
1111
import zed.rainxch.core.domain.model.InstallerType
1212
import zed.rainxch.core.domain.model.SystemArchitecture
1313
import zed.rainxch.core.domain.repository.TweaksRepository
14+
import zed.rainxch.core.domain.system.InstallOutcome
1415
import zed.rainxch.core.domain.system.Installer
1516
import zed.rainxch.core.domain.system.InstallerInfoExtractor
1617

@@ -97,7 +98,7 @@ class ShizukuInstallerWrapper(
9798
override suspend fun install(
9899
filePath: String,
99100
extOrMime: String,
100-
) {
101+
): InstallOutcome {
101102
Logger.d(TAG) { "install() called — filePath=$filePath, extOrMime=$extOrMime" }
102103
Logger.d(TAG) { "cachedInstallerType=$cachedInstallerType, shizukuStatus=${shizukuServiceManager.status.value}" }
103104

@@ -122,7 +123,7 @@ class ShizukuInstallerWrapper(
122123
Logger.d(TAG) { "Shizuku installPackage() returned: $result" }
123124
if (result == 0) {
124125
Logger.d(TAG) { "Shizuku install SUCCEEDED for: $filePath" }
125-
return
126+
return InstallOutcome.COMPLETED
126127
}
127128
Logger.w(TAG) { "Shizuku install FAILED with code: $result, falling back to standard installer" }
128129
} else {
@@ -137,7 +138,7 @@ class ShizukuInstallerWrapper(
137138

138139
Logger.d(TAG) { "Using standard AndroidInstaller for: $filePath" }
139140
androidInstaller.ensurePermissionsOrThrow(extOrMime)
140-
androidInstaller.install(filePath, extOrMime)
141+
return androidInstaller.install(filePath, extOrMime)
141142
}
142143

143144
override fun uninstall(packageName: String) {

core/data/src/commonMain/kotlin/zed/rainxch/core/data/repository/InstalledAppsRepositoryImpl.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ class InstalledAppsRepositoryImpl(
186186
newVersionName: String,
187187
newVersionCode: Long,
188188
signingFingerprint: String?,
189+
isPendingInstall: Boolean,
189190
) {
190191
val app = installedAppsDao.getAppByPackage(packageName) ?: return
191192

@@ -220,6 +221,7 @@ class InstalledAppsRepositoryImpl(
220221
latestVersionName = newVersionName,
221222
latestVersionCode = newVersionCode,
222223
isUpdateAvailable = false,
224+
isPendingInstall = isPendingInstall,
223225
lastUpdatedAt = System.currentTimeMillis(),
224226
lastCheckedAt = System.currentTimeMillis(),
225227
signingFingerprint = signingFingerprint,

core/data/src/jvmMain/kotlin/zed/rainxch/core/data/services/DesktopInstaller.kt

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import zed.rainxch.core.domain.model.AssetArchitectureMatcher
99
import zed.rainxch.core.domain.model.GithubAsset
1010
import zed.rainxch.core.domain.model.Platform
1111
import zed.rainxch.core.domain.model.SystemArchitecture
12+
import zed.rainxch.core.domain.system.InstallOutcome
1213
import zed.rainxch.core.domain.system.Installer
1314
import zed.rainxch.core.domain.system.InstallerInfoExtractor
1415
import java.awt.Desktop
@@ -437,13 +438,14 @@ class DesktopInstaller(
437438
override suspend fun install(
438439
filePath: String,
439440
extOrMime: String,
440-
) = withContext(Dispatchers.IO) {
441-
val file = File(filePath)
442-
if (!file.exists()) {
443-
throw IllegalStateException("File not found: $filePath")
444-
}
441+
): InstallOutcome =
442+
withContext(Dispatchers.IO) {
443+
val file = File(filePath)
444+
if (!file.exists()) {
445+
throw IllegalStateException("File not found: $filePath")
446+
}
445447

446-
val ext = extOrMime.lowercase().removePrefix(".")
448+
val ext = extOrMime.lowercase().removePrefix(".")
447449

448450
// Inside the Flatpak sandbox we cannot:
449451
// - Run pkexec/sudo (no privilege escalation)
@@ -457,13 +459,16 @@ class DesktopInstaller(
457459
return@withContext
458460
}
459461

460-
when (platform) {
461-
Platform.WINDOWS -> installWindows(file, ext)
462-
Platform.MACOS -> installMacOS(file, ext)
463-
Platform.LINUX -> installLinux(file, ext)
464-
else -> throw UnsupportedOperationException("Installation not supported on $platform")
462+
when (platform) {
463+
Platform.WINDOWS -> installWindows(file, ext)
464+
Platform.MACOS -> installMacOS(file, ext)
465+
Platform.LINUX -> installLinux(file, ext)
466+
else -> throw UnsupportedOperationException("Installation not supported on $platform")
467+
}
468+
469+
InstallOutcome.DELEGATED_TO_SYSTEM
465470
}
466-
}
471+
467472

468473
/**
469474
* Flatpak-sandboxed installation flow.

core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/repository/InstalledAppsRepository.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ interface InstalledAppsRepository {
3434
newVersionName: String,
3535
newVersionCode: Long,
3636
signingFingerprint: String?,
37+
isPendingInstall: Boolean = true,
3738
)
3839

3940
suspend fun updateApp(app: InstalledApp)

core/domain/src/commonMain/kotlin/zed/rainxch/core/domain/system/Installer.kt

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@ package zed.rainxch.core.domain.system
33
import zed.rainxch.core.domain.model.GithubAsset
44
import zed.rainxch.core.domain.model.SystemArchitecture
55

6+
/**
7+
* Result of an [Installer.install] call.
8+
*/
9+
enum class InstallOutcome {
10+
/**
11+
* Installation completed synchronously (e.g. Shizuku silent install).
12+
* The package is already installed on the system — no need to wait
13+
* for a broadcast to confirm.
14+
*/
15+
COMPLETED,
16+
17+
/**
18+
* Installation was handed off to the system UI or an external process.
19+
* The caller should treat the install as pending until a
20+
* PACKAGE_ADDED / PACKAGE_REPLACED broadcast confirms it.
21+
*/
22+
DELEGATED_TO_SYSTEM,
23+
}
24+
625
interface Installer {
726
suspend fun isSupported(extOrMime: String): Boolean
827

@@ -11,7 +30,7 @@ interface Installer {
1130
suspend fun install(
1231
filePath: String,
1332
extOrMime: String,
14-
)
33+
): InstallOutcome
1534

1635
fun uninstall(packageName: String)
1736

core/presentation/src/commonMain/composeResources/values-ar/strings-ar.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@
266266
<string name="home_category_hot_release">إصدار ساخن</string>
267267
<string name="home_category_most_popular">الأكثر شعبية</string>
268268

269+
<string name="home_topic_privacy">الخصوصية</string>
270+
<string name="home_topic_media">الوسائط</string>
271+
<string name="home_topic_productivity">الإنتاجية</string>
272+
<string name="home_topic_networking">الشبكة</string>
273+
<string name="home_topic_dev_tools">أدوات المطور</string>
274+
269275
<string name="home_finding_repositories">جارٍ البحث عن مستودعات...</string>
270276
<string name="home_loading_more">جارٍ تحميل المزيد...</string>
271277
<string name="home_no_more_repositories">لا مزيد من المستودعات</string>

core/presentation/src/commonMain/composeResources/values-bn/strings-bn.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@
232232
<string name="home_category_hot_release">হট রিলিজ</string>
233233
<string name="home_category_most_popular">সবচেয়ে জনপ্রিয়</string>
234234

235+
<string name="home_topic_privacy">গোপনীয়তা</string>
236+
<string name="home_topic_media">মিডিয়া</string>
237+
<string name="home_topic_productivity">উৎপাদনশীলতা</string>
238+
<string name="home_topic_networking">নেটওয়ার্ক</string>
239+
<string name="home_topic_dev_tools">ডেভ টুলস</string>
240+
235241
<string name="home_finding_repositories">রিপোজিটরি খোঁজা হচ্ছে...</string>
236242
<string name="home_loading_more">আরও লোড হচ্ছে...</string>
237243
<string name="home_no_more_repositories">আর কোনো রিপোজিটরি নেই</string>

core/presentation/src/commonMain/composeResources/values-es/strings-es.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@
178178
<string name="home_category_hot_release">Lanzamiento en caliente</string>
179179
<string name="home_category_most_popular">Los más populares</string>
180180

181+
<string name="home_topic_privacy">Privacidad</string>
182+
<string name="home_topic_media">Multimedia</string>
183+
<string name="home_topic_productivity">Productividad</string>
184+
<string name="home_topic_networking">Red</string>
185+
<string name="home_topic_dev_tools">Herramientas de desarrollo</string>
186+
181187
<string name="home_finding_repositories">Buscando repositorios...</string>
182188
<string name="home_loading_more">Cargando...</string>
183189
<string name="home_no_more_repositories">No hay más repositorios</string>

core/presentation/src/commonMain/composeResources/values-fr/strings-fr.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,12 @@
178178
<string name="home_category_hot_release">Sortie en salles</string>
179179
<string name="home_category_most_popular">Les plus populaires</string>
180180

181+
<string name="home_topic_privacy">Confidentialité</string>
182+
<string name="home_topic_media">Médias</string>
183+
<string name="home_topic_productivity">Productivité</string>
184+
<string name="home_topic_networking">Réseau</string>
185+
<string name="home_topic_dev_tools">Outils de développement</string>
186+
181187
<string name="home_finding_repositories">Recherche de dépôts...</string>
182188
<string name="home_loading_more">Chargement...</string>
183189
<string name="home_no_more_repositories">Plus aucun dépôt</string>

0 commit comments

Comments
 (0)