Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.

Commit

Permalink
Various cleanup, deprecated code upgrades; remove unit tests as they …
Browse files Browse the repository at this point in the history
…need a revamp. Bump to 3.0.1.
  • Loading branch information
afollestad committed Dec 23, 2022
1 parent 52c591f commit 1d4b196
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 24 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
3.0.1
3.0.2

It's been a while! Going right to 3.0.1:
It's been a while! Going right to 3.0.2:

* Updated dependencies.
* Add new SDK 33 permissions to Permission.kt (#25 from @stephanepechard).
* Update internal lifecycle utilities to use `DefaultLifecycleObserver` instead of deprecated reflection-based annotations.
* Update usages of deprecated APIs internally.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package com.afollestad.assent.internal

import android.content.Context
import android.os.Bundle
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts.RequestMultiplePermissions
import androidx.fragment.app.Fragment
Expand All @@ -28,7 +29,14 @@ import com.afollestad.assent.internal.Assent.Companion.get
/** @author Aidan Follestad (afollestad) */
class PermissionFragment : Fragment() {

var launcher: ActivityResultLauncher<*>? = null
var launcher: ActivityResultLauncher<Array<String>>? = null

override fun onCreate(savedInstanceState: Bundle?) {
launcher = registerForActivityResult(RequestMultiplePermissions()) {
onPermissionsResponse(it)
}
super.onCreate(savedInstanceState)
}

override fun onAttach(context: Context) {
super.onAttach(context)
Expand All @@ -38,16 +46,14 @@ class PermissionFragment : Fragment() {
override fun onDetach() {
log("onDetach()")
launcher?.unregister()
launcher = null
super.onDetach()
}

internal fun perform(request: PendingRequest) {
log("perform(%s)", request)
launcher = registerForActivityResult(RequestMultiplePermissions()) {
onPermissionsResponse(it)
}.apply {
launch(request.permissions.allValues())
}
launcher?.launch(request.permissions.allValues())
?: error("PermissionFragment attempted request before lifecycle creation.")
}

internal fun detach() {
Expand Down
4 changes: 2 additions & 2 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
ext.versions = [
min_sdk: 14,
compile_sdk: 33,
publish_version: "3.0.1",
publish_version_code: 25
publish_version: "3.0.2",
publish_version_code: 26
]

ext.deps = [
Expand Down
2 changes: 1 addition & 1 deletion gradle/android-common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apply from: rootProject.file("gradle/spotless-plugin.gradle")
if (!project.hasProperty("min_sdk")) {
ext.min_sdk = versions.min_sdk
} else {
logger.warn("Using minSdk: $min_sdk")
logger.info("Using minSdk: $min_sdk")
}

android {
Expand Down
13 changes: 1 addition & 12 deletions gradle/publish-module.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,6 @@ afterEvaluate {
developerConnection = 'scm:git:ssh://github.com/afollestad/assent.git'
url = 'https://github.com/afollestad/assent/tree/main'
}
// A slightly hacky fix so that the POM will include any transitive dependencies
// that the module builds upon.
withXml {
def dependenciesNode = asNode().appendNode('dependencies')
project.configurations.implementation.allDependencies.each {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', it.group)
dependencyNode.appendNode('artifactId', it.name)
dependencyNode.appendNode('version', it.version)
}
}
}
}
}
Expand All @@ -104,5 +93,5 @@ signing {
}

afterEvaluate {
publishReleasePublicationToSonatypeRepository.dependsOn assembleRelease
publishToSonatype.dependsOn assembleRelease
}

0 comments on commit 1d4b196

Please sign in to comment.