For #8759 Use activityName instead of packageName as app identification

innovation-week
mcarare 4 years ago committed by Mihai Adrian
parent f23b9fcb89
commit 7fbb1640b6

@ -84,7 +84,7 @@ class DefaultShareController(
override fun handleShareToApp(app: AppShareOption) { override fun handleShareToApp(app: AppShareOption) {
lifecycleScope.launch(Dispatchers.IO) { lifecycleScope.launch(Dispatchers.IO) {
recentAppsStorage.updateRecentApp(app.packageName) recentAppsStorage.updateRecentApp(app.activityName)
} }
val intent = Intent(ACTION_SEND).apply { val intent = Intent(ACTION_SEND).apply {

@ -90,7 +90,7 @@ class ShareViewModel(application: Application) : AndroidViewModel(application) {
} }
val shareAppsActivities = getIntentActivities(shareIntent, getApplication()) val shareAppsActivities = getIntentActivities(shareIntent, getApplication())
var apps = buildAppsList(shareAppsActivities, getApplication()) var apps = buildAppsList(shareAppsActivities, getApplication())
recentAppsStorage.updateDatabaseWithNewApps(apps.map { app -> app.packageName }) recentAppsStorage.updateDatabaseWithNewApps(apps.map { app -> app.activityName })
val recentApps = buildRecentAppsList(apps) val recentApps = buildRecentAppsList(apps)
apps = filterOutRecentApps(apps, recentApps) apps = filterOutRecentApps(apps, recentApps)
@ -117,7 +117,7 @@ class ShareViewModel(application: Application) : AndroidViewModel(application) {
val result: MutableList<AppShareOption> = ArrayList() val result: MutableList<AppShareOption> = ArrayList()
for (recentApp in recentAppsDatabase) { for (recentApp in recentAppsDatabase) {
for (app in apps) { for (app in apps) {
if (recentApp.packageName == app.packageName) { if (recentApp.activityName == app.activityName) {
result.add(app) result.add(app)
} }
} }

@ -32,7 +32,7 @@ class AppShareAdapter(
private object DiffCallback : DiffUtil.ItemCallback<AppShareOption>() { private object DiffCallback : DiffUtil.ItemCallback<AppShareOption>() {
override fun areItemsTheSame(oldItem: AppShareOption, newItem: AppShareOption) = override fun areItemsTheSame(oldItem: AppShareOption, newItem: AppShareOption) =
oldItem.packageName == newItem.packageName oldItem.activityName == newItem.activityName
override fun areContentsTheSame(oldItem: AppShareOption, newItem: AppShareOption) = override fun areContentsTheSame(oldItem: AppShareOption, newItem: AppShareOption) =
oldItem == newItem oldItem == newItem

Loading…
Cancel
Save