Skip to content

Commit 2f8386f

Browse files
Provide package name when sharing APK files
1 parent 4573729 commit 2f8386f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/src/main/kotlin/com/d4rk/cleaner/app/apps/manager/ui/AppManagerViewModel.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import kotlinx.coroutines.flow.launchIn
3939
import kotlinx.coroutines.flow.onEach
4040
import kotlinx.coroutines.flow.update
4141
import kotlinx.coroutines.launch
42+
import java.io.File
4243
import java.util.Locale
4344

4445
class AppManagerViewModel(
@@ -287,7 +288,11 @@ class AppManagerViewModel(
287288
launch(dispatchers.io) {
288289
when (item) {
289290
is AppManagerItem.ApkFile -> {
290-
shareApkUseCase(item.path).collectLatest { result ->
291+
val pkgName =
292+
applicationContext.packageManager
293+
.getPackageArchiveInfo(item.path, 0)?.packageName
294+
?: File(item.path).nameWithoutExtension
295+
shareApkUseCase(item.path, pkgName).collectLatest { result ->
291296
when (result) {
292297
is DataState.Success -> sendAction(
293298
AppManagerAction.LaunchShareIntent(

0 commit comments

Comments
 (0)