diff --git a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt index bfbd6e26982e..27a6106d0fb4 100644 --- a/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt +++ b/app/src/main/java/com/duckduckgo/app/browser/BrowserTabFragment.kt @@ -2017,7 +2017,7 @@ class BrowserTabFragment : private fun launchDialogForIntent( context: Context, - pm: PackageManager?, + pm: PackageManager, intent: Intent, activities: List, useFirstActivityFound: Boolean, diff --git a/app/src/main/java/com/duckduckgo/app/global/view/ViewChildrenSequences.kt b/app/src/main/java/com/duckduckgo/app/global/view/ViewChildrenSequences.kt deleted file mode 100644 index 3abba3e768b3..000000000000 --- a/app/src/main/java/com/duckduckgo/app/global/view/ViewChildrenSequences.kt +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2021 DuckDuckGo - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -@file:Suppress("unused") - -package com.duckduckgo.app.global.view - -import android.view.View -import android.view.ViewGroup -import java.util.ConcurrentModificationException -import java.util.NoSuchElementException - -fun View.childrenSequence(): Sequence = ViewChildrenSequence(this) - -/** - * Return the [Sequence] of all children of the received [View], recursively. - * Note that the sequence is not thread-safe. - * - * @return the [Sequence] of children. - */ -fun View.childrenRecursiveSequence(): Sequence = ViewChildrenRecursiveSequence(this) - -private class ViewChildrenSequence(private val view: View) : Sequence { - override fun iterator(): Iterator { - if (view !is ViewGroup) return emptyList().iterator() - return ViewIterator(view) - } - - private class ViewIterator(private val view: ViewGroup) : Iterator { - private var index = 0 - private val count = view.childCount - - override fun next(): View { - if (!hasNext()) throw NoSuchElementException() - return view.getChildAt(index++) - } - - override fun hasNext(): Boolean { - checkCount() - return index < count - } - - private fun checkCount() { - if (count != view.childCount) throw ConcurrentModificationException() - } - } -} - -private class ViewChildrenRecursiveSequence(private val view: View) : Sequence { - override fun iterator(): Iterator { - if (view !is ViewGroup) return emptyList().iterator() - return RecursiveViewIterator(view) - } - - private class RecursiveViewIterator(view: View) : Iterator { - private val sequences = arrayListOf(view.childrenSequence()) - private var current = sequences.removeLast().iterator() - - override fun next(): View { - if (!hasNext()) throw NoSuchElementException() - val view = current.next() - if (view is ViewGroup && view.childCount > 0) { - sequences.add(view.childrenSequence()) - } - return view - } - - override fun hasNext(): Boolean { - if (!current.hasNext() && sequences.isNotEmpty()) { - current = sequences.removeLast().iterator() - } - return current.hasNext() - } - - @Suppress("NOTHING_TO_INLINE") - private inline fun MutableList.removeLast(): T { - if (isEmpty()) throw NoSuchElementException() - return removeAt(size - 1) - } - } -} diff --git a/app/src/test/java/com/duckduckgo/app/bookmarks/model/SyncSavedSitesRepositoryTest.kt b/app/src/test/java/com/duckduckgo/app/bookmarks/model/SyncSavedSitesRepositoryTest.kt index 75ba9f230a5d..e8733f9c6193 100644 --- a/app/src/test/java/com/duckduckgo/app/bookmarks/model/SyncSavedSitesRepositoryTest.kt +++ b/app/src/test/java/com/duckduckgo/app/bookmarks/model/SyncSavedSitesRepositoryTest.kt @@ -213,7 +213,7 @@ class SyncSavedSitesRepositoryTest { savedSitesRelationsDao.insertList(relation) val removedEntities = entities.toMutableList() - val removedEntity = removedEntities.removeFirst() + val removedEntity = removedEntities.removeAt(0) val removedEntitiesIds = removedEntities.map { it.entityId } val childrenJSON = stringListAdapter.toJson(removedEntitiesIds) @@ -320,7 +320,7 @@ class SyncSavedSitesRepositoryTest { savedSitesRelationsDao.insertList(folderRelation) val updatedChildren = bookmarks.toMutableList() - val removedChildren = updatedChildren.removeFirst() + val removedChildren = updatedChildren.removeAt(0) repository.replaceBookmarkFolder(folder, updatedChildren.map { it.entityId }) diff --git a/build.gradle b/build.gradle index 27eebf63bd0b..746a4044627b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ buildscript { ext { min_sdk = 26 target_sdk = 34 - compile_sdk = 34 + compile_sdk = 35 // Calculate lint_version (must always be gradle_plugin + 23) def gradle_plugin_version = versionFor(project, Android.tools.build.gradlePlugin) diff --git a/verified-installation/verified-installation-impl/src/main/java/com/duckduckgo/verifiedinstallation/certificate/SigningCertificateHashExtractor.kt b/verified-installation/verified-installation-impl/src/main/java/com/duckduckgo/verifiedinstallation/certificate/SigningCertificateHashExtractor.kt index ebb86791c3b4..e4585daca844 100644 --- a/verified-installation/verified-installation-impl/src/main/java/com/duckduckgo/verifiedinstallation/certificate/SigningCertificateHashExtractor.kt +++ b/verified-installation/verified-installation-impl/src/main/java/com/duckduckgo/verifiedinstallation/certificate/SigningCertificateHashExtractor.kt @@ -65,15 +65,13 @@ class SigningCertificateHashExtractorImpl @Inject constructor( @RequiresApi(Build.VERSION_CODES.P) private fun getSigningCertHashesModern(): String? { val info: PackageInfo? = context.packageManager.getPackageInfo(appBuildConfig.applicationId, PackageManager.GET_SIGNING_CERTIFICATES) - if (info?.signingInfo == null) { - return null - } - - if (info.signingInfo.signingCertificateHistory.size != 1) { - return null + return info?.signingInfo?.let { signingInfo -> + if (signingInfo.signingCertificateHistory.size != 1) { + null + } else { + signingInfo.signingCertificateHistory.lastOrNull()?.sha256() + } } - - return info.signingInfo.signingCertificateHistory?.lastOrNull()?.sha256() } private fun Signature.sha256(): String { diff --git a/versions.properties b/versions.properties index 0ea6b052d5c3..8abd20d8d91f 100644 --- a/versions.properties +++ b/versions.properties @@ -31,7 +31,7 @@ version.androidx.arch.core=2.2.0 version.androidx.browser=1.8.0 -version.androidx.constraintlayout=2.1.4 +version.androidx.constraintlayout=2.2.0 version.androidx.biometric=1.1.0 @@ -45,17 +45,17 @@ version.androidx.recyclerview=1.3.2 version.androidx.core=1.13.1 -version.androidx.fragment=1.8.3 +version.androidx.fragment=1.8.5 version.androidx.legacy=1.0.0 -version.androidx.lifecycle=2.8.5 +version.androidx.lifecycle=2.8.7 version.androidx.room=2.6.1 version.androidx.swiperefreshlayout=1.1.0 -version.androidx.test.orchestrator=1.5.0 +version.androidx.test.orchestrator=1.5.1 version.androidx.test.espresso=3.6.1 @@ -125,7 +125,7 @@ version.okhttp3=4.12.0 version.net.zetetic..android-database-sqlcipher=4.5.4 - version.okio=3.9.0 +version.okio=3.9.0 version.org.apache.commons..commons-math3=3.6.1 @@ -161,4 +161,4 @@ version.com.google.zxing..core=3.5.3 version.android.tools.desugar_jdk_libs=2.1.2 -version.de.siegmar..fastcsv=2.2.2 \ No newline at end of file +version.de.siegmar..fastcsv=2.2.2