From 0df39a1136eeda0bf42ba1886f04b6a4a07a6d41 Mon Sep 17 00:00:00 2001 From: Ax333l Date: Fri, 5 Apr 2024 19:09:39 +0200 Subject: [PATCH] refactor: replace deprecated functions --- app/build.gradle.kts | 5 +++-- .../main/java/app/revanced/manager/MainActivity.kt | 2 +- .../data/room/apps/installed/InstalledAppDao.kt | 7 ++++--- .../revanced/manager/data/room/options/OptionDao.kt | 5 ++--- .../manager/data/room/selection/SelectionDao.kt | 12 +++++++----- .../app/revanced/manager/ui/component/AppIcon.kt | 2 +- .../app/revanced/manager/ui/component/AppLabel.kt | 2 +- .../manager/ui/component/patches/OptionFields.kt | 4 ++-- .../revanced/manager/ui/screen/AppSelectorScreen.kt | 4 ++-- .../revanced/manager/ui/screen/DashboardScreen.kt | 4 ++-- .../manager/ui/screen/InstalledAppsScreen.kt | 4 ++-- .../manager/ui/screen/PatchesSelectorScreen.kt | 7 ++----- .../manager/ui/screen/SelectedAppInfoScreen.kt | 6 +++--- .../app/revanced/manager/ui/screen/SettingsScreen.kt | 7 +++---- .../manager/ui/screen/VersionSelectorScreen.kt | 3 --- .../ui/screen/settings/AboutSettingsScreen.kt | 4 ++-- .../ui/screen/settings/AdvancedSettingsScreen.kt | 4 ++-- .../manager/ui/screen/settings/ContributorScreen.kt | 5 ++--- .../ui/screen/settings/DownloadsSettingsScreen.kt | 4 ++-- .../ui/screen/settings/ImportExportSettingsScreen.kt | 4 ++-- .../ui/screen/settings/update/ChangelogsScreen.kt | 4 ++-- .../ui/screen/settings/update/UpdateScreen.kt | 4 ++-- .../screen/settings/update/UpdatesSettingsScreen.kt | 4 ++-- gradle/libs.versions.toml | 6 ++++-- 24 files changed, 55 insertions(+), 58 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f5e4fd54..e11dd0e6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -124,8 +124,9 @@ dependencies { // Accompanist implementation(libs.accompanist.drawablepainter) - implementation(libs.accompanist.webview) - implementation(libs.accompanist.placeholder) + + // Placeholder + implementation(libs.placeholder.material3) // HTML Scraper implementation(libs.skrapeit.dsl) diff --git a/app/src/main/java/app/revanced/manager/MainActivity.kt b/app/src/main/java/app/revanced/manager/MainActivity.kt index a2d0c855..e3202399 100644 --- a/app/src/main/java/app/revanced/manager/MainActivity.kt +++ b/app/src/main/java/app/revanced/manager/MainActivity.kt @@ -35,7 +35,7 @@ import dev.olshevski.navigation.reimagined.pop import dev.olshevski.navigation.reimagined.popUpTo import dev.olshevski.navigation.reimagined.rememberNavController import org.koin.core.parameter.parametersOf -import org.koin.androidx.compose.getViewModel as getComposeViewModel +import org.koin.androidx.compose.koinViewModel as getComposeViewModel import org.koin.androidx.viewmodel.ext.android.getViewModel as getAndroidViewModel class MainActivity : ComponentActivity() { diff --git a/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt index 90d40b9f..c290cc5e 100644 --- a/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt +++ b/app/src/main/java/app/revanced/manager/data/room/apps/installed/InstalledAppDao.kt @@ -3,7 +3,7 @@ package app.revanced.manager.data.room.apps.installed import androidx.room.Dao import androidx.room.Delete import androidx.room.Insert -import androidx.room.MapInfo +import androidx.room.MapColumn import androidx.room.Query import androidx.room.Transaction import androidx.room.Upsert @@ -17,12 +17,13 @@ interface InstalledAppDao { @Query("SELECT * FROM installed_app WHERE current_package_name = :packageName") suspend fun get(packageName: String): InstalledApp? - @MapInfo(keyColumn = "bundle", valueColumn = "patch_name") @Query( "SELECT bundle, patch_name FROM applied_patch" + " WHERE package_name = :packageName" ) - suspend fun getPatchesSelection(packageName: String): Map> + suspend fun getPatchesSelection(packageName: String): Map<@MapColumn("bundle") Int, List<@MapColumn( + "patch_name" + ) String>> @Transaction suspend fun upsertApp(installedApp: InstalledApp, appliedPatches: List) { diff --git a/app/src/main/java/app/revanced/manager/data/room/options/OptionDao.kt b/app/src/main/java/app/revanced/manager/data/room/options/OptionDao.kt index fa343a6d..5a147f6f 100644 --- a/app/src/main/java/app/revanced/manager/data/room/options/OptionDao.kt +++ b/app/src/main/java/app/revanced/manager/data/room/options/OptionDao.kt @@ -2,7 +2,7 @@ package app.revanced.manager.data.room.options import androidx.room.Dao import androidx.room.Insert -import androidx.room.MapInfo +import androidx.room.MapColumn import androidx.room.Query import androidx.room.Transaction import kotlinx.coroutines.flow.Flow @@ -10,13 +10,12 @@ import kotlinx.coroutines.flow.Flow @Dao abstract class OptionDao { @Transaction - @MapInfo(keyColumn = "patch_bundle") @Query( "SELECT patch_bundle, `group`, patch_name, `key`, value FROM option_groups" + " LEFT JOIN options ON uid = options.`group`" + " WHERE package_name = :packageName" ) - abstract suspend fun getOptions(packageName: String): Map> + abstract suspend fun getOptions(packageName: String): Map<@MapColumn("patch_bundle") Int, List