From 616c2f41d12daf8e79b13c44ec42a862b4e9d08f Mon Sep 17 00:00:00 2001 From: althafvly Date: Mon, 23 Dec 2024 19:58:49 +0530 Subject: [PATCH 01/15] apps: Update gradle deps --- app/build.gradle | 138 +++++++++--------- .../foundation/e/apps/AppLoungeApplication.kt | 4 +- .../install/pkg/AppLoungePackageManager.kt | 15 +- .../splitinstall/SplitInstallBinder.kt | 1 + .../java/foundation/e/apps/ui/MainActivity.kt | 2 +- .../ApplicationListFragment.kt | 3 +- .../foundation/e/apps/ui/home/HomeFragment.kt | 3 +- .../e/apps/ui/purchase/AppPurchaseFragment.kt | 3 +- .../e/apps/ui/search/SearchFragment.kt | 8 +- .../signin/google/GoogleSignInFragment.kt | 3 +- .../e/apps/ui/updates/UpdatesFragment.kt | 7 +- .../e/apps/utils/StorageComputer.kt | 3 +- build.gradle | 18 ++- gradle.properties | 1 - gradle/wrapper/gradle-wrapper.properties | 4 +- settings.gradle | 8 +- 16 files changed, 110 insertions(+), 111 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6592d9072..ace28eeb4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,14 +43,14 @@ def getSentryDsn = { -> } android { - compileSdk 34 + compileSdk = 35 defaultConfig { - applicationId "foundation.e.apps" - minSdk 26 - targetSdk 30 - versionCode versionMajor * 1000000 + versionMinor * 1000 + versionPatch - versionName "${versionMajor}.${versionMinor}.${versionPatch}" + applicationId = "foundation.e.apps" + minSdk = 30 + targetSdk = 35 + versionCode = versionMajor * 1000000 + versionMinor * 1000 + versionPatch + versionName = "${versionMajor}.${versionMinor}.${versionPatch}" buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\"" buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"") @@ -60,7 +60,7 @@ android { manifestPlaceholders = [parentalControlPkgName: parentalControlPkgName] buildConfigField "String", "PACKAGE_NAME_PARENTAL_CONTROL", "\"${parentalControlPkgName}\"" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } signingConfigs { @@ -72,22 +72,22 @@ android { keyPassword "platform" } releaseTestConfig { - storeFile file("../keystore/proprietary.keystore") - storePassword keystore_password - keyAlias 'platform.test' - keyPassword keystore_password + storeFile = file("../keystore/proprietary.keystore") + storePassword = keystore_password + keyAlias = 'platform.test' + keyPassword = keystore_password } releaseCommunityConfig { - storeFile file("../keystore/proprietary.keystore") - storePassword keystore_password - keyAlias 'platform.dev' - keyPassword keystore_password + storeFile = file("../keystore/proprietary.keystore") + storePassword = keystore_password + keyAlias = 'platform.dev' + keyPassword = keystore_password } releaseOfficialConfig { - storeFile file("../keystore/proprietary.keystore") - storePassword keystore_password - keyAlias 'platform.stable' - keyPassword keystore_password + storeFile = file("../keystore/proprietary.keystore") + storePassword = keystore_password + keyAlias = 'platform.stable' + keyPassword = keystore_password } } @@ -111,28 +111,28 @@ android { buildTypes { debug { - signingConfig signingConfigs.debugConfig + signingConfig = signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } release { - minifyEnabled false + minifyEnabled = false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } releaseTest { - minifyEnabled false - signingConfig signingConfigs.releaseTestConfig + minifyEnabled = false + signingConfig = signingConfigs.releaseTestConfig sourceSets proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } releaseCommunity { - minifyEnabled false - signingConfig signingConfigs.releaseCommunityConfig + minifyEnabled = false + signingConfig = signingConfigs.releaseCommunityConfig sourceSets proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } releaseOfficial { - minifyEnabled false - signingConfig signingConfigs.releaseOfficialConfig + minifyEnabled = false + signingConfig = signingConfigs.releaseOfficialConfig proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } @@ -143,21 +143,22 @@ android { } } buildFeatures { - viewBinding true - aidl true + buildConfig = true + viewBinding = true + aidl = true } compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = '17' } lint { - lintConfig file('lint.xml') + lintConfig = file('lint.xml') } - namespace 'foundation.e.apps' - kotlin.sourceSets.all { + namespace = 'foundation.e.apps' + kotlin.sourceSets.configureEach { languageSettings.optIn("kotlin.RequiresOptIn") } } @@ -182,27 +183,27 @@ dependencies { implementation 'foundation.e.lib:telemetry:0.0.11-alpha' implementation 'foundation.e:gplayapi:3.4.2-0' - implementation 'androidx.core:core-ktx:1.9.0' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'androidx.fragment:fragment-ktx:1.5.6' - implementation 'com.google.android.material:material:1.5.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.3' + implementation 'androidx.core:core-ktx:1.15.0' + implementation 'androidx.appcompat:appcompat:1.7.0' + implementation 'androidx.fragment:fragment-ktx:1.8.5' + implementation 'com.google.android.material:material:1.12.0' + implementation 'androidx.constraintlayout:constraintlayout:2.2.0' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.preference:preference-ktx:1.2.0' - implementation "androidx.datastore:datastore-preferences:1.0.0" + implementation 'androidx.preference:preference-ktx:1.2.1' + implementation "androidx.datastore:datastore-preferences:1.1.1" implementation 'com.facebook.shimmer:shimmer:0.5.0' - implementation 'androidx.core:core-google-shortcuts:1.0.0' + implementation 'androidx.core:core-google-shortcuts:1.1.0' debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' - testImplementation "com.google.truth:truth:1.1.3" + testImplementation "com.google.truth:truth:1.1.4" testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' + androidTestImplementation 'androidx.test.ext:junit:1.2.1' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' // Optional -- Robolectric environment - testImplementation "androidx.test:core:1.5.0" + testImplementation "androidx.test:core:1.6.1" // Optional -- Mockito framework - testImplementation "org.mockito:mockito-core:5.0.0" + testImplementation "org.mockito:mockito-core:5.14.2" // Optional -- mockito-kotlin - testImplementation "org.mockito.kotlin:mockito-kotlin:4.1.0" + testImplementation "org.mockito.kotlin:mockito-kotlin:5.4.0" testImplementation 'org.mockito:mockito-inline:5.0.0' testImplementation "androidx.arch.core:core-testing:2.2.0" @@ -213,12 +214,12 @@ dependencies { implementation 'com.github.Baseflow:PhotoView:2.3.0' //Protobuf and Gson - implementation 'com.google.code.gson:gson:2.9.0' - implementation "com.google.protobuf:protobuf-javalite:3.25.2" + implementation 'com.google.code.gson:gson:2.11.0' + implementation "com.google.protobuf:protobuf-javalite:4.28.2" // ViewPager2 and RecyclerView - implementation "androidx.viewpager2:viewpager2:1.0.0" - implementation "androidx.recyclerview:recyclerview:1.2.1" + implementation "androidx.viewpager2:viewpager2:1.1.0" + implementation "androidx.recyclerview:recyclerview:1.3.2" //logger implementation 'com.jakewharton.timber:timber:5.0.1' @@ -227,43 +228,42 @@ dependencies { implementation 'org.bouncycastle:bcpg-jdk15on:1.60' // Retrofit - def retrofit_version = "2.9.0" + def retrofit_version = "2.11.0" implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version" implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version" - implementation "com.squareup.moshi:moshi-kotlin:1.13.0" -// implementation "com.squareup.moshi:moshi-adapters:1.5.0" - implementation "com.squareup.okhttp3:okhttp:4.9.2" - implementation "com.squareup.okhttp3:logging-interceptor:4.9.2" + implementation "com.squareup.moshi:moshi-kotlin:1.15.1" + implementation "com.squareup.okhttp3:okhttp:4.12.0" + implementation "com.squareup.okhttp3:logging-interceptor:4.11.0" // JSON Converter - implementation 'com.squareup.retrofit2:converter-gson:2.5.0' + implementation 'com.squareup.retrofit2:converter-gson:2.11.0' // YAML factory - implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.2" + implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0" // Navigation Components - def navigation_version = "2.6.0" + def navigation_version = "2.8.5" implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" // Hilt - def hilt_version = '2.51.1' + def hilt_version = '2.54' kapt "com.google.dagger:hilt-compiler:$hilt_version" implementation "com.google.dagger:hilt-android:$hilt_version" - implementation 'androidx.hilt:hilt-work:1.0.0' - kapt 'androidx.hilt:hilt-compiler:1.0.0' + implementation 'androidx.hilt:hilt-work:1.2.0' + kapt 'androidx.hilt:hilt-compiler:1.2.0' // Lifecycle Components - def lifecycle_version = "2.6.1" + def lifecycle_version = "2.8.7" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "android.arch.lifecycle:extensions:1.1.1" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // Coroutines - def coroutines_version = "1.6.0" - def test_kotlin_version = "1.6.0" + def coroutines_version = "1.9.0" + def test_kotlin_version = "2.1.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" @@ -275,15 +275,15 @@ dependencies { implementation "androidx.room:room-runtime:2.6.1" // WorkManager - implementation 'androidx.work:work-runtime-ktx:2.7.1' + implementation 'androidx.work:work-runtime-ktx:2.10.0' // JSoup - implementation 'org.jsoup:jsoup:1.13.1' + implementation 'org.jsoup:jsoup:1.17.2' // elib implementation 'foundation.e:elib:0.0.1-alpha11' // androidx.activity - def activity_version = "1.6.1" + def activity_version = "1.9.3" implementation("androidx.activity:activity-ktx:$activity_version") } diff --git a/app/src/main/java/foundation/e/apps/AppLoungeApplication.kt b/app/src/main/java/foundation/e/apps/AppLoungeApplication.kt index 12af89dcf..b73bdd45a 100644 --- a/app/src/main/java/foundation/e/apps/AppLoungeApplication.kt +++ b/app/src/main/java/foundation/e/apps/AppLoungeApplication.kt @@ -110,8 +110,8 @@ class AppLoungeApplication : Application(), Configuration.Provider { ) } - override fun getWorkManagerConfiguration() = - Configuration.Builder() + override val workManagerConfiguration: Configuration + get() = Configuration.Builder() .setWorkerFactory(workerFactory) .setExecutor(Executors.newSingleThreadExecutor()) .build() diff --git a/app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt b/app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt index e61c84164..5702c878b 100644 --- a/app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt +++ b/app/src/main/java/foundation/e/apps/install/pkg/AppLoungePackageManager.kt @@ -139,12 +139,8 @@ class AppLoungePackageManager @Inject constructor( fun getInstallerName(packageName: String): String { return try { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { - val installerInfo = packageManager.getInstallSourceInfo(packageName) - installerInfo.originatingPackageName ?: installerInfo.installingPackageName ?: UNKNOWN_VALUE - } else { - packageManager.getInstallerPackageName(packageName) ?: UNKNOWN_VALUE - } + val installerInfo = packageManager.getInstallSourceInfo(packageName) + installerInfo.originatingPackageName ?: installerInfo.installingPackageName ?: UNKNOWN_VALUE } catch (e: NameNotFoundException) { Timber.e("getInstallerName -> $packageName : ${e.localizedMessage}") UNKNOWN_VALUE @@ -164,12 +160,7 @@ class AppLoungePackageManager @Inject constructor( fun getVersionCode(packageName: String): String { val packageInfo = getPackageInfo(packageName) - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - packageInfo?.longVersionCode?.toString() ?: UNKNOWN_VALUE - } else { - @Suppress("DEPRECATION") - packageInfo?.versionCode?.toString() ?: UNKNOWN_VALUE - } + return packageInfo?.longVersionCode?.toString() ?: UNKNOWN_VALUE } fun getVersionName(packageName: String): String { diff --git a/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt b/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt index 557d5ba3d..69bc60957 100644 --- a/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt +++ b/app/src/main/java/foundation/e/apps/install/splitinstall/SplitInstallBinder.kt @@ -113,6 +113,7 @@ class SplitInstallBinder( if (ignoreList != null && packageName in ignoreList) return val appInfo = context.packageManager.getPackageInfo(packageName, 0).applicationInfo + ?: return val appLabel = context.packageManager.getApplicationLabel(appInfo) val callerUid = appInfo.uid val contentText = context.getString( diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt index 59d88fcd0..826441220 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt @@ -127,7 +127,7 @@ class MainActivity : AppCompatActivity() { checkGPlayLoginRequest(intent) } - override fun onNewIntent(intent: Intent?) { + override fun onNewIntent(intent: Intent) { super.onNewIntent(intent) checkGPlayLoginRequest(intent) findNavController(R.id.fragment).handleDeepLink(intent) diff --git a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListFragment.kt b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListFragment.kt index 3c5fc507d..895c01334 100644 --- a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListFragment.kt @@ -48,6 +48,7 @@ import foundation.e.apps.ui.PrivacyInfoViewModel import foundation.e.apps.ui.application.subFrags.ApplicationDialogFragment import foundation.e.apps.ui.parentFragment.TimeoutFragment import kotlinx.coroutines.launch +import java.util.Locale import javax.inject.Inject @AndroidEntryPoint @@ -321,7 +322,7 @@ class ApplicationListFragment : ) viewHolder?.let { (viewHolder as ApplicationListRVAdapter.ViewHolder).binding.installButton.text = - String.format("%d%%", progress) + String.format(Locale.getDefault(), "%d%%", progress) } } } diff --git a/app/src/main/java/foundation/e/apps/ui/home/HomeFragment.kt b/app/src/main/java/foundation/e/apps/ui/home/HomeFragment.kt index b349adb42..3992a2b68 100644 --- a/app/src/main/java/foundation/e/apps/ui/home/HomeFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/home/HomeFragment.kt @@ -48,6 +48,7 @@ import foundation.e.apps.ui.home.model.HomeParentRVAdapter import foundation.e.apps.ui.parentFragment.TimeoutFragment import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import java.util.Locale import javax.inject.Inject @AndroidEntryPoint @@ -246,7 +247,7 @@ class HomeFragment : TimeoutFragment(R.layout.fragment_home), ApplicationInstall ) childViewHolder?.let { (childViewHolder as HomeChildRVAdapter.ViewHolder).binding.installButton.text = - String.format("%d%%", progress) + String.format(Locale.getDefault(),"%d%%", progress) } } } diff --git a/app/src/main/java/foundation/e/apps/ui/purchase/AppPurchaseFragment.kt b/app/src/main/java/foundation/e/apps/ui/purchase/AppPurchaseFragment.kt index c49336d72..218da4fcc 100644 --- a/app/src/main/java/foundation/e/apps/ui/purchase/AppPurchaseFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/purchase/AppPurchaseFragment.kt @@ -97,8 +97,7 @@ class AppPurchaseFragment : Fragment() { binding.playStoreWebView.apply { settings.apply { allowContentAccess = true - databaseEnabled = true - domStorageEnabled = true + domStorageEnabled = true // Replaces databaseEnabled for local storage support javaScriptEnabled = true // Google Play page is tested to not work otherwise cacheMode = WebSettings.LOAD_DEFAULT } diff --git a/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt b/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt index c0de63525..17237c92b 100644 --- a/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt @@ -65,6 +65,7 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Job import kotlinx.coroutines.delay import kotlinx.coroutines.launch +import java.util.Locale import javax.inject.Inject @AndroidEntryPoint @@ -399,7 +400,7 @@ class SearchFragment : ) viewHolder?.let { (viewHolder as ApplicationListRVAdapter.ViewHolder).binding.installButton.text = - String.format("%d%%", progress) + String.format(Locale.getDefault(), "%d%%", progress) } } } @@ -517,7 +518,10 @@ class SearchFragment : isAccessible = true get(searchView) as EditText }?.onSuccess { - inputMethodManager.showSoftInput(it, InputMethodManager.SHOW_FORCED) + // Instead of forcing the keyboard to show, you should use + // InputMethodManager.SHOW_IMPLICIT, which is the recommended + // way to request the keyboard in modern Android development. + inputMethodManager.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT) } } diff --git a/app/src/main/java/foundation/e/apps/ui/setup/signin/google/GoogleSignInFragment.kt b/app/src/main/java/foundation/e/apps/ui/setup/signin/google/GoogleSignInFragment.kt index 94b5d1fa5..fcd2e3d3a 100644 --- a/app/src/main/java/foundation/e/apps/ui/setup/signin/google/GoogleSignInFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/setup/signin/google/GoogleSignInFragment.kt @@ -91,8 +91,7 @@ class GoogleSignInFragment : Fragment(R.layout.fragment_google_signin) { binding.webview.apply { settings.apply { allowContentAccess = true - databaseEnabled = true - domStorageEnabled = true + domStorageEnabled = true // Replaces databaseEnabled for local storage support javaScriptEnabled = true cacheMode = WebSettings.LOAD_DEFAULT } diff --git a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt index 941ec2f11..1903a68f9 100644 --- a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt @@ -64,6 +64,7 @@ import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.filter import kotlinx.coroutines.launch import timber.log.Timber +import java.util.Locale import javax.inject.Inject @AndroidEntryPoint @@ -183,7 +184,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI } } - private fun shouldUpdateButtonEnable(workInfoList: MutableList) = + private fun shouldUpdateButtonEnable(workInfoList: List) = !updatesViewModel.updatesList.value?.first.isNullOrEmpty() && ( workInfoList.isNullOrEmpty() || @@ -303,7 +304,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI } private fun hasAnyPendingUpdates( - workInfoList: MutableList + workInfoList: List ): Boolean { val errorStates = listOf( WorkInfo.State.FAILED, @@ -370,7 +371,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI ) viewHolder?.let { (viewHolder as ApplicationListRVAdapter.ViewHolder).binding.installButton.text = - String.format("%d%%", progress) + String.format(Locale.getDefault(), "%d%%", progress); } } } diff --git a/app/src/main/java/foundation/e/apps/utils/StorageComputer.kt b/app/src/main/java/foundation/e/apps/utils/StorageComputer.kt index e3ca3c403..8d77b40e8 100644 --- a/app/src/main/java/foundation/e/apps/utils/StorageComputer.kt +++ b/app/src/main/java/foundation/e/apps/utils/StorageComputer.kt @@ -22,6 +22,7 @@ import android.os.StatFs import foundation.e.apps.data.install.models.AppInstall import java.text.CharacterIterator import java.text.StringCharacterIterator +import java.util.Locale object StorageComputer { fun spaceMissing(appInstall: AppInstall): Long { @@ -48,6 +49,6 @@ object StorageComputer { bytes /= 1000 ci.next() } - return String.format("%.1f %cB", bytes / 1000.0, ci.current()) + return String.format(Locale.getDefault(),"%.1f %cB", bytes / 1000.0, ci.current()) } } diff --git a/build.gradle b/build.gradle index f5341756b..42871480a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,20 +1,22 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.1.0' apply false - id 'com.android.library' version '8.1.0' apply false + id 'com.android.application' version '8.7.3' apply false + id 'com.android.library' version '8.7.3' apply false id 'org.jetbrains.kotlin.android' version '2.0.21' apply false id "org.jetbrains.kotlin.plugin.allopen" version "2.0.21" id 'org.jetbrains.kotlin.jvm' version '2.0.21' apply false - id 'com.google.dagger.hilt.android' version '2.51.1' apply false - id 'androidx.navigation.safeargs' version '2.5.3' apply false + id 'com.google.dagger.hilt.android' version '2.54' apply false + id 'androidx.navigation.safeargs' version '2.8.5' apply false id 'io.gitlab.arturbosch.detekt' version '1.23.1' } allprojects { - tasks.withType(JavaCompile) { - options.deprecation = true - options.compilerArgs += ['-Werror'] + tasks.withType(JavaCompile).tap { + configureEach { + options.deprecation = true + options.compilerArgs += ['-Werror'] + } } } @@ -38,7 +40,7 @@ subprojects { } } -task clean(type: Delete) { +tasks.register('clean', Delete) { delete rootProject.buildDir } diff --git a/gradle.properties b/gradle.properties index 63b8f402f..e080be130 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,6 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official -android.defaults.buildfeatures.buildconfig=true android.nonTransitiveRClass=false android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index fb45f10f5..6a66ab375 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Aug 17 09:40:45 CEST 2023 +#Wed Jan 01 17:01:03 IST 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/settings.gradle b/settings.gradle index d222ecead..0b3590379 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,8 +10,8 @@ dependencyResolutionManagement { repositories { google() mavenCentral() - maven { url 'https://jitpack.io' } - maven { url 'https://gitlab.e.foundation/api/v4/groups/9/-/packages/maven'} + maven { url = 'https://jitpack.io' } + maven { url = 'https://gitlab.e.foundation/api/v4/groups/9/-/packages/maven'} // Gitlab repository configuration for gplayapi dependency def ciJobToken = System.getenv("CI_JOB_TOKEN") @@ -45,8 +45,8 @@ dependencyResolutionManagement { localProperties.load(new FileInputStream(rootProject.projectDir.path + "/local.properties")) maven { - url "https://gitlab.e.foundation/api/v4/projects/1269/packages/maven" - name "GitLab" + url = "https://gitlab.e.foundation/api/v4/projects/1269/packages/maven" + name = "GitLab" credentials(HttpHeaderCredentials) { name = 'Private-Token' -- GitLab From 228720fafc2b25f6c348cd9bd208d2ab117e525a Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 1 Jan 2025 12:14:52 +0530 Subject: [PATCH 02/15] feat: add incrementing versionCode and versionName --- app/.gitignore | 3 ++- app/build.gradle | 66 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 6 deletions(-) diff --git a/app/.gitignore b/app/.gitignore index 42afabfd2..cdb86eeb6 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,2 @@ -/build \ No newline at end of file +version.properties +/build diff --git a/app/build.gradle b/app/build.gradle index ace28eeb4..ee08430f1 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,9 +10,9 @@ plugins { id 'kotlin-parcelize' } -def versionMajor = 2 -def versionMinor = 12 -def versionPatch = 3 +def appVersionMajor = 2 +def appVersionMinor = 12 +def appVersionPatch = 3 def getGitHash = { -> def stdOut = new ByteArrayOutputStream() @@ -43,14 +43,70 @@ def getSentryDsn = { -> } android { + def versionPropsFile = file('version.properties') + Properties versionProps = new Properties() + + if (!versionPropsFile.exists()) { + versionProps['VERSION_CHANGE'] = '0' + versionProps['VERSION_MAJOR'] = appVersionMajor.toString() + versionProps['VERSION_MINOR'] = appVersionMinor.toString() + versionProps['VERSION_PATCH'] = appVersionPatch.toString() + versionProps['VERSION_CODE'] = (appVersionMajor * 1000000 + appVersionMinor * 1000 + appVersionPatch).toString() + versionProps.store(versionPropsFile.newWriter(), null) + } + + def getVersionCode = { -> + if (versionPropsFile.canRead()) { + versionProps.load(new FileInputStream(versionPropsFile)) + def versionChange = versionProps['VERSION_CHANGE'].toInteger() + 1 + def versionMinor = versionProps['VERSION_MINOR'].toInteger() + def versionMajor = versionProps['VERSION_MAJOR'].toInteger() + def versionPatch = versionProps['VERSION_PATCH'].toInteger() + // Up version on each 100 cycles of builds + if (versionChange >= 100) { + versionPatch = versionProps['VERSION_PATCH'].toInteger() + 1 + versionChange = 0 + } + if (versionPatch == 9) { + versionMinor = versionProps['VERSION_MINOR'].toInteger() + 1 + versionPatch = 0 + } + if (versionMinor == 9) { + versionMajor = versionProps['VERSION_MAJOR'].toInteger() + 1 + versionMinor = 0 + } + def versionCode = versionProps['VERSION_CODE'].toInteger() + + versionProps['VERSION_CHANGE'] = versionChange.toString() + versionProps['VERSION_PATCH'] = versionPatch.toString() + versionProps['VERSION_MINOR'] = versionMinor.toString() + versionProps['VERSION_MAJOR'] = versionMajor.toString() + versionProps['VERSION_CODE'] = (versionCode.toInteger() + 1).toString() + versionProps.store(versionPropsFile.newWriter(), null) + return versionCode + } + } + + def getVersionName = { -> + if (versionPropsFile.canRead()) { + versionProps.load(new FileInputStream(versionPropsFile)) + + def versionMajor = versionProps['VERSION_MAJOR'] + def versionMinor = versionProps['VERSION_MINOR'] + def versionPatch = versionProps['VERSION_PATCH'] + + return "${versionMajor}.${versionMinor}.${versionPatch}" + } + } + compileSdk = 35 defaultConfig { applicationId = "foundation.e.apps" minSdk = 30 targetSdk = 35 - versionCode = versionMajor * 1000000 + versionMinor * 1000 + versionPatch - versionName = "${versionMajor}.${versionMinor}.${versionPatch}" + versionCode = getVersionCode() + versionName = getVersionName() buildConfigField "String", "BUILD_ID", "\"${getGitHash() + "." + getDate()}\"" buildConfigField("String", "SENTRY_DSN", "\"${getSentryDsn()}\"") -- GitLab From 054744b02827380b3f25348e8d7e261ddea7cb04 Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 1 Jan 2025 16:36:14 +0530 Subject: [PATCH 03/15] apps: Minor refactor --- .../java/foundation/e/apps/ui/updates/UpdatesFragment.kt | 6 +++--- .../java/foundation/e/apps/ui/updates/UpdatesViewModel.kt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt index 1903a68f9..e7d84bd92 100644 --- a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt @@ -164,7 +164,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI private fun handleStateNoUpdates(list: List?) { if (!list.isNullOrEmpty()) { binding.button.isEnabled = true - initUpdataAllButton() + initUpdateAllButton() binding.noUpdates.visibility = View.GONE } else { binding.noUpdates.visibility = View.VISIBLE @@ -284,10 +284,10 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI clearAndRestartGPlayLogin() true } - initUpdataAllButton() + initUpdateAllButton() } - private fun initUpdataAllButton() { + private fun initUpdateAllButton() { binding.button.setOnClickListener { UpdatesWorkManager.startUpdateAllWork(requireContext()) observeUpdateWork() diff --git a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesViewModel.kt b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesViewModel.kt index 77214dc20..42045a30f 100644 --- a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesViewModel.kt @@ -63,7 +63,7 @@ class UpdatesViewModel @Inject constructor( }, retryBlock) } - fun getUpdates(authData: AuthData?) { + private fun getUpdates(authData: AuthData?) { viewModelScope.launch { val updatesResult = if (authData != null) updatesManagerRepository.getUpdates(authData) -- GitLab From 1c42f9045315522f5cf5f00943db28b6f881029c Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 1 Jan 2025 18:59:52 +0530 Subject: [PATCH 04/15] feat: Migrate from kapt to KSP --- app/build.gradle | 14 +++++--------- build.gradle | 7 ++++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ee08430f1..858a87b33 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -2,7 +2,7 @@ plugins { id 'com.android.application' id 'kotlin-android' - id 'kotlin-kapt' + id 'com.google.devtools.ksp' id 'org.jlleitschuh.gradle.ktlint' version '10.2.0' id 'androidx.navigation.safeargs.kotlin' id 'com.google.dagger.hilt.android' @@ -219,10 +219,6 @@ android { } } -kapt { - correctErrorTypes true -} - allOpen { // allows mocking for classes w/o directly opening them for release builds annotation 'foundation.e.apps.OpenClass' @@ -305,10 +301,10 @@ dependencies { // Hilt def hilt_version = '2.54' - kapt "com.google.dagger:hilt-compiler:$hilt_version" + ksp "com.google.dagger:hilt-compiler:$hilt_version" implementation "com.google.dagger:hilt-android:$hilt_version" implementation 'androidx.hilt:hilt-work:1.2.0' - kapt 'androidx.hilt:hilt-compiler:1.2.0' + ksp 'androidx.hilt:hilt-compiler:1.2.0' // Lifecycle Components def lifecycle_version = "2.8.7" @@ -318,7 +314,7 @@ dependencies { implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // Coroutines - def coroutines_version = "1.9.0" + def coroutines_version = "1.10.1" def test_kotlin_version = "2.1.0" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" @@ -326,7 +322,7 @@ dependencies { testImplementation "org.jetbrains.kotlin:kotlin-test:$test_kotlin_version" // Room - kapt "androidx.room:room-compiler:2.6.1" + ksp "androidx.room:room-compiler:2.6.1" implementation "androidx.room:room-ktx:2.6.1" implementation "androidx.room:room-runtime:2.6.1" diff --git a/build.gradle b/build.gradle index 42871480a..41f6ee20f 100644 --- a/build.gradle +++ b/build.gradle @@ -3,10 +3,11 @@ plugins { id 'com.android.application' version '8.7.3' apply false id 'com.android.library' version '8.7.3' apply false - id 'org.jetbrains.kotlin.android' version '2.0.21' apply false - id "org.jetbrains.kotlin.plugin.allopen" version "2.0.21" - id 'org.jetbrains.kotlin.jvm' version '2.0.21' apply false + id 'org.jetbrains.kotlin.android' version '2.1.0' apply false + id "org.jetbrains.kotlin.plugin.allopen" version "2.1.0" + id 'org.jetbrains.kotlin.jvm' version '2.1.0' apply false id 'com.google.dagger.hilt.android' version '2.54' apply false + id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false id 'androidx.navigation.safeargs' version '2.8.5' apply false id 'io.gitlab.arturbosch.detekt' version '1.23.1' } -- GitLab From dcecefb760bd443a76f194d24c02d07304cf5a91 Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 1 Jan 2025 19:05:13 +0530 Subject: [PATCH 05/15] feat: Update detekt --- build.gradle | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 41f6ee20f..e658ed403 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { id 'com.google.dagger.hilt.android' version '2.54' apply false id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false id 'androidx.navigation.safeargs' version '2.8.5' apply false - id 'io.gitlab.arturbosch.detekt' version '1.23.1' + id 'io.gitlab.arturbosch.detekt' version '1.23.7' } allprojects { @@ -23,12 +23,8 @@ allprojects { subprojects { detekt { - toolVersion = "1.23.1" - - source = files( - "src/main/java" - ) - + toolVersion = "1.23.7" + source.setFrom("src/main/java", "src/main/kotlin") config.setFrom("detekt.yml") baseline = file("detekt-baseline.xml") parallel = false -- GitLab From 0c0c20ac0a67cec7ebae38596064740d6576b3aa Mon Sep 17 00:00:00 2001 From: althafvly Date: Wed, 1 Jan 2025 19:15:51 +0530 Subject: [PATCH 06/15] feat: Refactor Gradle dependencies --- app/build.gradle | 193 ++++++++++++++++++++++++----------------------- 1 file changed, 100 insertions(+), 93 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 858a87b33..7bfcf39a3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -226,116 +226,123 @@ allOpen { } dependencies { + // Define versions + def activity_version = "1.9.3" + def appcompat_version = "1.7.0" + def constraintlayout_version = "2.2.0" + def core_ktx_version = "1.15.0" + def fragment_ktx_version = "1.8.5" + def material_version = "1.12.0" + def navigation_version = "2.8.5" + def lifecycle_version = "2.8.7" + def room_version = "2.6.1" + def workmanager_version = "2.10.0" + def coroutines_version = "1.10.1" + def retrofit_version = "2.11.0" + def okhttp_version = "4.12.0" + def moshi_version = "1.15.1" + def hilt_version = "2.54" + def test_kotlin_version = "2.1.0" - implementation project(':auth-data-lib') - implementation project(':parental-control-data') + // Project dependencies + implementation(project(":auth-data-lib")) + implementation(project(":parental-control-data")) + // Library dependencies // TODO: Add splitinstall-lib to a repo https://gitlab.e.foundation/e/os/backlog/-/issues/628 - api files('libs/splitinstall-lib.jar') - - implementation 'foundation.e.lib:telemetry:0.0.11-alpha' - implementation 'foundation.e:gplayapi:3.4.2-0' - implementation 'androidx.core:core-ktx:1.15.0' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'androidx.fragment:fragment-ktx:1.8.5' - implementation 'com.google.android.material:material:1.12.0' - implementation 'androidx.constraintlayout:constraintlayout:2.2.0' - implementation 'androidx.legacy:legacy-support-v4:1.0.0' - implementation 'androidx.preference:preference-ktx:1.2.1' - implementation "androidx.datastore:datastore-preferences:1.1.1" - implementation 'com.facebook.shimmer:shimmer:0.5.0' - implementation 'androidx.core:core-google-shortcuts:1.1.0' - debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7' - testImplementation "com.google.truth:truth:1.1.4" - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.2.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' - // Optional -- Robolectric environment - testImplementation "androidx.test:core:1.6.1" - // Optional -- Mockito framework - testImplementation "org.mockito:mockito-core:5.14.2" - // Optional -- mockito-kotlin - testImplementation "org.mockito.kotlin:mockito-kotlin:5.4.0" - testImplementation 'org.mockito:mockito-inline:5.0.0' - testImplementation "androidx.arch.core:core-testing:2.2.0" - - testImplementation "io.mockk:mockk:1.12.3" + api(files("libs/splitinstall-lib.jar")) + + // eFoundation libraries + implementation("foundation.e.lib:telemetry:0.0.11-alpha") + implementation("foundation.e:gplayapi:3.4.2-0") + implementation("foundation.e:elib:0.0.1-alpha11") + + // AndroidX libraries + implementation("androidx.core:core-ktx:$core_ktx_version") + implementation("androidx.appcompat:appcompat:$appcompat_version") + implementation("androidx.fragment:fragment-ktx:$fragment_ktx_version") + implementation("androidx.preference:preference-ktx:1.2.1") + implementation("androidx.constraintlayout:constraintlayout:$constraintlayout_version") + implementation("androidx.legacy:legacy-support-v4:1.0.0") + implementation("androidx.datastore:datastore-preferences:1.1.1") + implementation("androidx.viewpager2:viewpager2:1.1.0") + implementation("androidx.recyclerview:recyclerview:1.3.2") + implementation("androidx.navigation:navigation-fragment-ktx:$navigation_version") + implementation("androidx.navigation:navigation-ui-ktx:$navigation_version") + implementation("androidx.activity:activity-ktx:$activity_version") - // Coil and PhotoView - implementation "io.coil-kt:coil:1.4.0" - implementation 'com.github.Baseflow:PhotoView:2.3.0' + // Material Design + implementation("com.google.android.material:material:$material_version") - //Protobuf and Gson - implementation 'com.google.code.gson:gson:2.11.0' - implementation "com.google.protobuf:protobuf-javalite:4.28.2" + // Lifecycle Components + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version") + implementation("android.arch.lifecycle:extensions:1.1.1") - // ViewPager2 and RecyclerView - implementation "androidx.viewpager2:viewpager2:1.1.0" - implementation "androidx.recyclerview:recyclerview:1.3.2" + // WorkManager + implementation("androidx.work:work-runtime-ktx:$workmanager_version") - //logger - implementation 'com.jakewharton.timber:timber:5.0.1' + // Room + ksp("androidx.room:room-compiler:$room_version") + implementation("androidx.room:room-ktx:$room_version") + implementation("androidx.room:room-runtime:$room_version") - // Bouncy Castle - implementation 'org.bouncycastle:bcpg-jdk15on:1.60' + // Hilt + ksp("com.google.dagger:hilt-compiler:$hilt_version") + implementation("com.google.dagger:hilt-android:$hilt_version") + implementation("androidx.hilt:hilt-work:1.2.0") + ksp("androidx.hilt:hilt-compiler:1.2.0") - // Retrofit - def retrofit_version = "2.11.0" - implementation "com.squareup.retrofit2:retrofit:$retrofit_version" - implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version" - implementation "com.squareup.retrofit2:converter-jackson:$retrofit_version" - implementation "com.squareup.moshi:moshi-kotlin:1.15.1" - implementation "com.squareup.okhttp3:okhttp:4.12.0" - implementation "com.squareup.okhttp3:logging-interceptor:4.11.0" + // Facebook + implementation("com.facebook.shimmer:shimmer:0.5.0") - // JSON Converter - implementation 'com.squareup.retrofit2:converter-gson:2.11.0' + // Coroutines + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version") + testImplementation("org.jetbrains.kotlin:kotlin-test:$test_kotlin_version") + + // Testing dependencies + testImplementation("com.google.truth:truth:1.1.4") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + testImplementation("androidx.test:core:1.6.1") + testImplementation("org.mockito:mockito-core:5.14.2") + testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0") + testImplementation("org.mockito:mockito-inline:5.0.0") + testImplementation("androidx.arch.core:core-testing:2.2.0") + testImplementation("io.mockk:mockk:1.12.3") - // YAML factory - implementation "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0" + // Coil and PhotoView + implementation("io.coil-kt:coil:1.4.0") + implementation("com.github.Baseflow:PhotoView:2.3.0") - // Navigation Components - def navigation_version = "2.8.5" - implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" - implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" + // Protobuf and Gson + implementation("com.google.code.gson:gson:2.11.0") + implementation("com.google.protobuf:protobuf-javalite:4.28.2") - // Hilt - def hilt_version = '2.54' - ksp "com.google.dagger:hilt-compiler:$hilt_version" - implementation "com.google.dagger:hilt-android:$hilt_version" - implementation 'androidx.hilt:hilt-work:1.2.0' - ksp 'androidx.hilt:hilt-compiler:1.2.0' + // Logger + implementation("com.jakewharton.timber:timber:5.0.1") - // Lifecycle Components - def lifecycle_version = "2.8.7" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" - implementation "android.arch.lifecycle:extensions:1.1.1" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" + // Retrofit + implementation("com.squareup.retrofit2:retrofit:$retrofit_version") + implementation("com.squareup.retrofit2:converter-moshi:$retrofit_version") + implementation("com.squareup.retrofit2:converter-jackson:$retrofit_version") + implementation("com.squareup.moshi:moshi-kotlin:$moshi_version") + implementation("com.squareup.okhttp3:okhttp:$okhttp_version") + implementation("com.squareup.okhttp3:logging-interceptor:4.11.0") - // Coroutines - def coroutines_version = "1.10.1" - def test_kotlin_version = "2.1.0" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" - testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version" - testImplementation "org.jetbrains.kotlin:kotlin-test:$test_kotlin_version" + // JSON Converter + implementation("com.squareup.retrofit2:converter-gson:$retrofit_version") - // Room - ksp "androidx.room:room-compiler:2.6.1" - implementation "androidx.room:room-ktx:2.6.1" - implementation "androidx.room:room-runtime:2.6.1" + // YAML factory + implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0") - // WorkManager - implementation 'androidx.work:work-runtime-ktx:2.10.0' + // Bouncy Castle + implementation("org.bouncycastle:bcpg-jdk15on:1.60") // JSoup - implementation 'org.jsoup:jsoup:1.17.2' - - // elib - implementation 'foundation.e:elib:0.0.1-alpha11' - - // androidx.activity - def activity_version = "1.9.3" - implementation("androidx.activity:activity-ktx:$activity_version") + implementation("org.jsoup:jsoup:1.17.2") } -- GitLab From 32f57e40d89a57707ea50a8acc2289444238d7b0 Mon Sep 17 00:00:00 2001 From: althafvly Date: Thu, 2 Jan 2025 10:26:54 +0530 Subject: [PATCH 07/15] apps: Define foregroundServiceType - Required since android 14 --- app/src/main/AndroidManifest.xml | 23 +++++++++++++++---- .../install/workmanager/InstallAppWorker.kt | 14 ++++++++++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index fe79aa093..976bd3bc1 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -28,7 +28,8 @@ - + + @@ -84,7 +85,11 @@ - + + + - + + + android:exported="true" + android:foregroundServiceType="dataSync"> + + + = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + ForegroundInfo( + atomicInteger.getAndIncrement(), + notification, + ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE // Specify a valid service type + ) + } else { + ForegroundInfo( + atomicInteger.getAndIncrement(), + notification) + } } } -- GitLab From 34e3de8953b791ab21c77a687bd1674609a5e6a2 Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Thu, 23 Jan 2025 12:15:54 +0100 Subject: [PATCH 08/15] Fix foreground type for Install worker --- .../foundation/e/apps/install/workmanager/InstallAppWorker.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/install/workmanager/InstallAppWorker.kt b/app/src/main/java/foundation/e/apps/install/workmanager/InstallAppWorker.kt index d297cd5bc..8fb976c63 100644 --- a/app/src/main/java/foundation/e/apps/install/workmanager/InstallAppWorker.kt +++ b/app/src/main/java/foundation/e/apps/install/workmanager/InstallAppWorker.kt @@ -106,7 +106,7 @@ class InstallAppWorker @AssistedInject constructor( ForegroundInfo( atomicInteger.getAndIncrement(), notification, - ServiceInfo.FOREGROUND_SERVICE_TYPE_SPECIAL_USE // Specify a valid service type + ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC // Specify a valid service type ) } else { ForegroundInfo( -- GitLab From 8565984b30ff85a85ba96fd26a34f8dac6088cde Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Thu, 23 Jan 2025 16:24:42 +0100 Subject: [PATCH 09/15] Fix lint --- app/src/main/AndroidManifest.xml | 1 - .../ApplicationListRVAdapter.kt | 2 +- .../e/apps/ui/home/model/FusedHomeDiffUtil.kt | 2 ++ .../e/apps/ui/updates/UpdatesFragment.kt | 2 +- app/src/main/res/values-v27/themes.xml | 27 ------------------- lint.xml | 2 ++ 6 files changed, 6 insertions(+), 30 deletions(-) delete mode 100644 app/src/main/res/values-v27/themes.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 976bd3bc1..cce4b11c2 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -62,7 +62,6 @@ () { return oldItem.list == newItem.list } + @SuppressLint("DiffUtilEquals") override fun areContentsTheSame(oldItem: Home, newItem: Home): Boolean { return oldItem.title.contentEquals(newItem.title) && oldItem.list == newItem.list && diff --git a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt index e7d84bd92..9dc547e16 100644 --- a/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/updates/UpdatesFragment.kt @@ -371,7 +371,7 @@ class UpdatesFragment : TimeoutFragment(R.layout.fragment_updates), ApplicationI ) viewHolder?.let { (viewHolder as ApplicationListRVAdapter.ViewHolder).binding.installButton.text = - String.format(Locale.getDefault(), "%d%%", progress); + String.format(Locale.getDefault(), "%d%%", progress) } } } diff --git a/app/src/main/res/values-v27/themes.xml b/app/src/main/res/values-v27/themes.xml deleted file mode 100644 index 39e4aa910..000000000 --- a/app/src/main/res/values-v27/themes.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/lint.xml b/lint.xml index 9debeab74..88fe8852e 100644 --- a/lint.xml +++ b/lint.xml @@ -46,6 +46,8 @@ + + -- GitLab From eddf12ecf5398ebf4717aa31448587446d95c651 Mon Sep 17 00:00:00 2001 From: Jonathan Klee Date: Thu, 23 Jan 2025 16:30:59 +0100 Subject: [PATCH 10/15] Stick with API 34 since we have never tested it on API 35 --- app/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 7bfcf39a3..d4bbd1874 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -104,7 +104,8 @@ android { defaultConfig { applicationId = "foundation.e.apps" minSdk = 30 - targetSdk = 35 + //noinspection OldTargetApi + targetSdk = 34 versionCode = getVersionCode() versionName = getVersionName() -- GitLab From f7a620fec8593782f646b6a654aa28572f38eaa9 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 24 Jan 2025 18:07:47 +0530 Subject: [PATCH 11/15] apps: sign release with platform --- app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle b/app/build.gradle index d4bbd1874..2d5a91516 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -173,6 +173,7 @@ android { } release { minifyEnabled = false + signingConfig = signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } releaseTest { -- GitLab From b28ab89a6ae98e76893261d2f17eac3dced717a7 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 24 Jan 2025 18:16:44 +0530 Subject: [PATCH 12/15] apps: Fix light nav bar --- app/src/main/res/values-night/bools.xml | 24 ------------------------ app/src/main/res/values-night/colors.xml | 3 --- app/src/main/res/values/bools.xml | 24 ------------------------ app/src/main/res/values/colors.xml | 2 +- app/src/main/res/values/themes.xml | 3 ++- 5 files changed, 3 insertions(+), 53 deletions(-) delete mode 100644 app/src/main/res/values-night/bools.xml delete mode 100644 app/src/main/res/values/bools.xml diff --git a/app/src/main/res/values-night/bools.xml b/app/src/main/res/values-night/bools.xml deleted file mode 100644 index d1d7a3d17..000000000 --- a/app/src/main/res/values-night/bools.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - false - - diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index f708dbec7..ae1dd9752 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -23,7 +23,4 @@ #262626 #353535 - - - @color/colorNavBar \ No newline at end of file diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml deleted file mode 100644 index 9d510f638..000000000 --- a/app/src/main/res/values/bools.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - true - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index d1fae8b16..765406e98 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -24,7 +24,7 @@ @color/e_background - @android:color/white + @color/colorNavBar #f2f2f2 diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index dc5f734d8..8c002522f 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -26,7 +26,8 @@ @style/AppTheme.ActionBarStyle @color/colorBackground @color/colorBackground - @bool/is_day + @bool/isLight + @bool/isLight @color/colorNavBar @null @style/AutoCompleteTextViewStyle -- GitLab From be8469b561b6871500f22633078799ab83e74c89 Mon Sep 17 00:00:00 2001 From: Nishith Khanna Date: Fri, 24 Jan 2025 19:48:44 +0530 Subject: [PATCH 13/15] Use version catalog --- app/build.gradle | 135 +++++++++++++++++--------------------- build.gradle | 20 +++--- gradle/libs.versions.toml | 123 ++++++++++++++++++++++++++++++++++ 3 files changed, 192 insertions(+), 86 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/app/build.gradle b/app/build.gradle index 2d5a91516..c2547c6e7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -3,7 +3,7 @@ plugins { id 'com.android.application' id 'kotlin-android' id 'com.google.devtools.ksp' - id 'org.jlleitschuh.gradle.ktlint' version '10.2.0' + alias libs.plugins.ktlint id 'androidx.navigation.safeargs.kotlin' id 'com.google.dagger.hilt.android' id 'kotlin-allopen' @@ -228,23 +228,6 @@ allOpen { } dependencies { - // Define versions - def activity_version = "1.9.3" - def appcompat_version = "1.7.0" - def constraintlayout_version = "2.2.0" - def core_ktx_version = "1.15.0" - def fragment_ktx_version = "1.8.5" - def material_version = "1.12.0" - def navigation_version = "2.8.5" - def lifecycle_version = "2.8.7" - def room_version = "2.6.1" - def workmanager_version = "2.10.0" - def coroutines_version = "1.10.1" - def retrofit_version = "2.11.0" - def okhttp_version = "4.12.0" - def moshi_version = "1.15.1" - def hilt_version = "2.54" - def test_kotlin_version = "2.1.0" // Project dependencies implementation(project(":auth-data-lib")) @@ -255,96 +238,96 @@ dependencies { api(files("libs/splitinstall-lib.jar")) // eFoundation libraries - implementation("foundation.e.lib:telemetry:0.0.11-alpha") - implementation("foundation.e:gplayapi:3.4.2-0") - implementation("foundation.e:elib:0.0.1-alpha11") + implementation(libs.telemetry) + implementation(libs.gplayapi) + implementation(libs.elib) // AndroidX libraries - implementation("androidx.core:core-ktx:$core_ktx_version") - implementation("androidx.appcompat:appcompat:$appcompat_version") - implementation("androidx.fragment:fragment-ktx:$fragment_ktx_version") - implementation("androidx.preference:preference-ktx:1.2.1") - implementation("androidx.constraintlayout:constraintlayout:$constraintlayout_version") - implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation("androidx.datastore:datastore-preferences:1.1.1") - implementation("androidx.viewpager2:viewpager2:1.1.0") - implementation("androidx.recyclerview:recyclerview:1.3.2") - implementation("androidx.navigation:navigation-fragment-ktx:$navigation_version") - implementation("androidx.navigation:navigation-ui-ktx:$navigation_version") - implementation("androidx.activity:activity-ktx:$activity_version") + implementation(libs.core.ktx) + implementation(libs.appcompat) + implementation(libs.fragment.ktx) + implementation(libs.preference.ktx) + implementation(libs.constraintlayout) + implementation(libs.legacy.support.v4) + implementation(libs.datastore.preferences) + implementation(libs.viewpager2) + implementation(libs.recyclerview) + implementation(libs.navigation.fragment.ktx) + implementation(libs.navigation.ui.ktx) + implementation(libs.activity.ktx) // Material Design - implementation("com.google.android.material:material:$material_version") + implementation(libs.material) // Lifecycle Components - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version") - implementation("android.arch.lifecycle:extensions:1.1.1") + implementation(libs.lifecycle.viewmodel.ktx) + implementation(libs.lifecycle.livedata.ktx) + implementation(libs.lifecycle.runtime.ktx) + implementation(libs.lifecycle.extensions) // WorkManager - implementation("androidx.work:work-runtime-ktx:$workmanager_version") + implementation(libs.work.runtime.ktx) // Room - ksp("androidx.room:room-compiler:$room_version") - implementation("androidx.room:room-ktx:$room_version") - implementation("androidx.room:room-runtime:$room_version") + ksp(libs.room.compiler) + implementation(libs.room.ktx) + implementation(libs.room.runtime) // Hilt - ksp("com.google.dagger:hilt-compiler:$hilt_version") - implementation("com.google.dagger:hilt-android:$hilt_version") - implementation("androidx.hilt:hilt-work:1.2.0") - ksp("androidx.hilt:hilt-compiler:1.2.0") + ksp(libs.hilt.compile) + implementation(libs.hilt.android) + implementation(libs.hilt.work) + ksp(libs.hilt.compiler) // Facebook - implementation("com.facebook.shimmer:shimmer:0.5.0") + implementation(libs.shimmer) // Coroutines - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version") - testImplementation("org.jetbrains.kotlin:kotlin-test:$test_kotlin_version") + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.android) + testImplementation(libs.kotlinx.coroutines.test) + testImplementation(libs.kotlin.test) // Testing dependencies - testImplementation("com.google.truth:truth:1.1.4") - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.2.1") - androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") - testImplementation("androidx.test:core:1.6.1") - testImplementation("org.mockito:mockito-core:5.14.2") - testImplementation("org.mockito.kotlin:mockito-kotlin:5.4.0") - testImplementation("org.mockito:mockito-inline:5.0.0") - testImplementation("androidx.arch.core:core-testing:2.2.0") - testImplementation("io.mockk:mockk:1.12.3") + testImplementation(libs.truth) + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.espresso.core) + testImplementation(libs.core) + testImplementation(libs.mockito.core) + testImplementation(libs.mockito.kotlin) + testImplementation(libs.mockito.inline) + testImplementation(libs.core.testing) + testImplementation(libs.mockk) // Coil and PhotoView - implementation("io.coil-kt:coil:1.4.0") - implementation("com.github.Baseflow:PhotoView:2.3.0") + implementation(libs.coil) + implementation(libs.photoview) // Protobuf and Gson - implementation("com.google.code.gson:gson:2.11.0") - implementation("com.google.protobuf:protobuf-javalite:4.28.2") + implementation(libs.gson) + implementation(libs.protobuf.javalite) // Logger - implementation("com.jakewharton.timber:timber:5.0.1") + implementation(libs.timber) // Retrofit - implementation("com.squareup.retrofit2:retrofit:$retrofit_version") - implementation("com.squareup.retrofit2:converter-moshi:$retrofit_version") - implementation("com.squareup.retrofit2:converter-jackson:$retrofit_version") - implementation("com.squareup.moshi:moshi-kotlin:$moshi_version") - implementation("com.squareup.okhttp3:okhttp:$okhttp_version") - implementation("com.squareup.okhttp3:logging-interceptor:4.11.0") + implementation(libs.retrofit) + implementation(libs.converter.moshi) + implementation(libs.converter.jackson) + implementation(libs.moshi.kotlin) + implementation(libs.okhttp) + implementation(libs.logging.interceptor) // JSON Converter - implementation("com.squareup.retrofit2:converter-gson:$retrofit_version") + implementation(libs.converter.gson) // YAML factory - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0") + implementation(libs.jackson.dataformat.yaml) // Bouncy Castle - implementation("org.bouncycastle:bcpg-jdk15on:1.60") + implementation(libs.bcpg.jdk15on) // JSoup - implementation("org.jsoup:jsoup:1.17.2") + implementation(libs.jsoup) } diff --git a/build.gradle b/build.gradle index e658ed403..44178694e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,16 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.7.3' apply false - id 'com.android.library' version '8.7.3' apply false - id 'org.jetbrains.kotlin.android' version '2.1.0' apply false - id "org.jetbrains.kotlin.plugin.allopen" version "2.1.0" - id 'org.jetbrains.kotlin.jvm' version '2.1.0' apply false - id 'com.google.dagger.hilt.android' version '2.54' apply false - id("com.google.devtools.ksp") version "2.1.0-1.0.29" apply false - id 'androidx.navigation.safeargs' version '2.8.5' apply false - id 'io.gitlab.arturbosch.detekt' version '1.23.7' + alias libs.plugins.android.application apply false + alias libs.plugins.android.library apply false + alias libs.plugins.kotlin.android apply false + alias libs.plugins.kotlin.plugin.allopen apply false + alias libs.plugins.kotlin.jvm apply false + alias libs.plugins.hilt.android apply false + alias libs.plugins.ksp apply false + alias libs.plugins.navigation.safeargs apply false + alias libs.plugins.detekt + } allprojects { @@ -23,7 +24,6 @@ allprojects { subprojects { detekt { - toolVersion = "1.23.7" source.setFrom("src/main/java", "src/main/kotlin") config.setFrom("detekt.yml") baseline = file("detekt-baseline.xml") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..a63551a69 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,123 @@ +[versions] +activityKtx = "1.9.3" +androidGradlePlugin = "8.7.3" +appcompat = "1.7.0" +bcpgJdk15on = "1.60" +coil = "1.4.0" +constraintlayout = "2.2.0" +core = "1.6.1" +coreKtx = "1.15.0" +coreTesting = "2.2.0" +datastorePreferences = "1.1.1" +elib = "0.0.1-alpha11" +espressoCore = "3.6.1" +hiltCompiler = "1.2.0" +hiltWork = "1.2.0" +lifecycleExtensions = "1.1.1" +fragmentKtx = "1.8.5" +gplayapi = "3.4.2-0" +gson = "2.11.0" +jacksonDataformatYaml = "2.17.0" +jsoup = "1.17.2" +junit = "4.13.2" +junitVersion = "1.2.1" +kotlin = "2.1.0" +hilt = "2.54" +kotlinxCoroutinesAndroid = "1.10.1" +ksp = "2.1.0-1.0.29" +legacySupportV4 = "1.0.0" +lifecycleViewmodelKtx = "2.8.7" +loggingInterceptor = "4.11.0" +material = "1.12.0" +mockitoCore = "5.14.2" +mockitoInline = "5.0.0" +mockitoKotlin = "5.4.0" +mockk = "1.12.3" +moshiKotlin = "1.15.1" +detekt = "1.23.7" +ktlint = "10.2.0" +navigation = "2.8.5" +okhttp = "4.12.0" +photoview = "2.3.0" +preferenceKtx = "1.2.1" +protobufJavalite = "4.28.2" +room = "2.6.1" +shimmer = "0.5.0" +telemetry = "0.0.11-alpha" +timber = "5.0.1" +truth = "1.1.4" +viewpager2 = "1.1.0" +recyclerview = "1.3.2" +workRuntimeKtx = "2.10.0" + +[libraries] +activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" } +appcompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +bcpg-jdk15on = { module = "org.bouncycastle:bcpg-jdk15on", version.ref = "bcpgJdk15on" } +coil = { module = "io.coil-kt:coil", version.ref = "coil" } +constraintlayout = { module = "androidx.constraintlayout:constraintlayout", version.ref = "constraintlayout" } +converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "gson" } +converter-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "gson" } +converter-jackson = { module = "com.squareup.retrofit2:converter-jackson", version.ref = "gson" } +core = { module = "androidx.test:core", version.ref = "core" } +core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" } +core-testing = { module = "androidx.arch.core:core-testing", version.ref = "coreTesting" } +datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" } +elib = { module = "foundation.e:elib", version.ref = "elib" } +ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" } +espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" } +hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hiltWork" } +hilt-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltCompiler" } +lifecycle-extensions = { module = "android.arch.lifecycle:extensions", version.ref = "lifecycleExtensions" } +fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" } +gplayapi = { module = "foundation.e:gplayapi", version.ref = "gplayapi" } +gson = { module = "com.google.code.gson:gson", version.ref = "gson" } +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt"} +hilt-compile = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt"} +jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jacksonDataformatYaml" } +jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +junit = { module = "junit:junit", version.ref = "junit" } +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesAndroid" } +kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" } +kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesAndroid" } +legacy-support-v4 = { module = "androidx.legacy:legacy-support-v4", version.ref = "legacySupportV4" } +lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleViewmodelKtx" } +lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" } +lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleViewmodelKtx" } +logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptor" } +material = { module = "com.google.android.material:material", version.ref = "material" } +mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockitoCore" } +mockito-inline = { module = "org.mockito:mockito-inline", version.ref = "mockitoInline" } +mockito-kotlin = { module = "org.mockito.kotlin:mockito-kotlin", version.ref = "mockitoKotlin" } +mockk = { module = "io.mockk:mockk", version.ref = "mockk" } +moshi-kotlin = { module = "com.squareup.moshi:moshi-kotlin", version.ref = "moshiKotlin" } +navigation-ui-ktx = { module = "androidx.navigation:navigation-ui-ktx", version.ref = "navigation" } +navigation-fragment-ktx = { module = "androidx.navigation:navigation-fragment-ktx", version.ref = "navigation" } +okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +photoview = { module = "com.github.Baseflow:PhotoView", version.ref = "photoview" } +preference-ktx = { module = "androidx.preference:preference-ktx", version.ref = "preferenceKtx" } +protobuf-javalite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "protobufJavalite" } +recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" } +retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "gson" } +room-compiler = { module = "androidx.room:room-compiler", version.ref = "room" } +room-ktx = { module = "androidx.room:room-ktx", version.ref = "room" } +room-runtime = { module = "androidx.room:room-runtime", version.ref = "room" } +shimmer = { module = "com.facebook.shimmer:shimmer", version.ref = "shimmer" } +telemetry = { module = "foundation.e.lib:telemetry", version.ref = "telemetry" } +timber = { module = "com.jakewharton.timber:timber", version.ref = "timber" } +truth = { module = "com.google.truth:truth", version.ref = "truth" } +viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" } +work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" } + +[plugins] +android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" } +android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +navigation-safeargs = { id = "androidx.navigation.safeargs", version.ref = "navigation" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +ktlint = { id = "org.jlleitschuh.gradle.ktlint", version.ref = "ktlint" } \ No newline at end of file -- GitLab From c8d7c63bae7874694f00abcc337293a478e53460 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 24 Jan 2025 20:05:42 +0530 Subject: [PATCH 14/15] apps: Use OnBackPressedDispatcher instead of onBackPressed --- .../java/foundation/e/apps/ui/MainActivity.kt | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt index 826441220..8d914dd59 100644 --- a/app/src/main/java/foundation/e/apps/ui/MainActivity.kt +++ b/app/src/main/java/foundation/e/apps/ui/MainActivity.kt @@ -25,6 +25,7 @@ import android.os.Bundle import android.view.View import android.widget.Toast import android.window.OnBackInvokedDispatcher.PRIORITY_DEFAULT +import androidx.activity.OnBackPressedCallback import androidx.appcompat.app.AppCompatActivity import androidx.lifecycle.Lifecycle import androidx.lifecycle.ViewModelProvider @@ -82,6 +83,20 @@ class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + // Add an OnBackPressedCallback to handle the back press + onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) { + override fun handleOnBackPressed() { + if (isInitialScreen()) { + resetIgnoreStatusForSessionRefresh() + finish() + } else { + // Let the system handle the back press + isEnabled = false + onBackPressedDispatcher.onBackPressed() + } + } + }) + binding = ActivityMainBinding.inflate(layoutInflater) setupBackPressHandlingForTiramisuAndAbove() @@ -148,19 +163,7 @@ class MainActivity : AppCompatActivity() { loginViewModel.startLoginFlow(listOf(PlayStoreAuthenticator::class.java.simpleName)) } - // In Android 12 (API level 32) and lower, onBackPressed is always called, - // regardless of any registered instances of OnBackPressedCallback. - // https://developer.android.com/guide/navigation/navigation-custom-back#onbackpressed - @Deprecated("Deprecated in Java") - override fun onBackPressed() { - if (isInitialScreen()) { - resetIgnoreStatusForSessionRefresh() - finish() - } - super.onBackPressed() - } - - private fun isInitialScreen(): Boolean { + fun isInitialScreen(): Boolean { val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment @@ -169,7 +172,7 @@ class MainActivity : AppCompatActivity() { return navController.currentDestination?.id == navController.graph.startDestinationId } - private fun resetIgnoreStatusForSessionRefresh() { + fun resetIgnoreStatusForSessionRefresh() { viewModel.shouldIgnoreSessionError = false } -- GitLab From 44571f98fe7e8b44c5986eeba119949188c8ed20 Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 24 Jan 2025 20:18:07 +0530 Subject: [PATCH 15/15] apps: Update gradle deps --- gradle/libs.versions.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a63551a69..bd866a780 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,6 @@ [versions] -activityKtx = "1.9.3" -androidGradlePlugin = "8.7.3" +activityKtx = "1.10.0" +androidGradlePlugin = "8.8.0" appcompat = "1.7.0" bcpgJdk15on = "1.60" coil = "1.4.0" @@ -8,7 +8,7 @@ constraintlayout = "2.2.0" core = "1.6.1" coreKtx = "1.15.0" coreTesting = "2.2.0" -datastorePreferences = "1.1.1" +datastorePreferences = "1.1.2" elib = "0.0.1-alpha11" espressoCore = "3.6.1" hiltCompiler = "1.2.0" @@ -47,7 +47,7 @@ telemetry = "0.0.11-alpha" timber = "5.0.1" truth = "1.1.4" viewpager2 = "1.1.0" -recyclerview = "1.3.2" +recyclerview = "1.4.0" workRuntimeKtx = "2.10.0" [libraries] -- GitLab