Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AND-37] Change permission flow #2066

Open
wants to merge 2 commits into
base: dev-v10
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.aptoide.android.aptoidegames.installer.analytics
import cm.aptoide.pt.install_manager.AbortException
import cm.aptoide.pt.install_manager.dto.InstallPackageInfo
import cm.aptoide.pt.install_manager.workers.PackageDownloader
import cm.aptoide.pt.installer.platform.REQUEST_INSTALL_PACKAGES_NOT_ALLOWED
import cm.aptoide.pt.installer.platform.WRITE_EXTERNAL_STORAGE_NOT_ALLOWED
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onCompletion
Expand Down Expand Up @@ -37,7 +36,6 @@ class DownloadProbe(

is AbortException -> {
when (it.message) {
REQUEST_INSTALL_PACKAGES_NOT_ALLOWED,
WRITE_EXTERNAL_STORAGE_NOT_ALLOWED -> analytics.sendDownloadAbortEvent(
packageName = packageName,
analyticsPayload = analyticsPayload,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,26 @@ class InstallAnalytics(
)
}

fun sendInstallAbortEvent(
packageName: String,
analyticsPayload: AnalyticsPayload?,
errorMessage: String?,
) {
genericAnalytics.sendInstallErrorEvent(
packageName = packageName,
analyticsPayload = analyticsPayload,
errorMessage = errorMessage
)

logBIInstallEvent(
packageName = packageName,
status = "abort",
analyticsPayload = analyticsPayload,
P_ERROR_MESSAGE to errorMessage,
P_ERROR_TYPE to "permission",
)
}

fun sendInstallCancelEvent(
packageName: String,
analyticsPayload: AnalyticsPayload?,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package com.aptoide.android.aptoidegames.installer.analytics

import cm.aptoide.pt.install_manager.AbortException
import cm.aptoide.pt.install_manager.dto.InstallPackageInfo
import cm.aptoide.pt.install_manager.workers.PackageInstaller
import cm.aptoide.pt.installer.platform.REQUEST_INSTALL_PACKAGES_NOT_ALLOWED
import cm.aptoide.pt.installer.platform.WRITE_EXTERNAL_STORAGE_NOT_ALLOWED
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onCompletion
import kotlinx.coroutines.flow.onStart
Expand Down Expand Up @@ -31,6 +34,24 @@ class InstallProbe(
analyticsPayload = analyticsPayload
)

is AbortException -> {
when (it.message) {
REQUEST_INSTALL_PACKAGES_NOT_ALLOWED,
WRITE_EXTERNAL_STORAGE_NOT_ALLOWED -> analytics.sendInstallAbortEvent(
packageName = packageName,
analyticsPayload = analyticsPayload,
errorMessage = it.message
)

else -> analytics.sendInstallErrorEvent(
packageName = packageName,
analyticsPayload = analyticsPayload,
errorMessage = it.message,
errorType = it::class.simpleName,
)
}
}

null -> {
analytics.sendInstallCompletedEvent(
packageName = packageName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ class AptoideDownloader @Inject constructor(
if(installPackageInfo.hasObb()) {
installPermissions.checkIfCanWriteExternal()
}
installPermissions.checkIfCanInstall()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should do this, as this could break the installations

Copy link
Contributor

@GuiFPires GuiFPires Nov 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@G0retZ we check on the installations part, as it's done on vanilla. After the app is downloaded, the installation flow starts and if the user doesn't have install unknown sources permission, our dialog for the install unknown sources will appear

}
.flatMapMerge(concurrency = 3) { item ->
var progress = 0.0
Expand Down