diff --git a/app/build.gradle b/app/build.gradle index a5d807c22..dddf85266 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -24,7 +24,7 @@ android { buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } @@ -45,18 +45,14 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // --- SUPPORT --- - implementation 'androidx.core:core-ktx:1.3.1' - implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.constraintlayout:constraintlayout:2.0.1' - // Permissions + // General + implementation 'androidx.core:core-ktx:1.3.1' implementation 'androidx.activity:activity:1.2.0-alpha08' implementation 'androidx.fragment:fragment:1.3.0-alpha08' - // Navigation - def navigation_version = "2.3.0" - implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" - implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" + // Layout + implementation 'androidx.constraintlayout:constraintlayout:2.0.1' // Lifecycle implementation "androidx.lifecycle:lifecycle-extensions:2.2.0" @@ -64,6 +60,11 @@ dependencies { // Viewpager implementation 'androidx.viewpager2:viewpager2:1.0.0' + // Navigation + def navigation_version = "2.3.0" + implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version" + implementation "androidx.navigation:navigation-ui-ktx:$navigation_version" + // --- THIRD PARTY --- // Image loading implementation 'io.coil-kt:coil:0.12.0' @@ -73,6 +74,9 @@ dependencies { // Lint ktlint "com.pinterest:ktlint:0.37.2" + + // Memory Leak checking + debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.4' } task ktlint(type: JavaExec, group: "verification") { diff --git a/app/src/main/java/org/oxycblt/auxio/loading/LoadingFragment.kt b/app/src/main/java/org/oxycblt/auxio/loading/LoadingFragment.kt index 06b166770..ef1625aa3 100644 --- a/app/src/main/java/org/oxycblt/auxio/loading/LoadingFragment.kt +++ b/app/src/main/java/org/oxycblt/auxio/loading/LoadingFragment.kt @@ -29,8 +29,6 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) { ).get(LoadingViewModel::class.java) } - private var noPerms = false - private lateinit var binding: FragmentLoadingBinding private lateinit var permLauncher: ActivityResultLauncher @@ -75,8 +73,6 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) { if (granted) { wipeViews() - noPerms = false - loadingModel.retry() } } @@ -85,23 +81,25 @@ class LoadingFragment : Fragment(R.layout.fragment_loading) { // This should be in MusicRepository, but the response comes faster than the view creation // itself and therefore causes the error screen to not appear. if (checkPerms()) { - noPerms = true onNoPerms() } else { loadingModel.go() } + Log.d(this::class.simpleName, "Fragment created.") return binding.root } - // Check for permissions. God help us all. + // Check for two things: + // - If Auxio needs to show the rationale for getting the READ_EXTERNAL_STORAGE perm + // - If Auxio straight up doesnt have the permission private fun checkPerms(): Boolean { return shouldShowRequestPermissionRationale( Manifest.permission.READ_EXTERNAL_STORAGE ) || ContextCompat.checkSelfPermission( requireContext(), Manifest.permission.READ_EXTERNAL_STORAGE - ) == PackageManager.PERMISSION_DENIED || noPerms + ) == PackageManager.PERMISSION_DENIED } private fun onMusicLoadResponse(repoResponse: MusicLoaderResponse?) {