Refactor favorites and searchable database

This commit is contained in:
MM20
2023-04-10 22:44:05 +02:00
parent 582c94b6af
commit ed70097c38
49 changed files with 1238 additions and 501 deletions
+2 -1
View File
@@ -132,7 +132,7 @@ dependencies {
implementation(project(":core:crashreporter"))
implementation(project(":data:currencies"))
implementation(project(":data:customattrs"))
implementation(project(":data:favorites"))
implementation(project(":data:searchable"))
implementation(project(":data:files"))
implementation(project(":libs:g-services"))
implementation(project(":core:i18n"))
@@ -157,6 +157,7 @@ dependencies {
implementation(project(":data:search-actions"))
implementation(project(":services:global-actions"))
implementation(project(":services:widgets"))
implementation(project(":services:favorites"))
// Uncomment this if you want annoying notifications in your debug builds yelling at you how terrible your code is
//debugImplementation(libs.leakcanary)
@@ -13,7 +13,7 @@ import de.mm20.launcher2.calculator.calculatorModule
import de.mm20.launcher2.calendar.calendarModule
import de.mm20.launcher2.contacts.contactsModule
import de.mm20.launcher2.data.customattrs.customAttrsModule
import de.mm20.launcher2.favorites.favoritesModule
import de.mm20.launcher2.searchable.searchableModule
import de.mm20.launcher2.files.filesModule
import de.mm20.launcher2.icons.iconsModule
import de.mm20.launcher2.music.musicModule
@@ -29,6 +29,7 @@ import de.mm20.launcher2.notifications.notificationsModule
import de.mm20.launcher2.permissions.permissionsModule
import de.mm20.launcher2.preferences.preferencesModule
import de.mm20.launcher2.searchactions.searchActionsModule
import de.mm20.launcher2.services.favorites.favoritesModule
import de.mm20.launcher2.services.tags.servicesTagsModule
import de.mm20.launcher2.services.widgets.widgetsServiceModule
import de.mm20.launcher2.weather.weatherModule
@@ -67,6 +68,7 @@ class LauncherApplication : Application(), CoroutineScope, ImageLoaderFactory {
customAttrsModule,
databaseModule,
favoritesModule,
searchableModule,
filesModule,
globalActionsModule,
iconsModule,
@@ -1,23 +1,21 @@
package de.mm20.launcher2.activity
import android.app.Activity
import android.content.Context
import android.content.pm.LauncherApps
import android.os.Bundle
import de.mm20.launcher2.favorites.FavoritesRepository
import de.mm20.launcher2.searchable.SearchableRepository
import de.mm20.launcher2.search.data.AppShortcut
import de.mm20.launcher2.search.data.LauncherShortcut
import de.mm20.launcher2.services.favorites.FavoritesService
import org.koin.android.ext.android.inject
class AddItemActivity : Activity() {
val favoritesRepository: FavoritesRepository by inject()
private val favoritesService: FavoritesService by inject()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val shortcut = AppShortcut.fromPinRequestIntent(this, intent)
if (shortcut != null) {
favoritesRepository.pinItem(shortcut)
favoritesService.pinItem(shortcut)
}
finish()
}