This commit is contained in:
machiav3lli 2022-06-29 03:07:08 +02:00
parent 2f2856134f
commit fc74146194
6 changed files with 13 additions and 12 deletions

View File

@ -213,8 +213,8 @@ dependencies {
implementation("androidx.compose.material:material-icons-extended:$composeVersion")
implementation("com.google.android.material:compose-theme-adapter-3:1.0.13")
debugImplementation ("androidx.compose.ui:ui-tooling:$composeVersion")
debugImplementation ("androidx.compose.ui:ui-tooling-preview:$composeVersion")
debugImplementation("androidx.compose.ui:ui-tooling:$composeVersion")
debugImplementation("androidx.compose.ui:ui-tooling-preview:$composeVersion")
}
// using a task as a preBuild dependency instead of a function that takes some time insures that it runs

View File

@ -194,12 +194,12 @@ class DownloadService : ConnectionService<DownloadService.Binder>() {
mutableStateSubject.emit(State.Success(task.packageName, task.name, task.release))
consumed = true
}
if (!consumed) {
scope.launch {
AppInstaller.getInstance(this@DownloadService)
?.defaultInstaller?.install(task.name, task.release.cacheFileName)
}
//if (!consumed) { TODO investigate if there's resulting issues
scope.launch {
AppInstaller.getInstance(this@DownloadService)
?.defaultInstaller?.install(task.name, task.release.cacheFileName)
}
//}
}
private fun validatePackage(task: Task, file: File): ValidationError? {

View File

@ -391,7 +391,6 @@ class SyncService : ConnectionService<SyncService.Binder>() {
.subscribe { result, throwable ->
throwable?.printStackTrace()
currentTask = null
handleNextTask(false)
if (result.isNotEmpty()) {
if (Preferences[Preferences.Key.InstallAfterSync])
batchUpdate(result)
@ -400,6 +399,7 @@ class SyncService : ConnectionService<SyncService.Binder>() {
)
displayUpdatesNotification(result)
}
handleNextTask(false)
}
if (hasUpdates) {
currentTask = CurrentTask(null, disposable, true, State.Finishing)

View File

@ -35,6 +35,7 @@ class MainActivityX : AppCompatActivity() {
companion object {
const val ACTION_UPDATES = "${BuildConfig.APPLICATION_ID}.intent.action.UPDATES"
const val ACTION_INSTALL = "${BuildConfig.APPLICATION_ID}.intent.action.INSTALL"
const val EXTRA_UPDATES = "${BuildConfig.APPLICATION_ID}.intent.extra.UPDATES"
const val EXTRA_CACHE_FILE_NAME =
"${BuildConfig.APPLICATION_ID}.intent.extra.CACHE_FILE_NAME"
}
@ -154,6 +155,7 @@ class MainActivityX : AppCompatActivity() {
private fun handleSpecialIntent(specialIntent: SpecialIntent) {
when (specialIntent) {
is SpecialIntent.Updates -> {
// TODO directly update the apps??
binding.bottomNavigation.selectedItemId = R.id.installedTab
}
is SpecialIntent.Install -> {

View File

@ -43,7 +43,7 @@ fun ProductsVerticalRecycler(
ProductsListItem(
item = item,
repo = repositories[item.repositoryId],
isFavorite = favorites?.contains(item.packageName) == true,
isFavorite = favorites.contains(item.packageName),
onUserClick = onUserClick,
onFavouriteClick = onFavouriteClick,
installed = getInstalled.invoke(item),

View File

@ -171,8 +171,8 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
else -> null
}
viewModel.downloadState.value = state
if (downloadState is DownloadService.State.Success && isResumed && !rootInstallerEnabled) {
viewModel.updateActions()
if (downloadState is DownloadService.State.Success && !rootInstallerEnabled) { // && isResumed
withContext(Dispatchers.Default) {
AppInstaller.getInstance(context)?.defaultInstaller?.install(downloadState.release.cacheFileName)
}
@ -256,7 +256,6 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
)
}
// TODO fix in compose implementation
override fun onScreenshotClick(screenshot: Screenshot) {
val pair = viewModel.productRepos.asSequence()
.map { it ->
@ -354,7 +353,7 @@ class AppSheetX() : FullscreenBottomSheetDialogFragment(), Callbacks {
val repos by viewModel.repositories.observeAsState()
val downloadState by viewModel.downloadState.observeAsState(null)
val mainAction by viewModel.mainAction.observeAsState(if (installed == null) ActionState.Install else ActionState.Launch)
val actions by viewModel.actions.observeAsState() // TODO add rest actions to UI
val actions by viewModel.actions.observeAsState()
val secondaryAction by viewModel.secondaryAction.observeAsState()
val extras by viewModel.extras.observeAsState(Extras(packageName))
val productRepos = products?.mapNotNull { product ->